diff --git a/F-Droid/res/drawable-hdpi/ic_add_circle_outline_white.png b/F-Droid/res/drawable-hdpi/ic_add_circle_outline_white.png new file mode 100644 index 000000000..fdad9ba4d Binary files /dev/null and b/F-Droid/res/drawable-hdpi/ic_add_circle_outline_white.png differ diff --git a/F-Droid/res/drawable-hdpi/ic_check_circle_white.png b/F-Droid/res/drawable-hdpi/ic_check_circle_white.png new file mode 100644 index 000000000..542a64b31 Binary files /dev/null and b/F-Droid/res/drawable-hdpi/ic_check_circle_white.png differ diff --git a/F-Droid/res/drawable-mdpi/ic_add_circle_outline_white.png b/F-Droid/res/drawable-mdpi/ic_add_circle_outline_white.png new file mode 100644 index 000000000..ac9427430 Binary files /dev/null and b/F-Droid/res/drawable-mdpi/ic_add_circle_outline_white.png differ diff --git a/F-Droid/res/drawable-mdpi/ic_check_circle_white.png b/F-Droid/res/drawable-mdpi/ic_check_circle_white.png new file mode 100644 index 000000000..4c233ae9f Binary files /dev/null and b/F-Droid/res/drawable-mdpi/ic_check_circle_white.png differ diff --git a/F-Droid/res/drawable-xhdpi/ic_add_circle_outline_white.png b/F-Droid/res/drawable-xhdpi/ic_add_circle_outline_white.png new file mode 100644 index 000000000..573aefe2b Binary files /dev/null and b/F-Droid/res/drawable-xhdpi/ic_add_circle_outline_white.png differ diff --git a/F-Droid/res/drawable-xhdpi/ic_check_circle_white.png b/F-Droid/res/drawable-xhdpi/ic_check_circle_white.png new file mode 100644 index 000000000..816c59095 Binary files /dev/null and b/F-Droid/res/drawable-xhdpi/ic_check_circle_white.png differ diff --git a/F-Droid/res/drawable-xxhdpi/ic_add_circle_outline_white.png b/F-Droid/res/drawable-xxhdpi/ic_add_circle_outline_white.png new file mode 100644 index 000000000..2a83748df Binary files /dev/null and b/F-Droid/res/drawable-xxhdpi/ic_add_circle_outline_white.png differ diff --git a/F-Droid/res/drawable-xxhdpi/ic_check_circle_white.png b/F-Droid/res/drawable-xxhdpi/ic_check_circle_white.png new file mode 100644 index 000000000..d8f900f3c Binary files /dev/null and b/F-Droid/res/drawable-xxhdpi/ic_check_circle_white.png differ diff --git a/F-Droid/res/drawable-xxxhdpi/ic_add_circle_outline_white.png b/F-Droid/res/drawable-xxxhdpi/ic_add_circle_outline_white.png new file mode 100644 index 000000000..cebba168e Binary files /dev/null and b/F-Droid/res/drawable-xxxhdpi/ic_add_circle_outline_white.png differ diff --git a/F-Droid/res/drawable-xxxhdpi/ic_check_circle_white.png b/F-Droid/res/drawable-xxxhdpi/ic_check_circle_white.png new file mode 100644 index 000000000..5078aa2d6 Binary files /dev/null and b/F-Droid/res/drawable-xxxhdpi/ic_check_circle_white.png differ diff --git a/F-Droid/res/drawable/ic_add_circle_outline_white.png b/F-Droid/res/drawable/ic_add_circle_outline_white.png new file mode 100644 index 000000000..ac9427430 Binary files /dev/null and b/F-Droid/res/drawable/ic_add_circle_outline_white.png differ diff --git a/F-Droid/res/drawable/ic_check_circle_white.png b/F-Droid/res/drawable/ic_check_circle_white.png new file mode 100644 index 000000000..4c233ae9f Binary files /dev/null and b/F-Droid/res/drawable/ic_check_circle_white.png differ diff --git a/F-Droid/res/layout-v11/select_local_apps_list_item.xml b/F-Droid/res/layout-v11/select_local_apps_list_item.xml index bacc76baa..716e0fa25 100644 --- a/F-Droid/res/layout-v11/select_local_apps_list_item.xml +++ b/F-Droid/res/layout-v11/select_local_apps_list_item.xml @@ -12,11 +12,10 @@ limitations under the License. --> - @@ -28,30 +27,50 @@ android:layout_marginLeft="?attr/listPreferredItemPaddingLeft" android:layout_marginStart="?android:attr/listPreferredItemPaddingStart" android:layout_marginTop="6dip" + android:layout_alignParentStart="true" + android:layout_alignParentLeft="true" + tools:src="@drawable/ic_launcher" tools:ignore="ContentDescription" /> + + + android:textAppearance="?android:attr/textAppearanceMedium" + tools:text="F-Droid" /> + android:textAppearance="?android:attr/textAppearanceSmall" + tools:text="Application Manager" /> - + diff --git a/F-Droid/res/layout-v17/select_local_apps_list_item.xml b/F-Droid/res/layout-v17/select_local_apps_list_item.xml index 5ac585492..b0ebeac96 100644 --- a/F-Droid/res/layout-v17/select_local_apps_list_item.xml +++ b/F-Droid/res/layout-v17/select_local_apps_list_item.xml @@ -12,46 +12,57 @@ limitations under the License. --> - + android:paddingTop="2dip"> + + + android:textAppearance="?android:attr/textAppearanceMedium" + tools:text="F-Droid" /> + android:textAppearance="?android:attr/textAppearanceSmall" + tools:text="Application Manager" /> - + diff --git a/F-Droid/res/layout/select_local_apps_list_item.xml b/F-Droid/res/layout/select_local_apps_list_item.xml index 29b0598e8..653cf4d91 100644 --- a/F-Droid/res/layout/select_local_apps_list_item.xml +++ b/F-Droid/res/layout/select_local_apps_list_item.xml @@ -12,19 +12,15 @@ limitations under the License. --> - - - + + + android:textAppearance="?android:attr/textAppearanceMedium" + tools:text="F-Droid" /> + android:textAppearance="?android:attr/textAppearanceSmall" + tools:text="Application Manager" /> - + \ No newline at end of file diff --git a/F-Droid/src/org/fdroid/fdroid/views/swap/SelectAppsView.java b/F-Droid/src/org/fdroid/fdroid/views/swap/SelectAppsView.java index dfbf5091e..49c8defb3 100644 --- a/F-Droid/src/org/fdroid/fdroid/views/swap/SelectAppsView.java +++ b/F-Droid/src/org/fdroid/fdroid/views/swap/SelectAppsView.java @@ -4,6 +4,7 @@ import android.annotation.TargetApi; import android.content.Context; import android.content.pm.PackageManager; import android.database.Cursor; +import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; @@ -149,9 +150,12 @@ public class SelectAppsView extends ListView implements String packageName = c.getString(c.getColumnIndex(InstalledAppProvider.DataColumns.APP_ID)); if (getState().hasSelectedPackage(packageName)) { getState().deselectPackage(packageName); + adapter.updateCheckedIndicatorView(position, false); } else { getState().selectPackage(packageName); + adapter.updateCheckedIndicatorView(position, true); } + } @Override @@ -275,6 +279,8 @@ public class SelectAppsView extends ListView implements labelView.setText(appLabel); iconView.setImageDrawable(icon); + final int listPosition = cursor.getPosition() + 1; // To account for the header view. + // Since v11, the Android SDK provided the ability to show selected list items // by highlighting their background. Prior to this, we need to handle this ourselves // by adding a checkbox which can toggle selected items. @@ -283,8 +289,6 @@ public class SelectAppsView extends ListView implements CheckBox checkBox = (CheckBox)checkBoxView; checkBox.setOnCheckedChangeListener(null); - final int listPosition = cursor.getPosition() + 1; // To account for the header view. - checkBox.setChecked(listView.isItemChecked(listPosition)); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @@ -294,6 +298,35 @@ public class SelectAppsView extends ListView implements } }); } + + updateCheckedIndicatorView(view, listView.isItemChecked(listPosition)); + } + + public void updateCheckedIndicatorView(int position, boolean checked) { + final int firstListItemPosition = listView.getFirstVisiblePosition(); + final int lastListItemPosition = firstListItemPosition + listView.getChildCount() - 1; + + if (position >= firstListItemPosition && position <= lastListItemPosition ) { + final int childIndex = position - firstListItemPosition; + updateCheckedIndicatorView(listView.getChildAt(childIndex), checked); + } + } + + private void updateCheckedIndicatorView(View view, boolean checked) { + ImageView imageView = (ImageView)view.findViewById(R.id.checked); + if (imageView != null) { + int resource; + int colour; + if (checked) { + resource = R.drawable.ic_check_circle_white; + colour = getResources().getColor(R.color.fdroid_blue); + } else { + resource = R.drawable.ic_add_circle_outline_white; + colour = 0xFFD0D0D4; + } + imageView.setImageDrawable(getResources().getDrawable(resource)); + imageView.setColorFilter(colour, PorterDuff.Mode.MULTIPLY); + } } } diff --git a/F-Droid/tools/download-material-icon.sh b/F-Droid/tools/download-material-icon.sh index fc5ce8639..6bd8e128b 100755 --- a/F-Droid/tools/download-material-icon.sh +++ b/F-Droid/tools/download-material-icon.sh @@ -48,7 +48,7 @@ function download { RES_DIR=$1 CATEGORY=$2 -ICON="${3}_white" +ICON="${3}_black" BASE_URL="https://raw.githubusercontent.com/google/material-design-icons/master" SCREENS="mdpi hdpi xhdpi xxhdpi xxxhdpi"