From 21ea7b6cc2a9400cd1a24f709c0549b1c1df6fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Van=C4=9Bk?= Date: Thu, 18 Nov 2021 12:22:43 +0100 Subject: [PATCH] Add Activity info into Device Card. (#2453) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - this tries to address a common request to display user data up front - i would make this via a fragment, but RecyclerView doesn't like Fragments - (fragments would make it much easier to also add a charts like view, like we use on the Activity list tab) - i added configuration that allows to disable it partially or fully Co-authored-by: Petr Vaněk Co-committed-by: Petr Vaněk --- .../activities/ControlCenterv2.java | 57 +++++++- .../DeviceSettingsActivity.java | 2 + .../DeviceSettingsPreferenceConst.java | 5 + .../DeviceSpecificSettingsFragment.java | 37 +++++ .../adapter/GBDeviceAdapterv2.java | 125 ++++++++++++++++- .../gadgetbridge/model/DailyTotals.java | 14 +- .../main/res/drawable/ic_activity_sleep.xml | 4 +- .../res/drawable/ic_settings_applications.xml | 10 ++ app/src/main/res/layout/device_itemv2.xml | 132 ++++++++++++++++++ app/src/main/res/values/strings.xml | 8 ++ ..._device_card_activity_card_preferences.xml | 46 ++++++ 11 files changed, 429 insertions(+), 11 deletions(-) create mode 100644 app/src/main/res/drawable/ic_settings_applications.xml create mode 100644 app/src/main/res/xml/devicesettings_device_card_activity_card_preferences.xml diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java index fb33c3a43..07dc10dc9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java @@ -53,6 +53,9 @@ import com.google.android.material.navigation.NavigationView; import java.io.Serializable; import java.util.ArrayList; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Locale; @@ -63,11 +66,16 @@ import de.cketti.library.changelog.ChangeLog; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.adapter.GBDeviceAdapterv2; +import nodomain.freeyourgadget.gadgetbridge.database.DBAccess; +import nodomain.freeyourgadget.gadgetbridge.database.DBHandler; +import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample; +import nodomain.freeyourgadget.gadgetbridge.model.DailyTotals; import nodomain.freeyourgadget.gadgetbridge.model.DeviceService; import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils; +import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper; import nodomain.freeyourgadget.gadgetbridge.util.GB; import nodomain.freeyourgadget.gadgetbridge.util.Prefs; @@ -88,6 +96,9 @@ public class ControlCenterv2 extends AppCompatActivity private RecyclerView deviceListView; private FloatingActionButton fab; private boolean isLanguageInvalid = false; + List deviceList; + private HashMap deviceActivityHashMap = new HashMap(); + private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -100,12 +111,13 @@ public class ControlCenterv2 extends AppCompatActivity finish(); break; case DeviceManager.ACTION_DEVICES_CHANGED: + case GBApplication.ACTION_NEW_DATA: + createRefreshTask("get activity data", getApplication()).execute(); refreshPairedDevices(); break; case DeviceService.ACTION_REALTIME_SAMPLES: handleRealtimeSample(intent.getSerializableExtra(DeviceService.EXTRA_REALTIME_SAMPLE)); break; - } } }; @@ -155,8 +167,12 @@ public class ControlCenterv2 extends AppCompatActivity deviceListView.setHasFixedSize(true); deviceListView.setLayoutManager(new LinearLayoutManager(this)); - List deviceList = deviceManager.getDevices(); - mGBDeviceAdapter = new GBDeviceAdapterv2(this, deviceList); + deviceList = deviceManager.getDevices(); + mGBDeviceAdapter = new GBDeviceAdapterv2(this, deviceList, deviceActivityHashMap); + + // get activity data asynchronously, this fills the deviceActivityHashMap + // and calls refreshPairedDevices() → notifyDataSetChanged + createRefreshTask("get activity data", getApplication()).execute(); deviceListView.setAdapter(this.mGBDeviceAdapter); @@ -210,6 +226,7 @@ public class ControlCenterv2 extends AppCompatActivity IntentFilter filterLocal = new IntentFilter(); filterLocal.addAction(GBApplication.ACTION_LANGUAGE_CHANGE); filterLocal.addAction(GBApplication.ACTION_QUIT); + filterLocal.addAction(GBApplication.ACTION_NEW_DATA); filterLocal.addAction(DeviceManager.ACTION_DEVICES_CHANGED); filterLocal.addAction(DeviceService.ACTION_REALTIME_SAMPLES); LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filterLocal); @@ -475,4 +492,38 @@ public class ControlCenterv2 extends AppCompatActivity } AndroidUtils.setLanguage(this, language); } + + private long[] getSteps(GBDevice device, DBHandler db) { + Calendar day = GregorianCalendar.getInstance(); + + DailyTotals ds = new DailyTotals(); + return ds.getDailyTotalsForDevice(device, day, db); + } + + protected RefreshTask createRefreshTask(String task, Context context) { + return new RefreshTask(task, context); + } + + public class RefreshTask extends DBAccess { + public RefreshTask(String task, Context context) { + super(task, context); + } + + @Override + protected void doInBackground(DBHandler db) { + for (GBDevice gbDevice : deviceList) { + final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice); + if (coordinator.supportsActivityDataFetching()) { + long[] steps = getSteps(gbDevice, db); + deviceActivityHashMap.put(gbDevice.getAddress(), steps); + } + } + } + + @Override + protected void onPostExecute(Object o) { + refreshPairedDevices(); + } + + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsActivity.java index 85d8c7e95..bd06ca0ac 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsActivity.java @@ -57,6 +57,7 @@ public class DeviceSettingsActivity extends AbstractGBActivity implements } if (coordinator.supportsActivityTracking()) { supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_chartstabs); + supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_device_card_activity_card_preferences); } fragment = DeviceSpecificSettingsFragment.newInstance(device.getAddress(), supportedSettings, supportedLanguages); @@ -81,6 +82,7 @@ public class DeviceSettingsActivity extends AbstractGBActivity implements if (coordinator.supportsActivityTracking()) { supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_chartstabs); + supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_device_card_activity_card_preferences); } PreferenceFragmentCompat fragment = DeviceSpecificSettingsFragment.newInstance(device.getAddress(), supportedSettings, supportedLanguages); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java index 57eff46c1..67d9dab3b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java @@ -140,6 +140,11 @@ public class DeviceSettingsPreferenceConst { public static final String PREF_SONY_WH1000XM3_AUTOMATIC_POWER_OFF = "pref_sony_wh1000xm3_automatic_power_off"; public static final String PREF_SONY_WH1000XM3_NOTIFICATION_VOICE_GUIDE = "pref_sony_wh1000xm3_notification_voice_guide"; + public static final String PREFS_ACTIVITY_IN_DEVICE_CARD = "prefs_activity_in_device_card"; + public static final String PREFS_ACTIVITY_IN_DEVICE_CARD_STEPS = "prefs_activity_in_device_card_steps"; + public static final String PREFS_ACTIVITY_IN_DEVICE_CARD_SLEEP = "prefs_activity_in_device_card_sleep"; + public static final String PREFS_ACTIVITY_IN_DEVICE_CARD_DISTANCE = "prefs_activity_in_device_card_distance"; + public static final String PREF_SOUNDS = "sounds"; public static final String PREF_AUTH_KEY = "authkey"; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java index 21769b35f..2c918b287 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java @@ -16,12 +16,14 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.activities.devicesettings; +import android.content.Intent; import android.os.Bundle; import android.text.InputType; import android.widget.EditText; import androidx.annotation.NonNull; import androidx.fragment.app.DialogFragment; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.preference.EditTextPreference; import androidx.preference.ListPreference; import androidx.preference.Preference; @@ -39,6 +41,7 @@ import java.util.Objects; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; +import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.makibeshr3.MakibesHR3Constants; import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst; @@ -149,6 +152,11 @@ import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.Dev import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_TOUCH_SENSOR; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_AUTOMATIC_POWER_OFF; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_NOTIFICATION_VOICE_GUIDE; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD_DISTANCE; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD_SLEEP; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD_STEPS; + import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_ACTIVATE_DISPLAY_ON_LIFT; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_FELL_SLEEP_BROADCAST; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_FELL_SLEEP_SELECTION; @@ -778,6 +786,35 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat { if (deviceActionsStartNonWearBroadcast != null) { deviceActionsStartNonWearBroadcast.setEnabled(deviceActionsStartNonWearSelectionBroadcast); } + + + final Preference activityInDeviceCard = findPreference(PREFS_ACTIVITY_IN_DEVICE_CARD); + final Preference activityInDeviceSteps = findPreference(PREFS_ACTIVITY_IN_DEVICE_CARD_STEPS); + final Preference activityInDeviceSleep = findPreference(PREFS_ACTIVITY_IN_DEVICE_CARD_SLEEP); + final Preference activityInDeviceDistance = findPreference(PREFS_ACTIVITY_IN_DEVICE_CARD_DISTANCE); + + Preference.OnPreferenceClickListener sendIntentRefreshDeviceListListener = new Preference.OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference arg0) { + Intent refreshIntent = new Intent(DeviceManager.ACTION_REFRESH_DEVICELIST); + LocalBroadcastManager.getInstance(getContext()).sendBroadcast(refreshIntent); + return true; + } + }; + + if (activityInDeviceCard != null) { + activityInDeviceCard.setOnPreferenceClickListener(sendIntentRefreshDeviceListListener); + } + if (activityInDeviceSteps != null) { + activityInDeviceSteps.setOnPreferenceClickListener(sendIntentRefreshDeviceListListener); + } + if (activityInDeviceSleep != null) { + activityInDeviceSleep.setOnPreferenceClickListener(sendIntentRefreshDeviceListListener); + } + if (activityInDeviceDistance != null) { + activityInDeviceDistance.setOnPreferenceClickListener(sendIntentRefreshDeviceListListener); + } + } static DeviceSpecificSettingsFragment newInstance(String settingsFileSuffix, @NonNull int[] supportedSettings, String[] supportedLanguages) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java index 68dc493cb..fa880e03a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java @@ -41,6 +41,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.cardview.widget.CardView; +import androidx.fragment.app.FragmentActivity; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.recyclerview.widget.RecyclerView; @@ -51,8 +52,13 @@ import com.jaredrummler.android.colorpicker.ColorPickerDialogListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.text.DecimalFormat; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.HashMap; import java.util.List; import java.util.Locale; +import java.util.concurrent.TimeUnit; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; @@ -61,9 +67,13 @@ import nodomain.freeyourgadget.gadgetbridge.activities.BatteryInfoActivity; import nodomain.freeyourgadget.gadgetbridge.activities.ConfigureAlarms; import nodomain.freeyourgadget.gadgetbridge.activities.ControlCenterv2; import nodomain.freeyourgadget.gadgetbridge.activities.HeartRateDialog; +import nodomain.freeyourgadget.gadgetbridge.activities.SettingsActivity; import nodomain.freeyourgadget.gadgetbridge.activities.VibrationActivity; +import nodomain.freeyourgadget.gadgetbridge.activities.charts.ActivityListingDashboard; import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsActivity; +import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst; +import nodomain.freeyourgadget.gadgetbridge.database.DBAccess; import nodomain.freeyourgadget.gadgetbridge.database.DBHandler; import nodomain.freeyourgadget.gadgetbridge.database.DBHelper; import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator; @@ -72,9 +82,12 @@ import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession; import nodomain.freeyourgadget.gadgetbridge.entities.Device; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample; +import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; import nodomain.freeyourgadget.gadgetbridge.model.BatteryState; +import nodomain.freeyourgadget.gadgetbridge.model.DailyTotals; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.RecordedDataTypes; +import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils; import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper; import nodomain.freeyourgadget.gadgetbridge.util.GB; @@ -88,10 +101,12 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter deviceList; private int expandedDevicePosition = RecyclerView.NO_POSITION; private ViewGroup parent; + private HashMap deviceActivityMap = new HashMap(); - public GBDeviceAdapterv2(Context context, List deviceList) { + public GBDeviceAdapterv2(Context context, List deviceList, HashMap deviceMap) { this.context = context; this.deviceList = deviceList; + this.deviceActivityMap = deviceMap; } @NonNull @@ -105,12 +120,18 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter 2000) { + distanceFormatted = distanceMeters / 1000; + unit = "###.#km"; + } + String units = GBApplication.getPrefs().getString(SettingsActivity.PREF_MEASUREMENT_SYSTEM, GBApplication.getContext().getString(R.string.p_unit_metric)); + if (units.equals(GBApplication.getContext().getString(R.string.p_unit_imperial))) { + unit = "###ft"; + distanceFormatted = distanceFeet; + if (distanceFeet > 6000) { + distanceFormatted = distanceFeet * 0.0001893939f; + unit = "###.#mi"; + } + } + DecimalFormat df = new DecimalFormat(unit); + + + holder.cardViewActivityCardSteps.setText(String.format("%1s", steps)); + holder.cardViewActivityCardSleep.setText(String.format("%1s", getHM(sleep))); + holder.cardViewActivityCardDistance.setText(df.format(distanceFormatted)); + + holder.cardViewActivityCardStepsProgress.setMax(stepGoal); + holder.cardViewActivityCardStepsProgress.setProgress(steps); + + holder.cardViewActivityCardSleepProgress.setMax(sleepGoalMinutes); + holder.cardViewActivityCardSleepProgress.setProgress(sleep); + + holder.cardViewActivityCardDistanceProgress.setMax(distanceGoal); + holder.cardViewActivityCardDistanceProgress.setProgress(steps * stepLength); + + boolean showActivityCard = GBApplication.getDeviceSpecificSharedPrefs(device.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD, true); + holder.cardViewActivityCardLayout.setVisibility(showActivityCard ? View.VISIBLE : View.GONE); + + boolean showActivitySteps = GBApplication.getDeviceSpecificSharedPrefs(device.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD_STEPS, true); + holder.cardViewActivityCardStepsLayout.setVisibility(showActivitySteps ? View.VISIBLE : View.GONE); + + boolean showActivitySleep = GBApplication.getDeviceSpecificSharedPrefs(device.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD_SLEEP, true); + holder.cardViewActivityCardSleepLayout.setVisibility(showActivitySleep ? View.VISIBLE : View.GONE); + + boolean showActivityDistance = GBApplication.getDeviceSpecificSharedPrefs(device.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD_DISTANCE, true); + holder.cardViewActivityCardDistanceLayout.setVisibility(showActivityDistance ? View.VISIBLE : View.GONE); + + } + + private String getHM(long value) { + return DateTimeUtils.formatDurationHoursMinutes(value, TimeUnit.MINUTES); + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DailyTotals.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DailyTotals.java index 94496045e..b110382b6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DailyTotals.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DailyTotals.java @@ -68,6 +68,15 @@ public class DailyTotals { public long[] getDailyTotalsForDevice(GBDevice device, Calendar day) { try (DBHandler handler = GBApplication.acquireDB()) { + return getDailyTotalsForDevice(device, day, handler); + + } catch (Exception e) { + //GB.toast("Error loading sleep/steps widget data for device: " + device, Toast.LENGTH_SHORT, GB.ERROR, e); + return new long[]{0, 0}; + } + } + + public long[] getDailyTotalsForDevice(GBDevice device, Calendar day, DBHandler handler) { ActivityAnalysis analysis = new ActivityAnalysis(); ActivityAmounts amountsSteps; ActivityAmounts amountsSleep; @@ -79,11 +88,6 @@ public class DailyTotals { long steps = getTotalsStepsForActivityAmounts(amountsSteps); return new long[]{steps, sleep[0] + sleep[1]}; - - } catch (Exception e) { - //GB.toast("Error loading sleep/steps widget data for device: " + device, Toast.LENGTH_SHORT, GB.ERROR, e); - return new long[]{0, 0}; - } } private long[] getTotalsSleepForActivityAmounts(ActivityAmounts activityAmounts) { diff --git a/app/src/main/res/drawable/ic_activity_sleep.xml b/app/src/main/res/drawable/ic_activity_sleep.xml index 4f88c7967..aa65ac6e1 100644 --- a/app/src/main/res/drawable/ic_activity_sleep.xml +++ b/app/src/main/res/drawable/ic_activity_sleep.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/drawable/ic_settings_applications.xml b/app/src/main/res/drawable/ic_settings_applications.xml new file mode 100644 index 000000000..82ed4fe54 --- /dev/null +++ b/app/src/main/res/drawable/ic_settings_applications.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/device_itemv2.xml b/app/src/main/res/layout/device_itemv2.xml index 0081b9b64..93fd24af9 100644 --- a/app/src/main/res/layout/device_itemv2.xml +++ b/app/src/main/res/layout/device_itemv2.xml @@ -126,6 +126,7 @@ card_view:tint="@color/secondarytext" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8e798c231..c75086b28 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -25,6 +25,14 @@ Connecting… Taking a screenshot of the device Calibrate Device + Activity info on device card + Choose what activity details are displayed on device card + Show Activity info on device card + Show current steps, distance or sleep on device card + Sleep + Show sleep duration + Distance is calculated from steps and step length (adjustable in Settings - About you) + Show total steps Battery info Battery level diff --git a/app/src/main/res/xml/devicesettings_device_card_activity_card_preferences.xml b/app/src/main/res/xml/devicesettings_device_card_activity_card_preferences.xml new file mode 100644 index 000000000..8c6968392 --- /dev/null +++ b/app/src/main/res/xml/devicesettings_device_card_activity_card_preferences.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + +