Browse Source

partial click fix

AndyScherzinger 8 years ago
parent
commit
ca0f1bbb2d

+ 8 - 0
src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java

@@ -41,6 +41,7 @@ import android.widget.GridView;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
+import android.widget.Toast;
 
 import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
@@ -199,6 +200,13 @@ public class FileListListAdapter extends BaseAdapter {
             LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ListItemLayout);
             linearLayout.setContentDescription("LinearLayout-" + name);
 
+            ((ImageView) view.findViewById(R.id.favorite_action)).setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    Toast.makeText(mContext, "WORKS!", Toast.LENGTH_LONG).show();
+                }
+            });
+
             switch (viewType) {
                 case LIST_ITEM:
                     TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);

+ 2 - 2
src/main/java/third_parties/in/srain/cube/GridViewWithHeaderAndFooter.java

@@ -72,8 +72,8 @@ public class GridViewWithHeaderAndFooter extends GridView {
     private int mRowHeight = -1;
     private static final String LOG_TAG = "grid-view-with-header-and-footer";
 
-    private ArrayList<FixedViewInfo> mHeaderViewInfos = new ArrayList<FixedViewInfo>();
-    private ArrayList<FixedViewInfo> mFooterViewInfos = new ArrayList<FixedViewInfo>();
+    private ArrayList<FixedViewInfo> mHeaderViewInfos = new ArrayList<>();
+    private ArrayList<FixedViewInfo> mFooterViewInfos = new ArrayList<>();
 
     private void initHeaderGridView() {
     }

+ 4 - 3
src/main/res/layout/grid_image.xml

@@ -38,15 +38,16 @@
             android:scaleType="centerCrop"
             android:src="@drawable/ic_menu_archive"/>
 
-        <Button
+        <ImageButton
             android:id="@+id/favorite_action"
             android:layout_width="24dp"
             android:layout_height="24dp"
             android:layout_marginStart="6dp"
             android:layout_marginEnd="6dp"
-            android:layout_gravity="top|start"
+            android:layout_gravity="bottom|left"
             android:background="@drawable/favorite_button_selector"
-            android:focusable="false"/>
+            android:focusable="false"
+            android:focusableInTouchMode="false"/>
 
         <ImageView
             android:id="@+id/sharedIcon"

+ 14 - 13
src/main/res/layout/grid_item.xml

@@ -28,7 +28,7 @@
     <FrameLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal" >
+        android:layout_gravity="center_horizontal">
 
         <ImageView
             android:id="@+id/thumbnail"
@@ -37,34 +37,35 @@
             android:layout_gravity="center_horizontal"
             android:layout_marginLeft="@dimen/fragment_margin"
             android:layout_marginRight="@dimen/alternate_margin"
-            android:src="@drawable/ic_menu_archive" />
+            android:src="@drawable/ic_menu_archive"/>
 
-        <Button
+        <ImageButton
             android:id="@+id/favorite_action"
             android:layout_width="24dp"
             android:layout_height="24dp"
-            android:layout_marginStart="6dp"
+            android:layout_gravity="bottom|left"
             android:layout_marginEnd="6dp"
-            android:layout_gravity="top|left"
+            android:layout_marginStart="6dp"
             android:background="@drawable/favorite_button_selector"
-            android:focusable="false"/>
+            android:focusable="false"
+            android:focusableInTouchMode="false"/>
 
         <ImageView
             android:id="@+id/sharedIcon"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_margin="@dimen/standard_quarter_margin"
             android:layout_gravity="top|right"
-            android:src="@drawable/shared_via_link" />
+            android:layout_margin="@dimen/standard_quarter_margin"
+            android:src="@drawable/shared_via_link"/>
 
         <ImageView
             android:id="@+id/localFileIndicator"
             android:layout_width="@dimen/file_icon_size"
             android:layout_height="@dimen/file_icon_size"
             android:layout_gravity="bottom|right"
-            android:layout_marginTop="@dimen/standard_eighth_margin"
             android:layout_marginRight="@dimen/standard_eighth_margin"
-            android:src="@drawable/ic_synced" />
+            android:layout_marginTop="@dimen/standard_eighth_margin"
+            android:src="@drawable/ic_synced"/>
 
         <ImageView
             android:id="@+id/keptOfflineIcon"
@@ -73,7 +74,7 @@
             android:layout_gravity="bottom|right"
             android:layout_marginBottom="@dimen/standard_eighth_margin"
             android:layout_marginRight="@dimen/standard_eighth_margin"
-            android:src="@drawable/ic_available_offline" />
+            android:src="@drawable/ic_available_offline"/>
 
         <ImageView
             android:id="@+id/custom_checkbox"
@@ -82,8 +83,8 @@
             android:layout_gravity="center_vertical|top"
             android:layout_marginLeft="@dimen/standard_quarter_margin"
             android:layout_marginRight="@dimen/standard_quarter_margin"
-            android:src="@android:drawable/checkbox_off_background"
-            android:elevation="@dimen/elevation" />
+            android:elevation="@dimen/elevation"
+            android:src="@android:drawable/checkbox_off_background"/>
 
     </FrameLayout>
 

+ 6 - 2
src/main/res/layout/list_fragment.xml

@@ -41,7 +41,9 @@
             android:divider="@color/list_divider_background"
             android:dividerHeight="1px"
             android:visibility="visible"
-            android:focusable="true"/>
+            android:focusable="true"
+            android:clickable="true"
+            android:descendantFocusability="beforeDescendants"/>
 
     </android.support.v4.widget.SwipeRefreshLayout>
 
@@ -63,7 +65,9 @@
             android:stretchMode="columnWidth"
             android:verticalSpacing="@dimen/list_fragment_spacing"
             android:visibility="visible"
-            android:focusable="true"/>
+            android:focusable="true"
+            android:clickable="true"
+            android:descendantFocusability="beforeDescendants"/>
 
     </android.support.v4.widget.SwipeRefreshLayout>
 

+ 2 - 2
src/main/res/layout/list_item.xml

@@ -29,7 +29,7 @@
         android:layout_height="match_parent"
         android:orientation="horizontal">
 
-        <Button
+        <ImageButton
             android:id="@+id/favorite_action"
             android:layout_width="24dp"
             android:layout_height="24dp"
@@ -38,7 +38,7 @@
             android:layout_gravity="center_vertical"
             android:background="@drawable/favorite_button_selector"
             android:focusable="false"
-            />
+            android:focusableInTouchMode="false" />
 
         <FrameLayout
             android:layout_width="60dp"