diff --git a/res/values/colors.xml b/res/values/colors.xml index 7fbec22b811c07a3676b80bffcb0d6a54ad9be03..0ae5a0e2472e1e4a7ba00f769df708ec9cb037a3 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -26,9 +26,9 @@ #ff254FAE @color/tool_bar_color - + @*android:color/accent_device_default - @*android:color/accent_device_default + @*android:color/accent_device_default_dark @*android:color/white diff --git a/src/com/android/documentsui/BaseActivity.java b/src/com/android/documentsui/BaseActivity.java index cb745078982fbac27d8fbaef533cc84a7fcb017f..13e25123389de20dbda14ea1a5468c99ff79fb0e 100644 --- a/src/com/android/documentsui/BaseActivity.java +++ b/src/com/android/documentsui/BaseActivity.java @@ -39,6 +39,7 @@ import android.support.annotation.LayoutRes; import android.support.annotation.VisibleForTesting; import android.util.Log; import android.util.TypedValue; +import android.view.ContextThemeWrapper; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; @@ -692,12 +693,13 @@ public abstract class BaseActivity * */ private int fetchAccentColor() { - TypedValue typedValue = new TypedValue(); - TypedArray a = this.obtainStyledAttributes(typedValue.data, new int[] { R.attr.colorAccent }); + int color=getResources().getColor(R.color.accent); + /* TypedValue typedValue = new TypedValue(); + TypedArray a = activity.obtainStyledAttributes(typedValue.data, new int[] { R.attr.colorAccent }); int color = a.getColor(0, 0); - a.recycle(); + a.recycle();*/ Log.e("TAG", "accent Colour #"+Integer.toHexString(color)); - //toolbar change color to accent color + //toolbar change color to accent color toolbar.setBackgroundColor(color); //change status bar color diff --git a/src/com/android/documentsui/DrawerController.java b/src/com/android/documentsui/DrawerController.java index f5dcf8ea2a8abe52d957d905e768d988c4b16000..51dbda611423724c901063a1abffba96a321341d 100644 --- a/src/com/android/documentsui/DrawerController.java +++ b/src/com/android/documentsui/DrawerController.java @@ -274,13 +274,12 @@ public abstract class DrawerController implements DrawerListener { * */ private static int fetchAccentColor(Activity activity) { - TypedValue typedValue = new TypedValue(); - - ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(activity, android.R.style.Theme_DeviceDefault_Light); - contextThemeWrapper.getTheme().resolveAttribute(android.R.attr.colorAccent, - typedValue, true); - int color = typedValue.data; + int color=activity.getResources().getColor(R.color.accent); + /* TypedValue typedValue = new TypedValue(); + TypedArray a = activity.obtainStyledAttributes(typedValue.data, new int[] { R.attr.colorAccent }); + int color = a.getColor(0, 0); + a.recycle();*/ Log.e("TAG", "accent Colour #"+Integer.toHexString(color)); //toolbar change color to accent color return color; diff --git a/src/com/android/documentsui/files/LauncherActivity.java b/src/com/android/documentsui/files/LauncherActivity.java index ef086eb74f67ece3e45ec3755715aadfffdc4acf..59d5c8e855f88b0ab0e02ba25157a8acf1656e6f 100644 --- a/src/com/android/documentsui/files/LauncherActivity.java +++ b/src/com/android/documentsui/files/LauncherActivity.java @@ -31,6 +31,7 @@ import android.provider.DocumentsContract; import android.support.annotation.Nullable; import android.util.Log; import android.util.TypedValue; +import android.view.ContextThemeWrapper; import com.android.documentsui.R; @@ -180,13 +181,13 @@ public class LauncherActivity extends Activity { * */ private int fetchAccentColor() { - TypedValue typedValue = new TypedValue(); - TypedArray a = this.obtainStyledAttributes(typedValue.data, new int[] { R.attr.colorAccent }); + int color=getResources().getColor(R.color.accent); + /* TypedValue typedValue = new TypedValue(); + TypedArray a = activity.obtainStyledAttributes(typedValue.data, new int[] { R.attr.colorAccent }); int color = a.getColor(0, 0); - a.recycle(); + a.recycle();*/ Log.e("TAG", "accent Colour #"+Integer.toHexString(color)); //toolbar change color to accent color - return color; }