Search in sources :

Example 1 with Preferences

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();
}
Also used : Handler(android.os.Handler) Preferences(com.zegoggles.smssync.preferences.Preferences)

Example 2 with Preferences

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;
}
Also used : AuthPreferences(com.zegoggles.smssync.preferences.AuthPreferences) Preferences(com.zegoggles.smssync.preferences.Preferences)

Example 3 with Preferences

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);
}
Also used : BackupJobs(com.zegoggles.smssync.service.BackupJobs) Preferences(com.zegoggles.smssync.preferences.Preferences) K9MailLib(com.fsck.k9.mail.K9MailLib)

Example 4 with Preferences

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();
}
Also used : AuthPreferences(com.zegoggles.smssync.preferences.AuthPreferences) OAuth2Client(com.zegoggles.smssync.auth.OAuth2Client) MainSettings(com.zegoggles.smssync.activity.fragments.MainSettings) Intent(android.content.Intent) Preferences(com.zegoggles.smssync.preferences.Preferences) AuthPreferences(com.zegoggles.smssync.preferences.AuthPreferences) Toolbar(android.support.v7.widget.Toolbar)

Example 5 with Preferences

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);
}
Also used : Preferences(com.zegoggles.smssync.preferences.Preferences)

Aggregations

Preferences (com.zegoggles.smssync.preferences.Preferences)10 AuthPreferences (com.zegoggles.smssync.preferences.AuthPreferences)3 BackupJobs (com.zegoggles.smssync.service.BackupJobs)2 Before (org.junit.Before)2 Intent (android.content.Intent)1 Handler (android.os.Handler)1 Toolbar (android.support.v7.widget.Toolbar)1 K9MailLib (com.fsck.k9.mail.K9MailLib)1 MainSettings (com.zegoggles.smssync.activity.fragments.MainSettings)1 OAuth2Client (com.zegoggles.smssync.auth.OAuth2Client)1 DataType (com.zegoggles.smssync.mail.DataType)1 DataTypePreferences (com.zegoggles.smssync.preferences.DataTypePreferences)1 AppLog (com.zegoggles.smssync.utils.AppLog)1