Skip to content

Commit ad96daf

Browse files
committed
-More UI polish and release
1 parent e1cf3d5 commit ad96daf

File tree

11 files changed

+56
-44
lines changed

11 files changed

+56
-44
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ android {
99
applicationId "com.darkrockstudios.apps.pcvolumemixer"
1010
minSdkVersion 21
1111
targetSdkVersion 27
12-
versionCode 15
13-
versionName "2.0"
12+
versionCode 16
13+
versionName "2.1"
1414
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1515
}
1616
compileOptions {

app/src/main/java/com/darkrockstudios/apps/pcvolumemixer/AudioSessionViewHolder.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package com.darkrockstudios.apps.pcvolumemixer
33
import android.annotation.TargetApi
44
import android.os.Build
55
import android.view.View
6-
import android.widget.*
6+
import android.widget.ImageButton
7+
import android.widget.SeekBar
8+
import android.widget.TextView
79
import com.darkrockstudios.apps.pcvolumemixer.data.AudioSession
810
import com.darkrockstudios.apps.pcvolumemixer.data.AudioSessionOptions
911

@@ -12,7 +14,7 @@ import com.darkrockstudios.apps.pcvolumemixer.data.AudioSessionOptions
1214
* Created by adamw on 9/16/2017.
1315
*/
1416
class AudioSessionViewHolder(rootView: View, session: AudioSession, listener: VolumeChangeListener, isMaster: Boolean = false)
15-
: SeekBar.OnSeekBarChangeListener, CompoundButton.OnCheckedChangeListener
17+
: SeekBar.OnSeekBarChangeListener
1618
{
1719
private val m_isMaster = isMaster
1820

@@ -23,7 +25,7 @@ class AudioSessionViewHolder(rootView: View, session: AudioSession, listener: Vo
2325
private val m_volumeBarContainer: View = rootView.findViewById(R.id.AUDIO_volume_container)
2426
private val m_volumeBar: SeekBar = rootView.findViewById(R.id.AUDIO_volume)
2527
private val m_sessionName: TextView = rootView.findViewById(R.id.AUDIO_name)
26-
private val muteButton: ToggleButton = rootView.findViewById(R.id.AUDIO_mute)
28+
private val muteButton: ImageButton = rootView.findViewById(R.id.AUDIO_mute)
2729

2830
private val menuButton: ImageButton? = rootView.findViewById(R.id.AUDIO_menu)
2931

@@ -47,8 +49,8 @@ class AudioSessionViewHolder(rootView: View, session: AudioSession, listener: Vo
4749

4850
m_volumeBar.setOnSeekBarChangeListener(this)
4951

50-
muteButton.isChecked = session.muted
51-
muteButton.setOnCheckedChangeListener(this)
52+
muteButton.isSelected = session.muted
53+
muteButton.setOnClickListener { onCheckedChanged( it ) }
5254

5355
menuButton?.tag = session
5456
}
@@ -66,7 +68,7 @@ class AudioSessionViewHolder(rootView: View, session: AudioSession, listener: Vo
6668
override fun onStopTrackingTouch(seekBar: SeekBar?)
6769
{
6870
val volume = m_volumeBar.progress.toFloat()
69-
val isMuted = muteButton.isChecked
71+
val isMuted = muteButton.isSelected
7072

7173
if (m_isMaster)
7274
{
@@ -80,10 +82,12 @@ class AudioSessionViewHolder(rootView: View, session: AudioSession, listener: Vo
8082
m_listener.onVolumeChangeStopped()
8183
}
8284

83-
override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean)
85+
private fun onCheckedChanged(buttonView: View?)
8486
{
8587
val volume = m_volumeBar.progress.toFloat()
86-
val isMuted = muteButton.isChecked
88+
val isMuted = !muteButton.isSelected
89+
90+
muteButton.isSelected = isMuted
8791

8892
if (m_isMaster)
8993
{

app/src/main/res/drawable/ic_mute.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
3+
<item android:drawable="@drawable/ic_mute_off"
4+
android:state_selected="false"/>
5+
<item android:drawable="@drawable/ic_mute_on"
6+
android:state_selected="true"/>
7+
<item android:drawable="@drawable/ic_mute_off"/>
8+
</selector>

app/src/main/res/layout-land/audio_session.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@
5252
android:layout_height="wrap_content"
5353
android:orientation="horizontal">
5454

55-
<ToggleButton
55+
<ImageButton
5656
android:id="@+id/AUDIO_mute"
5757
android:layout_width="wrap_content"
58-
android:layout_height="@dimen/min_touch"
59-
android:gravity="center"
60-
android:button="@drawable/ic_mute"
61-
android:background="@color/colorPrimary"/>
58+
android:layout_height="wrap_content"
59+
android:minWidth="@dimen/min_touch"
60+
android:minHeight="@dimen/min_touch"
61+
android:src="@drawable/mute_checkbox"
62+
android:background="?android:attr/selectableItemBackgroundBorderless"/>
6263

6364
<ImageButton
6465
android:id="@+id/AUDIO_menu"

app/src/main/res/layout-land/audio_session_master.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
android:layout_marginStart="@dimen/default_margin_half"
1313
android:layout_marginEnd="@dimen/default_margin_half"
1414
android:gravity="center_horizontal"
15-
android:elevation="@dimen/default_elevation"
15+
android:elevation="@dimen/large_elevation"
1616
android:background="@color/masterBackground"
1717
android:focusable="false"
1818
android:focusableInTouchMode="false">
@@ -24,7 +24,7 @@
2424
android:lines="2"
2525
android:id="@+id/AUDIO_name"
2626
tools:text="Channel"
27-
android:textStyle="bold"
27+
android:textStyle="bold|italic"
2828
android:textAppearance="@android:style/TextAppearance"/>
2929

3030
<!-- This library requires pair of the VerticalSeekBar and VerticalSeekBarWrapper classes -->
@@ -47,11 +47,12 @@
4747
app:seekBarRotation="CW270"/>
4848
</com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper>
4949

50-
<ToggleButton
50+
<ImageButton
5151
android:id="@+id/AUDIO_mute"
5252
android:layout_width="wrap_content"
53-
android:layout_height="@dimen/min_touch"
54-
android:gravity="center"
55-
android:button="@drawable/ic_mute"
56-
android:background="@color/colorPrimary"/>
53+
android:layout_height="wrap_content"
54+
android:minWidth="@dimen/min_touch"
55+
android:minHeight="@dimen/min_touch"
56+
android:src="@drawable/mute_checkbox"
57+
android:background="?android:attr/selectableItemBackgroundBorderless"/>
5758
</LinearLayout>

app/src/main/res/layout/audio_session.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,14 @@
6868
android:contentDescription="@string/AUDIO_MENU_description"
6969
android:onClick="showAudioSessionOptions"/>
7070

71-
<ToggleButton
71+
<ImageButton
7272
android:id="@+id/AUDIO_mute"
7373
android:layout_width="wrap_content"
74-
android:layout_height="@dimen/min_touch"
75-
android:gravity="center"
76-
android:button="@drawable/ic_mute"
77-
android:background="@color/colorPrimary"/>
74+
android:layout_height="wrap_content"
75+
android:minWidth="@dimen/min_touch"
76+
android:minHeight="@dimen/min_touch"
77+
android:src="@drawable/mute_checkbox"
78+
android:background="?android:attr/selectableItemBackgroundBorderless"/>
7879

7980
</LinearLayout>
8081
</android.support.constraint.ConstraintLayout>

app/src/main/res/layout/audio_session_master.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
android:layout_marginStart="@dimen/default_margin"
1313
android:layout_marginEnd="@dimen/default_margin"
1414
android:gravity="center_horizontal"
15-
android:elevation="@dimen/default_elevation"
15+
android:elevation="@dimen/large_elevation"
1616
android:background="@color/masterBackground"
1717
android:focusable="false"
1818
android:focusableInTouchMode="false">
@@ -25,7 +25,7 @@
2525
android:id="@+id/AUDIO_name"
2626
tools:text="Channel"
2727
android:textAlignment="textStart"
28-
android:textStyle="bold"
28+
android:textStyle="bold|italic"
2929
android:textAppearance="@android:style/TextAppearance"
3030
app:layout_constraintEnd_toStartOf="@+id/AUDIO_mute"
3131
app:layout_constraintStart_toStartOf="parent"
@@ -52,12 +52,13 @@
5252
android:thumb="@drawable/seekbar_thumb"/>
5353
</FrameLayout>
5454

55-
<ToggleButton
55+
<ImageButton
5656
android:id="@+id/AUDIO_mute"
5757
android:layout_width="wrap_content"
58-
android:layout_height="@dimen/min_touch"
59-
android:gravity="center"
60-
android:button="@drawable/ic_mute"
58+
android:layout_height="wrap_content"
59+
android:minWidth="@dimen/min_touch"
60+
android:minHeight="@dimen/min_touch"
6161
app:layout_constraintRight_toRightOf="parent"
62-
android:background="@color/colorPrimary"/>
62+
android:src="@drawable/mute_checkbox"
63+
android:background="?android:attr/selectableItemBackgroundBorderless"/>
6364
</android.support.constraint.ConstraintLayout>

app/src/main/res/values/colors.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<resources>
33
<color name="colorPrimary">#3F51B5</color>
44
<color name="colorPrimaryDark">#303F9F</color>
5-
<color name="colorAccent">#FF4081</color>
5+
<color name="colorAccent">#FF5252</color>
66

77
<color name="subtleBackground">#1a1a1a</color>
88

9-
<color name="masterBackground">#452318</color>
9+
<color name="masterBackground">#1c1414</color>
10+
11+
<color name="transparent">#00000000</color>
1012
</resources>

app/src/main/res/values/dimens.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<dimen name="min_touch">48dp</dimen>
44

55
<dimen name="default_elevation">4dp</dimen>
6+
<dimen name="large_elevation">8dp</dimen>
67

78
<dimen name="default_padding">8dp</dimen>
89
<dimen name="default_margin">8dp</dimen>

0 commit comments

Comments
 (0)