From cd94615223e4ea94c31cc8071787a4c3aaf33cd6 Mon Sep 17 00:00:00 2001 From: John Heroy Date: Tue, 20 Oct 2015 11:10:29 -0700 Subject: Set more padding on volume pref SeekBar for Lollipop and above --- app/src/main/java/org/connectbot/util/VolumePreference.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/java/org/connectbot/util/VolumePreference.java b/app/src/main/java/org/connectbot/util/VolumePreference.java index 09feb61..82685a4 100644 --- a/app/src/main/java/org/connectbot/util/VolumePreference.java +++ b/app/src/main/java/org/connectbot/util/VolumePreference.java @@ -18,6 +18,7 @@ package org.connectbot.util; import android.content.Context; +import android.os.Build; import android.preference.DialogPreference; import android.util.AttributeSet; import android.view.View; @@ -56,7 +57,13 @@ public class VolumePreference extends DialogPreference implements OnSeekBarChang sb.setMax(100); sb.setProgress((int) (getPersistedFloat( PreferenceConstants.DEFAULT_BELL_VOLUME) * 100)); - sb.setPadding(10, 10, 10, 10); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + sb.setPadding(75, 70, 75, 10); + } else { + sb.setPadding(10, 10, 10, 10); + } + sb.setOnSeekBarChangeListener(this); return sb; -- cgit v1.2.3 From 083fcd882a91e3350a1cfaa5a49ef0cae9999930 Mon Sep 17 00:00:00 2001 From: John Heroy Date: Tue, 20 Oct 2015 16:02:52 -0700 Subject: Add volume up material icon for bell volume dialog --- app/src/main/res/drawable-hdpi/ic_volume_up.png | Bin 0 -> 518 bytes app/src/main/res/drawable-mdpi/ic_volume_up.png | Bin 0 -> 365 bytes app/src/main/res/drawable-xhdpi/ic_volume_up.png | Bin 0 -> 654 bytes app/src/main/res/drawable-xxhdpi/ic_volume_up.png | Bin 0 -> 998 bytes app/src/main/res/drawable-xxxhdpi/ic_volume_up.png | Bin 0 -> 1304 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/ic_volume_up.png create mode 100644 app/src/main/res/drawable-mdpi/ic_volume_up.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_volume_up.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_volume_up.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_volume_up.png (limited to 'app') diff --git a/app/src/main/res/drawable-hdpi/ic_volume_up.png b/app/src/main/res/drawable-hdpi/ic_volume_up.png new file mode 100644 index 0000000..62d22be Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_volume_up.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_volume_up.png b/app/src/main/res/drawable-mdpi/ic_volume_up.png new file mode 100644 index 0000000..57d7871 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_volume_up.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_volume_up.png b/app/src/main/res/drawable-xhdpi/ic_volume_up.png new file mode 100644 index 0000000..2e751a4 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_volume_up.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_volume_up.png b/app/src/main/res/drawable-xxhdpi/ic_volume_up.png new file mode 100644 index 0000000..96c1f98 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_volume_up.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_volume_up.png b/app/src/main/res/drawable-xxxhdpi/ic_volume_up.png new file mode 100644 index 0000000..fd633b6 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_volume_up.png differ -- cgit v1.2.3 From 9b435c91c5d6e13efc004f0caa88ee36916b9534 Mon Sep 17 00:00:00 2001 From: John Heroy Date: Tue, 20 Oct 2015 16:04:40 -0700 Subject: Use volume icon in 'bell volume' dialog and factor out SeekBar declaration to an XML layout --- .../java/org/connectbot/util/VolumePreference.java | 24 ++++------- .../res/layout/volume_preference_dialog_layout.xml | 50 ++++++++++++++++++++++ 2 files changed, 58 insertions(+), 16 deletions(-) create mode 100644 app/src/main/res/layout/volume_preference_dialog_layout.xml (limited to 'app') diff --git a/app/src/main/java/org/connectbot/util/VolumePreference.java b/app/src/main/java/org/connectbot/util/VolumePreference.java index 82685a4..c5ef549 100644 --- a/app/src/main/java/org/connectbot/util/VolumePreference.java +++ b/app/src/main/java/org/connectbot/util/VolumePreference.java @@ -18,13 +18,14 @@ package org.connectbot.util; import android.content.Context; -import android.os.Build; import android.preference.DialogPreference; import android.util.AttributeSet; import android.view.View; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; +import org.connectbot.R; + /** * @author kenny * @@ -47,26 +48,17 @@ public class VolumePreference extends DialogPreference implements OnSeekBarChang } private void setupLayout(Context context, AttributeSet attrs) { + setDialogLayoutResource(R.layout.volume_preference_dialog_layout); setPersistent(true); } @Override - protected View onCreateDialogView() { - SeekBar sb = new SeekBar(getContext()); - - sb.setMax(100); - sb.setProgress((int) (getPersistedFloat( + protected void onBindDialogView(View view) { + SeekBar volumeBar = (SeekBar) view.findViewById(R.id.volume_bar); + volumeBar.setProgress((int) (getPersistedFloat( PreferenceConstants.DEFAULT_BELL_VOLUME) * 100)); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - sb.setPadding(75, 70, 75, 10); - } else { - sb.setPadding(10, 10, 10, 10); - } - - sb.setOnSeekBarChangeListener(this); - - return sb; + volumeBar.setOnSeekBarChangeListener(this); + super.onBindDialogView(view); } public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { diff --git a/app/src/main/res/layout/volume_preference_dialog_layout.xml b/app/src/main/res/layout/volume_preference_dialog_layout.xml new file mode 100644 index 0000000..fb4bb22 --- /dev/null +++ b/app/src/main/res/layout/volume_preference_dialog_layout.xml @@ -0,0 +1,50 @@ + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From 6593e182a94bd23863926e2466a7c453ce31849a Mon Sep 17 00:00:00 2001 From: John Heroy Date: Tue, 20 Oct 2015 16:26:37 -0700 Subject: Add newline at end of volume preference dialog layout XML file. --- app/src/main/res/layout/volume_preference_dialog_layout.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/res/layout/volume_preference_dialog_layout.xml b/app/src/main/res/layout/volume_preference_dialog_layout.xml index fb4bb22..c26dd8e 100644 --- a/app/src/main/res/layout/volume_preference_dialog_layout.xml +++ b/app/src/main/res/layout/volume_preference_dialog_layout.xml @@ -47,4 +47,4 @@ android:secondaryProgress="0" /> - \ No newline at end of file + -- cgit v1.2.3 From 8445d8dd6922e6fe87116b1a97f3a5a4e6041c21 Mon Sep 17 00:00:00 2001 From: John Heroy Date: Wed, 21 Oct 2015 09:16:08 -0700 Subject: Add content description to volume pref dialog ImageView and reset padding on SeekBar --- app/src/main/res/layout/volume_preference_dialog_layout.xml | 2 ++ app/src/main/res/values/strings.xml | 3 +++ 2 files changed, 5 insertions(+) (limited to 'app') diff --git a/app/src/main/res/layout/volume_preference_dialog_layout.xml b/app/src/main/res/layout/volume_preference_dialog_layout.xml index c26dd8e..a0c66a0 100644 --- a/app/src/main/res/layout/volume_preference_dialog_layout.xml +++ b/app/src/main/res/layout/volume_preference_dialog_layout.xml @@ -28,6 +28,7 @@ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 445d894..0d3e1ee 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -602,6 +602,9 @@ purposes. --> Arrow right + + Volume + Esc -- cgit v1.2.3 From 6daccaf04a0fe2f719e9aec9b86f4b83b54ad687 Mon Sep 17 00:00:00 2001 From: John Heroy Date: Wed, 21 Oct 2015 12:02:33 -0700 Subject: Remove margin on SeekBar and move up super.onBindDialogView to top of VolumePreference#onBindDialogView decl --- app/src/main/java/org/connectbot/util/VolumePreference.java | 3 ++- app/src/main/res/layout/volume_preference_dialog_layout.xml | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/src/main/java/org/connectbot/util/VolumePreference.java b/app/src/main/java/org/connectbot/util/VolumePreference.java index c5ef549..e33582d 100644 --- a/app/src/main/java/org/connectbot/util/VolumePreference.java +++ b/app/src/main/java/org/connectbot/util/VolumePreference.java @@ -54,11 +54,12 @@ public class VolumePreference extends DialogPreference implements OnSeekBarChang @Override protected void onBindDialogView(View view) { + super.onBindDialogView(view); + SeekBar volumeBar = (SeekBar) view.findViewById(R.id.volume_bar); volumeBar.setProgress((int) (getPersistedFloat( PreferenceConstants.DEFAULT_BELL_VOLUME) * 100)); volumeBar.setOnSeekBarChangeListener(this); - super.onBindDialogView(view); } public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { diff --git a/app/src/main/res/layout/volume_preference_dialog_layout.xml b/app/src/main/res/layout/volume_preference_dialog_layout.xml index a0c66a0..f332325 100644 --- a/app/src/main/res/layout/volume_preference_dialog_layout.xml +++ b/app/src/main/res/layout/volume_preference_dialog_layout.xml @@ -20,10 +20,10 @@ android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="horizontal" - android:paddingLeft="24dp" - android:paddingStart="24dp" - android:paddingEnd="24dp" - android:paddingRight="24dp" + android:paddingLeft="@dimen/abc_dialog_padding_material" + android:paddingStart="@dimen/abc_dialog_padding_material" + android:paddingEnd="@dimen/abc_dialog_padding_material" + android:paddingRight="@dimen/abc_dialog_padding_material" > -- cgit v1.2.3 From 9fdcd2b1ce30b456158efe5e12876eb4e445a4c2 Mon Sep 17 00:00:00 2001 From: John Heroy Date: Wed, 21 Oct 2015 14:21:32 -0700 Subject: Ignore private resource linter warning in volume pref dalog XML --- app/src/main/res/layout/volume_preference_dialog_layout.xml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/src/main/res/layout/volume_preference_dialog_layout.xml b/app/src/main/res/layout/volume_preference_dialog_layout.xml index f332325..37f7bac 100644 --- a/app/src/main/res/layout/volume_preference_dialog_layout.xml +++ b/app/src/main/res/layout/volume_preference_dialog_layout.xml @@ -17,13 +17,15 @@ -->