mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-26 00:21:45 +01:00
Activity info into Device Card: use correct coordinator method
- use correct DeviceCoordinator method supportsActivityTracking() - remove placeholders from xml - clarify comments in DeviceCoordinator - clean up some previously added unused imports
This commit is contained in:
parent
c15833f149
commit
b24da9a409
@ -513,7 +513,7 @@ public class ControlCenterv2 extends AppCompatActivity
|
||||
protected void doInBackground(DBHandler db) {
|
||||
for (GBDevice gbDevice : deviceList) {
|
||||
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice);
|
||||
if (coordinator.supportsActivityDataFetching()) {
|
||||
if (coordinator.supportsActivityTracking()) {
|
||||
long[] steps = getSteps(gbDevice, db);
|
||||
deviceActivityHashMap.put(gbDevice.getAddress(), steps);
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ 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;
|
||||
|
||||
@ -53,8 +52,6 @@ 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;
|
||||
@ -69,11 +66,9 @@ 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;
|
||||
@ -84,7 +79,6 @@ 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;
|
||||
@ -126,7 +120,6 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
|
||||
}
|
||||
|
||||
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device);
|
||||
|
||||
holder.container.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
@ -630,7 +623,7 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
|
||||
}
|
||||
}
|
||||
);
|
||||
if (coordinator.supportsActivityDataFetching()) {
|
||||
if (coordinator.supportsActivityTracking()) {
|
||||
setActivityCard(holder, device, dailyTotals);
|
||||
}
|
||||
}
|
||||
|
@ -143,6 +143,8 @@ public interface DeviceCoordinator {
|
||||
/**
|
||||
* Returns true if activity data fetching is supported by the device
|
||||
* (with this coordinator).
|
||||
* This enables the sync button in control center and the device can thus be asked to send the data
|
||||
* (as opposed the device pushing the data to us by itself)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ -151,6 +153,7 @@ public interface DeviceCoordinator {
|
||||
/**
|
||||
* Returns true if activity tracking is supported by the device
|
||||
* (with this coordinator).
|
||||
* This enables the ChartsActivity.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
@ -502,7 +502,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="59999"
|
||||
android:text=""
|
||||
android:textSize="18sp" />
|
||||
|
||||
<ProgressBar
|
||||
@ -542,7 +542,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="1"
|
||||
android:text=""
|
||||
android:textSize="18sp" />
|
||||
|
||||
<ProgressBar
|
||||
@ -581,7 +581,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="300"
|
||||
android:text=""
|
||||
android:textSize="18sp" />
|
||||
|
||||
<ProgressBar
|
||||
|
Loading…
Reference in New Issue
Block a user