Search in sources :

Example 1 with OsmOAuthDialogFragment

use of de.westnordost.streetcomplete.oauth.OsmOAuthDialogFragment in project StreetComplete by westnordost.

the class SettingsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getIntent().getBooleanExtra(EXTRA_LAUNCH_AUTH, false)) {
        new OsmOAuthDialogFragment().show(getSupportFragmentManager(), OsmOAuthDialogFragment.TAG);
    }
    getIntent().putExtra(EXTRA_FRAGMENT_CLASS, SettingsFragment.class.getName());
}
Also used : OsmOAuthDialogFragment(de.westnordost.streetcomplete.oauth.OsmOAuthDialogFragment)

Example 2 with OsmOAuthDialogFragment

use of de.westnordost.streetcomplete.oauth.OsmOAuthDialogFragment in project StreetComplete by westnordost.

the class SettingsFragment method onCreatePreferences.

@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
    Injector.instance.getApplicationComponent().inject(this);
    PreferenceManager.setDefaultValues(getContext(), R.xml.preferences, false);
    addPreferencesFromResource(R.xml.preferences);
    Preference oauth = getPreferenceScreen().findPreference("oauth");
    oauth.setOnPreferenceClickListener(preference -> {
        new OsmOAuthDialogFragment().show(getFragmentManager(), OsmOAuthDialogFragment.TAG);
        return true;
    });
    Preference quests = getPreferenceScreen().findPreference("quests");
    quests.setOnPreferenceClickListener(preference -> {
        getFragmentActivity().setCurrentFragment(new QuestSelectionFragment());
        return true;
    });
    Preference questsInvalidation = getPreferenceScreen().findPreference("quests.invalidation");
    questsInvalidation.setOnPreferenceClickListener(preference -> {
        new AlertDialogBuilder(getContext()).setMessage(R.string.invalidation_dialog_message).setPositiveButton(R.string.invalidate_confirmation, (dialog, which) -> {
            downloadedTilesDao.removeAll();
        }).setNegativeButton(android.R.string.cancel, null).create().show();
        return true;
    });
}
Also used : Bundle(android.os.Bundle) FragmentContainerActivity(de.westnordost.streetcomplete.FragmentContainerActivity) Provider(javax.inject.Provider) AlertDialogBuilder(de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder) PreferenceFragmentCompat(android.support.v7.preference.PreferenceFragmentCompat) Intent(android.content.Intent) DialogFragment(android.support.v4.app.DialogFragment) DownloadedTilesDao(de.westnordost.streetcomplete.data.tiles.DownloadedTilesDao) Preference(android.support.v7.preference.Preference) PreferenceManager(android.support.v7.preference.PreferenceManager) Inject(javax.inject.Inject) IntentListener(de.westnordost.streetcomplete.IntentListener) R(de.westnordost.streetcomplete.R) SharedPreferences(android.content.SharedPreferences) Injector(de.westnordost.streetcomplete.Injector) OAuthPrefs(de.westnordost.streetcomplete.oauth.OAuthPrefs) Prefs(de.westnordost.streetcomplete.Prefs) OsmOAuthDialogFragment(de.westnordost.streetcomplete.oauth.OsmOAuthDialogFragment) AlertDialogBuilder(de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder) Preference(android.support.v7.preference.Preference) OsmOAuthDialogFragment(de.westnordost.streetcomplete.oauth.OsmOAuthDialogFragment)

Aggregations

OsmOAuthDialogFragment (de.westnordost.streetcomplete.oauth.OsmOAuthDialogFragment)2 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 Bundle (android.os.Bundle)1 DialogFragment (android.support.v4.app.DialogFragment)1 Preference (android.support.v7.preference.Preference)1 PreferenceFragmentCompat (android.support.v7.preference.PreferenceFragmentCompat)1 PreferenceManager (android.support.v7.preference.PreferenceManager)1 FragmentContainerActivity (de.westnordost.streetcomplete.FragmentContainerActivity)1 Injector (de.westnordost.streetcomplete.Injector)1 IntentListener (de.westnordost.streetcomplete.IntentListener)1 Prefs (de.westnordost.streetcomplete.Prefs)1 R (de.westnordost.streetcomplete.R)1 DownloadedTilesDao (de.westnordost.streetcomplete.data.tiles.DownloadedTilesDao)1 OAuthPrefs (de.westnordost.streetcomplete.oauth.OAuthPrefs)1 AlertDialogBuilder (de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder)1 Inject (javax.inject.Inject)1 Provider (javax.inject.Provider)1