mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +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.CommonsApplication;
|
||||||
import fr.free.nrw.commons.Media;
|
import fr.free.nrw.commons.Media;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
import fr.free.nrw.commons.Utils;
|
||||||
import fr.free.nrw.commons.auth.SessionManager;
|
import fr.free.nrw.commons.auth.SessionManager;
|
||||||
import fr.free.nrw.commons.bookmarks.models.Bookmark;
|
import fr.free.nrw.commons.bookmarks.models.Bookmark;
|
||||||
import fr.free.nrw.commons.bookmarks.pictures.BookmarkPicturesContentProvider;
|
import fr.free.nrw.commons.bookmarks.pictures.BookmarkPicturesContentProvider;
|
||||||
|
|
@ -211,6 +212,13 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
||||||
snackbar.show();
|
snackbar.show();
|
||||||
updateBookmarkState(item);
|
updateBookmarkState(item);
|
||||||
return true;
|
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:
|
case R.id.menu_share_current_image:
|
||||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||||
shareIntent.setType("text/plain");
|
shareIntent.setType("text/plain");
|
||||||
|
|
@ -390,6 +398,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
// Enable default set of actions, then re-enable different set of actions only if it is a failed contrib
|
// 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_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_share_current_image).setEnabled(true).setVisible(true);
|
||||||
menu.findItem(R.id.menu_download_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);
|
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:
|
case Contribution.STATE_QUEUED:
|
||||||
menu.findItem(R.id.menu_browser_current_image).setEnabled(false)
|
menu.findItem(R.id.menu_browser_current_image).setEnabled(false)
|
||||||
.setVisible(false);
|
.setVisible(false);
|
||||||
|
menu.findItem(R.id.menu_copy_link).setEnabled(false)
|
||||||
|
.setVisible(false);
|
||||||
menu.findItem(R.id.menu_share_current_image).setEnabled(false)
|
menu.findItem(R.id.menu_share_current_image).setEnabled(false)
|
||||||
.setVisible(false);
|
.setVisible(false);
|
||||||
menu.findItem(R.id.menu_download_current_image).setEnabled(false)
|
menu.findItem(R.id.menu_download_current_image).setEnabled(false)
|
||||||
|
|
@ -440,6 +451,8 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
||||||
} else {
|
} else {
|
||||||
menu.findItem(R.id.menu_browser_current_image).setEnabled(false)
|
menu.findItem(R.id.menu_browser_current_image).setEnabled(false)
|
||||||
.setVisible(false);
|
.setVisible(false);
|
||||||
|
menu.findItem(R.id.menu_copy_link).setEnabled(false)
|
||||||
|
.setVisible(false);
|
||||||
menu.findItem(R.id.menu_share_current_image).setEnabled(false)
|
menu.findItem(R.id.menu_share_current_image).setEnabled(false)
|
||||||
.setVisible(false);
|
.setVisible(false);
|
||||||
menu.findItem(R.id.menu_download_current_image).setEnabled(false)
|
menu.findItem(R.id.menu_download_current_image).setEnabled(false)
|
||||||
|
|
|
||||||
7
app/src/main/res/drawable/menu_ic_copy_link_24dp.xml
Normal file
7
app/src/main/res/drawable/menu_ic_copy_link_24dp.xml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:width="24dp" >
|
||||||
|
<path android:fillColor="?attr/notification_icon_text_color" android:pathData="M3.9,12c0,-1.71 1.39,-3.1 3.1,-3.1h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-1.9L7,15.1c-1.71,0 -3.1,-1.39 -3.1,-3.1zM8,13h8v-2L8,11v2zM17,7h-4v1.9h4c1.71,0 3.1,1.39 3.1,3.1s-1.39,3.1 -3.1,3.1h-4L13,17h4c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5z"/>
|
||||||
|
</vector>
|
||||||
|
|
@ -7,6 +7,11 @@
|
||||||
android:icon="@drawable/menu_ic_round_star_border_24px"
|
android:icon="@drawable/menu_ic_round_star_border_24px"
|
||||||
android:title="@string/menu_bookmark"
|
android:title="@string/menu_bookmark"
|
||||||
app:showAsAction="always" />
|
app:showAsAction="always" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_copy_link"
|
||||||
|
android:icon="@drawable/menu_ic_copy_link_24dp"
|
||||||
|
android:title="@string/menu_copy_link"
|
||||||
|
app:showAsAction="always" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_share_current_image"
|
android:id="@+id/menu_share_current_image"
|
||||||
android:icon="@drawable/menu_ic_share_24dp"
|
android:icon="@drawable/menu_ic_share_24dp"
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="menu_from_gallery">从图库</string>
|
<string name="menu_from_gallery">从图库</string>
|
||||||
<string name="menu_from_camera">拍照</string>
|
<string name="menu_from_camera">拍照</string>
|
||||||
<string name="provider_contributions">我的上传</string>
|
<string name="provider_contributions">我的上传</string>
|
||||||
|
<string name="menu_copy_link">复制链接</string>
|
||||||
|
<string name="menu_link_copied">链接已复制到剪贴板</string>
|
||||||
<string name="menu_share">分享</string>
|
<string name="menu_share">分享</string>
|
||||||
<string name="menu_open_in_browser">在浏览器中查看</string>
|
<string name="menu_open_in_browser">在浏览器中查看</string>
|
||||||
<string name="share_title_hint">标题</string>
|
<string name="share_title_hint">标题</string>
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,8 @@
|
||||||
<string name="menu_from_camera">Take photo</string>
|
<string name="menu_from_camera">Take photo</string>
|
||||||
<string name="menu_nearby">Nearby</string>
|
<string name="menu_nearby">Nearby</string>
|
||||||
<string name="provider_contributions">My uploads</string>
|
<string name="provider_contributions">My uploads</string>
|
||||||
|
<string name="menu_copy_link">Copy link</string>
|
||||||
|
<string name="menu_link_copied">The link has been copied to the clipboard</string>
|
||||||
<string name="menu_share">Share</string>
|
<string name="menu_share">Share</string>
|
||||||
<string name="menu_view_file_page">View file page</string>
|
<string name="menu_view_file_page">View file page</string>
|
||||||
<string name="share_title_hint">Caption (Required)</string>
|
<string name="share_title_hint">Caption (Required)</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue