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

Commit bc63ed80 authored by Shashidhar Vithalrao Kulkarni's avatar Shashidhar Vithalrao Kulkarni Committed by Gerrit - the friendly Code Review server
Browse files

SystemUI: Fix for display datatype icon while in roaming

Display both roaming and data type icons in status bar
when mobile is in roaming
* Enhanced status bar style Extended to show
both romaing and data type icons for all RATs
* Increase padding between RAT and network type
  icon view when mobile is in roaming and
  show_roaming_and_network_icon flag set to true
* Fix for display R icon on wifi tile view when mobile
is in roaming

Change-Id: I583e6163f5c841e74593d94cbcd67855eb11bd14
CRs-Fixed: 1023026
parent ecf7fd34
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -476,7 +476,7 @@


    <!-- Extra padding between the mobile data type icon and the strength indicator when the data
    <!-- Extra padding between the mobile data type icon and the strength indicator when the data
         type icon is wide for the tile in quick settings. -->
         type icon is wide for the tile in quick settings. -->
    <dimen name="wide_type_icon_start_padding_qs">3dp</dimen>
    <dimen name="wide_type_icon_start_padding_qs">8dp</dimen>


    <!-- The maximum width of the navigation bar ripples. -->
    <!-- The maximum width of the navigation bar ripples. -->
    <dimen name="key_button_ripple_max_width">95dp</dimen>
    <dimen name="key_button_ripple_max_width">95dp</dimen>
+11 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.ImageView.ScaleType;
import com.android.systemui.R;
import com.android.systemui.R;
import com.android.systemui.statusbar.policy.MobileSignalController;


import java.util.Objects;
import java.util.Objects;


@@ -35,9 +36,19 @@ public class QSIconView extends ViewGroup {
    protected final int mTilePaddingBelowIconPx;
    protected final int mTilePaddingBelowIconPx;
    private boolean mAnimationEnabled = true;
    private boolean mAnimationEnabled = true;


    private final int STATUS_BAR_STYLE_ANDROID_DEFAULT = 0;
    protected final int STATUS_BAR_STYLE_EXTENDED = 4;

    protected int mStyle = STATUS_BAR_STYLE_ANDROID_DEFAULT;

    public QSIconView(Context context) {
    public QSIconView(Context context) {
        super(context);
        super(context);


        if (MobileSignalController.isCarrierOneSupported()) {
            mStyle = STATUS_BAR_STYLE_EXTENDED;
        } else {
            mStyle = mContext.getResources().getInteger(R.integer.status_bar_style);
        }
        final Resources res = context.getResources();
        final Resources res = context.getResources();
        mIconSizePx = res.getDimensionPixelSize(R.dimen.qs_tile_icon_size);
        mIconSizePx = res.getDimensionPixelSize(R.dimen.qs_tile_icon_size);
        mTilePaddingBelowIconPx =  res.getDimensionPixelSize(R.dimen.qs_tile_padding_below_icon);
        mTilePaddingBelowIconPx =  res.getDimensionPixelSize(R.dimen.qs_tile_padding_below_icon);
+10 −1
Original line number Original line Diff line number Diff line
@@ -653,6 +653,8 @@ public abstract class QSTile<TState extends State> {
        public int overlayIconId;
        public int overlayIconId;
        public boolean filter;
        public boolean filter;
        public boolean isOverlayIconWide;
        public boolean isOverlayIconWide;
        public boolean isShowRoaming;
        public int subId;


        @Override
        @Override
        public boolean copyTo(State other) {
        public boolean copyTo(State other) {
@@ -660,13 +662,18 @@ public abstract class QSTile<TState extends State> {
            final boolean changed = o.connected != connected || o.activityIn != activityIn
            final boolean changed = o.connected != connected || o.activityIn != activityIn
                    || o.activityOut != activityOut
                    || o.activityOut != activityOut
                    || o.overlayIconId != overlayIconId
                    || o.overlayIconId != overlayIconId
                    || o.isOverlayIconWide != isOverlayIconWide;
                    || o.isOverlayIconWide != isOverlayIconWide
                    || o.isShowRoaming != isShowRoaming
                    || o.subId != subId;

            o.connected = connected;
            o.connected = connected;
            o.activityIn = activityIn;
            o.activityIn = activityIn;
            o.activityOut = activityOut;
            o.activityOut = activityOut;
            o.overlayIconId = overlayIconId;
            o.overlayIconId = overlayIconId;
            o.filter = filter;
            o.filter = filter;
            o.isOverlayIconWide = isOverlayIconWide;
            o.isOverlayIconWide = isOverlayIconWide;
            o.isShowRoaming = isShowRoaming;
            o.subId = subId;
            return super.copyTo(other) || changed;
            return super.copyTo(other) || changed;
        }
        }


@@ -679,6 +686,8 @@ public abstract class QSTile<TState extends State> {
            rt.insert(rt.length() - 1, ",overlayIconId=" + overlayIconId);
            rt.insert(rt.length() - 1, ",overlayIconId=" + overlayIconId);
            rt.insert(rt.length() - 1, ",filter=" + filter);
            rt.insert(rt.length() - 1, ",filter=" + filter);
            rt.insert(rt.length() - 1, ",wideOverlayIcon=" + isOverlayIconWide);
            rt.insert(rt.length() - 1, ",wideOverlayIcon=" + isOverlayIconWide);
            rt.insert(rt.length() - 1, ",isShowRoaming=" + isShowRoaming);
            rt.insert(rt.length() - 1, ",subId=" + subId);
            return rt;
            return rt;
        }
        }
    }
    }
+14 −5
Original line number Original line Diff line number Diff line
@@ -66,13 +66,19 @@ public final class SignalTileView extends QSIconView {
        mSignal = new ImageView(mContext);
        mSignal = new ImageView(mContext);
        mIconFrame.addView(mSignal);
        mIconFrame.addView(mSignal);
        mOverlay = new ImageView(mContext);
        mOverlay = new ImageView(mContext);
        if (getContext().getResources().getBoolean(R.bool.show_roaming_and_network_icons)) {
        if (getContext().getResources().getBoolean(R.bool.show_roaming_and_network_icons)
                || mStyle == STATUS_BAR_STYLE_EXTENDED) {
            mRoaming = new ImageView(mContext);
            mRoaming = new ImageView(mContext);
            mRoaming.setImageResource(R.drawable.ic_qs_signal_r);
            mRoaming.setImageResource(R.drawable.ic_qs_signal_r);
            mRoaming.setVisibility(View.GONE);
            mRoaming.setVisibility(View.GONE);
            LinearLayout iconLayout = new LinearLayout(mContext);
            LinearLayout iconLayout = new LinearLayout(mContext);
            if (getContext().getResources().getBoolean(R.bool.show_roaming_and_network_icons)) {
                iconLayout.addView(mRoaming, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
                iconLayout.addView(mRoaming, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
                iconLayout.addView(mOverlay, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
                iconLayout.addView(mOverlay, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            } else {
                iconLayout.addView(mOverlay, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
                iconLayout.addView(mRoaming, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            }
            mIconFrame.addView(iconLayout, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            mIconFrame.addView(iconLayout, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        } else {
        } else {
            mIconFrame.addView(mOverlay, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            mIconFrame.addView(mOverlay, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
@@ -140,10 +146,13 @@ public final class SignalTileView extends QSIconView {
        final boolean shown = isShown();
        final boolean shown = isShown();
        setVisibility(mIn, shown, s.activityIn);
        setVisibility(mIn, shown, s.activityIn);
        setVisibility(mOut, shown, s.activityOut);
        setVisibility(mOut, shown, s.activityOut);
        if (getContext().getResources().getBoolean(R.bool.show_roaming_and_network_icons)) {
        if ((mRoaming != null)
                && getContext().getResources().getBoolean(R.bool.show_roaming_and_network_icons)
                        || mStyle == STATUS_BAR_STYLE_EXTENDED) {
            TelephonyManager tm =
            TelephonyManager tm =
                    (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
                    (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
            mRoaming.setVisibility(tm.isNetworkRoaming()? View.VISIBLE : View.GONE);
            mRoaming.setVisibility(
                    tm.isNetworkRoaming(s.subId) && s.isShowRoaming ? View.VISIBLE : View.GONE);
         }
         }
    }
    }


+5 −0
Original line number Original line Diff line number Diff line
@@ -113,6 +113,9 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
                : R.drawable.ic_qs_signal_no_signal;
                : R.drawable.ic_qs_signal_no_signal;
        state.icon = ResourceIcon.get(iconId);
        state.icon = ResourceIcon.get(iconId);
        state.isOverlayIconWide = cb.isDataTypeIconWide;
        state.isOverlayIconWide = cb.isDataTypeIconWide;
        state.isShowRoaming = (!(cb.noSim || !cb.enabled || cb.airplaneModeEnabled)
                && cb.mobileSignalIconId > 0);
        state.subId = cb.subId;
        state.autoMirrorDrawable = !cb.noSim;
        state.autoMirrorDrawable = !cb.noSim;
        state.overlayIconId = cb.enabled && (cb.dataTypeIconId > 0) ? cb.dataTypeIconId : 0;
        state.overlayIconId = cb.enabled && (cb.dataTypeIconId > 0) ? cb.dataTypeIconId : 0;
        state.filter = iconId != R.drawable.ic_qs_no_sim;
        state.filter = iconId != R.drawable.ic_qs_no_sim;
@@ -183,6 +186,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
        String enabledDesc;
        String enabledDesc;
        boolean noSim;
        boolean noSim;
        boolean isDataTypeIconWide;
        boolean isDataTypeIconWide;
        int subId;
    }
    }


    private final class CellSignalCallback extends SignalCallbackAdapter {
    private final class CellSignalCallback extends SignalCallbackAdapter {
@@ -212,6 +216,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
            mInfo.activityOut = activityOut;
            mInfo.activityOut = activityOut;
            mInfo.enabledDesc = description;
            mInfo.enabledDesc = description;
            mInfo.isDataTypeIconWide = qsType != 0 && isWide;
            mInfo.isDataTypeIconWide = qsType != 0 && isWide;
            mInfo.subId = subId;
            refreshState(mInfo);
            refreshState(mInfo);
        }
        }


Loading