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

Commit 8b01df5d authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Notification slider changes." into nyc-dev

parents 89726fd9 088fb52e
Loading
Loading
Loading
Loading
+59 −42
Original line number Diff line number Diff line
@@ -21,41 +21,58 @@
              android:gravity="center_vertical"
              android:paddingStart="?android:attr/listPreferredItemPaddingStart"
              android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
              android:paddingTop="8dp"
              android:paddingBottom="8dp"
              android:orientation="vertical"
              android:clickable="false"
              android:focusable="false" >

    <TextView
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:textAppearance="@android:style/TextAppearance.Material.Subhead"
            android:textColor="?android:attr/textColorPrimary"
            android:ellipsize="marquee"
            android:fadingEdge="horizontal" />

    <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

        <ImageView
                    android:id="@+id/low_importance"
                    android:src="@*android:drawable/ic_notification_block"
                android:id="@+id/auto_importance"
                android:src="@drawable/notification_auto_importance"
                android:layout_gravity="center_vertical|start"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:tint="@color/importance_icon_tint" />
                android:layout_width="48dp"
                android:layout_height="48dp" />

        <SeekBar
                android:id="@*android:id/seekbar"
                android:layout_marginStart="56dp"
                    android:layout_marginEnd="56dp"
                android:layout_marginEnd="32dp"
                android:layout_gravity="center_vertical"
                android:layout_width="match_parent"
                android:layout_height="48dp"
                android:focusable="true"
                android:background="#00ffffff"
                android:progressBackgroundTint="@color/importance_secondary_slider_color"
                android:thumbTint="@color/importance_disabled_slider_color"
                android:progressTint="@color/importance_disabled_slider_color"
                style="@android:style/Widget.Material.SeekBar.Discrete"
                android:tickMarkTint="@android:color/black" />

            <ImageView
                    android:id="@+id/max_importance"
                    android:src="@*android:drawable/ic_notification_alert"
                    android:layout_gravity="center_vertical|end"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:tint="@color/importance_icon_tint" />

    </FrameLayout>

    <TextView
            android:id="@android:id/summary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignStart="@android:id/title"
            android:textAlignment="viewStart"
            android:textAppearance="@android:style/TextAppearance.Material.Body1"
            android:textColor="?android:attr/textColorSecondary"
            android:maxLines="10"
            android:minLines="3" />
</LinearLayout>
+4 −0
Original line number Diff line number Diff line
@@ -125,6 +125,10 @@

    <color name="seek_bar_preference_preview_text">#fff</color>

    <color name="importance_slider_color">@*android:color/material_deep_teal_500</color>
    <color name="importance_disabled_slider_color">@*android:color/material_grey_300</color>
    <color name="importance_secondary_slider_color">#858383</color>

    <color name="usage_graph_dots">#B0BEC5</color>

</resources>
+11 −6
Original line number Diff line number Diff line
@@ -5979,22 +5979,25 @@
    <string name="notification_importance_none">Not set</string>
    <!-- [CHAR LIMIT=100] Notification Importance slider: blocked importance level description -->
    <string name="notification_importance_blocked">Blocked: Never show these notifications</string>
    <string name="notification_importance_blocked">Never show notifications from this app</string>
    <!-- [CHAR LIMIT=100] Notification Importance slider: min importance level description -->
    <string name="notification_importance_min">Min: Silently show at the bottom of the notification list</string>
    <string name="notification_importance_min">No full screen interruption, peeking, sound, or vibration. Show at the bottom of the notification list. Hide from lock screen and status bar.</string>
    <!-- [CHAR LIMIT=100] Notification Importance slider: low importance level description -->
    <string name="notification_importance_low">Low: Silently show these notifications</string>
    <string name="notification_importance_low">No full screen interruption, peeking, sound, or vibration.</string>
    <!-- [CHAR LIMIT=100] Notification Importance slider: normal importance level description -->
    <string name="notification_importance_default">Normal: Allow these notification to make sounds</string>
    <string name="notification_importance_default">No full screen interruption or peeking.</string>
    <!-- [CHAR LIMIT=100] Notification Importance slider: high importance level description -->
    <string name="notification_importance_high">High: Peek onto the screen and allow sound</string>
    <string name="notification_importance_high">Always peek. No full screen interruption.</string>
    <!-- [CHAR LIMIT=100] Notification Importance slider: max importance level description -->
    <string name="notification_importance_max">Urgent: Show at the top of the notifications list, peek onto the screen and allow sound</string>
    <string name="notification_importance_max">Always peek, and allow full screen interruption. Show at the top of the notification list.</string>
    <!-- [CHAR LIMIT=100] Notification Importance slider: max importance level description -->
    <string name="notification_importance_unspecified">App determines importance for each notification</string>
    <!-- [CHAR LIMIT=60] Notification importance reset button -->
    <string name="importance_reset">Reset</string>
@@ -6486,6 +6489,8 @@
    <string name="notifications_priority">Do Not Disturb overridden</string>
    <!-- App notification summary divider [CHAR LIMIT=40] -->
    <string name="notifications_summary_divider">\u00A0/\u00A0</string>
    <!-- App notification summary for advanced controls -->
    <string name="notification_summary_level">Level %d</string>
   <!-- Permissions preference summary [CHAR LIMIT=40] -->
   <plurals name="permissions_summary">
+4 −12
Original line number Diff line number Diff line
@@ -32,30 +32,22 @@
            android:summary="@string/show_silently_summary"
            android:order="3" />
    <!-- Slider -->
    <com.android.settingslib.RestrictedPreference
            android:key="importance_title"
            android:title="@string/notification_importance_title"
            android:order="4"/>
    <com.android.settings.notification.ImportanceSeekBarPreference
            android:key="importance"
            android:order="5"/>

    <com.android.settings.applications.LayoutPreference
            android:key="importance_reset_button"
            android:layout="@layout/two_buttons_panel"
            android:order="6" />
            android:title="@string/notification_importance_title"
            android:order="4"/>

    <!-- Visibility Override -->
    <DropDownPreference
            android:key="visibility_override"
            android:title="@string/app_notification_visibility_override_title"
            android:order="7" />
            android:order="5" />

    <!-- Bypass DND -->
    <com.android.settingslib.RestrictedSwitchPreference
            android:key="bypass_dnd"
            android:title="@string/app_notification_override_dnd_title"
            android:summary="@string/app_notification_override_dnd_summary"
            android:order="8" />
            android:order="6" />

</PreferenceScreen>
+18 −5
Original line number Diff line number Diff line
@@ -51,7 +51,9 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.service.notification.NotificationListenerService;
import android.service.notification.NotificationListenerService.Ranking;
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.support.v7.preference.PreferenceCategory;
@@ -144,6 +146,8 @@ public class InstalledAppDetails extends AppInfoBase
    private static final String KEY_BATTERY = "battery";
    private static final String KEY_MEMORY = "memory";

    private static final String NOTIFICATION_TUNER_SETTING = "show_importance_slider";

    private final HashSet<String> mHomePackages = new HashSet<String>();

    private boolean mInitialized;
@@ -1016,14 +1020,23 @@ public class InstalledAppDetails extends AppInfoBase
    }

    public static CharSequence getNotificationSummary(AppRow appRow, Context context) {
        boolean showSlider = Settings.Secure.getInt(
                context.getContentResolver(), NOTIFICATION_TUNER_SETTING, 0) == 1;
        List<String> summaryAttributes = new ArrayList<>();
        StringBuffer summary = new StringBuffer();
        if (showSlider) {
            if (appRow.appImportance != Ranking.IMPORTANCE_UNSPECIFIED) {
                summaryAttributes.add(context.getString(
                        R.string.notification_summary_level, appRow.appImportance));
            }
        } else {
            if (appRow.banned) {
                summaryAttributes.add(context.getString(R.string.notifications_disabled));
        } else if (appRow.appImportance > NotificationListenerService.Ranking.IMPORTANCE_NONE
                && appRow.appImportance < NotificationListenerService.Ranking.IMPORTANCE_DEFAULT) {
            } else if (appRow.appImportance > Ranking.IMPORTANCE_NONE
                    && appRow.appImportance < Ranking.IMPORTANCE_DEFAULT) {
                summaryAttributes.add(context.getString(R.string.notifications_silenced));
            }
        }
        final boolean lockscreenSecure = new LockPatternUtils(context).isSecure(
                UserHandle.myUserId());
        if (lockscreenSecure) {
Loading