Merge "Show volume row headers by default." into nyc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
459f594bb1
@@ -20,16 +20,14 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/volume_dialog_margin_bottom"
|
android:layout_marginBottom="@dimen/volume_dialog_margin_bottom"
|
||||||
android:background="@drawable/volume_dialog_background"
|
android:background="@drawable/volume_dialog_background"
|
||||||
android:translationZ="4dp"
|
android:translationZ="4dp" >
|
||||||
android:paddingTop="8dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/volume_dialog_content"
|
android:id="@+id/volume_dialog_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="8dp"
|
android:paddingTop="@dimen/volume_dialog_collapsed_padding_top"
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:animateLayoutChanges="true" >
|
android:animateLayoutChanges="true" >
|
||||||
|
|
||||||
<!-- volume rows added and removed here! :-) -->
|
<!-- volume rows added and removed here! :-) -->
|
||||||
@@ -52,6 +50,8 @@
|
|||||||
android:src="@drawable/ic_volume_collapse_animation"
|
android:src="@drawable/ic_volume_collapse_animation"
|
||||||
tools:ignore="RtlHardcoded"
|
tools:ignore="RtlHardcoded"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentTop="true"/>
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_marginTop="@dimen/volume_expander_margin_top"
|
||||||
|
android:layout_marginEnd="@dimen/volume_expander_margin_end"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@@ -13,14 +13,16 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/volume_row_height"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:id="@+id/volume_dialog_row"
|
android:id="@+id/volume_dialog_row"
|
||||||
android:paddingEnd="@dimen/volume_button_size" >
|
android:paddingEnd="@dimen/volume_dialog_padding_end"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="@dimen/volume_row_padding_bottom" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/volume_row_header"
|
android:id="@+id/volume_row_header"
|
||||||
@@ -29,32 +31,28 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textAppearance="@style/TextAppearance.Volume.Header"
|
android:textAppearance="@style/TextAppearance.Volume.Header"
|
||||||
android:paddingBottom="0dp"
|
android:paddingStart="@dimen/volume_row_header_padding_start" />
|
||||||
android:paddingEnd="12dp"
|
|
||||||
android:paddingStart="12dp"
|
|
||||||
android:paddingTop="4dp"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<com.android.keyguard.AlphaOptimizedImageButton
|
<LinearLayout
|
||||||
android:id="@+id/volume_row_icon"
|
android:layout_width="match_parent"
|
||||||
style="@style/VolumeButtons"
|
android:layout_height="@dimen/volume_row_slider_height"
|
||||||
android:layout_width="@dimen/volume_button_size"
|
android:orientation="horizontal"
|
||||||
android:layout_height="@dimen/volume_button_size"
|
android:paddingStart="@dimen/volume_row_padding_start" >
|
||||||
android:layout_below="@id/volume_row_header"
|
<com.android.keyguard.AlphaOptimizedImageButton
|
||||||
android:soundEffectsEnabled="false" />
|
android:id="@+id/volume_row_icon"
|
||||||
|
style="@style/VolumeButtons"
|
||||||
|
android:layout_width="@dimen/volume_button_size"
|
||||||
|
android:layout_height="@dimen/volume_button_size"
|
||||||
|
android:soundEffectsEnabled="false" />
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/volume_row_slider"
|
android:id="@+id/volume_row_slider"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignBottom="@+id/volume_row_icon"
|
android:layout_alignWithParentIfMissing="true"
|
||||||
android:layout_alignWithParentIfMissing="true"
|
android:focusable="true"
|
||||||
android:layout_below="@id/volume_row_header"
|
android:focusableInTouchMode="true"
|
||||||
android:layout_toEndOf="@id/volume_row_icon"
|
android:paddingStart="@dimen/volume_row_slider_padding_start"/>
|
||||||
android:layout_toStartOf="@+id/volume_settings_button"
|
</LinearLayout>
|
||||||
android:focusable="true"
|
|
||||||
android:focusableInTouchMode="true"
|
|
||||||
android:paddingEnd="8dp"
|
|
||||||
android:paddingStart="8dp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</LinearLayout>
|
||||||
@@ -535,6 +535,19 @@
|
|||||||
|
|
||||||
<!-- Volume dialog root view bottom margin, at rest -->
|
<!-- Volume dialog root view bottom margin, at rest -->
|
||||||
<dimen name="volume_dialog_margin_bottom">4dp</dimen>
|
<dimen name="volume_dialog_margin_bottom">4dp</dimen>
|
||||||
|
<dimen name="volume_dialog_collapsed_padding_top">8dp</dimen>
|
||||||
|
<dimen name="volume_dialog_expanded_padding_top">22dp</dimen>
|
||||||
|
<dimen name="volume_dialog_padding_end">40dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="volume_row_padding_bottom">9.4dp</dimen>
|
||||||
|
<dimen name="volume_row_padding_start">4dp</dimen>
|
||||||
|
<dimen name="volume_row_header_padding_start">16dp</dimen>
|
||||||
|
<dimen name="volume_row_height">64dp</dimen>
|
||||||
|
<dimen name="volume_row_slider_height">48dp</dimen>
|
||||||
|
<dimen name="volume_row_slider_padding_start">12dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="volume_expander_margin_end">2dp</dimen>
|
||||||
|
<dimen name="volume_expander_margin_top">6dp</dimen>
|
||||||
|
|
||||||
<!-- Padding between icon and text for managed profile toast -->
|
<!-- Padding between icon and text for managed profile toast -->
|
||||||
<dimen name="managed_profile_toast_padding">4dp</dimen>
|
<dimen name="managed_profile_toast_padding">4dp</dimen>
|
||||||
|
|||||||
@@ -1096,14 +1096,14 @@
|
|||||||
<!-- Toast shown when user unlocks screen and managed profile activity is in the foreground -->
|
<!-- Toast shown when user unlocks screen and managed profile activity is in the foreground -->
|
||||||
<string name="managed_profile_foreground_toast">You\'re using your work profile</string>
|
<string name="managed_profile_foreground_toast">You\'re using your work profile</string>
|
||||||
|
|
||||||
<string-array name="volume_stream_titles" translatable="false">
|
<string-array name="volume_stream_titles">
|
||||||
<item>Voice calls</item> <!-- STREAM_VOICE_CALL -->
|
<item>Call</item> <!-- STREAM_VOICE_CALL -->
|
||||||
<item>System</item> <!-- STREAM_SYSTEM -->
|
<item>System</item> <!-- STREAM_SYSTEM -->
|
||||||
<item>Notifications</item> <!-- STREAM_RING -->
|
<item>Ring</item> <!-- STREAM_RING -->
|
||||||
<item>Media</item> <!-- STREAM_MUSIC -->
|
<item>Media</item> <!-- STREAM_MUSIC -->
|
||||||
<item>Alarms</item> <!-- STREAM_ALARM -->
|
<item>Alarm</item> <!-- STREAM_ALARM -->
|
||||||
<item></item> <!-- STREAM_NOTIFICATION -->
|
<item></item> <!-- STREAM_NOTIFICATION -->
|
||||||
<item>Bluetooth calls</item> <!-- STREAM_BLUETOOTH_SCO -->
|
<item>Bluetooth</item> <!-- STREAM_BLUETOOTH_SCO -->
|
||||||
<item></item> <!-- STREAM_SYSTEM_ENFORCED -->
|
<item></item> <!-- STREAM_SYSTEM_ENFORCED -->
|
||||||
<item></item> <!-- STREAM_DTMF -->
|
<item></item> <!-- STREAM_DTMF -->
|
||||||
<item></item> <!-- STREAM_TTS -->
|
<item></item> <!-- STREAM_TTS -->
|
||||||
|
|||||||
@@ -563,6 +563,14 @@ public class VolumeDialog implements TunerService.Tunable {
|
|||||||
if (!mExpanded && mExpandButtonAnimationRunning) {
|
if (!mExpanded && mExpandButtonAnimationRunning) {
|
||||||
prepareForCollapse();
|
prepareForCollapse();
|
||||||
}
|
}
|
||||||
|
final Resources res = mContext.getResources();
|
||||||
|
int paddingTop = mExpanded
|
||||||
|
? res.getDimensionPixelSize(R.dimen.volume_dialog_expanded_padding_top)
|
||||||
|
: res.getDimensionPixelSize(R.dimen.volume_dialog_collapsed_padding_top);
|
||||||
|
mDialogContentView.setPaddingRelative(mDialogContentView.getPaddingStart(),
|
||||||
|
paddingTop,
|
||||||
|
mDialogContentView.getPaddingEnd(),
|
||||||
|
mDialogContentView.getPaddingBottom());
|
||||||
updateRowsH();
|
updateRowsH();
|
||||||
if (mExpandButtonAnimationRunning) {
|
if (mExpandButtonAnimationRunning) {
|
||||||
final Drawable d = mExpandButton.getDrawable();
|
final Drawable d = mExpandButton.getDrawable();
|
||||||
@@ -623,7 +631,6 @@ public class VolumeDialog implements TunerService.Tunable {
|
|||||||
Util.setVisOrGone(row.view, visible);
|
Util.setVisOrGone(row.view, visible);
|
||||||
Util.setVisOrGone(row.space, visible && mExpanded);
|
Util.setVisOrGone(row.space, visible && mExpanded);
|
||||||
updateVolumeRowHeaderVisibleH(row);
|
updateVolumeRowHeaderVisibleH(row);
|
||||||
row.header.setAlpha(mExpanded && isActive ? 1 : 0.5f);
|
|
||||||
updateVolumeRowSliderTintH(row, isActive);
|
updateVolumeRowSliderTintH(row, isActive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -741,21 +748,7 @@ public class VolumeDialog implements TunerService.Tunable {
|
|||||||
updateVolumeRowHeaderVisibleH(row);
|
updateVolumeRowHeaderVisibleH(row);
|
||||||
|
|
||||||
// update header text
|
// update header text
|
||||||
String text = ss.name;
|
Util.setText(row.header, ss.name);
|
||||||
if (mShowHeaders) {
|
|
||||||
if (isRingZenNone) {
|
|
||||||
text = mContext.getString(R.string.volume_stream_muted_dnd, ss.name);
|
|
||||||
} else if (isRingVibrate && isRingLimited) {
|
|
||||||
text = mContext.getString(R.string.volume_stream_vibrate_dnd, ss.name);
|
|
||||||
} else if (isRingVibrate) {
|
|
||||||
text = mContext.getString(R.string.volume_stream_vibrate, ss.name);
|
|
||||||
} else if (ss.muted || mAutomute && ss.level == 0) {
|
|
||||||
text = mContext.getString(R.string.volume_stream_muted, ss.name);
|
|
||||||
} else if (isRingLimited) {
|
|
||||||
text = mContext.getString(R.string.volume_stream_limited_dnd, ss.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Util.setText(row.header, text);
|
|
||||||
|
|
||||||
// update icon
|
// update icon
|
||||||
final boolean iconEnabled = (mAutomute || ss.muteSupported) && !zenMuted;
|
final boolean iconEnabled = (mAutomute || ss.muteSupported) && !zenMuted;
|
||||||
@@ -824,7 +817,7 @@ public class VolumeDialog implements TunerService.Tunable {
|
|||||||
|
|
||||||
private void updateVolumeRowHeaderVisibleH(VolumeRow row) {
|
private void updateVolumeRowHeaderVisibleH(VolumeRow row) {
|
||||||
final boolean dynamic = row.ss != null && row.ss.dynamic;
|
final boolean dynamic = row.ss != null && row.ss.dynamic;
|
||||||
final boolean showHeaders = mShowHeaders || mExpanded && dynamic;
|
final boolean showHeaders = mExpanded && (mShowHeaders || dynamic);
|
||||||
if (row.cachedShowHeaders != showHeaders) {
|
if (row.cachedShowHeaders != showHeaders) {
|
||||||
row.cachedShowHeaders = showHeaders;
|
row.cachedShowHeaders = showHeaders;
|
||||||
Util.setVisOrGone(row.header, showHeaders);
|
Util.setVisOrGone(row.header, showHeaders);
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
|
|||||||
private void applyConfiguration() {
|
private void applyConfiguration() {
|
||||||
mDialog.setStreamImportant(AudioManager.STREAM_ALARM, true);
|
mDialog.setStreamImportant(AudioManager.STREAM_ALARM, true);
|
||||||
mDialog.setStreamImportant(AudioManager.STREAM_SYSTEM, false);
|
mDialog.setStreamImportant(AudioManager.STREAM_SYSTEM, false);
|
||||||
mDialog.setShowHeaders(false);
|
|
||||||
mDialog.setAutomute(true);
|
mDialog.setAutomute(true);
|
||||||
mDialog.setSilentMode(false);
|
mDialog.setSilentMode(false);
|
||||||
mController.setVolumePolicy(mVolumePolicy);
|
mController.setVolumePolicy(mVolumePolicy);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class VolumePrefs {
|
|||||||
public static final String PREF_ADJUST_ALARMS = "pref_adjust_alarms";
|
public static final String PREF_ADJUST_ALARMS = "pref_adjust_alarms";
|
||||||
public static final String PREF_ADJUST_NOTIFICATION = "pref_adjust_notification";
|
public static final String PREF_ADJUST_NOTIFICATION = "pref_adjust_notification";
|
||||||
|
|
||||||
public static final boolean DEFAULT_SHOW_HEADERS = false;
|
public static final boolean DEFAULT_SHOW_HEADERS = true;
|
||||||
public static final boolean DEFAULT_ENABLE_AUTOMUTE = true;
|
public static final boolean DEFAULT_ENABLE_AUTOMUTE = true;
|
||||||
public static final boolean DEFAULT_ENABLE_SILENT_MODE = true;
|
public static final boolean DEFAULT_ENABLE_SILENT_MODE = true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user