Browse Source

Merge pull request #2519 from nextcloud/rippleEffect

Add ripple effect
Andy Scherzinger 7 years ago
parent
commit
36328e242e

+ 2 - 14
src/main/java/com/owncloud/android/ui/adapter/ShareUserListAdapter.java

@@ -21,7 +21,6 @@
 package com.owncloud.android.ui.adapter;
 
 import android.content.Context;
-import android.graphics.drawable.Drawable;
 import android.support.annotation.NonNull;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -116,21 +115,10 @@ public class ShareUserListAdapter extends ArrayAdapter {
             userName.setText(name);
 
             /// bind listener to edit privileges
-            editShareButton.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    mListener.editShare(mShares.get(position));
-                }
-            });
+            editShareButton.setOnClickListener(v -> mListener.editShare(mShares.get(position)));
 
             /// bind listener to unshare
-            unshareButton.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    mListener.unshareButtonPressed(mShares.get(position));
-                }
-            });
-
+            unshareButton.setOnClickListener(v -> mListener.unshareButtonPressed(mShares.get(position)));
         }
         return view;
     }

+ 17 - 16
src/main/res/layout/grid_image.xml

@@ -21,6 +21,7 @@
     android:layout_height="wrap_content"
     android:layout_gravity="center_horizontal"
     android:background="@drawable/list_selector"
+    android:foreground="?android:attr/selectableItemBackground"
     android:gravity="center_horizontal"
     android:orientation="vertical">
 
@@ -43,19 +44,19 @@
             android:layout_height="wrap_content"
             android:layout_gravity="top|end"
             android:layout_margin="@dimen/standard_quarter_margin"
-            android:src="@drawable/badge_favorite"
-            android:contentDescription="@string/favorite_icon" />
+            android:contentDescription="@string/favorite_icon"
+            android:src="@drawable/badge_favorite" />
 
         <ImageView
             android:id="@+id/sharedIcon"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="top|end"
-            android:layout_marginTop="@dimen/grid_image_shared_icon_layout_top_margin"
-            android:layout_marginRight="@dimen/standard_quarter_margin"
             android:layout_marginEnd="@dimen/standard_quarter_margin"
-            android:src="@drawable/shared_via_link"
-            android:contentDescription="@string/shared_via_link_icon" />
+            android:layout_marginRight="@dimen/standard_quarter_margin"
+            android:layout_marginTop="@dimen/grid_image_shared_icon_layout_top_margin"
+            android:contentDescription="@string/shared_via_link_icon"
+            android:src="@drawable/shared_via_link" />
 
         <ImageView
             android:id="@+id/localFileIndicator"
@@ -63,11 +64,11 @@
             android:layout_height="@dimen/grid_image_local_file_indicator_layout_height"
             android:layout_gravity="bottom|end"
             android:layout_marginBottom="@dimen/standard_quarter_margin"
-            android:layout_marginRight="@dimen/standard_quarter_margin"
             android:layout_marginEnd="@dimen/standard_quarter_margin"
+            android:layout_marginRight="@dimen/standard_quarter_margin"
             android:layout_marginTop="@dimen/standard_quarter_margin"
-            android:src="@drawable/ic_synced"
-            android:contentDescription="@string/synced_icon" />
+            android:contentDescription="@string/synced_icon"
+            android:src="@drawable/ic_synced" />
 
         <ImageView
             android:id="@+id/keptOfflineIcon"
@@ -75,20 +76,20 @@
             android:layout_height="@dimen/grid_image_kept_offline_icon_layout_height"
             android:layout_gravity="bottom|end"
             android:layout_marginBottom="@dimen/standard_quarter_margin"
-            android:layout_marginRight="@dimen/grid_image_kept_offline_icon_layout_right_end_margin"
             android:layout_marginEnd="@dimen/grid_image_kept_offline_icon_layout_right_end_margin"
-            android:src="@drawable/ic_available_offline"
-            android:contentDescription="@string/available_offline_icon" />
+            android:layout_marginRight="@dimen/grid_image_kept_offline_icon_layout_right_end_margin"
+            android:contentDescription="@string/available_offline_icon"
+            android:src="@drawable/ic_available_offline" />
 
         <ImageView
             android:id="@+id/custom_checkbox"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical|top"
             android:layout_marginLeft="@dimen/standard_quarter_margin"
             android:layout_marginRight="@dimen/standard_quarter_margin"
-            android:layout_gravity="center_vertical|top"
-            android:src="@android:drawable/checkbox_off_background"
-            android:contentDescription="@string/checkbox" />
+            android:contentDescription="@string/checkbox"
+            android:src="@android:drawable/checkbox_off_background" />
     </FrameLayout>
 
-</LinearLayout>
+</LinearLayout>

+ 51 - 50
src/main/res/layout/list_item.xml

@@ -20,26 +20,27 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/ListItemLayout"
     android:layout_width="match_parent"
-    android:background="@drawable/list_selector"
-    android:orientation="vertical"
     android:layout_height="@dimen/standard_list_item_size"
-    android:descendantFocusability="blocksDescendants">
+    android:background="@drawable/list_selector"
+    android:descendantFocusability="blocksDescendants"
+    android:foreground="?android:attr/selectableItemBackground"
+    android:orientation="vertical">
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:orientation="horizontal"
-        android:baselineAligned="false">
+        android:baselineAligned="false"
+        android:orientation="horizontal">
 
         <RelativeLayout
             android:layout_width="@dimen/standard_list_item_size"
             android:layout_height="@dimen/standard_list_item_size"
             android:paddingBottom="@dimen/standard_padding"
-            android:paddingTop="@dimen/standard_padding"
             android:paddingEnd="@dimen/standard_quarter_padding"
+            android:paddingLeft="@dimen/zero"
             android:paddingRight="@dimen/standard_quarter_padding"
             android:paddingStart="@dimen/zero"
-            android:paddingLeft="@dimen/zero">
+            android:paddingTop="@dimen/standard_padding">
 
             <ImageView
                 android:id="@+id/thumbnail"
@@ -48,45 +49,45 @@
                 android:layout_centerInParent="true"
                 android:layout_marginLeft="@dimen/standard_half_margin"
                 android:layout_marginStart="@dimen/standard_half_margin"
-                android:src="@drawable/folder"
-                android:contentDescription="@string/thumbnail"/>
+                android:contentDescription="@string/thumbnail"
+                android:src="@drawable/folder" />
 
             <ImageView
                 android:id="@+id/favorite_action"
                 android:layout_width="@dimen/list_item_favorite_action_layout_width"
                 android:layout_height="@dimen/list_item_favorite_action_layout_height"
-                android:layout_alignParentTop="true"
-                android:layout_alignParentRight="true"
                 android:layout_alignParentEnd="true"
-                android:layout_marginRight="@dimen/standard_quarter_margin"
+                android:layout_alignParentRight="true"
+                android:layout_alignParentTop="true"
                 android:layout_marginEnd="@dimen/standard_quarter_margin"
+                android:layout_marginRight="@dimen/standard_quarter_margin"
                 android:contentDescription="@string/favorite"
                 android:src="@drawable/badge_favorite" />
 
             <ImageView
                 android:id="@+id/keptOfflineIcon"
-                android:layout_height="@dimen/list_item_kept_offline_icon_layout_height"
                 android:layout_width="@dimen/list_item_kept_offline_icon_layout_width"
+                android:layout_height="@dimen/list_item_kept_offline_icon_layout_height"
                 android:layout_alignParentBottom="true"
-                android:layout_alignParentRight="true"
                 android:layout_alignParentEnd="true"
-                android:layout_marginRight="@dimen/list_item_kept_offline_icon_layout_right_end_margin"
+                android:layout_alignParentRight="true"
                 android:layout_marginEnd="@dimen/list_item_kept_offline_icon_layout_right_end_margin"
-                android:src="@drawable/ic_available_offline"
-                android:contentDescription="@string/available_offline_icon"/>
+                android:layout_marginRight="@dimen/list_item_kept_offline_icon_layout_right_end_margin"
+                android:contentDescription="@string/available_offline_icon"
+                android:src="@drawable/ic_available_offline" />
 
             <ImageView
                 android:id="@+id/localFileIndicator"
                 android:layout_width="@dimen/list_item_local_file_indicator_layout_width"
                 android:layout_height="@dimen/list_item_local_file_indicator_layout_height"
-                android:src="@drawable/ic_synced"
                 android:layout_alignParentBottom="true"
-                android:layout_alignParentRight="true"
                 android:layout_alignParentEnd="true"
-                android:scaleType="fitCenter"
-                android:contentDescription="@string/downloader_download_succeeded_ticker"
+                android:layout_alignParentRight="true"
+                android:layout_marginEnd="@dimen/standard_quarter_margin"
                 android:layout_marginRight="@dimen/standard_quarter_margin"
-                android:layout_marginEnd="@dimen/standard_quarter_margin"/>
+                android:contentDescription="@string/downloader_download_succeeded_ticker"
+                android:scaleType="fitCenter"
+                android:src="@drawable/ic_synced" />
 
         </RelativeLayout>
 
@@ -95,8 +96,8 @@
             android:layout_height="match_parent"
             android:layout_weight="1"
             android:gravity="top"
-            android:paddingTop="@dimen/standard_padding"
-            android:orientation="vertical" >
+            android:orientation="vertical"
+            android:paddingTop="@dimen/standard_padding">
 
             <TextView
                 android:id="@+id/Filename"
@@ -120,20 +121,20 @@
                     android:layout_height="wrap_content"
                     android:text="@string/placeholder_fileSize"
                     android:textColor="@color/list_item_lastmod_and_filesize_text"
-                    android:textSize="@dimen/two_line_secondary_text_size"/>
+                    android:textSize="@dimen/two_line_secondary_text_size" />
 
                 <TextView
                     android:id="@+id/file_separator"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:paddingRight="@dimen/standard_quarter_padding"
+                    android:gravity="end"
                     android:paddingEnd="@dimen/standard_quarter_padding"
                     android:paddingLeft="@dimen/zero"
+                    android:paddingRight="@dimen/standard_quarter_padding"
                     android:paddingStart="@dimen/zero"
-                    android:gravity="end"
                     android:text="@string/info_separator"
                     android:textColor="@color/list_item_lastmod_and_filesize_text"
-                    android:textSize="@dimen/two_line_secondary_text_size"/>
+                    android:textSize="@dimen/two_line_secondary_text_size" />
 
                 <TextView
                     android:id="@+id/last_mod"
@@ -142,7 +143,7 @@
                     android:gravity="end"
                     android:text="@string/placeholder_media_time"
                     android:textColor="@color/list_item_lastmod_and_filesize_text"
-                    android:textSize="@dimen/two_line_secondary_text_size"/>
+                    android:textSize="@dimen/two_line_secondary_text_size" />
 
             </LinearLayout>
 
@@ -152,56 +153,56 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center_vertical"
+            android:paddingEnd="@dimen/zero"
             android:paddingLeft="@dimen/standard_half_padding"
-            android:paddingStart="@dimen/standard_half_padding"
             android:paddingRight="@dimen/zero"
-            android:paddingEnd="@dimen/zero">
+            android:paddingStart="@dimen/standard_half_padding">
 
             <ImageView
                 android:id="@+id/sharedIcon"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
                 android:layout_centerVertical="true"
-                android:paddingRight="@dimen/list_item_share_right_margin"
+                android:clickable="true"
+                android:contentDescription="@string/shared_icon"
+                android:focusable="true"
                 android:paddingEnd="@dimen/list_item_share_right_margin"
                 android:paddingLeft="@dimen/standard_half_padding"
+                android:paddingRight="@dimen/list_item_share_right_margin"
                 android:paddingStart="@dimen/standard_half_padding"
-                android:clickable="true"
-                android:focusable="true"
-                android:src="@drawable/ic_unshared"
-                android:contentDescription="@string/shared_icon"/>
+                android:src="@drawable/ic_unshared" />
 
             <ImageView
                 android:id="@+id/custom_checkbox"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
                 android:layout_centerVertical="true"
-                android:paddingLeft="@dimen/standard_half_padding"
-                android:paddingStart="@dimen/standard_half_padding"
-                android:paddingRight="@dimen/alternate_padding"
-                android:paddingEnd="@dimen/alternate_padding"
-                android:layout_toRightOf="@id/sharedIcon"
                 android:layout_toEndOf="@id/sharedIcon"
+                android:layout_toRightOf="@id/sharedIcon"
                 android:clickable="false"
+                android:contentDescription="@string/checkbox"
                 android:focusable="false"
-                android:src="@drawable/ic_checkbox_blank_outline"
-                android:contentDescription="@string/checkbox"/>
+                android:paddingEnd="@dimen/alternate_padding"
+                android:paddingLeft="@dimen/standard_half_padding"
+                android:paddingRight="@dimen/alternate_padding"
+                android:paddingStart="@dimen/standard_half_padding"
+                android:src="@drawable/ic_checkbox_blank_outline" />
 
             <ImageView
                 android:id="@+id/overflow_menu"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
                 android:layout_centerVertical="true"
-                android:paddingLeft="@dimen/standard_half_padding"
-                android:paddingStart="@dimen/standard_half_padding"
-                android:layout_toRightOf="@id/custom_checkbox"
                 android:layout_toEndOf="@id/custom_checkbox"
-                android:paddingRight="@dimen/alternate_padding"
-                android:paddingEnd="@dimen/alternate_padding"
+                android:layout_toRightOf="@id/custom_checkbox"
                 android:clickable="true"
+                android:contentDescription="@string/overflow_menu"
                 android:focusable="true"
-                android:src="@drawable/ic_dots_vertical"
-                android:contentDescription="@string/overflow_menu"/>
+                android:paddingEnd="@dimen/alternate_padding"
+                android:paddingLeft="@dimen/standard_half_padding"
+                android:paddingRight="@dimen/alternate_padding"
+                android:paddingStart="@dimen/standard_half_padding"
+                android:src="@drawable/ic_dots_vertical" />
 
         </RelativeLayout>