diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/AAPSPreferences.java b/wear/src/main/java/info/nightscout/androidaps/interaction/AAPSPreferences.java deleted file mode 100644 index 72f9f0a968..0000000000 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/AAPSPreferences.java +++ /dev/null @@ -1,35 +0,0 @@ -package info.nightscout.androidaps.interaction; - - -import android.os.Bundle; -import android.view.View; -import android.view.ViewGroup; - -import androidx.core.content.ContextCompat; - -import info.nightscout.androidaps.R; -import preference.WearPreferenceActivity; - -public class AAPSPreferences extends WearPreferenceActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - addPreferencesFromResource(R.xml.preferences); - ViewGroup view = (ViewGroup) getWindow().getDecorView(); - removeBackgroundRecursively(view); - view.setBackground(ContextCompat.getDrawable(this, R.drawable.settings_background)); - view.requestFocus(); - } - - void removeBackgroundRecursively(View parent) { - if (parent instanceof ViewGroup) { - ViewGroup group = (ViewGroup) parent; - for (int i = 0; i < group.getChildCount(); i++) { - removeBackgroundRecursively(group.getChildAt(i)); - } - } - parent.setBackground(null); - } - -} diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/AAPSPreferences.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/AAPSPreferences.kt new file mode 100644 index 0000000000..e02f3fb2ad --- /dev/null +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/AAPSPreferences.kt @@ -0,0 +1,29 @@ +package info.nightscout.androidaps.interaction + +import android.os.Bundle +import android.view.View +import android.view.ViewGroup +import androidx.core.content.ContextCompat +import info.nightscout.androidaps.R +import preference.WearPreferenceActivity + +class AAPSPreferences : WearPreferenceActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + addPreferencesFromResource(R.xml.preferences) + val view = window.decorView as ViewGroup + removeBackgroundRecursively(view) + view.background = ContextCompat.getDrawable(this, R.drawable.settings_background) + view.requestFocus() + } + + private fun removeBackgroundRecursively(parent: View) { + if (parent is ViewGroup) { + for (i in 0 until parent.childCount) { + removeBackgroundRecursively(parent.getChildAt(i)) + } + } + parent.background = null + } +} \ No newline at end of file