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

Commit a8facd18 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊 Committed by Nishith Khanna
Browse files

SystemUI: QSCustomizer: Fix QS tile reset text color

- https://gitlab.com/LineageOS/issues/android/-/issues/4873

Change-Id: I49a599f10f68c0c576ec863b919936a3b171f2c6
parent 308fc3fb
Loading
Loading
Loading
Loading
+19 −4
Original line number Original line Diff line number Diff line
@@ -20,6 +20,9 @@ import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.graphics.Color;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
@@ -78,8 +81,7 @@ public class QSCustomizer extends LinearLayout {
        mToolbar.setNavigationIcon(
        mToolbar.setNavigationIcon(
                getResources().getDrawable(value.resourceId, mContext.getTheme()));
                getResources().getDrawable(value.resourceId, mContext.getTheme()));


        mToolbar.getMenu().add(Menu.NONE, MENU_RESET, 0, com.android.internal.R.string.reset)
        setMenuItem();
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        mToolbar.setTitle(R.string.qs_edit);
        mToolbar.setTitle(R.string.qs_edit);
        mRecyclerView = findViewById(android.R.id.list);
        mRecyclerView = findViewById(android.R.id.list);
        mTransparentView = findViewById(R.id.customizer_transparent_view);
        mTransparentView = findViewById(R.id.customizer_transparent_view);
@@ -304,10 +306,23 @@ public class QSCustomizer extends LinearLayout {
        mTransparentView.setLayoutParams(lp);
        mTransparentView.setLayoutParams(lp);
    }
    }


    private boolean isNightMode() {
        return (mContext.getResources().getConfiguration().uiMode
                & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
    }

    private void setMenuItem() {
        SpannableString resetText = new SpannableString(
                mContext.getString(com.android.internal.R.string.reset));
        resetText.setSpan(new ForegroundColorSpan(isNightMode() ?
                Color.WHITE : Color.BLACK), 0, resetText.length(), 0);
        mToolbar.getMenu().add(Menu.NONE, MENU_RESET, 0, resetText)
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    private void updateToolbarMenuFontSize() {
    private void updateToolbarMenuFontSize() {
        // Clearing and re-adding the toolbar action force updates the font size
        // Clearing and re-adding the toolbar action force updates the font size
        mToolbar.getMenu().clear();
        mToolbar.getMenu().clear();
        mToolbar.getMenu().add(Menu.NONE, MENU_RESET, 0, com.android.internal.R.string.reset)
        setMenuItem();
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }
    }
}
}
 No newline at end of file