Merge pull request #182 from AdrianLxM/wear-bolus5

Background for wear settings
This commit is contained in:
Milos Kozak 2017-02-15 19:38:13 +01:00 committed by GitHub
commit 11e57e4043
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.preference.PreferenceActivity;
import android.view.View;
import android.view.ViewGroup;
import info.nightscout.androidaps.R;
import preference.WearPreferenceActivity;
@ -13,6 +14,9 @@ public class AAPSPreferences extends WearPreferenceActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
ViewGroup view = (ViewGroup)getWindow().getDecorView();
removeBackgroundRecursively(view);
view.setBackground(getResources().getDrawable(R.drawable.settings_background));
}
@Override
@ -21,4 +25,15 @@ public class AAPSPreferences extends WearPreferenceActivity {
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>