Merge branch 'dev' of https://github.com/nightscout/AndroidAPS into dev
This commit is contained in:
commit
ff91ebb994
26 changed files with 208 additions and 301 deletions
|
@ -106,7 +106,7 @@
|
|||
<string name="sms_basal">Dosis Basal:</string>
|
||||
<string name="changeyourinput">¡Cambiar datos!</string>
|
||||
<string name="configbuilder_bgsource">Origen de Glucosa</string>
|
||||
<string name="configbuilder_bgsource_description">¿De donde debe AndroidAPS obtener sus datos?</string>
|
||||
<string name="configbuilder_bgsource_description">¿De dónde debe AndroidAPS obtener sus datos?</string>
|
||||
<string name="xdrip">xDrip+</string>
|
||||
<string name="apsmode_title">Modo APS</string>
|
||||
<string name="closedloop">Lazo cerrado</string>
|
||||
|
@ -536,7 +536,7 @@
|
|||
<string name="wear_notifysmb_summary">Mostrar SMB en el reloj como un bolo estándar</string>
|
||||
<string name="ns_create_announcements_from_errors_title">Crear notificaciones de los errores</string>
|
||||
<string name="ns_create_announcements_from_carbs_req_title">Crear notificaciones de alertas de carbohidratos necesarios</string>
|
||||
<string name="ns_create_announcements_from_errors_summary">Crear notificaciones en Nightscout para diálogos de error y alertas locales (también visibles en el portal del cuidador, en los tratamientos)</string>
|
||||
<string name="ns_create_announcements_from_errors_summary">Crear notificaciones en Nightscout para diálogos de error y alertas locales (también visibles en el portal de cuidados, en los tratamientos)</string>
|
||||
<string name="ns_create_announcements_from_carbs_req_summary">Crear notificaciones de Nightscout para las alertas de carbohidratos necesarios</string>
|
||||
<string name="wear_predictions_summary">Mostrar las predicciones en el reloj</string>
|
||||
<string name="wear_predictions_title">Predicciones</string>
|
||||
|
|
|
@ -629,6 +629,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
|
|||
<string name="exitwizard">Ignorer l\'assistant de configuration</string>
|
||||
<string name="setupwizard_loop_description">Appuyez sur le bouton ci-dessous pour autoriser AndroidAPS à suggérer/faire des changements de basal</string>
|
||||
<string name="setupwizard_sensitivity_description">Le plugin de Sensibilité est utilisé pour la détection de la Sensibilité et de calcul de glucides actifs. Pour plus d’informations visitez :</string>
|
||||
<string name="setupwizard_sensitivity_url">https://androidaps.readthedocs.io/fr/latest/Configuration/Sensitivity-detection-and-COB.html</string>
|
||||
<string name="nsclientinfotext">Le NSClient gère la connexion avec Nightscout. Vous pouvez sauter cette étape maintenant mais vous ne pourrez pas terminer les objectifs sans cette configuration.</string>
|
||||
<string name="diawarning">Rappel : les nouveaux profils d\'insuline requièrent une DIA d\'au moins 5h. Une DIA 5-6h dans les nouveaux profils d\'insuline équivaut à une DIA 3h dans les anciens profils d\'insuline.</string>
|
||||
<string name="setupwizard_aps_description">Sélectionnez un des algorithmes disponibles. Ils sont organisés du plus ancien au plus récent. Les algorithmes les plus récents sont habituellement plus puissants et plus agressifs. De ce fait, si vous êtes un nouvel utilisateur, vous devriez probablement démarrer avec AMA au lieu de choisir un algorithme plus récent. N\'oubliez pas de lire la documentation OpenAPS et en faire la configuration avant utilisation.</string>
|
||||
|
|
|
@ -628,6 +628,7 @@
|
|||
<string name="exitwizard">Pomiń Kreatora konfiguracji</string>
|
||||
<string name="setupwizard_loop_description">Naciśnij przycisk poniżej, by umożliwić AndroidAPS wprowadzenie zmian insuliny bazowej</string>
|
||||
<string name="setupwizard_sensitivity_description">Wtyczka wrażliwości używana jest w celu określenia wrażliwości i kalkulacji COB. Więcej informacji na:</string>
|
||||
<string name="setupwizard_sensitivity_url">https://androidaps.readthedocs.io/en/latest/Configuration/Sensitivity-detection-and-COB.html</string>
|
||||
<string name="nsclientinfotext">NSClient obsługuje połączenia z Nightscout. Można teraz pominąć tę część, ale nie będziesz mógł wykonać Zadań (programu do nauki), dopóki nie dokończysz tej konfiguracji.</string>
|
||||
<string name="diawarning">Pamiętaj: nowe profile insuliny wymagają ustawienia DIA (czas działania insuliny) powyżej 5h. DIA między 5-6h na nowym profilu odpowiada 3h DIA na starych profilach insuliny.</string>
|
||||
<string name="setupwizard_aps_description">Wybierz jeden z dostępnych algorytmów. Ułożone są one od najstarszych do najnowszych. Nowszy algorytm jest zazwyczaj bardziej wydajny i agresywny. Jeśli jesteś nowym użytkownikiem, lepiej zacznij od zaawansowanego asystenta posiłku AMA, a nie od najnowszego algorytmu. Zapoznaj się koniecznie z dokumentacją OpenAPS przed wybraniem odpowiedniego algorytmu i jego konfiguracją.</string>
|
||||
|
|
|
@ -629,6 +629,7 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
|
|||
<string name="exitwizard">Kurulum sihirbazını atla</string>
|
||||
<string name="setupwizard_loop_description">AndroidAPS\'ın bazal değişiklikleri önerme/yapmasını sağlamak için aşağıdaki düğmeye basın</string>
|
||||
<string name="setupwizard_sensitivity_description">Duyarlılık eklentisi, duyarlılık tespiti ve COB hesaplaması için kullanılır. Daha fazla bilgi için ziyaret edin:</string>
|
||||
<string name="setupwizard_sensitivity_url">https://androidaps.readthedocs.io/en/latest/Configuration/Sensitivity-detection-and-COB.html</string>
|
||||
<string name="nsclientinfotext">NSClient, Nightscout\'a bağlantıyı sağlar. Şimdi bu kısmı atlayabilirsiniz, ancak ayarlamadan görevleri geçemezsiniz.</string>
|
||||
<string name="diawarning">Lütfen unutmayın: yeni insülin profilleri en az 5 saat DIA gerektirir. Yeni profildeki DIA 5–6 saat, eski insülin profillerinde DIA 3saat\'e eşittir.</string>
|
||||
<string name="setupwizard_aps_description">Mevcut algoritmalardan birini seçin. En eskiden en yeniye doğru sıralanırlar. Yeni algoritma genellikle daha güçlü ve daha agresiftir. Bu nedenle, yeni bir kullanıcı iseniz, muhtemelen en sonuncusu ile değil, AMA ile başlayabilirsiniz. OpenAPS belgelerini okumayı ve kullanmadan önce yapılandırmayı unutmayın.</string>
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
<string name="careportal_tempbasalend">Fin Basal Temp</string>
|
||||
<string name="careportal_carbscorrection">Corrección Carbohidratos</string>
|
||||
<string name="careportal_openapsoffline">OpenAPS sin conexión</string>
|
||||
<string name="careportal_pumpbatterychange">Cambio de batería en la bomba</string>
|
||||
<string name="careportal_pumpbatterychange">Cambio batería de bomba</string>
|
||||
<string name="careportal_temporarytarget">Objetivo temporal</string>
|
||||
<string name="careportal_temporarytargetvalue">Valor objetivo temporal</string>
|
||||
<string name="careportal_temporarytargetcancel">Cancelar Objetivo temporal</string>
|
||||
|
@ -338,13 +338,13 @@
|
|||
<string name="uel_calibration">CALIBRACIÓN</string>
|
||||
<string name="uel_prime_bolus">BOLO DE CEBADO</string>
|
||||
<string name="uel_treatment">TRATAMIENTO</string>
|
||||
<string name="uel_careportal_ns_refresh">ACTUALIZAR PORTAL DEL CUIDADOR NS</string>
|
||||
<string name="uel_careportal_ns_refresh">ACTUALIZAR PORTAL DE CUIDADOS NS</string>
|
||||
<string name="uel_profile_switch_ns_refresh">ACTUALIZAR CAMBIO DE PERFIL EN NS</string>
|
||||
<string name="uel_treatments_ns_refresh">ACTUALIZAR TRATAMIENTOS NS</string>
|
||||
<string name="uel_tt_ns_refresh">ACTUALIZAR OBJETIVO TEMPORAL EN NS</string>
|
||||
<string name="uel_automation_removed">AUTOMACIÓN ELIMINADA</string>
|
||||
<string name="uel_bg_removed">BG ELIMINADO</string>
|
||||
<string name="uel_careportal_removed">PORTAL DEL CUIDADOR ELIMINADO</string>
|
||||
<string name="uel_careportal_removed">PORTAL DE CUIDADOS ELIMINADO</string>
|
||||
<string name="uel_bolus_removed">BOLO ELIMINADO</string>
|
||||
<string name="uel_carbs_removed">CARBOHIDRATOS ELIMINADOS</string>
|
||||
<string name="uel_temp_basal_removed">BASAL TEMPORAL ELIMINADA</string>
|
||||
|
|
|
@ -49,7 +49,7 @@ def generateGitBuild = { ->
|
|||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
compileSdkVersion 31
|
||||
|
||||
defaultConfig {
|
||||
applicationId "info.nightscout.androidaps"
|
||||
|
@ -117,8 +117,6 @@ dependencies {
|
|||
implementation project(':shared')
|
||||
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
//implementation files("libs/hellocharts-library-1.5.5.jar")
|
||||
//compile "com.ustwo.android:clockwise-wearable:1.0.2"
|
||||
|
||||
implementation "androidx.appcompat:appcompat:$appcompat_version"
|
||||
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
||||
|
@ -131,10 +129,12 @@ dependencies {
|
|||
implementation(name: 'ustwo-clockwise-debug', ext: 'aar')
|
||||
implementation(name: 'wearpreferenceactivity-0.5.0', ext: 'aar')
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.percentlayout:percentlayout:1.0.0'
|
||||
implementation 'androidx.wear:wear:1.1.0'
|
||||
implementation 'androidx.wear:wear:1.2.0'
|
||||
implementation('com.github.lecho:hellocharts-library:1.5.8@aar')
|
||||
|
||||
implementation "androidx.core:core-ktx:$coreVersion"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation 'org.json:json:20211205'
|
||||
testImplementation("org.mockito:mockito-core:${mockitoVersion}") {
|
||||
|
@ -157,9 +157,6 @@ dependencies {
|
|||
}
|
||||
testImplementation "org.skyscreamer:jsonassert:1.5.0"
|
||||
testImplementation "org.hamcrest:hamcrest-all:1.3"
|
||||
implementation "androidx.core:core-ktx:$coreVersion"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
|
||||
|
||||
// for old fashioned support-app version
|
||||
implementation "com.google.dagger:dagger:$dagger_version"
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
package info.nightscout.androidaps.interaction.actions;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Vibrator;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import android.support.wearable.view.DotsPageIndicator;
|
||||
import android.support.wearable.view.GridPagerAdapter;
|
||||
import android.support.wearable.view.GridViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -24,10 +19,8 @@ import info.nightscout.androidaps.data.ListenerService;
|
|||
* Created by adrian on 09/02/17.
|
||||
*/
|
||||
|
||||
|
||||
public class AcceptActivity extends ViewSelectorActivity {
|
||||
|
||||
|
||||
String title = "";
|
||||
String message = "";
|
||||
String actionstring = "";
|
||||
|
@ -45,30 +38,25 @@ public class AcceptActivity extends ViewSelectorActivity {
|
|||
message = extras.getString("message", "");
|
||||
actionstring = extras.getString("actionstring", "");
|
||||
|
||||
if ("".equals(message) || "".equals(actionstring) ){
|
||||
finish(); return;
|
||||
if ("".equals(message) || "".equals(actionstring)) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.grid_layout);
|
||||
|
||||
final GridViewPager pager = findViewById(R.id.pager);
|
||||
pager.setAdapter(new MyGridViewPagerAdapter());
|
||||
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
|
||||
dotsPageIndicator.setPager(pager);
|
||||
setAdapter(new MyGridViewPagerAdapter());
|
||||
|
||||
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||
long[] vibratePattern = new long[]{0, 100, 50, 100, 50};
|
||||
v.vibrate(vibratePattern, -1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
private class MyGridViewPagerAdapter extends GridPagerAdapter {
|
||||
@Override
|
||||
public int getColumnCount(int arg0) {
|
||||
|
@ -83,7 +71,7 @@ public class AcceptActivity extends ViewSelectorActivity {
|
|||
@Override
|
||||
public Object instantiateItem(ViewGroup container, int row, int col) {
|
||||
|
||||
if(col == 0){
|
||||
if (col == 0) {
|
||||
final View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_confirm_text, container, false);
|
||||
final TextView headingView = view.findViewById(R.id.title);
|
||||
headingView.setText(title);
|
||||
|
@ -110,29 +98,29 @@ public class AcceptActivity extends ViewSelectorActivity {
|
|||
public void destroyItem(ViewGroup container, int row, int col, Object view) {
|
||||
// Handle this to get the data before the view is destroyed?
|
||||
// Object should still be kept by this, just setup for reinit?
|
||||
container.removeView((View)view);
|
||||
container.removeView((View) view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(View view, Object object) {
|
||||
return view==object;
|
||||
return view == object;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onDestroy(){
|
||||
public synchronized void onDestroy() {
|
||||
super.onDestroy();
|
||||
if(dismissThread != null){
|
||||
if (dismissThread != null) {
|
||||
dismissThread.invalidate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class DismissThread extends Thread{
|
||||
private class DismissThread extends Thread {
|
||||
private boolean valid = true;
|
||||
|
||||
public synchronized void invalidate(){
|
||||
public synchronized void invalidate() {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
|
@ -140,7 +128,7 @@ public class AcceptActivity extends ViewSelectorActivity {
|
|||
public void run() {
|
||||
SystemClock.sleep(60 * 1000);
|
||||
synchronized (this) {
|
||||
if(valid) {
|
||||
if (valid) {
|
||||
AcceptActivity.this.finish();
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +138,7 @@ public class AcceptActivity extends ViewSelectorActivity {
|
|||
@Override
|
||||
protected synchronized void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
if(dismissThread != null) dismissThread.invalidate();
|
||||
if (dismissThread != null) dismissThread.invalidate();
|
||||
Bundle extras = intent.getExtras();
|
||||
Intent msgIntent = new Intent(this, AcceptActivity.class);
|
||||
msgIntent.putExtras(extras);
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
package info.nightscout.androidaps.interaction.actions;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.wearable.view.DotsPageIndicator;
|
||||
import android.support.wearable.view.GridPagerAdapter;
|
||||
import android.support.wearable.view.GridViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
|
@ -22,7 +18,6 @@ import info.nightscout.shared.SafeParse;
|
|||
* Created by adrian on 09/02/17.
|
||||
*/
|
||||
|
||||
|
||||
public class BolusActivity extends ViewSelectorActivity {
|
||||
|
||||
PlusMinusEditText editCarbs;
|
||||
|
@ -31,32 +26,7 @@ public class BolusActivity extends ViewSelectorActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid_layout);
|
||||
|
||||
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());
|
||||
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
|
||||
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);
|
||||
}
|
||||
});
|
||||
setAdapter(new MyGridViewPagerAdapter());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -108,10 +78,8 @@ public class BolusActivity extends ViewSelectorActivity {
|
|||
confirmbutton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
//check if it can happen that the fagment is never created that hold data?
|
||||
// (you have to swipe past them anyways - but still)
|
||||
|
||||
String actionstring = "bolus " + SafeParse.stringToDouble(editInsulin.editText.getText().toString())
|
||||
+ " " + SafeParse.stringToInt(editCarbs.editText.getText().toString());
|
||||
ListenerService.initiateAction(BolusActivity.this, actionstring);
|
||||
|
@ -135,6 +103,5 @@ public class BolusActivity extends ViewSelectorActivity {
|
|||
return view == object;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,15 +1,11 @@
|
|||
package info.nightscout.androidaps.interaction.actions;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.wearable.view.DotsPageIndicator;
|
||||
import android.support.wearable.view.GridPagerAdapter;
|
||||
import android.support.wearable.view.GridViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
|
@ -22,7 +18,6 @@ import info.nightscout.shared.SafeParse;
|
|||
* Created by adrian on 09/02/17.
|
||||
*/
|
||||
|
||||
|
||||
public class CPPActivity extends ViewSelectorActivity {
|
||||
|
||||
PlusMinusEditText editPercentage;
|
||||
|
@ -46,34 +41,8 @@ public class CPPActivity extends ViewSelectorActivity {
|
|||
|
||||
if (timeshift < 0) timeshift += 24;
|
||||
|
||||
setContentView(R.layout.grid_layout);
|
||||
|
||||
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());
|
||||
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
|
||||
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);
|
||||
setAdapter(new MyGridViewPagerAdapter());
|
||||
}
|
||||
@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
|
||||
protected void onPause() {
|
||||
|
@ -81,7 +50,6 @@ public class CPPActivity extends ViewSelectorActivity {
|
|||
finish();
|
||||
}
|
||||
|
||||
|
||||
private class MyGridViewPagerAdapter extends GridPagerAdapter {
|
||||
@Override
|
||||
public int getColumnCount(int arg0) {
|
||||
|
@ -151,6 +119,5 @@ public class CPPActivity extends ViewSelectorActivity {
|
|||
return view == object;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
package info.nightscout.androidaps.interaction.actions;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.wearable.view.DotsPageIndicator;
|
||||
import android.support.wearable.view.GridPagerAdapter;
|
||||
import android.support.wearable.view.GridViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
|
@ -22,45 +18,17 @@ import info.nightscout.shared.SafeParse;
|
|||
* Created by adrian on 04/08/18.
|
||||
*/
|
||||
|
||||
|
||||
public class ECarbActivity extends ViewSelectorActivity {
|
||||
|
||||
PlusMinusEditText editCarbs;
|
||||
PlusMinusEditText editStartTime;
|
||||
PlusMinusEditText editDuration;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid_layout);
|
||||
|
||||
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());
|
||||
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
|
||||
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);
|
||||
setAdapter(new MyGridViewPagerAdapter());
|
||||
}
|
||||
@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
|
||||
protected void onPause() {
|
||||
|
@ -68,7 +36,6 @@ public class ECarbActivity extends ViewSelectorActivity {
|
|||
finish();
|
||||
}
|
||||
|
||||
|
||||
private class MyGridViewPagerAdapter extends GridPagerAdapter {
|
||||
@Override
|
||||
public int getColumnCount(int arg0) {
|
||||
|
@ -83,10 +50,10 @@ public class ECarbActivity extends ViewSelectorActivity {
|
|||
@Override
|
||||
public Object instantiateItem(ViewGroup container, int row, int col) {
|
||||
|
||||
if(col == 0){
|
||||
if (col == 0) {
|
||||
final View view = getInflatedPlusMinusView(container);
|
||||
double def = 0;
|
||||
if (editCarbs != null){
|
||||
if (editCarbs != null) {
|
||||
def = SafeParse.stringToDouble(editCarbs.editText.getText().toString());
|
||||
}
|
||||
editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), true);
|
||||
|
@ -94,20 +61,20 @@ public class ECarbActivity extends ViewSelectorActivity {
|
|||
container.addView(view);
|
||||
view.requestFocus();
|
||||
return view;
|
||||
} else if(col == 1){
|
||||
} else if (col == 1) {
|
||||
final View view = getInflatedPlusMinusView(container);
|
||||
double def = 0;
|
||||
if (editStartTime != null){
|
||||
if (editStartTime != null) {
|
||||
def = SafeParse.stringToDouble(editStartTime.editText.getText().toString());
|
||||
}
|
||||
editStartTime = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 300d, 15d, new DecimalFormat("0"), false);
|
||||
setLabelToPlusMinusView(view, getString(R.string.action_start_min));
|
||||
container.addView(view);
|
||||
return view;
|
||||
} else if(col == 2){
|
||||
} else if (col == 2) {
|
||||
final View view = getInflatedPlusMinusView(container);
|
||||
double def = 0;
|
||||
if (editDuration != null){
|
||||
if (editDuration != null) {
|
||||
def = SafeParse.stringToDouble(editDuration.editText.getText().toString());
|
||||
}
|
||||
editDuration = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 8d, 1d, new DecimalFormat("0"), false);
|
||||
|
@ -125,7 +92,7 @@ public class ECarbActivity extends ViewSelectorActivity {
|
|||
//check if it can happen that the fagment is never created that hold data?
|
||||
// (you have to swipe past them anyways - but still)
|
||||
|
||||
String actionstring = "ecarbs " +SafeParse.stringToInt(editCarbs.editText.getText().toString())
|
||||
String actionstring = "ecarbs " + SafeParse.stringToInt(editCarbs.editText.getText().toString())
|
||||
+ " " + SafeParse.stringToInt(editStartTime.editText.getText().toString())
|
||||
+ " " + SafeParse.stringToInt(editDuration.editText.getText().toString());
|
||||
ListenerService.initiateAction(ECarbActivity.this, actionstring);
|
||||
|
@ -141,14 +108,13 @@ public class ECarbActivity extends ViewSelectorActivity {
|
|||
public void destroyItem(ViewGroup container, int row, int col, Object view) {
|
||||
// Handle this to get the data before the view is destroyed?
|
||||
// Object should still be kept by this, just setup for reinit?
|
||||
container.removeView((View)view);
|
||||
container.removeView((View) view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(View view, Object object) {
|
||||
return view==object;
|
||||
return view == object;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,15 +1,11 @@
|
|||
package info.nightscout.androidaps.interaction.actions;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.wearable.view.DotsPageIndicator;
|
||||
import android.support.wearable.view.GridPagerAdapter;
|
||||
import android.support.wearable.view.GridViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
|
@ -22,7 +18,6 @@ import info.nightscout.shared.SafeParse;
|
|||
* Created by adrian on 09/02/17.
|
||||
*/
|
||||
|
||||
|
||||
public class FillActivity extends ViewSelectorActivity {
|
||||
|
||||
PlusMinusEditText editInsulin;
|
||||
|
@ -30,25 +25,15 @@ public class FillActivity extends ViewSelectorActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid_layout);
|
||||
|
||||
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());
|
||||
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
|
||||
dotsPageIndicator.setPager(pager);
|
||||
setAdapter(new MyGridViewPagerAdapter());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
private class MyGridViewPagerAdapter extends GridPagerAdapter {
|
||||
@Override
|
||||
public int getColumnCount(int arg0) {
|
||||
|
@ -107,6 +92,5 @@ public class FillActivity extends ViewSelectorActivity {
|
|||
return view == object;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,12 +1,9 @@
|
|||
package info.nightscout.androidaps.interaction.actions;
|
||||
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.wearable.view.DotsPageIndicator;
|
||||
import android.support.wearable.view.GridPagerAdapter;
|
||||
import android.support.wearable.view.GridViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -24,7 +21,6 @@ import info.nightscout.shared.SafeParse;
|
|||
* Created by adrian on 09/02/17.
|
||||
*/
|
||||
|
||||
|
||||
public class TempTargetActivity extends ViewSelectorActivity {
|
||||
|
||||
PlusMinusEditText lowRange;
|
||||
|
@ -36,38 +32,12 @@ public class TempTargetActivity extends ViewSelectorActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid_layout);
|
||||
|
||||
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());
|
||||
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
|
||||
dotsPageIndicator.setPager(pager);
|
||||
setAdapter(new MyGridViewPagerAdapter());
|
||||
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
isMGDL = sp.getBoolean("units_mgdl", 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
|
@ -75,7 +45,6 @@ public class TempTargetActivity extends ViewSelectorActivity {
|
|||
finish();
|
||||
}
|
||||
|
||||
|
||||
private class MyGridViewPagerAdapter extends GridPagerAdapter {
|
||||
@Override
|
||||
public int getColumnCount(int arg0) {
|
||||
|
@ -183,6 +152,5 @@ public class TempTargetActivity extends ViewSelectorActivity {
|
|||
return view == object;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -2,26 +2,83 @@ package info.nightscout.androidaps.interaction.actions;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.wearable.view.DotsPageIndicator;
|
||||
import android.support.wearable.view.GridPagerAdapter;
|
||||
import android.support.wearable.view.GridViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.wear.widget.CurvedTextView;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
|
||||
/**
|
||||
* Created by adrian on 13/02/17.
|
||||
*/
|
||||
|
||||
public class ViewSelectorActivity extends Activity {
|
||||
|
||||
private GridViewPager pager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid_layout);
|
||||
|
||||
setTitleBasedOnScreenShape(String.valueOf(getTitle()));
|
||||
|
||||
pager = findViewById(R.id.pager);
|
||||
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setAdapter(GridPagerAdapter adapter) {
|
||||
pager.setAdapter(adapter);
|
||||
}
|
||||
|
||||
private void setTitleBasedOnScreenShape(String title) {
|
||||
CurvedTextView titleViewCurved = findViewById(R.id.title_curved);
|
||||
TextView titleView = findViewById(R.id.title);
|
||||
if (this.getResources().getConfiguration().isScreenRound()) {
|
||||
titleViewCurved.setText(title);
|
||||
titleViewCurved.setVisibility(View.VISIBLE);
|
||||
titleView.setVisibility((View.GONE));
|
||||
} else {
|
||||
titleView.setText(title);
|
||||
titleView.setVisibility(View.VISIBLE);
|
||||
titleViewCurved.setVisibility((View.GONE));
|
||||
}
|
||||
}
|
||||
|
||||
View getInflatedPlusMinusView(ViewGroup container) {
|
||||
SharedPreferences sharedPrefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(this);
|
||||
int design = Integer.parseInt(sharedPrefs.getString("input_design", "1"));
|
||||
|
||||
if (design == 2){
|
||||
if (design == 2) {
|
||||
return LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_editplusminus_item_quickrighty, container, false);
|
||||
} else if (design == 3) {
|
||||
return LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_editplusminus_item_quicklefty, container, false);
|
||||
|
@ -33,12 +90,12 @@ public class ViewSelectorActivity extends Activity {
|
|||
return LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_editplusminus_item, container, false);
|
||||
}
|
||||
|
||||
void setLabelToPlusMinusView(View view, String labelText){
|
||||
void setLabelToPlusMinusView(View view, String labelText) {
|
||||
SharedPreferences sharedPrefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(this);
|
||||
int design = Integer.parseInt(sharedPrefs.getString("input_design", "1"));
|
||||
|
||||
if (design == 4){
|
||||
if (design == 4) {
|
||||
//@LadyViktoria: Here the label can be set differently, if you like.
|
||||
final TextView textView = view.findViewById(R.id.label);
|
||||
textView.setText(labelText);
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package info.nightscout.androidaps.interaction.actions;
|
||||
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.wearable.view.DotsPageIndicator;
|
||||
import android.support.wearable.view.GridPagerAdapter;
|
||||
import android.support.wearable.view.GridViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
|
@ -24,7 +20,6 @@ import info.nightscout.shared.SafeParse;
|
|||
* Created by adrian on 09/02/17.
|
||||
*/
|
||||
|
||||
|
||||
public class WizardActivity extends ViewSelectorActivity {
|
||||
|
||||
PlusMinusEditText editCarbs;
|
||||
|
@ -32,40 +27,13 @@ public class WizardActivity extends ViewSelectorActivity {
|
|||
|
||||
boolean hasPercentage;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.grid_layout);
|
||||
|
||||
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());
|
||||
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
|
||||
dotsPageIndicator.setPager(pager);
|
||||
setAdapter(new MyGridViewPagerAdapter());
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
|
@ -73,7 +41,6 @@ public class WizardActivity extends ViewSelectorActivity {
|
|||
finish();
|
||||
}
|
||||
|
||||
|
||||
private class MyGridViewPagerAdapter extends GridPagerAdapter {
|
||||
@Override
|
||||
public int getColumnCount(int arg0) {
|
||||
|
@ -95,7 +62,6 @@ public class WizardActivity extends ViewSelectorActivity {
|
|||
} else {
|
||||
double def = SafeParse.stringToDouble(editCarbs.editText.getText().toString());
|
||||
editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), false);
|
||||
|
||||
}
|
||||
setLabelToPlusMinusView(view, getString(R.string.action_carbs));
|
||||
container.addView(view);
|
||||
|
@ -151,6 +117,5 @@ public class WizardActivity extends ViewSelectorActivity {
|
|||
return view == object;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -44,7 +44,6 @@ public class MainMenuActivity extends MenuListActivity {
|
|||
return menuItems;
|
||||
}
|
||||
|
||||
|
||||
boolean showPrimeFill = sp.getBoolean("primefill", false);
|
||||
boolean showWizard = sp.getBoolean("showWizard", true);
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.widget.RelativeLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.wear.widget.CurvedTextView;
|
||||
import androidx.wear.widget.WearableLinearLayoutManager;
|
||||
import androidx.wear.widget.WearableRecyclerView;
|
||||
|
||||
|
@ -23,10 +24,12 @@ import info.nightscout.androidaps.R;
|
|||
|
||||
public abstract class MenuListActivity extends Activity {
|
||||
List<MenuItem> elements;
|
||||
|
||||
protected abstract List<MenuItem> getElements();
|
||||
|
||||
protected abstract void doAction(String position);
|
||||
|
||||
public interface AdapterCallback{
|
||||
public interface AdapterCallback {
|
||||
void onItemClicked(MenuAdapter.ItemViewHolder v);
|
||||
}
|
||||
|
||||
|
@ -34,18 +37,22 @@ public abstract class MenuListActivity extends Activity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.actions_list_activity);
|
||||
TextView titleView = findViewById(R.id.title);
|
||||
titleView.setText(getTitle());
|
||||
setTitleBasedOnScreenShape(String.valueOf(getTitle()));
|
||||
|
||||
elements = getElements();
|
||||
CustomScrollingLayoutCallback customScrollingLayoutCallback = new CustomScrollingLayoutCallback();
|
||||
WearableLinearLayoutManager layoutManager = new WearableLinearLayoutManager(this);
|
||||
if (this.getResources().getConfiguration().isScreenRound()) {
|
||||
layoutManager.setLayoutCallback(customScrollingLayoutCallback);
|
||||
}
|
||||
WearableRecyclerView listView = findViewById(R.id.action_list);
|
||||
listView.setHasFixedSize(true);
|
||||
boolean isScreenRound = this.getResources().getConfiguration().isScreenRound();
|
||||
if (isScreenRound) {
|
||||
layoutManager.setLayoutCallback(customScrollingLayoutCallback);
|
||||
listView.setEdgeItemsCenteringEnabled(true);
|
||||
} else {
|
||||
// Bug in androidx.wear:wear:1.2.0
|
||||
// WearableRecyclerView setEdgeItemsCenteringEnabled requires fix for square screen
|
||||
listView.setPadding(0, 50, 0, 0);
|
||||
}
|
||||
listView.setHasFixedSize(true);
|
||||
listView.setLayoutManager(layoutManager);
|
||||
listView.setAdapter(new MenuAdapter(elements, v -> {
|
||||
String tag = (String) v.itemView.getTag();
|
||||
|
@ -53,16 +60,30 @@ public abstract class MenuListActivity extends Activity {
|
|||
}));
|
||||
}
|
||||
|
||||
private class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.ItemViewHolder> {
|
||||
private void setTitleBasedOnScreenShape(String title) {
|
||||
CurvedTextView titleViewCurved = findViewById(R.id.title_curved);
|
||||
TextView titleView = findViewById(R.id.title);
|
||||
if (this.getResources().getConfiguration().isScreenRound()) {
|
||||
titleViewCurved.setText(title);
|
||||
titleViewCurved.setVisibility(View.VISIBLE);
|
||||
titleView.setVisibility((View.GONE));
|
||||
} else {
|
||||
titleView.setText(title);
|
||||
titleView.setVisibility(View.VISIBLE);
|
||||
titleViewCurved.setVisibility((View.GONE));
|
||||
}
|
||||
}
|
||||
|
||||
private static class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.ItemViewHolder> {
|
||||
private final List<MenuItem> mDataset;
|
||||
private AdapterCallback callback;
|
||||
private final AdapterCallback callback;
|
||||
|
||||
public MenuAdapter(List<MenuItem> dataset, AdapterCallback callback) {
|
||||
mDataset = dataset;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public class ItemViewHolder extends RecyclerView.ViewHolder {
|
||||
public static class ItemViewHolder extends RecyclerView.ViewHolder {
|
||||
protected final RelativeLayout menuContainer;
|
||||
protected final TextView actionItem;
|
||||
protected final ImageView actionIcon;
|
||||
|
@ -78,9 +99,8 @@ public abstract class MenuListActivity extends Activity {
|
|||
@Override
|
||||
public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
|
||||
ItemViewHolder recyclerViewHolder = new ItemViewHolder(view);
|
||||
|
||||
return recyclerViewHolder;
|
||||
return new ItemViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,9 +109,7 @@ public abstract class MenuListActivity extends Activity {
|
|||
holder.actionItem.setText(item.actionItem);
|
||||
holder.actionIcon.setImageResource(item.actionIcon);
|
||||
holder.itemView.setTag(item.actionItem);
|
||||
holder.menuContainer.setOnClickListener(v -> {
|
||||
callback.onItemClicked(holder);
|
||||
});
|
||||
holder.menuContainer.setOnClickListener(v -> callback.onItemClicked(holder));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,19 +118,19 @@ public abstract class MenuListActivity extends Activity {
|
|||
}
|
||||
}
|
||||
|
||||
protected class MenuItem {
|
||||
protected static 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 {
|
||||
public static 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) {
|
||||
|
@ -121,7 +139,7 @@ public abstract class MenuListActivity extends Activity {
|
|||
float yRelativeToCenterOffset = (child.getY() / parent.getHeight()) + centerOffset;
|
||||
|
||||
// Normalize for center
|
||||
progressToCenter = Math.abs(0.5f - yRelativeToCenterOffset);
|
||||
float progressToCenter = Math.abs(0.5f - yRelativeToCenterOffset);
|
||||
// Adjust to the maximum scale
|
||||
progressToCenter = Math.min(progressToCenter, MAX_ICON_PROGRESS);
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,7 +5,7 @@
|
|||
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"/>
|
||||
android:fillColor="@color/colorCalculatorButton"/>
|
||||
<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"/>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
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"/>
|
||||
android:fillColor="@color/colorPrimeButton"/>
|
||||
<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"/>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
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"/>
|
||||
android:fillColor="@color/colorCarbsButton"/>
|
||||
<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"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
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"/>
|
||||
android:fillColor="@color/colorTemptButton"/>
|
||||
<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"/>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/menu_container"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/menu_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="@drawable/menu_item_layout_bg"
|
||||
android:paddingTop="8dp"
|
||||
android:background="@drawable/menu_item_layout_bg">
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menuItemIcon"
|
||||
|
@ -25,13 +25,13 @@
|
|||
android:layout_marginStart="10dp"
|
||||
android:layout_toEndOf="@+id/menuItemIcon"
|
||||
android:layout_toRightOf="@+id/menuItemIcon"
|
||||
android:autoSizeMaxTextSize="32sp"
|
||||
android:autoSizeMinTextSize="12sp"
|
||||
android:autoSizeStepGranularity="2sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:text="action item"
|
||||
android:textColor="@color/dark_statusView"
|
||||
android:textSize="20sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="12sp"
|
||||
android:autoSizeMaxTextSize="32sp"
|
||||
android:autoSizeStepGranularity="2sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -1,27 +1,41 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.wear.widget.WearableRecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.wear.widget.WearableRecyclerView 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:scrollbars="vertical" >
|
||||
android:scrollbars="vertical">
|
||||
|
||||
<requestFocus />
|
||||
|
||||
</androidx.wear.widget.WearableRecyclerView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="28dp"
|
||||
android:background="@color/titleHeader">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="26dp"
|
||||
android:autoSizeMaxTextSize="18sp"
|
||||
android:autoSizeMinTextSize="12sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:gravity="center"
|
||||
android:text="Title"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.wear.widget.CurvedTextView
|
||||
android:id="@+id/title_curved"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Title"
|
||||
android:textSize="18sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="12sp"
|
||||
android:autoSizeMaxTextSize="18sp"
|
||||
android:background="#D9000000"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
@ -1,14 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.wear.widget.CurvedTextView
|
||||
android:id="@+id/title_curved"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Title"
|
||||
android:textSize="18sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="26dp"
|
||||
android:autoSizeMaxTextSize="18sp"
|
||||
android:autoSizeMinTextSize="12sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp"/>
|
||||
android:text="Title"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<android.support.wearable.view.GridViewPager
|
||||
android:id="@+id/pager"
|
||||
|
@ -20,7 +32,6 @@
|
|||
android:id="@+id/page_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom">
|
||||
</android.support.wearable.view.DotsPageIndicator>
|
||||
android:layout_gravity="center_horizontal|bottom" />
|
||||
|
||||
</FrameLayout>
|
|
@ -1,11 +1,11 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/menu_container"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/menu_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="@drawable/menu_item_layout_bg"
|
||||
android:paddingTop="8dp"
|
||||
android:background="@drawable/menu_item_layout_bg">
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menuItemIcon"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<resources>
|
||||
|
||||
<color name="cardObjectiveText">#779ECB</color>
|
||||
<color name="titleHeader">#D9000000</color>
|
||||
|
||||
|
||||
<!-- light colors -->
|
||||
|
@ -38,10 +39,12 @@
|
|||
<color name="basal_light_lowres">@color/grey_300</color>
|
||||
<color name="basal_dark_lowres">@color/grey_500</color>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- menu colors -->
|
||||
<color name="colorCalculatorButton">#67e86a</color>
|
||||
<color name="colorCarbsButton">#ffae01</color>
|
||||
<color name="colorInsulinButton">#67dfe8</color>
|
||||
<color name="colorTemptButton">#CF8BFE</color>
|
||||
<color name="colorPrimeButton">#FBC02D</color>
|
||||
|
||||
<!-- Material Design - Color Palette -->
|
||||
<!-- https://designguidelines.withgoogle.com/wearos/style/color.html#color-dark-color-palette-for-wear-os -->
|
||||
|
|
Loading…
Reference in a new issue