Added share buttons to android
This commit is contained in:
parent
e2a62e852c
commit
7f94f65bea
16 changed files with 146 additions and 19 deletions
|
|
@ -427,6 +427,17 @@ void FileSelectScreen::move_selected_files(const std::filesystem::path& fromPath
|
|||
}
|
||||
}
|
||||
|
||||
void FileSelectScreen::share_selected_files() {
|
||||
for(const FileInfo& f : fileList) {
|
||||
if(f.selected) {
|
||||
#ifdef __ANDROID__
|
||||
AndroidJNICalls::shareInternalFile("saves/" + f.fileName + ".infpnt", "application/octet-stream");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileSelectScreen::duplicate_selected_files(const std::filesystem::path& inPath) {
|
||||
std::vector<std::string> toFolderListNames;
|
||||
try {
|
||||
|
|
@ -571,6 +582,15 @@ void FileSelectScreen::edit_action_bar() {
|
|||
update_file_list(fileList, savePath, false);
|
||||
editMode = false;
|
||||
});
|
||||
#ifdef __ANDROID__
|
||||
if(numberOfSelectedEntries == 1) {
|
||||
edit_action_bar_button("share", "data/icons/RemixIcon/share-line.svg", "Share", [&] {
|
||||
share_selected_files();
|
||||
update_file_list(fileList, savePath, false);
|
||||
editMode = false;
|
||||
});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(selectedMenu == SelectedMenu::TRASH) {
|
||||
edit_action_bar_button("restore", "data/icons/RemixIcon/refresh-line.svg", "Restore", [&] {
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ class FileSelectScreen : public Screen {
|
|||
};
|
||||
void move_selected_files(const std::filesystem::path& fromPath, const std::filesystem::path& toPath, TrashMoveType trashMoveType);
|
||||
void duplicate_selected_files(const std::filesystem::path& inPath);
|
||||
void share_selected_files();
|
||||
void delete_selected_files_in_trash();
|
||||
|
||||
enum class MoreOptionsMenu {
|
||||
|
|
|
|||
|
|
@ -255,13 +255,25 @@ void PhoneDrawingProgramScreen::top_toolbar_settings_popup() {
|
|||
input_text_field(gui, "lobby", "Lobby", &serverToConnectTo, {
|
||||
.immutable = true
|
||||
});
|
||||
text_button(gui, "Host button", "Copy & Host", {
|
||||
.wide = true,
|
||||
.onClick = [&] {
|
||||
main.input.set_clipboard_str(serverToConnectTo);
|
||||
main.world->start_hosting(serverToConnectTo, serverLocalID);
|
||||
topToolbarSettingsPopup = TopToolbarSettingsPopup::NONE;
|
||||
}
|
||||
left_to_right_line_layout(gui, [&] {
|
||||
text_button(gui, "Host button", "Copy & Host", {
|
||||
.wide = true,
|
||||
.onClick = [&] {
|
||||
main.input.set_clipboard_str(serverToConnectTo);
|
||||
main.world->start_hosting(serverToConnectTo, serverLocalID);
|
||||
topToolbarSettingsPopup = TopToolbarSettingsPopup::NONE;
|
||||
}
|
||||
});
|
||||
#ifdef __ANDROID__
|
||||
text_button(gui, "Share and host button", "Share & Host", {
|
||||
.wide = true,
|
||||
.onClick = [&] {
|
||||
AndroidJNICalls::shareText(serverToConnectTo);
|
||||
main.world->start_hosting(serverToConnectTo, serverLocalID);
|
||||
topToolbarSettingsPopup = TopToolbarSettingsPopup::NONE;
|
||||
}
|
||||
});
|
||||
#endif
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -291,12 +303,23 @@ void PhoneDrawingProgramScreen::top_toolbar_settings_popup() {
|
|||
input_text_field(gui, "lobby", "Lobby", &serverToConnectTo, {
|
||||
.immutable = true
|
||||
});
|
||||
text_button(gui, "Copy button", "Copy", {
|
||||
.wide = true,
|
||||
.onClick = [&] {
|
||||
main.input.set_clipboard_str(serverToConnectTo);
|
||||
topToolbarSettingsPopup = TopToolbarSettingsPopup::NONE;
|
||||
}
|
||||
left_to_right_line_layout(gui, [&] {
|
||||
text_button(gui, "Copy button", "Copy", {
|
||||
.wide = true,
|
||||
.onClick = [&] {
|
||||
main.input.set_clipboard_str(serverToConnectTo);
|
||||
topToolbarSettingsPopup = TopToolbarSettingsPopup::NONE;
|
||||
}
|
||||
});
|
||||
#ifdef __ANDROID__
|
||||
text_button(gui, "Share button", "Share", {
|
||||
.wide = true,
|
||||
.onClick = [&] {
|
||||
AndroidJNICalls::shareText(serverToConnectTo);
|
||||
topToolbarSettingsPopup = TopToolbarSettingsPopup::NONE;
|
||||
}
|
||||
});
|
||||
#endif
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue