Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added inactive days button to the G6 status page #2856

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions app/src/main/java/com/eveningoutpost/dexdrip/MegaStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,25 @@ public View getView(int i, View view, ViewGroup viewGroup) {
viewHolder.name.setText(row.value);
viewHolder.name.setGravity(Gravity.CENTER_HORIZONTAL);
viewHolder.name.setTextColor(Color.parseColor("#fff9c4"));
} else if (row.name.equals("blank-button")) {
viewHolder.spacer.setVisibility(View.GONE);
viewHolder.name.setVisibility(View.INVISIBLE);
viewHolder.value.setVisibility(View.GONE);
view.setOnClickListener(null);
if ((row.runnable != null) && (row.button_name != null) && (row.button_name.equals("long-press"))) {
runnableView = view;
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
runOnUiThread(row.runnable);
} catch (Exception e) {
}
}
});
} else {
view.setLongClickable(false);
}
} else {

viewHolder.name.setText(row.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public abstract class G5BaseService extends Service {
public static int LOW_BATTERY_WARNING_LEVEL = G5_LOW_BATTERY_WARNING_DEFAULT;

public static volatile boolean getBatteryStatusNow = false;
public static volatile boolean showInactiveDaysNow = false;
protected static volatile boolean hardResetTransmitterNow = false;
public static volatile boolean unBondAndStop = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public class Ob1G5CollectionService extends G5BaseService {
private static final String KEKS_ONE = "keks1_";
private static volatile STATE state = INIT;
private static volatile STATE last_automata_state = CLOSED;
private static volatile int showInactiveDaysCount =0;

private static RxBleClient rxBleClient;
private static volatile PendingIntent pendingIntent;
Expand Down Expand Up @@ -2315,6 +2316,23 @@ public void run() {
l.add(new StatusItem("Temperature", parsedBattery.temperature() + " \u2103"));
}
}
if (showInactiveDaysNow) {
++showInactiveDaysCount;
l.add(new StatusItem("Inactive days", "" + vr1.inactive_days, NOTICE));
if (showInactiveDaysCount > 100) {
showInactiveDaysNow = false;
}
}
if (!showInactiveDaysNow) {
l.add(new StatusItem("blank-button", "", NORMAL, "long-press", // A blank entry providing a button to view inactive days
new Runnable() {
@Override
public void run() {
showInactiveDaysNow = true;
showInactiveDaysCount = 0;
}
}));
}
} else {
l.add(new StatusItem("Battery Info Unavailable", "Click to trigger update", NORMAL, "long-press",
new Runnable() {
Expand Down
Loading