mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
* Add a "copy link" button next to the share button. Add relative English and Simplified Chinese text in strings.xml. * Change the icon from copy to link * Fixed typo * Fixed case --------- Co-authored-by: Justweng <justweng19@gmail.com> Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
parent
235e8cdba2
commit
f2d1f7dbbb
5 changed files with 29 additions and 0 deletions
|
|
@ -31,6 +31,7 @@ import com.google.android.material.snackbar.Snackbar;
|
|||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.Media;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.Utils;
|
||||
import fr.free.nrw.commons.auth.SessionManager;
|
||||
import fr.free.nrw.commons.bookmarks.models.Bookmark;
|
||||
import fr.free.nrw.commons.bookmarks.pictures.BookmarkPicturesContentProvider;
|
||||
|
|
@ -211,6 +212,13 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
|||
snackbar.show();
|
||||
updateBookmarkState(item);
|
||||
return true;
|
||||
case R.id.menu_copy_link:
|
||||
String uri = m.getPageTitle().getCanonicalUri();
|
||||
Utils.copy("shareLink", uri, requireContext());
|
||||
Timber.d("Copied share link to clipboard: %s", uri);
|
||||
Toast.makeText(requireContext(), getString(R.string.menu_link_copied),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
case R.id.menu_share_current_image:
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain");
|
||||
|
|
@ -390,6 +398,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
|||
if (m != null) {
|
||||
// Enable default set of actions, then re-enable different set of actions only if it is a failed contrib
|
||||
menu.findItem(R.id.menu_browser_current_image).setEnabled(true).setVisible(true);
|
||||
menu.findItem(R.id.menu_copy_link).setEnabled(true).setVisible(true);
|
||||
menu.findItem(R.id.menu_share_current_image).setEnabled(true).setVisible(true);
|
||||
menu.findItem(R.id.menu_download_current_image).setEnabled(true).setVisible(true);
|
||||
menu.findItem(R.id.menu_bookmark_current_image).setEnabled(true).setVisible(true);
|
||||
|
|
@ -423,6 +432,8 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
|||
case Contribution.STATE_QUEUED:
|
||||
menu.findItem(R.id.menu_browser_current_image).setEnabled(false)
|
||||
.setVisible(false);
|
||||
menu.findItem(R.id.menu_copy_link).setEnabled(false)
|
||||
.setVisible(false);
|
||||
menu.findItem(R.id.menu_share_current_image).setEnabled(false)
|
||||
.setVisible(false);
|
||||
menu.findItem(R.id.menu_download_current_image).setEnabled(false)
|
||||
|
|
@ -440,6 +451,8 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
|||
} else {
|
||||
menu.findItem(R.id.menu_browser_current_image).setEnabled(false)
|
||||
.setVisible(false);
|
||||
menu.findItem(R.id.menu_copy_link).setEnabled(false)
|
||||
.setVisible(false);
|
||||
menu.findItem(R.id.menu_share_current_image).setEnabled(false)
|
||||
.setVisible(false);
|
||||
menu.findItem(R.id.menu_download_current_image).setEnabled(false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue