Skip to content

Commit

Permalink
Update icons
Browse files Browse the repository at this point in the history
  • Loading branch information
billthefarmer committed Oct 22, 2023
1 parent 939ab6d commit ab9f174
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 23 deletions.
39 changes: 28 additions & 11 deletions src/main/java/org/billthefarmer/siggen/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioTrack;
Expand Down Expand Up @@ -118,6 +121,11 @@ public class Main extends Activity
private Scale scale;
private Display display;

private Drawable check_on;
private Drawable check_off;
private Drawable radio_on;
private Drawable radio_off;

private SeekBar duty;
private SeekBar fine;
private SeekBar level;
Expand Down Expand Up @@ -183,6 +191,15 @@ protected void onCreate(Bundle savedInstanceState)
fine = findViewById(R.id.fine);
level = findViewById(R.id.level);

Resources.Theme current = getTheme();
TypedArray array =
current.obtainStyledAttributes(R.styleable.Siggen);
check_on = array.getDrawable(R.styleable.Siggen_check_on);
check_off = array.getDrawable(R.styleable.Siggen_check_off);
radio_on = array.getDrawable(R.styleable.Siggen_radio_on);
radio_off = array.getDrawable(R.styleable.Siggen_radio_off);
array.recycle();

// Get wake lock
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOCK);
Expand Down Expand Up @@ -759,44 +776,44 @@ public void onClick(View v)
if (audio != null)
audio.waveform = Audio.SINE;
((Button) v).setCompoundDrawablesWithIntrinsicBounds(
android.R.drawable.radiobutton_on_background, 0, 0, 0);
radio_on, null, null, null);

v = findViewById(R.id.square);
((Button) v).setCompoundDrawablesWithIntrinsicBounds(
android.R.drawable.radiobutton_off_background, 0, 0, 0);
radio_off, null, null, null);
v = findViewById(R.id.sawtooth);
((Button) v).setCompoundDrawablesWithIntrinsicBounds(
android.R.drawable.radiobutton_off_background, 0, 0, 0);
radio_off, null, null, null);
break;

// Square
case R.id.square:
if (audio != null)
audio.waveform = Audio.SQUARE;
((Button) v).setCompoundDrawablesWithIntrinsicBounds(
android.R.drawable.radiobutton_on_background, 0, 0, 0);
radio_on, null, null, null);

v = findViewById(R.id.sine);
((Button) v).setCompoundDrawablesWithIntrinsicBounds(
android.R.drawable.radiobutton_off_background, 0, 0, 0);
radio_off, null, null, null);
v = findViewById(R.id.sawtooth);
((Button) v).setCompoundDrawablesWithIntrinsicBounds(
android.R.drawable.radiobutton_off_background, 0, 0, 0);
radio_off, null, null, null);
break;

// Sawtooth
case R.id.sawtooth:
if (audio != null)
audio.waveform = Audio.SAWTOOTH;
((Button) v).setCompoundDrawablesWithIntrinsicBounds(
android.R.drawable.radiobutton_on_background, 0, 0, 0);
radio_on, null, null, null);

v = findViewById(R.id.sine);
((Button) v).setCompoundDrawablesWithIntrinsicBounds(
android.R.drawable.radiobutton_off_background, 0, 0, 0);
radio_off, null, null, null);
v = findViewById(R.id.square);
((Button) v).setCompoundDrawablesWithIntrinsicBounds(
android.R.drawable.radiobutton_off_background, 0, 0, 0);
radio_off, null, null, null);
break;

// Mute
Expand All @@ -806,11 +823,11 @@ public void onClick(View v)

if (audio.mute)
((Button) v).setCompoundDrawablesWithIntrinsicBounds(
android.R.drawable.checkbox_on_background, 0, 0, 0);
check_on, null, null, null);

else
((Button) v).setCompoundDrawablesWithIntrinsicBounds(
android.R.drawable.checkbox_off_background, 0, 0, 0);
check_off, null, null, null);
break;

// Back
Expand Down
9 changes: 9 additions & 0 deletions src/main/res/drawable/ic_check_box_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M19,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.11,0 2,-0.9 2,-2L21,5c0,-1.1 -0.89,-2 -2,-2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M19,5v14H5V5h14m0,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M19,5v14H5V5h14m0,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>
9 changes: 9 additions & 0 deletions src/main/res/drawable/ic_check_box_white_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M19,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.11,0 2,-0.9 2,-2L21,5c0,-1.1 -0.89,-2 -2,-2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z"/>
</vector>
9 changes: 9 additions & 0 deletions src/main/res/drawable/ic_radio_button_checked_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5 5,-2.24 5,-5 -2.24,-5 -5,-5zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
</vector>
9 changes: 9 additions & 0 deletions src/main/res/drawable/ic_radio_button_checked_white_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5 5,-2.24 5,-5 -2.24,-5 -5,-5zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
</vector>
8 changes: 4 additions & 4 deletions src/main/res/layout-large/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
android:layout_below="@id/display"
android:layout_alignLeft="@id/display"
android:layout_alignParentRight="true"
android:drawableLeft="@android:drawable/radiobutton_on_background"
android:drawableLeft="?attr/radio_on"
android:drawablePadding="8dp"
android:text="@string/sine" />

Expand All @@ -96,7 +96,7 @@
android:layout_below="@id/sine"
android:layout_alignLeft="@id/display"
android:layout_alignParentRight="true"
android:drawableLeft="@android:drawable/radiobutton_off_background"
android:drawableLeft="?attr/radio_off"
android:drawablePadding="8dp"
android:text="@string/square" />

Expand All @@ -107,7 +107,7 @@
android:layout_below="@id/square"
android:layout_alignLeft="@id/display"
android:layout_alignParentRight="true"
android:drawableLeft="@android:drawable/radiobutton_off_background"
android:drawableLeft="?attr/radio_off"
android:drawablePadding="8dp"
android:text="@string/sawtooth" />

Expand All @@ -118,7 +118,7 @@
android:layout_below="@id/sawtooth"
android:layout_alignLeft="@id/display"
android:layout_alignParentRight="true"
android:drawableLeft="@android:drawable/checkbox_off_background"
android:drawableLeft="?attr/check_off"
android:drawablePadding="8dp"
android:text="@string/mute" />

Expand Down
8 changes: 4 additions & 4 deletions src/main/res/layout-small/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:drawableLeft="@android:drawable/radiobutton_on_background"
android:drawableLeft="?attr/radio_on"
android:drawablePadding="8dp"
android:text="@string/s" />

Expand All @@ -102,7 +102,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:drawableLeft="@android:drawable/radiobutton_off_background"
android:drawableLeft="?attr/radio_off"
android:drawablePadding="8dp"
android:text="@string/q" />

Expand All @@ -111,7 +111,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:drawableLeft="@android:drawable/radiobutton_off_background"
android:drawableLeft="?attr/radio_off"
android:drawablePadding="8dp"
android:text="@string/w" />

Expand Down Expand Up @@ -161,7 +161,7 @@
android:layout_alignBottom="@id/lower"
android:layout_toLeftOf="@id/more"
android:layout_toRightOf="@id/less"
android:drawableLeft="@android:drawable/checkbox_off_background"
android:drawableLeft="?attr/check_off"
android:drawablePadding="8dp"
android:text="@string/mute" />

Expand Down
8 changes: 4 additions & 4 deletions src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:drawableLeft="@android:drawable/radiobutton_on_background"
android:drawableLeft="?attr/radio_on"
android:drawablePadding="8dp"
android:text="@string/sin" />

Expand All @@ -102,7 +102,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:drawableLeft="@android:drawable/radiobutton_off_background"
android:drawableLeft="?attr/radio_off"
android:drawablePadding="8dp"
android:text="@string/squ" />

Expand All @@ -111,7 +111,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:drawableLeft="@android:drawable/radiobutton_off_background"
android:drawableLeft="?attr/radio_off"
android:drawablePadding="8dp"
android:text="@string/saw" />

Expand Down Expand Up @@ -161,7 +161,7 @@
android:layout_alignBottom="@id/lower"
android:layout_toLeftOf="@id/more"
android:layout_toRightOf="@id/less"
android:drawableLeft="@android:drawable/checkbox_off_background"
android:drawableLeft="?attr/check_off"
android:drawablePadding="8dp"
android:text="@string/mute" />

Expand Down
4 changes: 4 additions & 0 deletions src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<attr name="forward" format="reference" />
<attr name="next" format="reference" />
<attr name="previous" format="reference" />
<attr name="radio_off" format="reference" />
<attr name="radio_on" format="reference" />
<attr name="check_off" format="reference" />
<attr name="check_on" format="reference" />

<attr name="pref_about" format="reference" />
<attr name="pref_theme" format="reference" />
Expand Down
8 changes: 8 additions & 0 deletions src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<item name="forward">@drawable/ic_forward</item>
<item name="next">@drawable/ic_chevron_right_black_24dp</item>
<item name="previous">@drawable/ic_chevron_left_black_24dp</item>
<item name="radio_off">@drawable/ic_radio_button_unchecked_black_24dp</item>
<item name="radio_on">@drawable/ic_radio_button_checked_black_24dp</item>
<item name="check_off">@drawable/ic_check_box_outline_blank_black_24dp</item>
<item name="check_on">@drawable/ic_check_box_black_24dp</item>

<item name="pref_about">@drawable/ic_action_about</item>
<item name="pref_theme">@drawable/ic_action_brightness_high_light</item>
Expand Down Expand Up @@ -53,6 +57,10 @@
<item name="forward">@drawable/ic_forward_dark</item>
<item name="next">@drawable/ic_chevron_right_white_24dp</item>
<item name="previous">@drawable/ic_chevron_left_white_24dp</item>
<item name="radio_off">@drawable/ic_radio_button_unchecked_white_24dp</item>
<item name="radio_on">@drawable/ic_radio_button_checked_white_24dp</item>
<item name="check_off">@drawable/ic_check_box_outline_blank_white_24dp</item>
<item name="check_on">@drawable/ic_check_box_white_24dp</item>

<item name="pref_about">@drawable/ic_action_about_dark</item>
<item name="pref_theme">@drawable/ic_action_brightness_high</item>
Expand Down

0 comments on commit ab9f174

Please sign in to comment.