Remove unecessary commended code

This commit is contained in:
Jacques Foucry 2016-11-08 12:17:49 +01:00
parent f88a7157b8
commit d2b17bf637
3 changed files with 1 additions and 85 deletions

View file

@ -53,7 +53,6 @@
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<service android:name=".TimeService"/>
<service android:name=".PillDroidJobService"
android:permission="android.permission.BIND_JOB_SERVICE"/>
</application>

View file

@ -75,17 +75,9 @@ public class MedicamentListActivity extends AppCompatActivity {
super.onStart();
Log.d(TAG, "Remove old notification");
// cancelAllJobs(mRecyclerView);
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.cancelAll();
/*try {
mJobScheduler.cancelAll();
} catch (Exception e) {
Log.d(TAG, "no old job to remove");
}*/
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client.connect();
@ -106,16 +98,6 @@ public class MedicamentListActivity extends AppCompatActivity {
public void onStop() {
super.onStop();
// mJobScheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
//
// JobInfo.Builder builder = new JobInfo.Builder(1,
// new ComponentName( getPackageName(), PillDroidJobService.class.getName()));
// builder.setPeriodic(30000); // Dans 30 secondes, en millisecondes
//
// if (mJobScheduler.schedule(builder.build()) <= 0) {
// Log.d(TAG, "Something goes wrong at job schedule");
// }
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
Action viewAction = Action.newAction(
@ -132,17 +114,11 @@ public class MedicamentListActivity extends AppCompatActivity {
client.disconnect();
}
/* public void cancelAllJobs(View v) {
JobScheduler tm = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
tm.cancelAll();
}*/
private static final String TAG = MedicamentListActivity.class.getName();
private DBHelper dbHelper;
private DBMedoc dbMedoc;
// private SimpleCursorAdapter drugAdapter;
private List<Medicament> medicaments;
private View mRecyclerView;
@ -171,8 +147,6 @@ public class MedicamentListActivity extends AppCompatActivity {
toolbar.setTitle(getTitle());
}
// startService(new Intent(this, TimeService.class));
if (DEMO) {
// Added to drop database each the app is launch.
if (DBDEMO) {
@ -298,8 +272,7 @@ public class MedicamentListActivity extends AppCompatActivity {
currentMedicament.newStock(currentMedicament.getStock());
}
// Must record new stock in DB
// Toast.makeText(getApplicationContext(), "PillDroid - Calcul nouveau stocks", Toast.LENGTH_SHORT).show();
// TODO: Must record new stock in DB
// TODO: si un des médicaments est en rouge, on déclanche une notification visuelle pour dans 5 secondes
Calendar calendar = Calendar.getInstance();

View file

@ -1,56 +0,0 @@
package net.foucry.pilldroid;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.widget.Toast;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
/**
* Created by jacques on 22/08/16.
*/
public class TimeService extends Service {
//public static final long NOTIFY_INTERVAL = 10 *1000;
private Handler mHandler = new Handler();
private Timer mTimer = null;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
if(mTimer != null) {
mTimer.cancel();
} else {
mTimer = new Timer();
}
mTimer.scheduleAtFixedRate(new TimeDisplayTimerTask(),0, UtilDate.tomorrowAtNoonInMillis());
}
class TimeDisplayTimerTask extends TimerTask {
@Override
public void run() {
mHandler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(),getDateTime(), Toast.LENGTH_SHORT).show();
}
});
}
private String getDateTime() {
SimpleDateFormat sdf = new SimpleDateFormat("[yyyy/MM/dd - HH:mm:ss]");
return sdf.format(new Date());
}
}
}