Bladeren bron

update image when list element is touched

this is required from introduction of project butter
before that view was invalidated on any action, which
was slowing down UI
Bartek Przybylski 12 jaren geleden
bovenliggende
commit
1f57ae3b1e

+ 1 - 1
src/com/owncloud/android/ui/adapter/FileListListAdapter.java

@@ -154,12 +154,12 @@ public class FileListListAdapter implements ListAdapter {
                 if (parentList.getChoiceMode() == ListView.CHOICE_MODE_NONE) { 
                     checkBoxV.setVisibility(View.GONE);
                 } else {
-                    checkBoxV.setVisibility(View.VISIBLE);
                     if (parentList.isItemChecked(position)) {
                         checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);
                     } else {
                         checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);
                     }
+                    checkBoxV.setVisibility(View.VISIBLE);
                 }
                 
             } else {

+ 1 - 1
src/com/owncloud/android/ui/adapter/LocalFileListAdapter.java

@@ -123,12 +123,12 @@ public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
                 if (parentList.getChoiceMode() == ListView.CHOICE_MODE_NONE) { 
                     checkBoxV.setVisibility(View.GONE);
                 } else {
-                    checkBoxV.setVisibility(View.VISIBLE);
                     if (parentList.isItemChecked(position)) {
                         checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);
                     } else {
                         checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);
                     }
+                    checkBoxV.setVisibility(View.VISIBLE);
                 }
 
             } else {

+ 9 - 0
src/com/owncloud/android/ui/fragment/LocalFileListFragment.java

@@ -31,6 +31,7 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.AdapterView;
+import android.widget.ImageView;
 import android.widget.ListView;
 
 import com.owncloud.android.R;
@@ -116,6 +117,14 @@ public class LocalFileListFragment extends FragmentListView {
                 mContainerActivity.onDirectoryClick(file);
             
             } else {    /// Click on a file
+                ImageView checkBoxV = (ImageView) v.findViewById(R.id.custom_checkbox);
+                if (checkBoxV != null) {
+                    if (getListView().isItemChecked(position)) {
+                        checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);
+                    } else {
+                        checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);
+                    }
+                }
                 // notify the change to the container Activity
                 mContainerActivity.onFileClick(file);
             }