[Android] Lazyload UI tools resources

Geoffrey Métais git at videolan.org
Fri Nov 24 11:12:38 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Nov 24 11:08:12 2017 +0100| [1ea714647c070aa8da0e63088ae6b613d9ff7a4f] | committer: Geoffrey Métais

Lazyload UI tools resources

> https://code.videolan.org/videolan/vlc-android/commit/1ea714647c070aa8da0e63088ae6b613d9ff7a4f
---

 .../src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java   |  2 +-
 .../src/org/videolan/vlc/gui/helpers/SelectorViewHolder.java |  2 +-
 vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java    | 12 ++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
index 92c5ede6f..176464c21 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -468,7 +468,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
     public void onFocusChange(View v, boolean hasFocus) {
         if (v instanceof TextView)
             ((TextView) v).setTextColor(v.hasFocus() ?
-                    UiTools.ITEM_FOCUS_ON : mTextColor);
+                    UiTools.Resources.ITEM_FOCUS_ON : mTextColor);
         mToast.setText(mAdapter.getSelectedAdvOptionHelp());
         mToast.show();
     }
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/SelectorViewHolder.java b/vlc-android/src/org/videolan/vlc/gui/helpers/SelectorViewHolder.java
index 8c97ba946..9f478e4c3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/SelectorViewHolder.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/SelectorViewHolder.java
@@ -43,7 +43,7 @@ public class SelectorViewHolder<T extends ViewDataBinding> extends RecyclerView.
     }
 
     private void setViewBackground(boolean focus, boolean selected) {
-        final int color = focus ? UiTools.ITEM_FOCUS_ON : selected ? UiTools.ITEM_SELECTION_ON : UiTools.ITEM_FOCUS_OFF;
+        final int color = focus ? UiTools.Resources.ITEM_FOCUS_ON : selected ? UiTools.Resources.ITEM_SELECTION_ON : UiTools.Resources.ITEM_FOCUS_OFF;
         binding.setVariable(BR.bgColor, color);
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
index 46a3e52d1..db89dafc3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
@@ -52,8 +52,6 @@ import android.support.v7.app.AlertDialog;
 import android.support.v7.app.AppCompatActivity;
 import android.text.Html;
 import android.text.TextUtils;
-import android.util.DisplayMetrics;
-import android.util.TypedValue;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
@@ -82,11 +80,13 @@ import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
 public class UiTools {
+    private static final String TAG = "VLC/UiTools";
 
-    public static final int ITEM_FOCUS_ON = ContextCompat.getColor(VLCApplication.getAppContext(), R.color.orange500transparent);
-    public static final int ITEM_FOCUS_OFF = ContextCompat.getColor(VLCApplication.getAppContext(), R.color.transparent);
-    public static final int ITEM_SELECTION_ON = ContextCompat.getColor(VLCApplication.getAppContext(), R.color.orange200transparent);
-    public static final int ITEM_BG_TRANSPARENT = ContextCompat.getColor(VLCApplication.getAppContext(), R.color.transparent);
+    public static class Resources {
+        public static final int ITEM_FOCUS_OFF = ContextCompat.getColor(VLCApplication.getAppContext(), R.color.transparent);
+        public static final int ITEM_FOCUS_ON = ContextCompat.getColor(VLCApplication.getAppContext(), R.color.orange500transparent);
+        public static final int ITEM_SELECTION_ON = ContextCompat.getColor(VLCApplication.getAppContext(), R.color.orange200transparent);
+    }
 
     private static final AtomicInteger sNextGeneratedId = new AtomicInteger(1);
 



More information about the Android mailing list