WatchfaceSettingsPreference -> kt

This commit is contained in:
Milos Kozak 2022-04-24 17:40:16 +02:00
parent b210bea490
commit 09433d6a4f
4 changed files with 27 additions and 34 deletions

View file

@ -9,6 +9,7 @@ import info.nightscout.androidaps.BuildConfig
/**
* Created by adrian on 07/08/17.
*/
@Suppress("unused")
class VersionPreference(context: Context?, attrs: AttributeSet?) : WearListPreference(context, attrs) {
override fun getSummary(context: Context): CharSequence {

View file

@ -1,33 +0,0 @@
package info.nightscout.androidaps.interaction.utils;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.Toast;
import androidx.annotation.NonNull;
import preference.WearListPreference;
public class WatchfaceSettingsPreference extends WearListPreference {
private final String pref_moreWatchfaceSettings;
private final String pref_lookInYourWatchfaceConfiguration;
public WatchfaceSettingsPreference(Context context, AttributeSet attrs) {
super(context, attrs);
this.pref_moreWatchfaceSettings =context.getResources().getString(context.getResources().getIdentifier("pref_moreWatchfaceSettings", "string", context.getApplicationContext().getPackageName()));
this.pref_lookInYourWatchfaceConfiguration=context.getResources().getString(context.getResources().getIdentifier("pref_lookInYourWatchfaceConfiguration", "string", context.getApplicationContext().getPackageName()));
entries = new CharSequence[]{pref_moreWatchfaceSettings};
entryValues = new CharSequence[]{""};
}
@Override public CharSequence getSummary(@NonNull final Context context) {
return "";
}
@Override
public void onPreferenceClick(@NonNull Context context) {
Toast.makeText(context, pref_lookInYourWatchfaceConfiguration, Toast.LENGTH_LONG).show();
}
}

View file

@ -0,0 +1,25 @@
package info.nightscout.androidaps.interaction.utils
import android.content.Context
import android.util.AttributeSet
import android.widget.Toast
import info.nightscout.androidaps.R
import preference.WearListPreference
@Suppress("unused")
class WatchfaceSettingsPreference(context: Context, attrs: AttributeSet?) : WearListPreference(context, attrs) {
private val prefMoreWatchfaceSettings: String = context.getString(R.string.pref_moreWatchfaceSettings)
private val prefLookInYourWatchfaceConfiguration: String = context.getString(R.string.pref_lookInYourWatchfaceConfiguration)
override fun getSummary(context: Context): CharSequence = ""
override fun onPreferenceClick(context: Context) {
Toast.makeText(context, prefLookInYourWatchfaceConfiguration, Toast.LENGTH_LONG).show()
}
init {
entries = arrayOf<CharSequence>(prefMoreWatchfaceSettings)
entryValues = arrayOf<CharSequence>("")
}
}

View file

@ -70,7 +70,7 @@
<string name="pref_complication_tap_action">Complication Tap Action</string>
<string name="pref_unicode_in_complications">Unicode in Complications</string>
<string name="pref_version">Version:</string>
<string name="pref_moreWatchfaceSettings">more Watchface settings</string>
<string name="pref_moreWatchfaceSettings">More Watchface settings</string>
<string name="pref_lookInYourWatchfaceConfiguration">Look into Watchface configuration, please.</string>
<string name="menu_tempt">TempT</string>