diff --git a/hsdemo/build.gradle b/hsdemo/build.gradle index a84a248..91af8b1 100644 --- a/hsdemo/build.gradle +++ b/hsdemo/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.zebra.hsdemo" minSdk 33 targetSdk 34 - versionCode 2 - versionName "1.1" + versionCode 3 + versionName "1.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/hsdemo/src/main/java/com/zebra/hsdemo/MainActivity.java b/hsdemo/src/main/java/com/zebra/hsdemo/MainActivity.java index fdbf205..a1ce3ee 100644 --- a/hsdemo/src/main/java/com/zebra/hsdemo/MainActivity.java +++ b/hsdemo/src/main/java/com/zebra/hsdemo/MainActivity.java @@ -21,7 +21,9 @@ import android.os.Bundle; import android.util.Log; import android.view.View; +import android.widget.CompoundButton; import android.widget.SeekBar; +import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; @@ -51,13 +53,13 @@ public class MainActivity extends AppCompatActivity { AudioManager playAudioManager = null; AudioRecord recorder = null; Thread recordingThread = null; - MediaPlayer mp = null; int bufSize = 0; boolean isRecording = false; float recordingGain = 1.0f; - float replayGain = 15.0f; + float replayGain = 10.0f; - public static final int sampleRate = 44000; + final static int[] sampleRatevalues = {8000, 12000, 16000, 22000, 32000, 44000}; + public static int sampleRate = sampleRatevalues[0]; public static final int channelInConfig = AudioFormat.CHANNEL_IN_MONO; public static final int channelOutConfig = AudioFormat.CHANNEL_OUT_MONO; public static final int channelNumber = 1; @@ -241,6 +243,31 @@ public void onStopTrackingTouch(SeekBar seekBar) { } }); + + SeekBar sbSampleRate = findViewById(R.id.sbSampleRate); + TextView tvSampleRate = findViewById(R.id.tvSampleRate); + tvSampleRate.setText(String.format("%05d", sampleRatevalues[0]) + " Hz"); + sbSampleRate.setProgress(0); + sbSampleRate.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + sampleRate = sampleRatevalues[progress]; + String formattedValue = String.format("%05d", sampleRate); + tvSampleRate.setText(String.valueOf(formattedValue) + " Hz"); + // Do something with the selected value + Log.d("SeekBar", "Selected value: " + sampleRate); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + // Optional: handle start of touch + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + // Optional: handle stop of touch + } + }); } @Override diff --git a/hsdemo/src/main/res/drawable/empty_circle.xml b/hsdemo/src/main/res/drawable/empty_circle.xml new file mode 100644 index 0000000..73e47b3 --- /dev/null +++ b/hsdemo/src/main/res/drawable/empty_circle.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/hsdemo/src/main/res/drawable/filled_circle.xml b/hsdemo/src/main/res/drawable/filled_circle.xml new file mode 100644 index 0000000..ec62ce1 --- /dev/null +++ b/hsdemo/src/main/res/drawable/filled_circle.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/hsdemo/src/main/res/layout/activity_main.xml b/hsdemo/src/main/res/layout/activity_main.xml index 56e5e4e..81e49ec 100644 --- a/hsdemo/src/main/res/layout/activity_main.xml +++ b/hsdemo/src/main/res/layout/activity_main.xml @@ -7,16 +7,6 @@ android:layout_height="match_parent" tools:context=".MainActivity"> - - @@ -54,6 +46,8 @@ android:id="@+id/textView4" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginTop="20dp" + android:layout_marginBottom="10dp" android:gravity="center_horizontal" android:text="Recording Gain" /> @@ -77,23 +71,55 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.2" + android:gravity="center_horizontal" android:text="TextView" /> + + + + + + + + + - @@ -147,15 +175,35 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.2" + android:gravity="center_horizontal" android:text="TextView" /> + + + + + + + + + + + \ No newline at end of file diff --git a/hsdemo/src/main/res/values-night/themes.xml b/hsdemo/src/main/res/values-night/themes.xml index d25b0f2..3bcae31 100644 --- a/hsdemo/src/main/res/values-night/themes.xml +++ b/hsdemo/src/main/res/values-night/themes.xml @@ -3,5 +3,11 @@ + \ No newline at end of file diff --git a/hsdemo/src/main/res/values/themes.xml b/hsdemo/src/main/res/values/themes.xml index d66ac09..aec0e54 100644 --- a/hsdemo/src/main/res/values/themes.xml +++ b/hsdemo/src/main/res/values/themes.xml @@ -3,7 +3,12 @@ + +