wear settings same background as menu

This commit is contained in:
AdrianLxM 2017-02-15 16:27:46 +01:00
parent f0fc3f6688
commit 74562ae548
2 changed files with 28 additions and 1 deletions

View file

@ -2,7 +2,8 @@ package info.nightscout.androidaps.interaction;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceActivity; import android.view.View;
import android.view.ViewGroup;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import preference.WearPreferenceActivity; import preference.WearPreferenceActivity;
@ -13,6 +14,9 @@ public class AAPSPreferences extends WearPreferenceActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences); addPreferencesFromResource(R.xml.preferences);
ViewGroup view = (ViewGroup)getWindow().getDecorView();
removeBackgroundRecursively(view);
view.setBackground(getResources().getDrawable(R.drawable.settings_background));
} }
@Override @Override
@ -21,4 +25,15 @@ public class AAPSPreferences extends WearPreferenceActivity {
finish(); finish();
} }
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);
}
} }

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<solid android:color="@color/black"/>
</shape>
</item>
<item android:drawable="@drawable/nslogo_background" />
</layer-list>