From ec3b3bf617beaa4de87179d3f088f6f7cb7a9927 Mon Sep 17 00:00:00 2001 From: vanous Date: Thu, 18 Nov 2021 21:19:03 +0100 Subject: [PATCH] Make new FM Frequency selector with presets --- .../adapter/GBDeviceAdapterv2.java | 105 ++++++++++++++++-- .../res/layout/dialog_frequency_picker.xml | 77 +++++++++++++ app/src/main/res/values/strings.xml | 2 + 3 files changed, 173 insertions(+), 11 deletions(-) create mode 100644 app/src/main/res/layout/dialog_frequency_picker.xml diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java index 05869ab45..95da03ecf 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java @@ -22,6 +22,7 @@ import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.SharedPreferences; import android.graphics.Color; import android.graphics.drawable.GradientDrawable; import android.text.InputType; @@ -30,11 +31,13 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; +import android.widget.NumberPicker; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; @@ -45,7 +48,6 @@ import androidx.cardview.widget.CardView; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.recyclerview.widget.RecyclerView; -import com.github.mikephil.charting.animation.Easing; import com.github.mikephil.charting.charts.PieChart; import com.github.mikephil.charting.data.PieData; import com.github.mikephil.charting.data.PieDataSet; @@ -438,27 +440,107 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter 108.0) { + if (frequency < FREQ_MIN || frequency > FREQ_MAX) { new AlertDialog.Builder(context) .setTitle(R.string.pref_invalid_frequency_title) .setMessage(R.string.pref_invalid_frequency_message) @@ -481,7 +563,8 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter + + + + + + + + + + + + + + + +