mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Update widgets and reminders on background; faster startup
This commit is contained in:
@@ -24,6 +24,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
@@ -36,7 +37,6 @@ import org.isoron.helpers.ReplayableActivity;
|
|||||||
import org.isoron.uhabits.fragments.ListHabitsFragment;
|
import org.isoron.uhabits.fragments.ListHabitsFragment;
|
||||||
import org.isoron.uhabits.helpers.ReminderHelper;
|
import org.isoron.uhabits.helpers.ReminderHelper;
|
||||||
import org.isoron.uhabits.models.Habit;
|
import org.isoron.uhabits.models.Habit;
|
||||||
import org.isoron.uhabits.widgets.BaseWidgetProvider;
|
|
||||||
import org.isoron.uhabits.widgets.CheckmarkWidgetProvider;
|
import org.isoron.uhabits.widgets.CheckmarkWidgetProvider;
|
||||||
import org.isoron.uhabits.widgets.HistoryWidgetProvider;
|
import org.isoron.uhabits.widgets.HistoryWidgetProvider;
|
||||||
import org.isoron.uhabits.widgets.ScoreWidgetProvider;
|
import org.isoron.uhabits.widgets.ScoreWidgetProvider;
|
||||||
@@ -72,10 +72,19 @@ public class MainActivity extends ReplayableActivity
|
|||||||
private void onStartup()
|
private void onStartup()
|
||||||
{
|
{
|
||||||
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
||||||
ReminderHelper.createReminderAlarms(MainActivity.this);
|
|
||||||
DialogHelper.incrementLaunchCount(this);
|
DialogHelper.incrementLaunchCount(this);
|
||||||
showTutorial();
|
showTutorial();
|
||||||
updateWidgets(this);
|
|
||||||
|
new AsyncTask<Void, Void, Void>() {
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(Void... params)
|
||||||
|
{
|
||||||
|
ReminderHelper.createReminderAlarms(MainActivity.this);
|
||||||
|
updateWidgets(MainActivity.this);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}.execute();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showTutorial()
|
private void showTutorial()
|
||||||
|
|||||||
Reference in New Issue
Block a user