Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02110590 authored by narinder Rana's avatar narinder Rana
Browse files

update color from UI-SDK, test for drawer

parent 3db28992
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -47,9 +47,14 @@
    <color name="item_title">#ff333333</color>


    <color name="color_default_blue1">#007FFF</color>
    <color name="color_default_primary_text">#000000</color>
    <color name="color_default_foreground">#FFFFFF</color>

    <color name="accent">@color/color_default_blue1</color>

    <color name="color_default_blue1">@lineageos.platform:color/color_default_blue1</color>
    <!--white-->
    <color name="color_default_foreground">@lineageos.platform:color/color_default_foreground</color>
    <!--black 80%-->
    <color name="color_default_primary_text">@lineageos.platform:color/color_default_primary_text</color>


</resources>
+14 −9
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ public abstract class DrawerController implements DrawerListener {
     * Returns a controller suitable for {@code Layout}.
     */
    public static DrawerController create(Activity activity, ActivityConfig activityConfig) {
        accentColor=fetchAccentColor(activity);
      //  accentColor=fetchAccentColor(activity);
        DrawerLayout layout = (DrawerLayout) activity.findViewById(R.id.drawer_layout);

        if (layout == null) {
@@ -62,10 +62,10 @@ public abstract class DrawerController implements DrawerListener {
        View drawer = activity.findViewById(R.id.drawer_roots);
        Toolbar toolbar = (Toolbar) activity.findViewById(R.id.roots_toolbar);

        if(accentColor!=0){
       /* if(accentColor!=0){
            toolbar.setBackgroundColor(accentColor);
        }

*/
        drawer.getLayoutParams().width = calculateDrawerWidth(activity);

        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
@@ -75,6 +75,9 @@ public abstract class DrawerController implements DrawerListener {
                R.string.drawer_open,
                R.string.drawer_close);


        accentColor=fetchAccentColor(activity, toolbar, toggle);

        return new RuntimeDrawerController(layout, drawer, toggle, toolbar, activityConfig);
    }

@@ -141,11 +144,11 @@ public abstract class DrawerController implements DrawerListener {

            if(accentColor!=0){
                @ColorRes int id = highlight ? accentColor : android.R.color.transparent;
                v.setBackgroundColor(id);
               // v.setBackgroundColor(id);
            }
            else {
                @ColorRes int id = highlight ? R.color.item_doc_background_selected : android.R.color.transparent;
                v.setBackgroundColor(id);
               // v.setBackgroundColor(id);
            }

        }
@@ -259,13 +262,15 @@ public abstract class DrawerController implements DrawerListener {
        public void onDrawerStateChanged(int newState) {}
    }

    /*
     * get Accent color from OS
     * */

    private static int fetchAccentColor(Activity activity) {

    private static int fetchAccentColor(Activity activity, Toolbar toolbar, ActionBarDrawerToggle toggle) {

        int color=activity.getResources().getColor(R.color.accent);

        toolbar.setBackgroundColor(color);
        toolbar.setTitleTextColor(activity.getResources().getColor(R.color.color_default_foreground));

        return color;
    }