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

Commit 2bb7d42b authored by Wysie's avatar Wysie
Browse files

Added code to allow changing of some colors, such as clock and date.

parent 8e5348b4
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -1355,6 +1355,27 @@ public final class Settings {
         */
        public static final String RECENT_APPS_NUMBER = "recent_apps_number";
        
        /**
         * Wysie_Soh
         * Specifies the clock color
         * @hide
         */
        public static final String CLOCK_COLOR = "clock_color";
        
        /**
         * Wysie_Soh
         * Specifies the date color
         * @hide
         */
        public static final String DATE_COLOR = "date_color";
        public static final String NEW_NOTIF_TICKER_COLOR = "new_notifications_ticker_color";
        public static final String NO_NOTIF_COLOR = "no_notifications_color";
        public static final String LATEST_NOTIF_COLOR = "latest_notifications_color";
        public static final String ONGOING_NOTIF_COLOR = "ongoing_notifications_color";
        public static final String SPN_LABEL_COLOR = "spnlabel_color";
        public static final String PLMN_LABEL_COLOR = "plmnLabel_color";
        public static final String CLEAR_BUTTON_LABEL_COLOR = "clearbutton_color";
        
        /**
         * Whether the audible DTMF tones are played by the dialer when dialing. The value is
         * boolean (1 or 0).
@@ -1476,6 +1497,8 @@ public final class Settings {
         */
        public static final String BATTERY_PERCENTAGE_STATUS_ICON = "battery_percentage_status_icon";
        
        public static final String BATTERY_PERCENTAGE_STATUS_COLOR = "battery_status_color_title";
        
        /**
         * Settings to backup. This is here so that it's in the same place as the settings
         * keys and easy to update.
+12 −1
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
@@ -30,6 +31,8 @@ class StatusBarIcon {
    private TextView mTextView;
    private AnimatedImageView mImageView;
    private TextView mNumberView;
    private int clockColor = 0xff000000;
    private int currClockColor;

    public StatusBarIcon(Context context, IconData data, ViewGroup parent) {
        mData = data.clone();
@@ -43,7 +46,7 @@ class StatusBarIcon {
                        LinearLayout.LayoutParams.WRAP_CONTENT,
                        LinearLayout.LayoutParams.FILL_PARENT);
                t.setTextSize(16);
                t.setTextColor(0xff000000);
                updateColors(context);
                t.setTypeface(Typeface.DEFAULT_BOLD);
                t.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
                t.setPadding(6, 0, 0, 0);
@@ -204,5 +207,13 @@ class StatusBarIcon {
    int getNumber() {
        return mData.number;
    }
    
    private void updateColors(Context context) {
        clockColor = Settings.System.getInt(context.getContentResolver(), Settings.System.CLOCK_COLOR, clockColor);
        if (currClockColor != clockColor) {
            mTextView.setTextColor(clockColor);
            currClockColor = clockColor;
        }
    }
}
+24 −9
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.os.Binder;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.provider.Settings;
import android.provider.Telephony;
import android.util.Log;
import android.view.Display;
@@ -179,21 +180,21 @@ public class StatusBarService extends IStatusBar.Stub
    WindowManager.LayoutParams mExpandedParams;
    ScrollView mScrollView;
    View mNotificationLinearLayout;
    TextView mOngoingTitle;
    TextView mOngoingTitle; //Done
    LinearLayout mOngoingItems;
    TextView mLatestTitle;
    TextView mLatestTitle; //Done
    LinearLayout mLatestItems;
    TextView mNoNotificationsTitle;
    TextView mSpnLabel;
    TextView mPlmnLabel;
    TextView mClearButton;
    TextView mNoNotificationsTitle; //Done
    TextView mSpnLabel; //Done
    TextView mPlmnLabel; //Done
    TextView mClearButton; //Done
    CloseDragHandle mCloseView;
    int[] mCloseLocation = new int[2];
    boolean mExpanded;
    boolean mExpandedVisible;

    // the date view
    DateView mDateView;
    DateView mDateView; //Done

    // the tracker view
    TrackingView mTrackingView;
@@ -204,6 +205,7 @@ public class StatusBarService extends IStatusBar.Stub
    private Ticker mTicker;
    private View mTickerView;
    private boolean mTicking;
    private TickerView tickerView;
    
    // Tracking finger for opening/closing.
    boolean mTracking;
@@ -221,6 +223,7 @@ public class StatusBarService extends IStatusBar.Stub
    boolean mAnimatingReveal = false;
    int mViewDelta;
    int[] mAbsPos = new int[2];
    private int blackColor = 0xff000000;
    
    // for disabling the status bar
    ArrayList<DisableRecord> mDisableRecords = new ArrayList<DisableRecord>();
@@ -234,6 +237,7 @@ public class StatusBarService extends IStatusBar.Stub
        mDisplay = ((WindowManager)context.getSystemService(
                Context.WINDOW_SERVICE)).getDefaultDisplay();
        makeStatusBarView(context);
        updateColors();
        mUninstallReceiver = new UninstallReceiver();
    }

@@ -270,7 +274,6 @@ public class StatusBarService extends IStatusBar.Stub
        mIcons = (LinearLayout)sb.findViewById(R.id.icons);
        mTickerView = sb.findViewById(R.id.ticker);
        mDateView = (DateView)sb.findViewById(R.id.date);

        mExpandedDialog = new ExpandedDialog(context);
        mExpandedView = expanded;
        mOngoingTitle = (TextView)expanded.findViewById(R.id.ongoingTitle);
@@ -290,7 +293,7 @@ public class StatusBarService extends IStatusBar.Stub
        
        mTicker = new MyTicker(context, sb);

        TickerView tickerView = (TickerView)sb.findViewById(R.id.tickerText);
        tickerView = (TickerView)sb.findViewById(R.id.tickerText);
        tickerView.mTicker = mTicker;

        mTrackingView = (TrackingView)View.inflate(context,
@@ -960,6 +963,7 @@ public class StatusBarService extends IStatusBar.Stub
        mExpandedDialog.getWindow().setAttributes(mExpandedParams);
        mExpandedView.requestFocus(View.FOCUS_FORWARD);
        mTrackingView.setVisibility(View.VISIBLE);
        //updateColors();
        
        if (!mTicking) {
            setDateViewVisibility(true, com.android.internal.R.anim.fade_in);
@@ -1701,6 +1705,17 @@ public class StatusBarService extends IStatusBar.Stub
        }
    }
    
    private void updateColors() {
        mDateView.setTextColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.DATE_COLOR, blackColor));
        mNoNotificationsTitle.setTextColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.NO_NOTIF_COLOR, blackColor));
        mLatestTitle.setTextColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.LATEST_NOTIF_COLOR, blackColor));
        mOngoingTitle.setTextColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.ONGOING_NOTIF_COLOR, blackColor));
        mSpnLabel.setTextColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.SPN_LABEL_COLOR, blackColor));
        mPlmnLabel.setTextColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.PLMN_LABEL_COLOR, blackColor));
        mClearButton.setTextColor(Settings.System.getInt(mContext.getContentResolver(), Settings.System.CLEAR_BUTTON_LABEL_COLOR, blackColor));
        tickerView.updateColors(Settings.System.getInt(mContext.getContentResolver(), Settings.System.NEW_NOTIF_TICKER_COLOR, blackColor));
    }

    private View.OnClickListener mClearButtonListener = new View.OnClickListener() {
        public void onClick(View v) {
            mNotificationCallbacks.onClearAll();
+21 −0
Original line number Diff line number Diff line
@@ -4,11 +4,13 @@ package com.android.server.status;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextSwitcher;
import android.widget.TextView;


public class TickerView extends TextSwitcher
{
    Ticker mTicker;
    private int textColor = 0xFF000000;

    public TickerView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -19,5 +21,24 @@ public class TickerView extends TextSwitcher
        super.onSizeChanged(w, h, oldw, oldh);
        mTicker.reflowText();
    }
    
    @Override
    public void setText(CharSequence text) {
        final TextView t = (TextView) getNextView();
        t.setTextColor(textColor);
        t.setText(text);
        showNext();
    }

    @Override
    public void setCurrentText(CharSequence text) {
        final TextView t = (TextView) getCurrentView();
        t.setTextColor(textColor);
        t.setText(text);
    }
    
    public void updateColors(int color) {
        textColor = color;
    }
}