File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
app/src/main/java/com/simplemobiletools/flashlight Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 66import android .content .ComponentName ;
77import android .content .Context ;
88import android .content .Intent ;
9+ import android .content .SharedPreferences ;
910import android .content .res .Resources ;
1011import android .graphics .Bitmap ;
1112import android .widget .RemoteViews ;
@@ -44,8 +45,10 @@ private void initVariables(Context context) {
4445 mRemoteViews .setOnClickPendingIntent (R .id .toggle_btn , pendingIntent );
4546 mCameraImpl = new MyCameraImpl (context );
4647
48+ final SharedPreferences prefs = initPrefs (context );
4749 final Resources res = context .getResources ();
48- final int appColor = res .getColor (R .color .colorPrimary );
50+ final int defaultColor = res .getColor (R .color .colorPrimary );
51+ final int appColor = prefs .getInt (Constants .WIDGET_COLOR , defaultColor );
4952 mColoredBmp = Utils .getColoredIcon (context .getResources (), appColor , R .mipmap .flashlight_small );
5053
5154 if (mBus == null ) {
@@ -81,6 +84,10 @@ public void disableFlashlight() {
8184 }
8285 }
8386
87+ private SharedPreferences initPrefs (Context context ) {
88+ return context .getSharedPreferences (Constants .PREFS_KEY , Context .MODE_PRIVATE );
89+ }
90+
8491 @ Subscribe
8592 public void cameraUnavailable (Events .CameraUnavailable event ) {
8693 if (mContext != null ) {
You can’t perform that action at this time.
0 commit comments