Merge pull request #1011 from Andries-Smit/dev

Wear OS improvements
This commit is contained in:
Milos Kozak 2021-12-06 23:53:50 +01:00 committed by GitHub
commit 9d11323e0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 519 additions and 232 deletions

View file

@ -17,6 +17,7 @@ public class AAPSPreferences extends WearPreferenceActivity {
ViewGroup view = (ViewGroup)getWindow().getDecorView(); ViewGroup view = (ViewGroup)getWindow().getDecorView();
removeBackgroundRecursively(view); removeBackgroundRecursively(view);
view.setBackground(getResources().getDrawable(R.drawable.settings_background)); view.setBackground(getResources().getDrawable(R.drawable.settings_background));
view.requestFocus();
} }
@Override @Override

View file

@ -22,6 +22,7 @@ public class ConfigurationActivity extends WearPreferenceActivity {
ViewGroup view = (ViewGroup) getWindow().getDecorView(); ViewGroup view = (ViewGroup) getWindow().getDecorView();
removeBackgroundRecursively(view); removeBackgroundRecursively(view);
view.setBackground(getResources().getDrawable(R.drawable.settings_background)); view.setBackground(getResources().getDrawable(R.drawable.settings_background));
view.requestFocus();
} }
@Override @Override

View file

@ -50,9 +50,8 @@ public class AcceptActivity extends ViewSelectorActivity {
} }
setContentView(R.layout.grid_layout); setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter()); pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator); DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager); dotsPageIndicator.setPager(pager);
@ -99,7 +98,7 @@ public class AcceptActivity extends ViewSelectorActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
ListenerService.confirmAction(AcceptActivity.this, actionstring); ListenerService.confirmAction(AcceptActivity.this, actionstring);
finish(); finishAffinity();
} }
}); });
container.addView(view); container.addView(view);

View file

@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@ -32,14 +33,32 @@ public class BolusActivity extends ViewSelectorActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout); setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.menu_bolus));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter()); pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator); DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager); dotsPageIndicator.setPager(pager);
pager.setOnPageChangeListener(new GridViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int row, int column, float rowOffset, float columnOffset, int rowOffsetPixels, int columnOffsetPixels) {
dotsPageIndicator.onPageScrolled(row, column, rowOffset, columnOffset, rowOffsetPixels,
columnOffsetPixels);
}
@Override
public void onPageSelected(int row, int column) {
dotsPageIndicator.onPageSelected(row, column);
View view = pager.getChildAt(column);
view.requestFocus();
}
@Override
public void onPageScrollStateChanged(int state) {
dotsPageIndicator.onPageScrollStateChanged(state);
}
});
} }
@Override @Override
protected void onPause() { protected void onPause() {
@ -71,6 +90,7 @@ public class BolusActivity extends ViewSelectorActivity {
editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false); editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false);
setLabelToPlusMinusView(view, getString(R.string.action_insulin)); setLabelToPlusMinusView(view, getString(R.string.action_insulin));
container.addView(view); container.addView(view);
view.requestFocus();
return view; return view;
} else if (col == 1) { } else if (col == 1) {
final View view = getInflatedPlusMinusView(container); final View view = getInflatedPlusMinusView(container);
@ -96,7 +116,7 @@ public class BolusActivity extends ViewSelectorActivity {
String actionstring = "bolus " + SafeParse.stringToDouble(editInsulin.editText.getText().toString()) String actionstring = "bolus " + SafeParse.stringToDouble(editInsulin.editText.getText().toString())
+ " " + SafeParse.stringToInt(editCarbs.editText.getText().toString()); + " " + SafeParse.stringToInt(editCarbs.editText.getText().toString());
ListenerService.initiateAction(BolusActivity.this, actionstring); ListenerService.initiateAction(BolusActivity.this, actionstring);
finish(); finishAffinity();
} }
}); });
container.addView(view); container.addView(view);

View file

@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@ -47,12 +48,31 @@ public class CPPActivity extends ViewSelectorActivity {
if (timeshift < 0) timeshift += 24; if (timeshift < 0) timeshift += 24;
setContentView(R.layout.grid_layout); setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.status_cpp));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter()); pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator); DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager); dotsPageIndicator.setPager(pager);
pager.setOnPageChangeListener(new GridViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int row, int column, float rowOffset, float columnOffset, int rowOffsetPixels, int columnOffsetPixels) {
dotsPageIndicator.onPageScrolled(row, column, rowOffset, columnOffset, rowOffsetPixels,
columnOffsetPixels);
}
@Override
public void onPageSelected(int row, int column) {
dotsPageIndicator.onPageSelected(row, column);
View view = pager.getChildAt(column);
view.requestFocus();
}
@Override
public void onPageScrollStateChanged(int state) {
dotsPageIndicator.onPageScrollStateChanged(state);
}
});
} }
@ -86,6 +106,7 @@ public class CPPActivity extends ViewSelectorActivity {
editTimeshift = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 23d, 1d, new DecimalFormat("0"), true, true); editTimeshift = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 23d, 1d, new DecimalFormat("0"), true, true);
setLabelToPlusMinusView(view, getString(R.string.action_timeshift)); setLabelToPlusMinusView(view, getString(R.string.action_timeshift));
container.addView(view); container.addView(view);
view.requestFocus();
return view; return view;
} else if (col == 1) { } else if (col == 1) {
final View view = getInflatedPlusMinusView(container); final View view = getInflatedPlusMinusView(container);
@ -111,7 +132,7 @@ public class CPPActivity extends ViewSelectorActivity {
String actionstring = "cppset " + SafeParse.stringToInt(editTimeshift.editText.getText().toString()) String actionstring = "cppset " + SafeParse.stringToInt(editTimeshift.editText.getText().toString())
+ " " + SafeParse.stringToInt(editPercentage.editText.getText().toString()); + " " + SafeParse.stringToInt(editPercentage.editText.getText().toString());
ListenerService.initiateAction(CPPActivity.this, actionstring); ListenerService.initiateAction(CPPActivity.this, actionstring);
finish(); finishAffinity();
} }
}); });
container.addView(view); container.addView(view);

View file

@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@ -34,12 +35,31 @@ public class ECarbActivity extends ViewSelectorActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout); setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.menu_ecarb));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter()); pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator); DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager); dotsPageIndicator.setPager(pager);
pager.setOnPageChangeListener(new GridViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int row, int column, float rowOffset, float columnOffset, int rowOffsetPixels, int columnOffsetPixels) {
dotsPageIndicator.onPageScrolled(row, column, rowOffset, columnOffset, rowOffsetPixels,
columnOffsetPixels);
}
@Override
public void onPageSelected(int row, int column) {
dotsPageIndicator.onPageSelected(row, column);
View view = pager.getChildAt(column);
view.requestFocus();
}
@Override
public void onPageScrollStateChanged(int state) {
dotsPageIndicator.onPageScrollStateChanged(state);
}
});
} }
@ -73,6 +93,7 @@ public class ECarbActivity extends ViewSelectorActivity {
editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), true); editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), true);
setLabelToPlusMinusView(view, getString(R.string.action_carbs)); setLabelToPlusMinusView(view, getString(R.string.action_carbs));
container.addView(view); container.addView(view);
view.requestFocus();
return view; return view;
} else if(col == 1){ } else if(col == 1){
final View view = getInflatedPlusMinusView(container); final View view = getInflatedPlusMinusView(container);
@ -109,7 +130,7 @@ public class ECarbActivity extends ViewSelectorActivity {
+ " " + SafeParse.stringToInt(editStartTime.editText.getText().toString()) + " " + SafeParse.stringToInt(editStartTime.editText.getText().toString())
+ " " + SafeParse.stringToInt(editDuration.editText.getText().toString()); + " " + SafeParse.stringToInt(editDuration.editText.getText().toString());
ListenerService.initiateAction(ECarbActivity.this, actionstring); ListenerService.initiateAction(ECarbActivity.this, actionstring);
finish(); finishAffinity();
} }
}); });
container.addView(view); container.addView(view);

View file

@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@ -31,9 +32,11 @@ public class FillActivity extends ViewSelectorActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout); setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.menu_prime_fill));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter()); pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator); DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager); dotsPageIndicator.setPager(pager);
@ -70,6 +73,7 @@ public class FillActivity extends ViewSelectorActivity {
editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false); editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false);
setLabelToPlusMinusView(view, getString(R.string.action_insulin)); setLabelToPlusMinusView(view, getString(R.string.action_insulin));
container.addView(view); container.addView(view);
view.requestFocus();
return view; return view;
} else { } else {
@ -84,7 +88,7 @@ public class FillActivity extends ViewSelectorActivity {
String actionstring = "fill " + SafeParse.stringToDouble(editInsulin.editText.getText().toString()); String actionstring = "fill " + SafeParse.stringToDouble(editInsulin.editText.getText().toString());
ListenerService.initiateAction(FillActivity.this, actionstring); ListenerService.initiateAction(FillActivity.this, actionstring);
finish(); finishAffinity();
} }
}); });
container.addView(view); container.addView(view);

View file

@ -38,9 +38,11 @@ public class TempTargetActivity extends ViewSelectorActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout); setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.menu_tempt));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter()); pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator); DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager); dotsPageIndicator.setPager(pager);
@ -48,6 +50,23 @@ public class TempTargetActivity extends ViewSelectorActivity {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
isMGDL = sp.getBoolean("units_mgdl", true); isMGDL = sp.getBoolean("units_mgdl", true);
isSingleTarget = sp.getBoolean("singletarget", true); isSingleTarget = sp.getBoolean("singletarget", true);
pager.setOnPageChangeListener(new GridViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int row, int column, float rowOffset, float columnOffset, int rowOffsetPixels, int columnOffsetPixels) {
dotsPageIndicator.onPageScrolled(row, column, rowOffset, columnOffset, rowOffsetPixels,
columnOffsetPixels);
}
@Override
public void onPageSelected(int row, int column) {
dotsPageIndicator.onPageSelected(row, column);
View view = pager.getChildAt(column);
view.requestFocus();
}
@Override
public void onPageScrollStateChanged(int state) {
dotsPageIndicator.onPageScrollStateChanged(state);
}
});
} }
@ -84,6 +103,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
} }
setLabelToPlusMinusView(view, getString(R.string.action_duration)); setLabelToPlusMinusView(view, getString(R.string.action_duration));
container.addView(view); container.addView(view);
view.requestFocus();
return view; return view;
} else if (col == 1) { } else if (col == 1) {
@ -144,7 +164,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
+ " " + (isSingleTarget ? SafeParse.stringToDouble(lowRange.editText.getText().toString()) : SafeParse.stringToDouble(highRange.editText.getText().toString())); + " " + (isSingleTarget ? SafeParse.stringToDouble(lowRange.editText.getText().toString()) : SafeParse.stringToDouble(highRange.editText.getText().toString()));
ListenerService.initiateAction(TempTargetActivity.this, actionstring); ListenerService.initiateAction(TempTargetActivity.this, actionstring);
finish(); finishAffinity();
} }
}); });
container.addView(view); container.addView(view);

View file

@ -12,6 +12,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@ -37,14 +38,33 @@ public class WizardActivity extends ViewSelectorActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout); setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.menu_wizard));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter()); pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator); DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager); dotsPageIndicator.setPager(pager);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
hasPercentage = sp.getBoolean("wizardpercentage", false); hasPercentage = sp.getBoolean("wizardpercentage", false);
pager.setOnPageChangeListener(new GridViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int row, int column, float rowOffset, float columnOffset, int rowOffsetPixels, int columnOffsetPixels) {
dotsPageIndicator.onPageScrolled(row, column, rowOffset, columnOffset, rowOffsetPixels,
columnOffsetPixels);
}
@Override
public void onPageSelected(int row, int column) {
dotsPageIndicator.onPageSelected(row, column);
View view = pager.getChildAt(column);
view.requestFocus();
}
@Override
public void onPageScrollStateChanged(int state) {
dotsPageIndicator.onPageScrollStateChanged(state);
}
});
} }
@ -80,6 +100,7 @@ public class WizardActivity extends ViewSelectorActivity {
} }
setLabelToPlusMinusView(view, getString(R.string.action_carbs)); setLabelToPlusMinusView(view, getString(R.string.action_carbs));
container.addView(view); container.addView(view);
view.requestFocus();
return view; return view;
} else if (col == 1 && hasPercentage) { } else if (col == 1 && hasPercentage) {
final View view = getInflatedPlusMinusView(container); final View view = getInflatedPlusMinusView(container);
@ -111,7 +132,7 @@ public class WizardActivity extends ViewSelectorActivity {
String actionstring = "wizard2 " + SafeParse.stringToInt(editCarbs.editText.getText().toString()) String actionstring = "wizard2 " + SafeParse.stringToInt(editCarbs.editText.getText().toString())
+ " " + percentage; + " " + percentage;
ListenerService.initiateAction(WizardActivity.this, actionstring); ListenerService.initiateAction(WizardActivity.this, actionstring);
finish(); finishAffinity();
} }
}); });
container.addView(view); container.addView(view);

View file

@ -1,6 +1,10 @@
package info.nightscout.androidaps.interaction.menus; package info.nightscout.androidaps.interaction.menus;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle;
import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
@ -14,13 +18,20 @@ import info.nightscout.androidaps.interaction.utils.MenuListActivity;
public class FillMenuActivity extends MenuListActivity { public class FillMenuActivity extends MenuListActivity {
@Override @Override
protected String[] getElements() { protected void onCreate(Bundle savedInstanceState) {
return new String[]{ setTitle(R.string.menu_prime_fill);
getString(R.string.action_preset_1), super.onCreate(savedInstanceState);
getString(R.string.action_preset_2), }
getString(R.string.action_preset_3),
getString(R.string.action_free_amount) @Override
}; protected List<MenuItem> getElements() {
List<MenuItem> menuItems = new ArrayList<>();
menuItems.add(new MenuItem(R.drawable.ic_canula, getString(R.string.action_preset_1)));
menuItems.add(new MenuItem(R.drawable.ic_canula, getString(R.string.action_preset_2)));
menuItems.add(new MenuItem(R.drawable.ic_canula, getString(R.string.action_preset_3)));
menuItems.add(new MenuItem(R.drawable.ic_canula, getString(R.string.action_free_amount)));
return menuItems;
} }
@Override @Override

View file

@ -5,7 +5,8 @@ import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import java.util.Vector; import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
@ -27,34 +28,35 @@ public class MainMenuActivity extends MenuListActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
sp = PreferenceManager.getDefaultSharedPreferences(this); sp = PreferenceManager.getDefaultSharedPreferences(this);
setTitle(R.string.label_actions_activity);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ListenerService.requestData(this); ListenerService.requestData(this);
} }
@Override @Override
protected String[] getElements() { protected List<MenuItem> getElements() {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
if (!sharedPreferences.getBoolean("wearcontrol", false)) { List<MenuItem> menuItems = new ArrayList<>();
return new String[]{ if (!sp.getBoolean("wearcontrol", false)) {
getString(R.string.menu_settings), menuItems.add(new MenuItem(R.drawable.ic_settings, getString(R.string.menu_settings)));
getString(R.string.menu_resync)}; menuItems.add(new MenuItem(R.drawable.ic_sync, getString(R.string.menu_resync)));
return menuItems;
} }
boolean showPrimeFill = sp.getBoolean("primefill", false); boolean showPrimeFill = sp.getBoolean("primefill", false);
boolean showWizard = sp.getBoolean("showWizard", true); boolean showWizard = sp.getBoolean("showWizard", true);
Vector<String> menuitems = new Vector<String>(); if (showWizard) menuItems.add(new MenuItem(R.drawable.ic_calculator, getString(R.string.menu_wizard)));
menuitems.add(getString(R.string.menu_tempt)); menuItems.add(new MenuItem(R.drawable.ic_e_carbs, getString(R.string.menu_ecarb)));
if (showWizard) menuitems.add(getString(R.string.menu_wizard)); menuItems.add(new MenuItem(R.drawable.ic_bolus, getString(R.string.menu_bolus)));
menuitems.add(getString(R.string.menu_ecarb)); menuItems.add(new MenuItem(R.drawable.ic_temptarget, getString(R.string.menu_tempt)));
menuitems.add(getString(R.string.menu_bolus)); menuItems.add(new MenuItem(R.drawable.ic_settings, getString(R.string.menu_settings)));
menuitems.add(getString(R.string.menu_settings)); menuItems.add(new MenuItem(R.drawable.ic_status, getString(R.string.menu_status)));
menuitems.add(getString(R.string.menu_status)); if (showPrimeFill) menuItems.add(new MenuItem(R.drawable.ic_canula, getString(R.string.menu_prime_fill)));
if (showPrimeFill) menuitems.add(getString(R.string.menu_prime_fill));
return menuitems.toArray(new String[menuitems.size()]); return menuItems;
} }
@Override @Override

View file

@ -1,5 +1,10 @@
package info.nightscout.androidaps.interaction.menus; package info.nightscout.androidaps.interaction.menus;
import android.os.Bundle;
import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.MenuListActivity; import info.nightscout.androidaps.interaction.utils.MenuListActivity;
@ -11,14 +16,20 @@ import info.nightscout.androidaps.interaction.utils.MenuListActivity;
public class StatusMenuActivity extends MenuListActivity { public class StatusMenuActivity extends MenuListActivity {
@Override @Override
protected String[] getElements() { protected void onCreate(Bundle savedInstanceState) {
return new String[] { setTitle(R.string.menu_status);
getString(R.string.status_pump), super.onCreate(savedInstanceState);
getString(R.string.status_loop), }
getString(R.string.status_cpp),
getString(R.string.status_tdd)};
@Override
protected List<MenuItem> getElements() {
List<MenuItem> menuitems = new ArrayList<>();
menuitems.add(new MenuItem(R.drawable.ic_status, getString(R.string.status_pump)));
menuitems.add(new MenuItem(R.drawable.ic_loop_closed, getString(R.string.status_loop)));
menuitems.add(new MenuItem(R.drawable.ic_status, getString(R.string.status_cpp)));
menuitems.add(new MenuItem(R.drawable.ic_tdd, getString(R.string.status_tdd)));
return menuitems;
} }
@Override @Override

View file

@ -1,120 +1,133 @@
package info.nightscout.androidaps.interaction.utils; package info.nightscout.androidaps.interaction.utils;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.wearable.view.WearableListView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import androidx.wear.widget.WearableLinearLayoutManager;
import androidx.wear.widget.WearableRecyclerView;
import java.util.List;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
/** /**
* Created by adrian on 08/02/17. * Created by adrian on 08/02/17.
*/ */
public abstract class MenuListActivity extends Activity public abstract class MenuListActivity extends Activity {
implements WearableListView.ClickListener { List<MenuItem> elements;
protected abstract List<MenuItem> getElements();
String[] elements;
protected abstract String[] getElements();
protected abstract void doAction(String position); protected abstract void doAction(String position);
@Override public interface AdapterCallback{
protected void onPause(){ void onItemClicked(MenuAdapter.ItemViewHolder v);
super.onPause();
finish();
} }
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
elements = getElements();
setContentView(R.layout.actions_list_activity); setContentView(R.layout.actions_list_activity);
TextView titleView = findViewById(R.id.title);
titleView.setText(getTitle());
// Get the list component from the layout of the activity elements = getElements();
WearableListView listView = CustomScrollingLayoutCallback customScrollingLayoutCallback = new CustomScrollingLayoutCallback();
findViewById(R.id.wearable_list); WearableLinearLayoutManager layoutManager = new WearableLinearLayoutManager(this);
if (this.getResources().getConfiguration().isScreenRound()) {
// Assign an adapter to the list layoutManager.setLayoutCallback(customScrollingLayoutCallback);
listView.setAdapter(new Adapter(this, elements));
// Set a click listener
listView.setClickListener(this);
} }
WearableRecyclerView listView = findViewById(R.id.action_list);
// WearableListView click listener listView.setHasFixedSize(true);
@Override listView.setEdgeItemsCenteringEnabled(true);
public void onClick(WearableListView.ViewHolder v) { listView.setLayoutManager(layoutManager);
listView.setAdapter(new MenuAdapter(elements, v -> {
String tag = (String) v.itemView.getTag(); String tag = (String) v.itemView.getTag();
doAction(tag); doAction(tag);
//ActionsDefinitions.doAction(v.getAdapterPosition(), this); }));
finish();
} }
@Override private class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.ItemViewHolder> {
public void onTopEmptyRegionClick() { private final List<MenuItem> mDataset;
} private AdapterCallback callback;
public MenuAdapter(List<MenuItem> dataset, AdapterCallback callback) {
private static final class Adapter extends WearableListView.Adapter {
private final String[] mDataset;
private final Context mContext;
private final LayoutInflater mInflater;
// Provide a suitable constructor (depends on the kind of dataset)
public Adapter(Context context, String[] dataset) {
mContext = context;
mInflater = LayoutInflater.from(context);
mDataset = dataset; mDataset = dataset;
this.callback = callback;
} }
// Provide a reference to the type of views you're using public class ItemViewHolder extends RecyclerView.ViewHolder {
public static class ItemViewHolder extends WearableListView.ViewHolder { protected final RelativeLayout menuContainer;
private final TextView textView; protected final TextView actionItem;
protected final ImageView actionIcon;
public ItemViewHolder(View itemView) { public ItemViewHolder(View itemView) {
super(itemView); super(itemView);
// find the text view within the custom item's layout menuContainer = itemView.findViewById(R.id.menu_container);
textView = itemView.findViewById(R.id.actionitem); actionItem = itemView.findViewById(R.id.menuItemText);
actionIcon = itemView.findViewById(R.id.menuItemIcon);
} }
} }
// Create new views for list items
// (invoked by the WearableListView's layout manager)
@Override @Override
public WearableListView.ViewHolder onCreateViewHolder(ViewGroup parent, public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
// Inflate our custom layout for list items ItemViewHolder recyclerViewHolder = new ItemViewHolder(view);
return new ItemViewHolder(mInflater.inflate(R.layout.list_item, null));
return recyclerViewHolder;
} }
// Replace the contents of a list item
// Instead of creating new views, the list tries to recycle existing ones
// (invoked by the WearableListView's layout manager)
@Override @Override
public void onBindViewHolder(WearableListView.ViewHolder holder, public void onBindViewHolder(ItemViewHolder holder, final int position) {
int position) { MenuItem item = mDataset.get(position);
// retrieve the text view holder.actionItem.setText(item.actionItem);
ItemViewHolder itemHolder = (ItemViewHolder) holder; holder.actionIcon.setImageResource(item.actionIcon);
TextView view = itemHolder.textView; holder.itemView.setTag(item.actionItem);
// replace text contents holder.menuContainer.setOnClickListener(v -> {
view.setText(mDataset[position]); callback.onItemClicked(holder);
// replace list item's metadata });
holder.itemView.setTag(mDataset[position]);
} }
// Return the size of your dataset
// (invoked by the WearableListView's layout manager)
@Override @Override
public int getItemCount() { public int getItemCount() {
return mDataset.length; return mDataset.size();
} }
} }
protected class MenuItem {
public MenuItem(int actionIcon, String actionItem) {
this.actionIcon = actionIcon;
this.actionItem = actionItem;
}
public int actionIcon;
public String actionItem;
}
public class CustomScrollingLayoutCallback extends WearableLinearLayoutManager.LayoutCallback {
// How much should we scale the icon at most.
private static final float MAX_ICON_PROGRESS = 0.65f;
private float progressToCenter;
@Override
public void onLayoutFinished(View child, RecyclerView parent) {
// Figure out % progress from top to bottom
float centerOffset = ((float) child.getHeight() / 2.0f) / (float) parent.getHeight();
float yRelativeToCenterOffset = (child.getY() / parent.getHeight()) + centerOffset;
// Normalize for center
progressToCenter = Math.abs(0.5f - yRelativeToCenterOffset);
// Adjust to the maximum scale
progressToCenter = Math.min(progressToCenter, MAX_ICON_PROGRESS);
child.setScaleX(1 - progressToCenter);
child.setScaleY(1 - progressToCenter);
}
}
} }

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.interaction.utils;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.support.wearable.input.RotaryEncoder;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
@ -19,7 +20,7 @@ import java.util.concurrent.TimeUnit;
* Created by mike on 28.06.2016. * Created by mike on 28.06.2016.
*/ */
public class PlusMinusEditText implements View.OnKeyListener, public class PlusMinusEditText implements View.OnKeyListener,
View.OnTouchListener, View.OnClickListener { View.OnTouchListener, View.OnClickListener, View.OnGenericMotionListener {
Integer editTextID; Integer editTextID;
public TextView editText; public TextView editText;
@ -104,6 +105,7 @@ public class PlusMinusEditText implements View.OnKeyListener,
plusImage.setOnTouchListener(this); plusImage.setOnTouchListener(this);
plusImage.setOnKeyListener(this); plusImage.setOnKeyListener(this);
plusImage.setOnClickListener(this); plusImage.setOnClickListener(this);
editText.setOnGenericMotionListener(this);
updateEditText(); updateEditText();
} }
@ -207,4 +209,18 @@ public class PlusMinusEditText implements View.OnKeyListener,
return false; return false;
} }
@Override
public boolean onGenericMotion(View v, MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_SCROLL && RotaryEncoder.isFromRotaryEncoder(ev)) {
float delta = -RotaryEncoder.getRotaryAxisValue(ev);
if (delta > 0) {
inc(1);
} else {
dec(1);
}
return true;
}
return false;
}
} }

View file

@ -1,54 +0,0 @@
package info.nightscout.androidaps.interaction.utils;
import android.content.Context;
import android.support.wearable.view.WearableListView;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import android.widget.TextView;
import info.nightscout.androidaps.R;
/**
* Created by adrian on 08/02/17.
*/
public class WearableListItemLayout extends LinearLayout
implements WearableListView.OnCenterProximityListener {
//private ImageView mCircle;
private TextView mName;
private final float mFadedTextAlpha;
public WearableListItemLayout(Context context) {
this(context, null);
}
public WearableListItemLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public WearableListItemLayout(Context context, AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
mFadedTextAlpha = 40 / 100f;
}
// Get references to the icon and text in the item layout definition
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mName = findViewById(R.id.actionitem);
}
@Override
public void onCenterPosition(boolean animate) {
mName.setAlpha(1f);
}
@Override
public void onNonCenterPosition(boolean animate) {
mName.setAlpha(mFadedTextAlpha);
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportHeight="30"
android:viewportWidth="30">
<path
android:pathData="M 15 0 c -8 0 -15 7 -15 15 c 0 8 7 15 15 15 s 15 -7 15 -15 C 30 7 23 0 15 0"
android:fillColor="@color/green"/>
<path android:fillColor="@android:color/white" android:pathData="M 20.625 18.345 h -4.083 c -0.063 0 -0.113 0.051 -0.113 0.113 v 1.292 c 0 0.063 0.051 0.113 0.113 0.113 h 4.083 c 0.063 0 0.113 -0.051 0.113 -0.113 v -1.292 C 20.738 18.396 20.688 18.345 20.625 18.345 z"/>
<path android:fillColor="@android:color/white" android:pathData="M 19.343 17.036 c 0 -0.063 -0.051 -0.113 -0.113 -0.113 h -1.292 c -0.063 0 -0.113 0.051 -0.113 0.113 v 1.016 h 1.519 V 17.036 z"/>
<path android:fillColor="@android:color/white" android:pathData="M 17.824 21.119 c 0 0.063 0.051 0.113 0.113 0.113 h 1.292 c 0.063 0 0.113 -0.051 0.113 -0.113 v -1.017 h -1.519 V 21.119 z"/>
<path android:fillColor="@android:color/white" android:pathData="M 22.836 4.96 h -15.1 c -0.344 0 -0.624 0.279 -0.624 0.624 v 18.375 c 0 0.345 0.279 0.624 0.624 0.624 h 15.1 c 0.345 0 0.624 -0.279 0.624 -0.624 V 5.583 C 23.46 5.239 23.181 4.96 22.836 4.96 z M 22.212 23.334 H 8.36 V 10.04 h 13.852 V 23.334 z M 22.212 8.793 H 8.36 V 6.207 h 13.852 V 8.793 z"/>
<path android:fillColor="@android:color/white" android:pathData="M 16.542 14.363 h 4.083 c 0.063 0 0.113 -0.051 0.113 -0.113 V 12.958 c 0 -0.063 -0.051 -0.113 -0.113 -0.113 h -4.083 c -0.063 0 -0.113 0.051 -0.113 0.113 v 1.292 C 16.429 14.313 16.479 14.363 16.542 14.363 z"/>
<path android:fillColor="@android:color/white" android:pathData="M 10.042 14.363 h 1.283 v 1.282 c 0 0.063 0.051 0.113 0.113 0.113 h 1.292 c 0.063 0 0.113 -0.051 0.113 -0.113 v -1.282 h 1.283 c 0.063 0 0.113 -0.051 0.113 -0.113 V 12.958 c 0 -0.063 -0.051 -0.113 -0.113 -0.113 H 12.842 V 11.563 c 0 -0.063 -0.051 -0.113 -0.113 -0.113 H 11.438 c -0.063 0 -0.113 0.051 -0.113 0.113 v 1.283 H 10.042 c -0.063 0 -0.113 0.051 -0.113 0.113 v 1.292 C 9.928 14.313 9.979 14.363 10.042 14.363 z"/>
<path android:fillColor="@android:color/white" android:pathData="M 13.157 19.078 l 0.907 -0.907 c 0.021 -0.021 0.033 -0.05 0.033 -0.08 s -0.012 -0.059 -0.033 -0.08 l -0.914 -0.913 c -0.044 -0.045 -0.116 -0.045 -0.16 0 l -0.907 0.907 l -0.907 -0.907 c -0.044 -0.045 -0.116 -0.045 -0.16 0 l -0.913 0.913 c -0.044 0.044 -0.044 0.116 0 0.16 l 0.907 0.907 l -0.907 0.907 c -0.044 0.044 -0.044 0.116 0 0.16 l 0.913 0.914 c 0.021 0.021 0.05 0.033 0.08 0.033 s 0.059 -0.012 0.08 -0.033 l 0.907 -0.907 l 0.907 0.907 c 0.021 0.021 0.05 0.033 0.08 0.033 s 0.059 -0.012 0.08 -0.033 l 0.914 -0.914 c 0.044 -0.044 0.044 -0.116 0 -0.16 L 13.157 19.078 z"/>
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportHeight="30"
android:viewportWidth="30">
<path
android:pathData="M 15 0 c -8 0 -15 7 -15 15 c 0 8 7 15 15 15 s 15 -7 15 -15 C 30 7 23 0 15 0"
android:fillColor="@color/yellow_700"/>
<path
android:pathData="M 25.3461 13.8038 h -2.189 c -0.0594 -0.8063 -0.7249 -1.4443 -1.5466 -1.4443 h -2.5894 c -0.8217 0 -1.4872 0.638 -1.5466 1.4443 h -2.189 c -0.4268 0 -0.7656 0.297 -0.8481 0.6842 c -1.452 -0.0231 -2.4486 -0.6105 -3.2296 -1.0989 c -0.77 -0.4807 -1.4344 -0.8954 -2.2055 -0.4774 c -1.3222 0.7194 -0.9273 2.2264 -0.6094 3.4386 c 0.2112 0.8041 0.429 1.6379 0.1078 2.0196 c -0.6633 0.7898 -2.4332 0.3036 -3.0591 0.0495 c -0.1573 -0.0627 -0.341 0.0121 -0.4059 0.1716 c -0.0649 0.1606 0.0121 0.3421 0.1716 0.4059 c 0.0671 0.0264 1.0681 0.4268 2.0823 0.4268 c 0.6314 0 1.2683 -0.1562 1.6874 -0.6523 c 0.5302 -0.6281 0.2816 -1.5763 0.0187 -2.5795 c -0.3553 -1.3574 -0.5269 -2.2814 0.3036 -2.7335 c 0.4312 -0.2343 0.8382 -0.0033 1.5774 0.4587 c 0.8305 0.5181 1.9426 1.2353 3.6949 1.2056 C 14.7311 15.3449 14.9841 15.5 15.2866 15.5 h 4.8466 v 6.3481 l 0.3663 -0.9394 V 15.5 h 4.8466 c 0.4873 0 0.8822 -0.3795 0.8822 -0.8481 S 25.8334 13.8038 25.3461 13.8038 z"
android:fillColor="@android:color/white"/>
</vector>

View file

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportHeight="30"
android:viewportWidth="30">
<path
android:pathData="M 15 0 c -8 0 -15 7 -15 15 c 0 8 7 15 15 15 s 15 -7 15 -15 C 30 7 23 0 15 0"
android:fillColor="@color/yellow_700"/>
<path
android:pathData="m 7.5141 22.7634 c -0.2986 -0.3299 -0.2903 -0.3554 0.2922 -0.8979 c 0.3297 -0.3071 0.6383 -0.6738 0.6858 -0.8149 c 0.0475 -0.141 -0.1921 -0.7568 -0.5325 -1.3682 c -0.5896 -1.0592 -0.6188 -1.1883 -0.6188 -2.7364 c 0 -1.4789 0.0452 -1.7064 0.5039 -2.5344 c 0.6105 -1.1021 1.5893 -2.0253 1.8601 -1.7544 c 0.3483 0.3483 0.5587 0.1819 1.0118 -0.7992 c 0.7093 -1.5363 1.3211 -2.1695 2.1021 -2.1755 c 0.6115 -0.0053 0.664 -0.0481 0.8942 -0.7375 c 0.1359 -0.407 0.6179 -1.129 1.0849 -1.6248 l 0.8403 -0.8923 l 0.6745 0.7614 c 0.371 0.4188 0.8112 1.0152 0.9782 1.3255 c 0.167 0.3102 0.4016 0.564 0.5211 0.564 c 0.1196 0 0.6601 -0.3433 1.201 -0.7628 c 1.3668 -1.06 2.5215 -1.4125 4.2988 -1.3124 c 0.396 0.0213 0.4054 0.0564 0.325 1.1801 c -0.1013 1.4152 -0.5647 2.5089 -1.4872 3.5097 c -0.3846 0.4173 -0.6993 0.8439 -0.6993 0.9481 c 0 0.1043 0.4041 0.4545 0.8979 0.7784 c 0.4938 0.324 1.115 0.7698 1.3803 0.9908 l 0.4824 0.4017 l -0.6535 0.6627 c -0.3594 0.3645 -1.0768 0.8572 -1.5941 1.095 c -1.067 0.4903 -1.2364 0.6671 -1.0225 1.0669 c 0.1947 0.3638 -0.7979 1.3504 -1.885 1.8734 c -1.2965 0.6237 -1.2856 0.6136 -1.2323 1.1529 c 0.0403 0.4072 -0.0783 0.6225 -0.5908 1.0725 c -0.3527 0.3097 -1.0566 0.7532 -1.5643 0.9856 c -0.8099 0.3708 -1.0994 0.4134 -2.3604 0.3472 c -1.2415 -0.0652 -1.6009 -0.1609 -2.6389 -0.7031 l -1.2016 -0.6277 l -0.7405 0.6826 c -0.4073 0.3754 -0.7777 0.6826 -0.8232 0.6826 c -0.0455 0 -0.2209 -0.1527 -0.3899 -0.3395 z M 15.4237 21.7239 c 0.4009 -0.1726 0.7794 -0.4454 0.8412 -0.6064 c 0.2746 -0.7156 -2.055 -1.7385 -3.5062 -1.5396 c -0.9984 0.137 -2.254 0.864 -2.254 1.3054 c 0 0.6595 2.2346 1.4303 3.5915 1.2388 c 0.3292 -0.0466 0.9266 -0.2256 1.3275 -0.3982 z M 10.2885 19.1385 c 0.4061 -0.6143 0.472 -0.8854 0.4678 -1.924 c -0.0063 -1.5335 -0.6186 -2.9192 -1.29 -2.9192 c -0.9294 0 -1.5377 2.5971 -0.9856 4.2073 c 0.5253 1.5321 1.0851 1.729 1.8078 0.6359 z M 17.6886 18.9823 c 0.9945 -0.2133 1.8196 -0.8183 1.6651 -1.2209 c -0.1975 -0.5147 -1.9131 -1.1915 -3.0203 -1.1915 c -1.0977 0 -2.2833 0.5008 -2.6492 1.119 c -0.2247 0.3797 0.184 0.7184 1.4172 1.1741 c 0.9392 0.3471 1.421 0.3693 2.5871 0.1192 z M 13.0604 16.5752 c 0.9308 -0.999 1.1002 -2.9508 0.3789 -4.3646 c -0.6882 -1.3489 -1.1359 -1.381 -1.7439 -0.125 c -0.6476 1.3377 -0.4749 3.0666 0.4469 4.4758 c 0.314 0.48 0.4815 0.4826 0.9182 0.0133 z M 21.5786 15.6696 c 0.9454 -0.4402 1.0921 -0.7235 0.5986 -1.1562 c -1.3166 -1.1544 -3.6084 -1.2763 -5.0452 -0.2683 c -0.7385 0.5181 -0.6049 0.8802 0.5131 1.3905 c 1.3181 0.6016 2.689 0.6135 3.9336 0.034 z M 16.5457 12.8415 c 0.3972 -0.774 0.4714 -1.1072 0.419 -1.8813 c -0.0691 -1.022 -0.7038 -2.4932 -1.1873 -2.752 c -0.4231 -0.2264 -0.9486 0.3947 -1.2703 1.5014 c -0.3046 1.0479 -0.1404 2.3277 0.4461 3.4774 c 0.5043 0.9885 0.9586 0.8898 1.5925 -0.3456 z M 19.9966 11.9951 c 1.0135 -0.4396 1.7154 -1.1061 2.21 -2.0986 c 0.8101 -1.6257 0.5226 -2.1729 -0.9168 -1.7455 c -1.5157 0.4501 -3.1317 2.3134 -3.1317 3.6109 c 0 0.7925 0.4247 0.8464 1.8385 0.2333 z"
android:strokeWidth="1"
android:fillColor="@android:color/white"/>
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportHeight="30"
android:viewportWidth="30">
<path
android:pathData="M 15 0 c -8 0 -15 7 -15 15 c 0 8 7 15 15 15 s 15 -7 15 -15 C 30 7 23 0 15 0"
android:fillColor="@color/green_900"/>
<path
android:pathData="M 27 12.343 l -5.781 -3.968 l -1.328 6.688 l 2.102 -1.757 c 0.014 0.056 0.03 0.111 0.043 0.168 c 0.116 0.512 0.183 1.042 0.183 1.589 c 0 3.952 -3.204 7.156 -7.156 7.156 s -7.156 -3.204 -7.156 -7.156 s 3.204 -7.156 7.156 -7.156 c 1.072 0 2.085 0.242 2.998 0.665 c 0.325 0.151 0.639 0.321 0.936 0.517 l 0.002 -0.002 l -0.352 -1.784 l 1.876 -0.538 c -1.567 -1.033 -3.442 -1.639 -5.46 -1.639 c -5.488 0 -9.938 4.449 -9.938 9.938 S 9.574 25 15.063 25 S 25 20.551 25 15.063 c 0 -0.759 -0.093 -1.496 -0.254 -2.206 c -0.04 -0.176 -0.085 -0.35 -0.134 -0.523 L 27 12.343 L 27 12.343 z"
android:fillColor="@android:color/white"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M24,9.343l-5.781,-3.968l-1.328,6.688l2.102,-1.757c0.014,0.056 0.03,0.111 0.043,0.168c0.116,0.512 0.183,1.042 0.183,1.589c0,3.952 -3.204,7.156 -7.156,7.156s-7.156,-3.204 -7.156,-7.156s3.204,-7.156 7.156,-7.156c1.072,0 2.085,0.242 2.998,0.665c0.325,0.151 0.639,0.321 0.936,0.517l0.002,-0.002l-0.352,-1.784l1.876,-0.538c-1.567,-1.033 -3.442,-1.639 -5.46,-1.639c-5.488,0 -9.938,4.449 -9.938,9.938S6.574,22 12.063,22S22,17.551 22,12.063c0,-0.759 -0.093,-1.496 -0.254,-2.206c-0.04,-0.176 -0.085,-0.35 -0.134,-0.523L24,9.343L24,9.343z"
android:fillColor="@android:color/white"/>
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportHeight="30"
android:viewportWidth="30">
<path
android:pathData="M 15 0 c -8 0 -15 7 -15 15 c 0 8 7 15 15 15 s 15 -7 15 -15 C 30 7 23 0 15 0"
android:fillColor="@color/bluegray_700"/>
<path
android:fillColor="@android:color/white"
android:pathData="M 22.14 15.94 c 0.04 -0.3 0.06 -0.61 0.06 -0.94 c 0 -0.32 -0.02 -0.64 -0.07 -0.94 l 2.03 -1.58 c 0.18 -0.14 0.23 -0.41 0.12 -0.61 l -1.92 -3.32 c -0.12 -0.22 -0.37 -0.29 -0.59 -0.22 l -2.39 0.96 c -0.5 -0.38 -1.03 -0.7 -1.62 -0.94 L 17.4 5.81 c -0.04 -0.24 -0.24 -0.41 -0.48 -0.41 h -3.84 c -0.24 0 -0.43 0.17 -0.47 0.41 L 12.25 8.35 C 11.66 8.59 11.12 8.92 10.63 9.29 L 8.24 8.33 c -0.22 -0.08 -0.47 0 -0.59 0.22 L 5.74 11.87 C 5.62 12.08 5.66 12.34 5.86 12.48 l 2.03 1.58 C 7.84 14.36 7.8 14.69 7.8 15 s 0.02 0.64 0.07 0.94 l -2.03 1.58 c -0.18 0.14 -0.23 0.41 -0.12 0.61 l 1.92 3.32 c 0.12 0.22 0.37 0.29 0.59 0.22 l 2.39 -0.96 c 0.5 0.38 1.03 0.7 1.62 0.94 l 0.36 2.54 c 0.05 0.24 0.24 0.41 0.48 0.41 h 3.84 c 0.24 0 0.44 -0.17 0.47 -0.41 l 0.36 -2.54 c 0.59 -0.24 1.13 -0.56 1.62 -0.94 l 2.39 0.96 c 0.22 0.08 0.47 0 0.59 -0.22 l 1.92 -3.32 c 0.12 -0.22 0.07 -0.47 -0.12 -0.61 L 22.14 15.94 z M 15 18.6 c -1.98 0 -3.6 -1.62 -3.6 -3.6 s 1.62 -3.6 3.6 -3.6 s 3.6 1.62 3.6 3.6 S 16.98 18.6 15 18.6 z"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12.028,2.042c-5.523,0 -10,4.477 -10,10c0,5.523 4.477,10 10,10s10,-4.477 10,-10C22.028,6.519 17.551,2.042 12.028,2.042zM13.007,16.958h-1.958V11h1.958V16.958zM13.007,8.958h-1.958V7h1.958V8.958z"
android:fillColor="@color/white"/>
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportHeight="30"
android:viewportWidth="30">
<path
android:pathData="M 15 0 c -8 0 -15 7 -15 15 c 0 8 7 15 15 15 s 15 -7 15 -15 C 30 7 23 0 15 0"
android:fillColor="@color/blue_900"/>
<path
android:fillColor="@android:color/white"
android:pathData="m 16 10.101 l 0.01 0.001 a 4.978 4.978 0 0 1 2.526 1.362 a 5.005 5.005 0 0 1 1.363 2.528 a 5.061 5.061 0 0 1 -0.001 2.016 a 4.976 4.976 0 0 1 -1.363 2.527 l 1.414 1.414 a 7.014 7.014 0 0 0 1.908 -3.54 a 6.98 6.98 0 0 0 0 -2.819 a 6.957 6.957 0 0 0 -1.907 -3.539 a 6.97 6.97 0 0 0 -2.223 -1.5 a 6.921 6.921 0 0 0 -1.315 -0.408 c -0.137 -0.028 -0.275 -0.043 -0.412 -0.063 V 5 L 12 9 l 4 4 V 10.101 z m -7.45 7.623 c 0.174 0.412 0.392 0.812 0.646 1.19 c 0.249 0.37 0.537 0.718 0.854 1.034 a 7.036 7.036 0 0 0 2.224 1.501 c 0.425 0.18 0.868 0.317 1.315 0.408 c 0.167 0.034 0.338 0.056 0.508 0.078 v 2.944 l 4 -4 l -4 -4 v 3.03 c -0.035 -0.006 -0.072 -0.003 -0.107 -0.011 a 4.978 4.978 0 0 1 -2.526 -1.362 a 4.994 4.994 0 0 1 0.001 -7.071 L 10.051 10.05 a 7.01 7.01 0 0 0 -1.5 2.224 A 6.974 6.974 0 0 0 8 15 a 6.997 6.997 0 0 0 0.55 2.724 z"/>
</vector>

View file

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportHeight="30"
android:viewportWidth="30">
<path
android:pathData="M 15 0 c -8 0 -15 7 -15 15 c 0 8 7 15 15 15 s 15 -7 15 -15 C 30 7 23 0 15 0"
android:fillColor="@color/blue_500"/>
<path
android:pathData="M 18.9697 5.6014 C 18.9562 5.5811 18.5848 5.9202 17.8469 6.6082 L 16.8729 7.5168 L 16.4459 7.4145 C 15.1908 7.1103 14.9658 7.074 14.7583 7.1334 C 14.6287 7.1707 13.2419 8.4746 11.4445 10.2494 C 8.744 12.9159 8.3351 13.2886 8.2112 13.1962 C 8.1332 13.1381 8.0515 13.0499 8.0298 12.9997 C 7.9672 12.8543 7.483 12.8196 7.2917 12.9465 C 7.1158 13.0638 7.0348 13.3246 7.0925 13.5836 C 7.1097 13.6608 7.42 14.0439 7.7828 14.4336 C 8.1457 14.8231 8.439 15.1667 8.4363 15.1825 C 8.433 15.2048 8.1326 15.5056 7.7678 15.8524 C 7.127 16.4614 7.0983 16.4775 6.9438 16.3244 C 6.5864 15.9693 6.3225 15.7551 6.2194 15.7419 C 6.1597 15.7327 6.0029 15.8044 5.8728 15.9001 C 5.6156 16.0917 5.5281 16.3869 5.6628 16.6164 C 5.7099 16.6967 6.1905 17.2412 6.731 17.8251 C 7.7952 18.9752 7.9791 19.0809 8.3285 18.7515 C 8.6389 18.4586 8.6234 18.2574 8.2548 17.7951 C 8.0357 17.5201 7.9497 17.344 8.0038 17.278 C 8.2564 16.971 9.1933 16.0956 9.2589 16.1061 C 9.3015 16.1125 9.626 16.4327 9.9806 16.8183 C 10.704 17.6047 10.96 17.7057 11.319 17.3476 C 11.5596 17.1078 11.5383 16.8545 11.2467 16.495 L 11.0407 16.2412 L 14.1621 13.158 C 16.6585 10.6922 17.2912 10.0245 17.3217 9.8196 C 17.3426 9.6791 17.2906 9.1487 17.2057 8.6409 L 17.0516 7.7173 L 17.9438 6.7528 C 18.639 6.0011 18.9832 5.6216 18.9697 5.6014 z M 14.9315 7.6928 C 15.0579 7.6875 15.2392 7.708 15.5304 7.7514 C 16.5419 7.9021 16.5739 7.9291 16.7214 8.8046 C 16.7904 9.2136 16.8368 9.6125 16.8251 9.6914 C 16.8134 9.7702 15.4388 11.1832 13.7705 12.8306 C 11.5681 15.0053 10.7048 15.8082 10.6177 15.7583 C 10.5526 15.7181 10.4806 15.6872 10.4622 15.6846 L 10.4622 15.686 C 10.2801 15.6588 10.7526 15.1264 12.2862 13.6341 C 13.2773 12.6698 14.0834 11.8528 14.0761 11.8237 C 14.0695 11.7919 13.7052 11.3779 13.2671 10.9042 C 12.8291 10.4304 12.475 10.0195 12.4813 9.9834 C 12.4873 9.9509 12.5758 9.8434 12.6778 9.7446 L 12.8633 9.5659 L 13.4731 10.2289 C 14.0352 10.8401 14.2725 10.985 14.248 10.7037 C 14.2427 10.6424 13.978 10.314 13.66 9.9752 L 13.0829 9.3585 L 13.2971 9.1361 C 13.4152 9.0134 13.5292 8.9166 13.5523 8.9192 C 13.5745 8.9226 13.8602 9.2165 14.188 9.5727 C 14.7459 10.1788 14.9295 10.2917 14.9656 10.0488 C 14.9738 9.9936 14.7113 9.6657 14.3831 9.3203 C 13.8797 8.7901 13.8026 8.6708 13.8906 8.5523 C 14.1744 8.1707 14.2575 8.1987 14.8906 8.8919 C 15.2211 9.2538 15.5271 9.5299 15.5714 9.5141 C 15.7554 9.435 15.6531 9.246 15.1212 8.6846 C 14.8124 8.3583 14.544 8.0563 14.525 8.0106 C 14.5058 7.965 14.5671 7.8654 14.6614 7.7883 C 14.7333 7.7286 14.8051 7.698 14.9315 7.6928 z M 13.4117 17.409 A 0.5602 0.5602 90 0 0 13.4677 18.5277 L 18.3817 18.5277 A 0.5595 0.5595 90 1 0 18.3817 17.409 L 13.4677 17.409 A 0.5595 0.5595 90 0 0 13.4117 17.409 z M 19.9547 17.409 A 0.5602 0.5602 90 0 0 20.0107 18.5277 L 21.7896 18.5277 A 0.5595 0.5595 90 1 0 21.7896 17.409 L 20.0107 17.409 A 0.5595 0.5595 90 0 0 19.9547 17.409 z M 13.4117 19.3272 A 0.5602 0.5602 90 0 0 13.4677 20.4459 L 15.5877 20.4459 A 0.5595 0.5595 90 1 0 15.5877 19.3272 L 13.4677 19.3272 A 0.5595 0.5595 90 0 0 13.4117 19.3272 z M 17.1798 19.3272 A 0.5602 0.5602 90 0 0 17.2371 20.4459 L 21.7896 20.4459 A 0.5595 0.5595 90 1 0 21.7896 19.3272 L 17.2371 19.3272 A 0.5595 0.5595 90 0 0 17.1798 19.3272 z M 13.4117 21.2453 A 0.5602 0.5602 90 0 0 13.4677 22.364 L 21.7896 22.364 A 0.5595 0.5595 90 1 0 21.7896 21.2453 L 13.4677 21.2453 A 0.5595 0.5595 90 0 0 13.4117 21.2453 z"
android:strokeWidth="3.77952743"
android:fillColor="@android:color/white"/>
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportHeight="30"
android:viewportWidth="30">
<path
android:pathData="M 15 0 c -8 0 -15 7 -15 15 c 0 8 7 15 15 15 s 15 -7 15 -15 C 30 7 23 0 15 0"
android:fillColor="@color/purple_500"/>
<path
android:pathData="M 24.569 15.709 h -4.772 c -0.392 0 -0.709 -0.317 -0.709 -0.709 V 12.177 H 10.927 l 0 2.823 c 0 0.392 -0.317 0.709 -0.708 0.709 H 5.431 c -0.392 0 -0.708 -0.317 -0.708 -0.709 s 0.317 -0.708 0.708 -0.708 H 9.51 l 0 -2.823 c 0 -0.392 0.317 -0.708 0.708 -0.708 h 9.578 c 0.392 0 0.709 0.317 0.709 0.708 v 2.823 h 4.063 c 0.392 0 0.709 0.317 0.709 0.708 S 24.961 15.709 24.569 15.709 z"
android:fillColor="@android:color/white"/>
</vector>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/gray_700">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/gray_900" />
<corners android:radius="35dp" />
</shape>
</item>
</ripple>

View file

@ -1,23 +1,37 @@
<info.nightscout.androidaps.interaction.utils.WearableListItemLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/menu_container"
android:gravity="center_vertical" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="80dp"> android:layout_height="wrap_content"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:background="@drawable/menu_item_layout_bg">
<ImageView
android:id="@+id/menuItemIcon"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:src="@drawable/circle" />
<TextView <TextView
android:id="@+id/actionitem" android:id="@+id/menuItemText"
android:gravity="center_vertical|center_horizontal" android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="35dp"
android:layout_marginRight="16dp" android:layout_centerVertical="true"
android:layout_marginLeft="16dp" android:layout_marginStart="10dp"
android:layout_height="match_parent" android:layout_toEndOf="@+id/menuItemIcon"
android:fontFamily="sans-serif-condensed-light" android:layout_toRightOf="@+id/menuItemIcon"
android:lineSpacingExtra="-4sp" android:text="action item"
android:textColor="@color/dark_statusView" android:textColor="@color/dark_statusView"
android:textSize="32sp" android:textSize="20sp"
android:autoSizeTextType="uniform" android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp" android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="32sp" android:autoSizeMaxTextSize="32sp"
android:autoSizeStepGranularity="2sp" android:autoSizeStepGranularity="2sp"
/> android:textStyle="bold" />
</info.nightscout.androidaps.interaction.utils.WearableListItemLayout>
</RelativeLayout>

View file

@ -1,21 +1,27 @@
<android.support.wearable.view.BoxInsetLayout <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/nslogo_background"
android:layout_height="match_parent"
android:layout_width="match_parent">
<FrameLayout
android:id="@+id/frame_layout"
android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
app:layout_box="left|bottom|right"> android:layout_height="match_parent" >
<android.support.wearable.view.WearableListView <androidx.wear.widget.WearableRecyclerView
android:id="@+id/wearable_list" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/action_list"
android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="match_parent"> android:scrollbars="vertical" >
</android.support.wearable.view.WearableListView> <requestFocus />
</FrameLayout> </androidx.wear.widget.WearableRecyclerView>
</android.support.wearable.view.BoxInsetLayout>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="26dp"
android:gravity="center"
android:text="Title"
android:textSize="18sp"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="18sp"
android:background="#D9000000"/>
</FrameLayout>

View file

@ -3,6 +3,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" >
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="26dp"
android:gravity="center"
android:textSize="18sp"/>
<android.support.wearable.view.GridViewPager <android.support.wearable.view.GridViewPager
android:id="@+id/pager" android:id="@+id/pager"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -1,24 +1,33 @@
<info.nightscout.androidaps.interaction.utils.WearableListItemLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/menu_container"
android:gravity="center_vertical" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="80dp"> android:layout_height="wrap_content"
<!-- ImageView android:paddingBottom="8dp"
android:id="@+id/circle" android:paddingTop="8dp"
android:layout_height="20dp" android:background="@drawable/menu_item_layout_bg">
android:layout_margin="16dp"
android:layout_width="20dp"
android:src="@drawable/wl_circle"/-->
<TextView
android:id="@+id/actionitem"
android:gravity="center_vertical|center_horizontal"
android:layout_width="match_parent"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
android:layout_height="match_parent"
android:fontFamily="sans-serif-condensed-light"
android:lineSpacingExtra="-4sp"
android:textColor="@color/dark_statusView"
android:textSize="32sp"/>
</info.nightscout.androidaps.interaction.utils.WearableListItemLayout>
<ImageView
android:id="@+id/menuItemIcon"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:src="@drawable/circle" />
<TextView
android:id="@+id/menuItemText"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:layout_toEndOf="@+id/menuItemIcon"
android:layout_toRightOf="@+id/menuItemIcon"
android:text="action item"
android:textColor="@color/dark_statusView"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>