use of com.eveningoutpost.dexdrip.Models.UserError in project xDrip by NightscoutFoundation.
the class ErrorListAdapter method getView.
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View view = convertView;
if (view == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.item_user_error, null);
}
LinearLayout row = (LinearLayout) view.findViewById(R.id.errorRow);
TextView shortText = (TextView) view.findViewById(R.id.errorShort);
TextView longText = (TextView) view.findViewById(R.id.errorLong);
TextView timestamp = (TextView) view.findViewById(R.id.errorTimestamp);
UserError error = list.get(position);
row.setBackgroundColor(backgroundFor(error.severity));
shortText.setText(error.shortError);
longText.setText(error.message);
timestamp.setText(dateformatter(error.timestamp));
return view;
}
use of com.eveningoutpost.dexdrip.Models.UserError in project xDrip by NightscoutFoundation.
the class ErrorsActivity method uploadLogs.
public void uploadLogs(View v) {
StringBuilder tmp = new StringBuilder(20000);
tmp.append("The following logs will be sent to the developers: \n\nPlease also include your email address or we will not know who they are from!\n\n");
for (UserError item : errors) {
tmp.append(item.toString());
tmp.append("\n");
if (tmp.length() > 200000) {
JoH.static_toast(this, "Could not package up all logs, using most recent", Toast.LENGTH_LONG);
break;
}
}
startActivity(new Intent(getApplicationContext(), SendFeedBack.class).putExtra("generic_text", tmp.toString()));
}
use of com.eveningoutpost.dexdrip.Models.UserError in project xDrip-plus by jamorham.
the class ListenerService method getWearLogData.
private synchronized DataMap getWearLogData(int count, long last_send_time, int min_count, long syncLogsRequested) {
forceGoogleApiConnect();
Log.d(TAG, "getWearLogData last_send_time:" + JoH.dateTimeText(last_send_time) + " max count=" + count + " min_count=" + min_count + " syncLogsRequested=" + syncLogsRequested);
UserError last_log = UserError.last();
if (last_log != null) {
Log.d(TAG, "getWearLogData last_log.timestamp:" + JoH.dateTimeText((long) last_log.timestamp));
}
if (last_log != null && last_send_time <= last_log.timestamp) {
// startTime
long last_send_success = last_send_time;
Log.d(TAG, "getWearLogData last_send_time < last_bg.timestamp:" + JoH.dateTimeText((long) last_log.timestamp));
List<UserError> logs = UserError.latestAsc(count, last_send_time);
if (!logs.isEmpty() && logs.size() > min_count) {
// Log.d(TAG, "getWearLogData count = " + logs.size());
DataMap entries = dataMap(last_log);
final ArrayList<DataMap> dataMaps = new ArrayList<>(logs.size());
for (UserError log : logs) {
dataMaps.add(dataMap(log));
last_send_success = (long) log.timestamp;
// Log.d(TAG, "getWearLogData set last_send_sucess:" + JoH.dateTimeText(last_send_sucess) + " Log:" + log.toString());
}
// MOST IMPORTANT LINE FOR TIMESTAMP
entries.putLong("time", new Date().getTime());
entries.putLong("syncLogsRequested", syncLogsRequested);
entries.putDataMapArrayList("entries", dataMaps);
Log.i(TAG, "getWearLogData SYNCED logs up to " + JoH.dateTimeText(last_send_success) + " count = " + logs.size() + " syncLogsRequested=" + syncLogsRequested);
return entries;
} else
Log.i(TAG, "getWearLogData SYNCED logs up to " + JoH.dateTimeText(last_send_success) + " count = 0" + " syncLogsRequested=" + syncLogsRequested);
}
return null;
}
use of com.eveningoutpost.dexdrip.Models.UserError in project xDrip-plus by jamorham.
the class ListenerService method isSafeToDeleteDB.
private boolean isSafeToDeleteDB() {
// TODO remove once confirm not needed
TransmitterData last_bg = TransmitterData.last();
if (last_bg != null && last_send_previous <= last_bg.timestamp) {
Log.d(TAG, "onDataChanged SYNC_DB_PATH requestData for last_send_previous < last_bg.timestamp:" + JoH.dateTimeText(last_send_previous) + "<=" + JoH.dateTimeText(last_bg.timestamp));
requestData();
return false;
}
if (mPrefs.getBoolean("sync_wear_logs", false)) {
UserError last_log = UserError.last();
if (last_log != null && last_send_previous_log <= last_log.timestamp) {
Log.d(TAG, "onDataChanged SYNC_DB_PATH requestData for last_send_previous_log < last_log.timestamp:" + JoH.dateTimeText(last_send_previous_log) + "<=" + JoH.dateTimeText((long) last_log.timestamp));
return false;
}
}
return true;
}
use of com.eveningoutpost.dexdrip.Models.UserError in project xDrip-plus by jamorham.
the class ErrorsActivity method uploadLogs.
public void uploadLogs(View v) {
StringBuilder tmp = new StringBuilder(20000);
tmp.append("The following logs will be sent to the developers: \n\nPlease also include your email address or we will not know who they are from!\n\n");
for (UserError item : errors) {
tmp.append(item.toString());
tmp.append("\n");
if (tmp.length() > 200000) {
JoH.static_toast(this, "Could not package up all logs, using most recent", Toast.LENGTH_LONG);
break;
}
}
startActivity(new Intent(getApplicationContext(), SendFeedBack.class).putExtra("generic_text", tmp.toString()));
}
Aggregations