com.eveningoutpost.dexdrip.ShareModels.ShareRest Java Examples

The following examples show how to use com.eveningoutpost.dexdrip.ShareModels.ShareRest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FollowerManagementActivity.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_follower_management);
    existingFollowersView = (ListView) findViewById(R.id.followerList);
    addFollowerButton = (Button) findViewById(R.id.inviteFollower);
    shareRest = new ShareRest(this, null);
}
 
Example #2
Source File: FollowerManagementActivity.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_follower_management);
    existingFollowersView = (ListView) findViewById(R.id.followerList);
    addFollowerButton = (Button) findViewById(R.id.inviteFollower);
    shareRest = new ShareRest(this, null);
}
 
Example #3
Source File: FollowerManagementActivity.java    From xDrip-Experimental with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_follower_management);
    existingFollowersView = (ListView) findViewById(R.id.followerList);
    addFollowerButton = (Button) findViewById(R.id.inviteFollower);
    shareRest = new ShareRest(this, null);
}
 
Example #4
Source File: FollowerListAdapter.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
public FollowerListAdapter(Context context, ShareRest shareRest, List<ExistingFollower> list) {
    this.context = context;
    this.list = list;
    this.shareRest = shareRest;
}
 
Example #5
Source File: FollowerListAdapter.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
public FollowerListAdapter(Context context, ShareRest shareRest, List<ExistingFollower> list) {
    this.context = context;
    this.list = list;
    this.shareRest = shareRest;
}
 
Example #6
Source File: FollowerListAdapter.java    From xDrip-Experimental with GNU General Public License v3.0 4 votes vote down vote up
public FollowerListAdapter(Context context, ShareRest shareRest, List<ExistingFollower> list) {
    this.context = context;
    this.list = list;
    this.shareRest = shareRest;
}
 
Example #7
Source File: BgSendQueue.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
public static void addToQueue(BgReading bgReading, String operation_type, Context context) {
    PowerManager powerManager = (PowerManager) context.getSystemService(context.POWER_SERVICE);
    PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
            "sendQueue");
    wakeLock.acquire();


    BgSendQueue bgSendQueue = new BgSendQueue();
    bgSendQueue.operation_type = operation_type;
    bgSendQueue.bgReading = bgReading;
    bgSendQueue.success = false;
    bgSendQueue.mongo_success = false;
    bgSendQueue.save();
    Log.d("BGQueue", "New value added to queue!");

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);

    Intent updateIntent = new Intent(Intents.ACTION_NEW_BG_ESTIMATE_NO_DATA);
    context.sendBroadcast(updateIntent);
    context.startService(new Intent(context, widgetUpdateService.class));

    if (prefs.getBoolean("cloud_storage_mongodb_enable", false) || prefs.getBoolean("cloud_storage_api_enable", false)) {
        Log.w("SENSOR QUEUE:", String.valueOf(bgSendQueue.mongo_success));
        if (operation_type.compareTo("create") == 0) {
            MongoSendTask task = new MongoSendTask(context, bgSendQueue);
            task.execute();
        }
    }

    if(prefs.getBoolean("broadcast_data_through_intents", false)) {
        Log.i("SENSOR QUEUE:", "Broadcast data");
        final Bundle bundle = new Bundle();
        bundle.putDouble(Intents.EXTRA_BG_ESTIMATE, bgReading.calculated_value);
        bundle.putDouble(Intents.EXTRA_BG_SLOPE, bgReading.calculated_value_slope);
        if(bgReading.hide_slope) {
            bundle.putString(Intents.EXTRA_BG_SLOPE_NAME, "9");
        } else {
            bundle.putString(Intents.EXTRA_BG_SLOPE_NAME, bgReading.slopeName());
        }
        bundle.putInt(Intents.EXTRA_SENSOR_BATTERY, getBatteryLevel(context));
        bundle.putLong(Intents.EXTRA_TIMESTAMP, bgReading.timestamp);

        Intent intent = new Intent(Intents.ACTION_NEW_BG_ESTIMATE);
        intent.putExtras(bundle);
        context.sendBroadcast(intent, Intents.RECEIVER_PERMISSION);
    }

    if(prefs.getBoolean("broadcast_to_pebble", false)) {
        PebbleSync pebbleSync = new PebbleSync();
        pebbleSync.sendData(context, bgReading);
    }

    if(prefs.getBoolean("share_upload", false)) {
        ShareRest shareRest = new ShareRest(context);
        Log.w("ShareRest", "About to call ShareRest!!");
        shareRest.sendBgData(bgReading);
    }
    wakeLock.release();
}