Search in sources :

Example 6 with UserError

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;
}
Also used : UserError(com.eveningoutpost.dexdrip.Models.UserError) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 7 with UserError

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()));
}
Also used : UserError(com.eveningoutpost.dexdrip.Models.UserError) Intent(android.content.Intent)

Example 8 with UserError

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;
}
Also used : UserError(com.eveningoutpost.dexdrip.Models.UserError) ArrayList(java.util.ArrayList) Date(java.util.Date) DataMap(com.google.android.gms.wearable.DataMap)

Example 9 with UserError

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;
}
Also used : TransmitterData(com.eveningoutpost.dexdrip.Models.TransmitterData) UserError(com.eveningoutpost.dexdrip.Models.UserError)

Example 10 with UserError

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()));
}
Also used : UserError(com.eveningoutpost.dexdrip.Models.UserError) Intent(android.content.Intent)

Aggregations

UserError (com.eveningoutpost.dexdrip.Models.UserError)10 DataMap (com.google.android.gms.wearable.DataMap)4 Intent (android.content.Intent)2 LayoutInflater (android.view.LayoutInflater)2 View (android.view.View)2 LinearLayout (android.widget.LinearLayout)2 TextView (android.widget.TextView)2 TransmitterData (com.eveningoutpost.dexdrip.Models.TransmitterData)2 Gson (com.google.gson.Gson)2 GsonBuilder (com.google.gson.GsonBuilder)2 DateTypeAdapter (com.google.gson.internal.bind.DateTypeAdapter)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2