use of com.zegoggles.smssync.preferences.Preferences in project sms-backup-plus by jberkel.
the class SMSBackupPreferenceFragment method onCreatePreferences.
@Override
public void onCreatePreferences(Bundle bundle, String rootKey) {
setPreferencesFromResource(R.xml.preferences, rootKey);
preferences = new Preferences(getContext(), getPreferenceManager().getSharedPreferences());
handler = new Handler();
}
use of com.zegoggles.smssync.preferences.Preferences in project sms-backup-plus by jberkel.
the class SmsBroadcastReceiver method shouldSchedule.
private boolean shouldSchedule(Context context) {
final Preferences preferences = getPreferences(context);
final boolean autoBackupEnabled = preferences.isAutoBackupEnabled();
final boolean loginInformationSet = getAuthPreferences(context).isLoginInformationSet();
final boolean firstBackup = preferences.isFirstBackup();
final boolean schedule = (autoBackupEnabled && loginInformationSet && !firstBackup);
if (!schedule) {
final String message = "Not set up to back up. " + "autoBackup=" + autoBackupEnabled + ", loginInfoSet=" + loginInformationSet + ", firstBackup=" + firstBackup;
log(context, message, preferences.isAppLogDebug());
}
return schedule;
}
use of com.zegoggles.smssync.preferences.Preferences in project sms-backup-plus by jberkel.
the class App method onCreate.
@Override
public void onCreate() {
super.onCreate();
setupStrictMode();
gcmAvailable = GooglePlayServices.isAvailable(this);
preferences = new Preferences(this);
preferences.migrate();
backupJobs = new BackupJobs(this);
if (gcmAvailable) {
setBroadcastReceiversEnabled(false);
} else {
Log.v(TAG, "Google Play Services not available, forcing use of old scheduler");
preferences.setUseOldScheduler(true);
}
K9MailLib.setDebugStatus(new K9MailLib.DebugStatus() {
@Override
public boolean enabled() {
return preferences.isAppLogDebug();
}
@Override
public boolean debugSensitive() {
return false;
}
});
if (gcmAvailable && DEBUG) {
getContentResolver().registerContentObserver(Consts.SMS_PROVIDER, true, new LoggingContentObserver());
getContentResolver().registerContentObserver(Consts.CALLLOG_PROVIDER, true, new LoggingContentObserver());
}
register(this);
}
use of com.zegoggles.smssync.preferences.Preferences in project sms-backup-plus by jberkel.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportFragmentManager().addOnBackStackChangedListener(this);
authPreferences = new AuthPreferences(this);
oauth2Client = new OAuth2Client(authPreferences.getOAuth2ClientId());
fallbackAuthIntent = new Intent(this, OAuth2WebAuthActivity.class).setData(oauth2Client.requestUrl());
changeDefaultPackageIntent = new Intent(ACTION_CHANGE_DEFAULT).putExtra(EXTRA_PACKAGE_NAME, getPackageName());
preferences = new Preferences(this);
if (bundle == null) {
showFragment(new MainSettings(), null);
}
if (preferences.shouldShowAboutDialog()) {
showDialog(ABOUT);
}
checkDefaultSmsApp();
requestPermissionsIfNeeded();
}
use of com.zegoggles.smssync.preferences.Preferences in project sms-backup-plus by jberkel.
the class ThemeActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
final int themeResId = new Preferences(this).getAppTheme();
setTheme(themeResId);
if (VERSION.SDK_INT >= 26) {
setNavBarColor(themeResId);
}
super.onCreate(savedInstanceState);
}
Aggregations