AAPSPreferences -> kt
This commit is contained in:
parent
6076191515
commit
aea1fde34e
2 changed files with 29 additions and 35 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue