From 7312979808d27ca614b45e1b17dc0e96735b292b Mon Sep 17 00:00:00 2001 From: Hari Date: Mon, 2 Oct 2017 11:56:51 +0530 Subject: [PATCH 01/18] Add options for operations on single files --- .../ui/adapter/FileListListAdapter.java | 58 +++++++++--------- .../ui/fragment/OCFileListFragment.java | 56 ++++++++++++++--- .../OCFileListFragmentInterface.java | 13 +++- .../{shared_via_users.png => ic_unshared.png} | Bin .../{shared_via_users.png => ic_unshared.png} | Bin .../{shared_via_users.png => ic_unshared.png} | Bin .../{shared_via_users.png => ic_unshared.png} | Bin .../{shared_via_users.png => ic_unshared.png} | Bin src/main/res/drawable/shared_via_users.xml | 9 +++ src/main/res/layout/list_item.xml | 33 ++++++---- 10 files changed, 117 insertions(+), 52 deletions(-) rename src/main/res/drawable-hdpi/{shared_via_users.png => ic_unshared.png} (100%) rename src/main/res/drawable-mdpi/{shared_via_users.png => ic_unshared.png} (100%) rename src/main/res/drawable-xhdpi/{shared_via_users.png => ic_unshared.png} (100%) rename src/main/res/drawable-xxhdpi/{shared_via_users.png => ic_unshared.png} (100%) rename src/main/res/drawable-xxxhdpi/{shared_via_users.png => ic_unshared.png} (100%) create mode 100644 src/main/res/drawable/shared_via_users.xml diff --git a/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java index 2d87d2daddb3..0f339aeb2157 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java @@ -26,7 +26,6 @@ import android.accounts.Account; import android.content.ContentValues; import android.content.Context; -import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Color; import android.os.Handler; @@ -62,8 +61,6 @@ import com.owncloud.android.operations.RemoteOperationFailedException; import com.owncloud.android.services.OperationsService.OperationsServiceBinder; import com.owncloud.android.ui.activity.ComponentsGetter; -import com.owncloud.android.ui.activity.FileActivity; -import com.owncloud.android.ui.activity.ShareActivity; import com.owncloud.android.ui.fragment.ExtendedListFragment; import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface; import com.owncloud.android.utils.DisplayUtils; @@ -237,7 +234,18 @@ public View getView(int position, View convertView, ViewGroup parent) { ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon); if (file.isSharedWithSharee() || file.isSharedWithMe()) { sharedIconV.setImageResource(R.drawable.shared_via_users); + } else if (file.isSharedViaLink()) { + sharedIconV.setImageResource(R.drawable.shared_via_link); + } else { + sharedIconV.setImageResource(R.drawable.ic_unshared); } + final OCFile temp = file; + sharedIconV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + OCFileListFragmentInterface.onShareIconClick(temp); + } + }); fileIcon.setTag(file.getFileId()); TextView fileName; @@ -258,21 +266,6 @@ public View getView(int position, View convertView, ViewGroup parent) { fileSizeV.setVisibility(View.VISIBLE); fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength())); - // Shared icon clickable - if (file.isSharedViaLink() || file.isSharedWithSharee()) { - final OCFile temp = file; - sharedIconV.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Intent intent = new Intent(mContext, ShareActivity.class); - intent.putExtra(FileActivity.EXTRA_FILE, temp); - intent.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount); - mContext.startActivity(intent); - } - }); - } - - case GRID_ITEM: // filename fileName = (TextView) view.findViewById(R.id.Filename); @@ -284,16 +277,6 @@ public void onClick(View view) { } case GRID_IMAGE: - // sharedIcon - if (file.isSharedViaLink()) { - sharedIconV.setVisibility(View.VISIBLE); - sharedIconV.bringToFront(); - } else if (file.isSharedWithSharee() || file.isSharedWithMe()) { - sharedIconV.setVisibility(View.VISIBLE); - sharedIconV.bringToFront(); - } else { - sharedIconV.setVisibility(View.GONE); - } // local state ImageView localStateView = (ImageView) view.findViewById(R.id.localFileIndicator); @@ -333,11 +316,18 @@ public void onClick(View view) { } // For all Views + ImageView favoriteV = (ImageView) view.findViewById(R.id.favorite_action); if (file.getIsFavorite()) { - view.findViewById(R.id.favorite_action).setVisibility(View.VISIBLE); + favoriteV.setImageResource(R.drawable.ic_favorite); } else { - view.findViewById(R.id.favorite_action).setVisibility(View.GONE); + favoriteV.setImageResource(R.drawable.nav_favorites); } + favoriteV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + OCFileListFragmentInterface.onFavoriteIconClick(temp); + } + }); ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox); checkBoxV.setVisibility(View.GONE); @@ -357,6 +347,14 @@ public void onClick(View view) { checkBoxV.setVisibility(View.VISIBLE); } + ImageView overflowIndicatorV = (ImageView) view.findViewById(R.id.overflow_menu); + overflowIndicatorV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + OCFileListFragmentInterface.onOverflowIconClick(v, temp); + } + }); + // this if-else is needed even though kept-in-sync icon is visible by default // because android reuses views in listview if (!file.isAvailableOffline()) { diff --git a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index bfc5c185dbd3..7a84dbd67ef7 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -53,6 +53,7 @@ import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.ListView; +import android.widget.PopupMenu; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; @@ -107,6 +108,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -513,6 +515,39 @@ public void finishedFiltering() { updateFooter(); } + @Override + public void onFavoriteIconClick(OCFile file) { + mContainerActivity.getFileOperationsHelper().toggleFavoriteFiles(Collections.singleton(file), + !file.getIsFavorite()); + } + + @Override + public void onShareIconClick(OCFile file) { + shareFile(file); + } + + @Override + public void onOverflowIconClick(View view, OCFile file) { + PopupMenu popup = new PopupMenu(getActivity(), view); + popup.inflate(R.menu.file_actions_menu); + FileMenuFilter mf = new FileMenuFilter( + mAdapter.getFiles().size(), + Collections.singleton(file), + ((FileActivity) getActivity()).getAccount(), + mContainerActivity, + getActivity() + ); + mf.filter(popup.getMenu()); + popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + ArrayList checkedFiles = new ArrayList<>(Collections.singletonList(file)); + return onFileActionChosen(item.getItemId(), checkedFiles); + } + }); + popup.show(); + } + /** * Handler for multiple selection mode. * @@ -643,7 +678,8 @@ public boolean onPrepareActionMode(ActionMode mode, Menu menu) { */ @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { - return onFileActionChosen(item.getItemId()); + ArrayList checkedFiles = mAdapter.getCheckedItems(getListView()); + return onFileActionChosen(item.getItemId(), checkedFiles); } /** @@ -902,10 +938,10 @@ public void onItemClick(AdapterView l, View v, int position, long id) { * Start the appropriate action(s) on the currently selected files given menu selected by the user. * * @param menuId Identifier of the action menu selected by the user + * @param checkedFiles List of files selected by the user on which the action should be performed * @return 'true' if the menu selection started any action, 'false' otherwise. */ - public boolean onFileActionChosen(int menuId) { - final ArrayList checkedFiles = mAdapter.getCheckedItems(getListView()); + public boolean onFileActionChosen(int menuId, ArrayList checkedFiles) { if (checkedFiles.size() <= 0) { return false; } @@ -915,11 +951,7 @@ public boolean onFileActionChosen(int menuId) { OCFile singleFile = checkedFiles.get(0); switch (menuId) { case R.id.action_share_file: { - if(singleFile.isSharedWithMe() && !singleFile.canReshare()){ - Snackbar.make(getView(), R.string.resharing_is_not_allowed, Snackbar.LENGTH_LONG).show(); - } else { - mContainerActivity.getFileOperationsHelper().showShareFile(singleFile); - } + shareFile(singleFile); return true; } case R.id.action_open_file_with: { @@ -1019,6 +1051,14 @@ public boolean onFileActionChosen(int menuId) { } } + private void shareFile(OCFile file) { + if(file.isSharedWithMe() && !file.canReshare()){ + Snackbar.make(getView(), R.string.resharing_is_not_allowed, Snackbar.LENGTH_LONG).show(); + } else { + mContainerActivity.getFileOperationsHelper().showShareFile(file); + } + } + /** * Use this to query the {@link OCFile} that is currently * being displayed by this fragment diff --git a/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java b/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java index 195c499cc64b..2ad6b6f6af37 100644 --- a/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java +++ b/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java @@ -20,12 +20,23 @@ */ package com.owncloud.android.ui.interfaces; +import android.view.View; + +import com.owncloud.android.datamodel.OCFile; + /** - * Interface for signaling filter finish + * Interface for communication between {@link com.owncloud.android.ui.fragment.OCFileListFragment} + * and {@link com.owncloud.android.ui.adapter.FileListListAdapter} */ public interface OCFileListFragmentInterface { void finishedFiltering(); int getColumnSize(); + + void onFavoriteIconClick(OCFile file); + + void onShareIconClick(OCFile file); + + void onOverflowIconClick(View view, OCFile file); } diff --git a/src/main/res/drawable-hdpi/shared_via_users.png b/src/main/res/drawable-hdpi/ic_unshared.png similarity index 100% rename from src/main/res/drawable-hdpi/shared_via_users.png rename to src/main/res/drawable-hdpi/ic_unshared.png diff --git a/src/main/res/drawable-mdpi/shared_via_users.png b/src/main/res/drawable-mdpi/ic_unshared.png similarity index 100% rename from src/main/res/drawable-mdpi/shared_via_users.png rename to src/main/res/drawable-mdpi/ic_unshared.png diff --git a/src/main/res/drawable-xhdpi/shared_via_users.png b/src/main/res/drawable-xhdpi/ic_unshared.png similarity index 100% rename from src/main/res/drawable-xhdpi/shared_via_users.png rename to src/main/res/drawable-xhdpi/ic_unshared.png diff --git a/src/main/res/drawable-xxhdpi/shared_via_users.png b/src/main/res/drawable-xxhdpi/ic_unshared.png similarity index 100% rename from src/main/res/drawable-xxhdpi/shared_via_users.png rename to src/main/res/drawable-xxhdpi/ic_unshared.png diff --git a/src/main/res/drawable-xxxhdpi/shared_via_users.png b/src/main/res/drawable-xxxhdpi/ic_unshared.png similarity index 100% rename from src/main/res/drawable-xxxhdpi/shared_via_users.png rename to src/main/res/drawable-xxxhdpi/ic_unshared.png diff --git a/src/main/res/drawable/shared_via_users.xml b/src/main/res/drawable/shared_via_users.xml new file mode 100644 index 000000000000..e3fe874d61e1 --- /dev/null +++ b/src/main/res/drawable/shared_via_users.xml @@ -0,0 +1,9 @@ + + + diff --git a/src/main/res/layout/list_item.xml b/src/main/res/layout/list_item.xml index 8ae40df923a7..734bbe83d8b0 100644 --- a/src/main/res/layout/list_item.xml +++ b/src/main/res/layout/list_item.xml @@ -30,6 +30,14 @@ android:layout_height="match_parent" android:orientation="horizontal"> + - - - + android:clickable="true" + android:src="@drawable/ic_unshared" /> + + From 1e7bc78d87300fbba9f1a28520ebe2f69249bbc9 Mon Sep 17 00:00:00 2001 From: Hari Date: Wed, 4 Oct 2017 12:35:07 +0530 Subject: [PATCH 02/18] Revert change in favourite icon --- .../ui/adapter/FileListListAdapter.java | 11 ++--------- .../ui/fragment/OCFileListFragment.java | 6 ------ .../OCFileListFragmentInterface.java | 2 -- src/main/res/layout/list_item.xml | 19 ++++++++++--------- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java index 0f339aeb2157..db153e527224 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java @@ -316,18 +316,11 @@ public void onClick(View view) { } // For all Views - ImageView favoriteV = (ImageView) view.findViewById(R.id.favorite_action); if (file.getIsFavorite()) { - favoriteV.setImageResource(R.drawable.ic_favorite); + view.findViewById(R.id.favorite_action).setVisibility(View.VISIBLE); } else { - favoriteV.setImageResource(R.drawable.nav_favorites); + view.findViewById(R.id.favorite_action).setVisibility(View.GONE); } - favoriteV.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - OCFileListFragmentInterface.onFavoriteIconClick(temp); - } - }); ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox); checkBoxV.setVisibility(View.GONE); diff --git a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 7a84dbd67ef7..d3d311ec7805 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -515,12 +515,6 @@ public void finishedFiltering() { updateFooter(); } - @Override - public void onFavoriteIconClick(OCFile file) { - mContainerActivity.getFileOperationsHelper().toggleFavoriteFiles(Collections.singleton(file), - !file.getIsFavorite()); - } - @Override public void onShareIconClick(OCFile file) { shareFile(file); diff --git a/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java b/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java index 2ad6b6f6af37..9fe06ac331d4 100644 --- a/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java +++ b/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java @@ -34,8 +34,6 @@ public interface OCFileListFragmentInterface { int getColumnSize(); - void onFavoriteIconClick(OCFile file); - void onShareIconClick(OCFile file); void onOverflowIconClick(View view, OCFile file); diff --git a/src/main/res/layout/list_item.xml b/src/main/res/layout/list_item.xml index 734bbe83d8b0..46c1445d31de 100644 --- a/src/main/res/layout/list_item.xml +++ b/src/main/res/layout/list_item.xml @@ -30,15 +30,6 @@ android:layout_height="match_parent" android:orientation="horizontal"> - - + + Date: Wed, 4 Oct 2017 16:20:18 +0530 Subject: [PATCH 03/18] Add material design specs --- src/main/res/layout/list_item.xml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/main/res/layout/list_item.xml b/src/main/res/layout/list_item.xml index 46c1445d31de..a535a8210435 100644 --- a/src/main/res/layout/list_item.xml +++ b/src/main/res/layout/list_item.xml @@ -138,17 +138,17 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" + android:gravity="center" + android:paddingLeft="@dimen/standard_padding" android:paddingRight="@dimen/standard_padding"> @@ -156,29 +156,28 @@ android:id="@+id/custom_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_marginLeft="@dimen/standard_quarter_margin" - - android:src="@drawable/ic_checkbox_blank_outline" - android:layout_toRightOf="@id/sharedIcon"/> + android:layout_marginLeft="@dimen/standard_half_margin" + android:layout_marginRight="@dimen/standard_half_margin" + android:layout_toRightOf="@id/sharedIcon" + android:clickable="true" + android:src="@drawable/ic_checkbox_blank_outline" /> - + android:src="@drawable/ic_dots_vertical" /> + + android:background="@color/list_divider_background" /> From dbad84667d113c48cafcc3072f3232a907e36f44 Mon Sep 17 00:00:00 2001 From: Hari Date: Wed, 4 Oct 2017 17:03:35 +0530 Subject: [PATCH 04/18] Do not show select/deselect all in the per-item overflow menus --- .../owncloud/android/files/FileMenuFilter.java | 16 +++++++++++----- .../android/ui/fragment/FileDetailFragment.java | 3 ++- .../android/ui/fragment/OCFileListFragment.java | 6 ++++-- .../android/ui/preview/PreviewImageFragment.java | 3 ++- .../android/ui/preview/PreviewMediaFragment.java | 3 ++- .../android/ui/preview/PreviewTextFragment.java | 3 ++- 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/owncloud/android/files/FileMenuFilter.java b/src/main/java/com/owncloud/android/files/FileMenuFilter.java index db820ec99f5f..bfa9e8445dc9 100644 --- a/src/main/java/com/owncloud/android/files/FileMenuFilter.java +++ b/src/main/java/com/owncloud/android/files/FileMenuFilter.java @@ -52,6 +52,7 @@ public class FileMenuFilter { private ComponentsGetter mComponentsGetter; private Account mAccount; private Context mContext; + private boolean mOverflowMenu; /** * Constructor @@ -61,14 +62,16 @@ public class FileMenuFilter { * @param account ownCloud {@link Account} holding targetFile. * @param cg Accessor to app components, needed to access synchronization services * @param context Android {@link Context}, needed to access build setup resources. + * @param overflowMenu true if the overflow menu items are being filtered */ public FileMenuFilter(int numberOfAllFiles, Collection targetFiles, Account account, - ComponentsGetter cg, Context context) { + ComponentsGetter cg, Context context, boolean overflowMenu) { mNumberOfAllFiles = numberOfAllFiles; mFiles = targetFiles; mAccount = account; mComponentsGetter = cg; mContext = context; + mOverflowMenu = overflowMenu; } /** @@ -78,9 +81,12 @@ public FileMenuFilter(int numberOfAllFiles, Collection targetFiles, Acco * @param account ownCloud {@link Account} holding targetFile. * @param cg Accessor to app components, needed to access synchronization services * @param context Android {@link Context}, needed to access build setup resources. + * @param overflowMenu true if the overflow menu items are being filtered */ - public FileMenuFilter(OCFile targetFile, Account account, ComponentsGetter cg, Context context) { - this(1, Collections.singletonList(targetFile), account, cg, context); + public FileMenuFilter(OCFile targetFile, Account account, ComponentsGetter cg, Context context, + boolean overflowMenu) { + this(1, Collections.singletonList(targetFile), account, cg, context, + overflowMenu); } /** @@ -178,7 +184,7 @@ private void filter(List toShow, List toHide, boolean inSingle // SELECT ALL if (!inSingleFileFragment) { // Show only if at least one item isn't selected. - if (mFiles.size() >= mNumberOfAllFiles) { + if (mFiles.size() >= mNumberOfAllFiles || mOverflowMenu) { toHide.add(R.id.action_select_all_action_menu); } else { toShow.add(R.id.action_select_all_action_menu); @@ -191,7 +197,7 @@ private void filter(List toShow, List toHide, boolean inSingle // DESELECT ALL if (!inSingleFileFragment) { // Show only if at least one item is selected. - if (mFiles.isEmpty()) { + if (mFiles.isEmpty() || mOverflowMenu) { toHide.add(R.id.action_deselect_all_action_menu); } else { toShow.add(R.id.action_deselect_all_action_menu); diff --git a/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java index 4a94ba6abe5f..59883b4c955e 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -216,7 +216,8 @@ public void onPrepareOptionsMenu(Menu menu) { getFile(), mContainerActivity.getStorageManager().getAccount(), mContainerActivity, - getActivity() + getActivity(), + false ); mf.filter(menu, true); } diff --git a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index d3d311ec7805..0f4e3a4ebd52 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -529,7 +529,8 @@ public void onOverflowIconClick(View view, OCFile file) { Collections.singleton(file), ((FileActivity) getActivity()).getAccount(), mContainerActivity, - getActivity() + getActivity(), + true ); mf.filter(popup.getMenu()); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @@ -661,7 +662,8 @@ public boolean onPrepareActionMode(ActionMode mode, Menu menu) { checkedFiles, ((FileActivity) getActivity()).getAccount(), mContainerActivity, - getActivity() + getActivity(), + false ); mf.filter(menu, false); return true; diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java index d92fe401ee6f..169f65a29923 100644 --- a/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java +++ b/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java @@ -275,7 +275,8 @@ public void onPrepareOptionsMenu(Menu menu) { getFile(), mContainerActivity.getStorageManager().getAccount(), mContainerActivity, - getActivity() + getActivity(), + false ); mf.filter(menu, true); } diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java index 3188de0a6ed5..09de311abed5 100644 --- a/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java +++ b/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java @@ -375,7 +375,8 @@ public void onPrepareOptionsMenu(Menu menu) { getFile(), mContainerActivity.getStorageManager().getAccount(), mContainerActivity, - getActivity() + getActivity(), + false ); mf.filter(menu, true); } diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java index c048c5e2e498..26d670dbefd8 100644 --- a/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java +++ b/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java @@ -285,7 +285,8 @@ public void onPrepareOptionsMenu(Menu menu) { getFile(), mContainerActivity.getStorageManager().getAccount(), mContainerActivity, - getActivity() + getActivity(), + false ); mf.filter(menu, true); } From 8e65a1decee646d45266d62cdb09c0b28f52e519 Mon Sep 17 00:00:00 2001 From: Hari Date: Thu, 5 Oct 2017 10:51:45 +0530 Subject: [PATCH 05/18] Align the overflow icon and share icon vertically --- src/main/res/layout/list_item.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/res/layout/list_item.xml b/src/main/res/layout/list_item.xml index a535a8210435..7e9aff61c136 100644 --- a/src/main/res/layout/list_item.xml +++ b/src/main/res/layout/list_item.xml @@ -138,7 +138,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:gravity="center" android:paddingLeft="@dimen/standard_padding" android:paddingRight="@dimen/standard_padding"> @@ -146,6 +145,7 @@ android:id="@+id/sharedIcon" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_centerVertical="true" android:layout_marginTop="@dimen/standard_quarter_margin" android:layout_marginBottom="@dimen/standard_quarter_margin" android:layout_marginRight="@dimen/standard_half_margin" @@ -156,6 +156,7 @@ android:id="@+id/custom_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_centerVertical="true" android:layout_marginLeft="@dimen/standard_half_margin" android:layout_marginRight="@dimen/standard_half_margin" android:layout_toRightOf="@id/sharedIcon" @@ -166,6 +167,7 @@ android:id="@+id/overflow_menu" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_centerVertical="true" android:layout_marginLeft="@dimen/standard_half_margin" android:layout_toRightOf="@id/custom_checkbox" android:clickable="true" From 2eae215984250870f3ca3ba04c7a99fd3f06ac7f Mon Sep 17 00:00:00 2001 From: Hari Date: Thu, 5 Oct 2017 13:37:24 +0530 Subject: [PATCH 06/18] Change dimensions of svg to 16dp x 16dp --- src/main/res/drawable/shared_via_users.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/res/drawable/shared_via_users.xml b/src/main/res/drawable/shared_via_users.xml index e3fe874d61e1..73954766e509 100644 --- a/src/main/res/drawable/shared_via_users.xml +++ b/src/main/res/drawable/shared_via_users.xml @@ -1,6 +1,6 @@ Date: Thu, 5 Oct 2017 16:24:18 +0530 Subject: [PATCH 07/18] Align row icons to action bar icons --- src/main/res/layout/list_item.xml | 6 +++--- src/main/res/values/dims.xml | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/res/layout/list_item.xml b/src/main/res/layout/list_item.xml index 7e9aff61c136..1d96360a64ed 100644 --- a/src/main/res/layout/list_item.xml +++ b/src/main/res/layout/list_item.xml @@ -138,8 +138,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:paddingLeft="@dimen/standard_padding" - android:paddingRight="@dimen/standard_padding"> + android:paddingLeft="@dimen/alternate_padding" + android:paddingRight="@dimen/alternate_padding"> diff --git a/src/main/res/values/dims.xml b/src/main/res/values/dims.xml index 9df5c75c478e..5d0ca3c0e769 100644 --- a/src/main/res/values/dims.xml +++ b/src/main/res/values/dims.xml @@ -47,6 +47,7 @@ 14sp 20dp 20dp + 14dp 72dp 0dp 72dp From b555e975f0dfeedcdc5bef474932f7558828f1a8 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Thu, 5 Oct 2017 14:39:03 +0200 Subject: [PATCH 08/18] replace share via user vector with Nextcloud variant --- src/main/res/drawable/shared_via_users.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/res/drawable/shared_via_users.xml b/src/main/res/drawable/shared_via_users.xml index 73954766e509..a33c1d61ec55 100644 --- a/src/main/res/drawable/shared_via_users.xml +++ b/src/main/res/drawable/shared_via_users.xml @@ -1,9 +1,12 @@ + android:viewportWidth="16.0" + android:viewportHeight="16.0"> + android:strokeColor="#FFFFFFFF" + android:strokeWidth="0.2" + android:strokeMiterLimit="4" + android:pathData="M12.228 1a2.457 2.457 0 0 0-2.46 2.454c0 0.075 0.01 0.15 0.016 0.224L5.05 6.092a2.445 2.445 0 0 0-1.596-0.586A2.453 2.453 0 0 0 1 7.96a2.453 2.453 0 0 0 2.454 2.455 2.45 2.45 0 0 0 1.46-0.477l4.865 2.474c-0.004 0.044-0.01 0.09-0.01 0.134a2.457 2.457 0 1 0 0.804-1.818l-4.696-2.4c 0.02-0.123 0.035-0.25 0.035-0.378 0-0.072-0.01-0.144-0.015-0.214l4.74-2.414A2.457 2.457 0 1 0 12.228 0.99z"/> From 4508370acad736bf28bf103a796b09ba01c94815 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Thu, 5 Oct 2017 14:39:33 +0200 Subject: [PATCH 09/18] replace shared via link pngs with vector variant --- .../res/drawable-hdpi/shared_via_link.png | Bin 992 -> 0 bytes .../res/drawable-mdpi/shared_via_link.png | Bin 701 -> 0 bytes .../res/drawable-xhdpi/shared_via_link.png | Bin 1436 -> 0 bytes .../res/drawable-xxhdpi/shared_via_link.png | Bin 2098 -> 0 bytes .../res/drawable-xxxhdpi/shared_via_link.png | Bin 2991 -> 0 bytes src/main/res/drawable/shared_via_link.xml | 18 ++++++++++++++++++ 6 files changed, 18 insertions(+) delete mode 100644 src/main/res/drawable-hdpi/shared_via_link.png delete mode 100644 src/main/res/drawable-mdpi/shared_via_link.png delete mode 100644 src/main/res/drawable-xhdpi/shared_via_link.png delete mode 100644 src/main/res/drawable-xxhdpi/shared_via_link.png delete mode 100644 src/main/res/drawable-xxxhdpi/shared_via_link.png create mode 100644 src/main/res/drawable/shared_via_link.xml diff --git a/src/main/res/drawable-hdpi/shared_via_link.png b/src/main/res/drawable-hdpi/shared_via_link.png deleted file mode 100644 index a7c3fd6ba373b73581762ec9d593729cc483c66d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 992 zcmV<610Vc}P)G;-bj3IM=% zAGpnC15p%TPft((C`nS9q9_CaNG6lAuIti!?VuBUW@ctf6vZcmkUtU8hKS#3n)dPe z`8j16h5!INx7xwG-~a%GkgJ}a9^G0~tJS&zZgE7nfnU#iP$(20T78-Eb0N~{0gwEx1p`oE6y{oGWCMPF%!{P9kgpfBK1&C|YL)Kp z?k-tl#bVKih&0dh6_#b2)8eFQx;8a6m5M|nv(4}pft8kxjg4TV(STeo=N%Xrh`ZhH z8UR2#o&HeQ^;txuE-o&7);fk^N_~BOuR@{F7wzyCfvT!=&1rEs9FEb^(N}^XY*G{j zilW55Uhhjy(_ZZF?>__p=tyj_S_rGqtp>GiJdri|8n&FC~ zXp$r?ybXSHMCEdsvkJYvy}!5L&`$97w7gZoFw9L_Ow;rtqV3;+16+SNx~@yh%gc+V zX;KtL;l#wm&rYW^Q!Exg*xTECbXWL|001B!k1wvRt%W;Ix+AF9I$z-1I?(WK_ zX;N0*<#JsH0)b6gmgnCW-XgG?uIrLv7(%sLWt>ju1<&&d>*4xew!Z+3ee!b6kz^YH O0000q!hL@{Jgtap{(=ONtJNw^f#kT?GM z{~qr>fCq?DiYcYYctdwR8&#=PHrws?8%0rkR;yKUxm=eXkLOb`7@RTp!G%KMMY&ww zS5=jDI-Tmx%?;n}c3+uHCJF!_P4~f)B<&MI*ia~Ro=&H?QmNDt!!UZk-+x9aMRyt) z;cz&7CJ4eILP!k+0+$@eO$i|@0KhIZC>D#GM%eH7UjP75N=>3D9t?*=%yC=?A*3$c zpxf>4s;bI{LZNfJ-Tot=&%f{Y`=@5Jd0Ma6w=u@V=kt9A0JxQ)R4NIB!QiQ)C_ab7 zF^$DyCk(@IlgR}4dc7@&!_l+ZY$O_u9>?Qx@s>fURN9dwY47^_`mxz;9*@UkOS9SB z@p`>y9LG&HO&(wCQ)r^De8V~p>G0RSEW0Awcf j5?}uZFBGMeeaQb`G6NIjfv|X{00000NkvXXu0mjfAL=V7 diff --git a/src/main/res/drawable-xhdpi/shared_via_link.png b/src/main/res/drawable-xhdpi/shared_via_link.png deleted file mode 100644 index 9ebd6230432d8f61bce20a63010fe69ec5e52def..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1436 zcmV;N1!MY&P)f4C=~Tk7y}vN!{)>09Bjg-b4>Kb`Dh>drs6z6ZT#(Fo)FvAHMVZB^LD=H{?6xnf9IUvIRO80Bd=moM63e<4gj_Sz&s%&^{*Jn zWHMG&RgY_$wp~$_rhGonuq?YM2!h(&+&tuPIQj`8%dfK`8;KQ%r+ZhO&pgb+A%=umjqu3g7yCh9f=J~1)z z#Y(u-=`8g0^ynPN{Yf=Mgu%hV&R8sVglbzh0#{YFdt_wfxj(P3uZP~=-g_M#9Y2`O zW?4~`z2R{9=-7Kti9|v`#5V~cnU`9EYHPj*8~^~Co11@aZ*MPeyi_V>1^^b|CH8=-s@=7~ z0RWQ8q(j$rGwm}B^8^5LH5<@0ZRhCd=$Ey?5wSs%q!Y3%GgK1_vLAXx{!I}(AO-&sO1On}A!6zmr zzV7eu-yMlW&LSc~#4V9XXiS&;=30I)`* zF}Y{Yo;gtz&sKw1H9(6@Fc{>E#Uf<0*)~GR6OQ9%={MMRqt4>*3NV~ zO=Ap*_y;03gu~%aWLbWl#&8^`Kig=5wZN+~kjZ4MQ&Ur)uPicFt2GM%2D{z<)BgSY zM-2u8`2Bv(>-C;)X=(Xwa&q$GjT<+1R>lZ|5cwzYstl;AdOQ#av{g=Y`0(Me9XocM zpm#SSo?;m0TZUlxfV{2CRTnwl2PX0u!ie64f7UIQtM#ge0+@~8FWQhbW?9;ba!ELWdL_~cP?peYja~^ zaAhuUa%Y?FJQ@H12d_y)K~!jg?V4Rr8`&AhpW`9e9=|Z-SBwDzA(2UumI_ow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gui;If^5u+fR-WZ1YVC~wq*UQSv?pmr=S67EOZ{B=` zVVIZXUfw(;G-;^N{Db3qo(Py81c9>z9SCmp&vxTXHVA;sXi0VqL zs;Vk%Fc|)>wo97|nUb%suODVvwh0kcx4dTqQw1pWdcBHS832G)t5!)Y%eH6Q$PCEO zXpxf+rV3#7dcCSsAHy(!i0a9A1!PLTuCDI$`$Zn$UIBt8lPQww1|mxP5K|&`oe_Dn z*_?G?lMSW{;7LSWiWnLi$^(Fv=~SFa-hQsg1KcaXb-UfJn$hX&>oZG|^jb3fRYNA^ z9S+Bwkq4L}03wc=&E}w5BzNP+4RE-BmK!C)|t=lM`!VPV*Aw^KYGALcl&EiW(cNG@af*+AC+7a*bq08k2(e_+f9051UC l1c2d0miPf4-~r}8{tJu&Emb@sH(LMz002ovPDHLkV1h>~xy=9o diff --git a/src/main/res/drawable/shared_via_link.xml b/src/main/res/drawable/shared_via_link.xml new file mode 100644 index 000000000000..b57c8f4432af --- /dev/null +++ b/src/main/res/drawable/shared_via_link.xml @@ -0,0 +1,18 @@ + + + + From 1924766a66f6f949e9628bb965a005fced9a1d1a Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Thu, 5 Oct 2017 16:37:00 +0200 Subject: [PATCH 10/18] fix lint warnings for clickable items + content description --- src/main/res/layout/list_item.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/res/layout/list_item.xml b/src/main/res/layout/list_item.xml index 1d96360a64ed..9f8b370a421d 100644 --- a/src/main/res/layout/list_item.xml +++ b/src/main/res/layout/list_item.xml @@ -52,6 +52,7 @@ android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_marginRight="4dp" + android:contentDescription="@string/favorite_switch" android:src="@drawable/ic_favorite" /> @@ -150,6 +152,7 @@ android:layout_marginBottom="@dimen/standard_quarter_margin" android:layout_marginRight="@dimen/list_item_share_right_margin" android:clickable="true" + android:focusable="true" android:src="@drawable/ic_unshared" /> From afa497cdff847541b87261bf91572ba0b779e808 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Thu, 5 Oct 2017 17:24:03 +0200 Subject: [PATCH 11/18] Fix NPE for grid views (as in non-list-views) --- .../android/ui/adapter/FileListListAdapter.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java index db153e527224..779b71f7ef80 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java @@ -340,13 +340,15 @@ public void onClick(View view) { checkBoxV.setVisibility(View.VISIBLE); } - ImageView overflowIndicatorV = (ImageView) view.findViewById(R.id.overflow_menu); - overflowIndicatorV.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - OCFileListFragmentInterface.onOverflowIconClick(v, temp); - } - }); + if (ViewType.LIST_ITEM.equals(viewType)) { + ImageView overflowIndicatorV = (ImageView) view.findViewById(R.id.overflow_menu); + overflowIndicatorV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + OCFileListFragmentInterface.onOverflowIconClick(v, temp); + } + }); + } // this if-else is needed even though kept-in-sync icon is visible by default // because android reuses views in listview From c5ac05bd559c1774844161aad30f9c44cec97368 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Thu, 5 Oct 2017 17:26:40 +0200 Subject: [PATCH 12/18] fix line formatting to 120 characters --- src/main/java/com/owncloud/android/files/FileMenuFilter.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/owncloud/android/files/FileMenuFilter.java b/src/main/java/com/owncloud/android/files/FileMenuFilter.java index bfa9e8445dc9..b43ed2ffd78e 100644 --- a/src/main/java/com/owncloud/android/files/FileMenuFilter.java +++ b/src/main/java/com/owncloud/android/files/FileMenuFilter.java @@ -85,8 +85,7 @@ public FileMenuFilter(int numberOfAllFiles, Collection targetFiles, Acco */ public FileMenuFilter(OCFile targetFile, Account account, ComponentsGetter cg, Context context, boolean overflowMenu) { - this(1, Collections.singletonList(targetFile), account, cg, context, - overflowMenu); + this(1, Collections.singletonList(targetFile), account, cg, context, overflowMenu); } /** From e558a9910a818a3a1a92c5def493ccdafce5a89a Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Thu, 5 Oct 2017 18:25:24 +0200 Subject: [PATCH 13/18] file local file listing --- .../com/owncloud/android/ui/adapter/LocalFileListAdapter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/owncloud/android/ui/adapter/LocalFileListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/LocalFileListAdapter.java index 01a683642318..beaa9f2b7771 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/LocalFileListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/LocalFileListAdapter.java @@ -178,6 +178,7 @@ public View getView(int position, View convertView, ViewGroup parent) { TextView lastModV = (TextView) view.findViewById(R.id.last_mod); lastModV.setVisibility(View.VISIBLE); lastModV.setText(DisplayUtils.getRelativeTimestamp(mContext, file.lastModified())); + view.findViewById(R.id.overflow_menu).setVisibility(View.GONE); } if (!file.isDirectory()) { From fde6e8bd82ae226e8c17bb1acd5f4d26f2de1d99 Mon Sep 17 00:00:00 2001 From: Hari Date: Fri, 6 Oct 2017 20:22:36 +0530 Subject: [PATCH 14/18] Hide share and overflow icons in the selected state --- .../ui/adapter/FileListListAdapter.java | 74 ++++++++++++------- 1 file changed, 48 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java index 779b71f7ef80..ccb0f089e487 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java @@ -231,21 +231,6 @@ public View getView(int position, View convertView, ViewGroup parent) { if (file != null) { ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail); - ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon); - if (file.isSharedWithSharee() || file.isSharedWithMe()) { - sharedIconV.setImageResource(R.drawable.shared_via_users); - } else if (file.isSharedViaLink()) { - sharedIconV.setImageResource(R.drawable.shared_via_link); - } else { - sharedIconV.setImageResource(R.drawable.ic_unshared); - } - final OCFile temp = file; - sharedIconV.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - OCFileListFragmentInterface.onShareIconClick(temp); - } - }); fileIcon.setTag(file.getFileId()); TextView fileName; @@ -323,7 +308,6 @@ public void onClick(View view) { } ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox); - checkBoxV.setVisibility(View.GONE); view.setBackgroundColor(Color.WHITE); AbsListView parentList = (AbsListView) parent; @@ -338,16 +322,12 @@ public void onClick(View view) { checkBoxV.setImageResource(R.drawable.ic_checkbox_blank_outline); } checkBoxV.setVisibility(View.VISIBLE); - } - - if (ViewType.LIST_ITEM.equals(viewType)) { - ImageView overflowIndicatorV = (ImageView) view.findViewById(R.id.overflow_menu); - overflowIndicatorV.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - OCFileListFragmentInterface.onOverflowIconClick(v, temp); - } - }); + hideShareIcon(view); + hideOverflowMenuIcon(view, viewType); + } else { + checkBoxV.setVisibility(View.GONE); + showShareIcon(view, file); + showOverflowMenuIcon(view, file, viewType); } // this if-else is needed even though kept-in-sync icon is visible by default @@ -423,6 +403,48 @@ public void onClick(View v) { return view; } + private void showShareIcon(View view, OCFile file) { + ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon); + sharedIconV.setVisibility(View.VISIBLE); + if (file.isSharedWithSharee() || file.isSharedWithMe()) { + sharedIconV.setImageResource(R.drawable.shared_via_users); + } else if (file.isSharedViaLink()) { + sharedIconV.setImageResource(R.drawable.shared_via_link); + } else { + sharedIconV.setImageResource(R.drawable.ic_unshared); + } + sharedIconV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + OCFileListFragmentInterface.onShareIconClick(file); + } + }); + } + + private void hideShareIcon(View view) { + view.findViewById(R.id.sharedIcon).setVisibility(View.GONE); + } + + private void showOverflowMenuIcon(View view, OCFile file, ViewType viewType) { + if (ViewType.LIST_ITEM.equals(viewType)) { + ImageView overflowIndicatorV = (ImageView) view.findViewById(R.id.overflow_menu); + overflowIndicatorV.setVisibility(View.VISIBLE); + overflowIndicatorV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + OCFileListFragmentInterface.onOverflowIconClick(v, file); + } + }); + } + } + + private void hideOverflowMenuIcon(View view, ViewType viewType) { + if (ViewType.LIST_ITEM.equals(viewType)) { + ImageView overflowIndicatorV = (ImageView) view.findViewById(R.id.overflow_menu); + overflowIndicatorV.setVisibility(View.GONE); + } + } + @Override public int getViewTypeCount() { return 1; From 0e352b3bb811f30715a7f8e1087d14936ac88831 Mon Sep 17 00:00:00 2001 From: Hari Date: Fri, 6 Oct 2017 20:28:22 +0530 Subject: [PATCH 15/18] Hide share option in per-item menu --- src/main/java/com/owncloud/android/files/FileMenuFilter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/files/FileMenuFilter.java b/src/main/java/com/owncloud/android/files/FileMenuFilter.java index b43ed2ffd78e..1c0fa469da5d 100644 --- a/src/main/java/com/owncloud/android/files/FileMenuFilter.java +++ b/src/main/java/com/owncloud/android/files/FileMenuFilter.java @@ -240,7 +240,8 @@ private void filter(List toShow, List toHide, boolean inSingle (capability.getFilesSharingApiEnabled().isTrue() || capability.getFilesSharingApiEnabled().isUnknown() ); - if ((!shareViaLinkAllowed && !shareWithUsersAllowed) || !isSingleSelection() || !shareApiEnabled) { + if ((!shareViaLinkAllowed && !shareWithUsersAllowed) || + !isSingleSelection() || !shareApiEnabled || mOverflowMenu) { toHide.add(R.id.action_share_file); } else { toShow.add(R.id.action_share_file); From 1bd5c65a0247e1446fb3c55741c9ce2a4ab418b2 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Wed, 18 Oct 2017 21:56:03 +0200 Subject: [PATCH 16/18] fix method call after rebase due to changed method signature --- .../com/owncloud/android/ui/fragment/OCFileListFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 0f4e3a4ebd52..0eae61b37f01 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -532,7 +532,7 @@ public void onOverflowIconClick(View view, OCFile file) { getActivity(), true ); - mf.filter(popup.getMenu()); + mf.filter(popup.getMenu(), false); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { From be097d238b9e1ecf012de9a7a045f21a51707dc1 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Wed, 18 Oct 2017 21:56:35 +0200 Subject: [PATCH 17/18] fix boolean --- .../com/owncloud/android/ui/fragment/OCFileListFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 0eae61b37f01..c6c85e006482 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -532,7 +532,7 @@ public void onOverflowIconClick(View view, OCFile file) { getActivity(), true ); - mf.filter(popup.getMenu(), false); + mf.filter(popup.getMenu(), true); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { From a2d182cf753226918c27621a8846859a1f228ace Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Wed, 18 Oct 2017 22:03:21 +0200 Subject: [PATCH 18/18] fixed size of the share icon hitbox in list view --- src/main/res/layout/list_item.xml | 3 +-- src/main/res/values/dims.xml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/res/layout/list_item.xml b/src/main/res/layout/list_item.xml index 9f8b370a421d..2bfa727de7bc 100644 --- a/src/main/res/layout/list_item.xml +++ b/src/main/res/layout/list_item.xml @@ -148,9 +148,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" - android:layout_marginTop="@dimen/standard_quarter_margin" - android:layout_marginBottom="@dimen/standard_quarter_margin" android:layout_marginRight="@dimen/list_item_share_right_margin" + android:padding="@dimen/standard_quarter_padding" android:clickable="true" android:focusable="true" android:src="@drawable/ic_unshared" /> diff --git a/src/main/res/values/dims.xml b/src/main/res/values/dims.xml index 5d0ca3c0e769..b3aa0df7480b 100644 --- a/src/main/res/values/dims.xml +++ b/src/main/res/values/dims.xml @@ -47,7 +47,7 @@ 14sp 20dp 20dp - 14dp + 10dp 72dp 0dp 72dp