Search in sources :

Example 16 with DialogFragment

use of android.app.DialogFragment in project android_packages_apps_Launcher2 by CyanogenMod.

the class WallpaperChooser method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.wallpaper_chooser_base);
    Fragment fragmentView = getFragmentManager().findFragmentById(R.id.wallpaper_chooser_fragment);
    // needs to be revived again.
    if (fragmentView == null) {
        /* When the screen is XLarge, the fragment is not included in the layout, so show it
             * as a dialog
             */
        DialogFragment fragment = WallpaperChooserDialogFragment.newInstance();
        fragment.show(getFragmentManager(), "dialog");
    }
}
Also used : DialogFragment(android.app.DialogFragment) Fragment(android.app.Fragment) DialogFragment(android.app.DialogFragment)

Example 17 with DialogFragment

use of android.app.DialogFragment in project Aegis by Decad3nce.

the class AdvancedSettingsFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.advanced_preferences);
    final Preference removeAdmin = findPreference("remove_admin");
    final Preference installToSystem = findPreference("install_to_system");
    final DevicePolicyManager mDPM = (DevicePolicyManager) getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);
    if (mDPM.getActiveAdmins() == null || !mDPM.isAdminActive(AegisActivity.DEVICE_ADMIN_COMPONENT)) {
        PreferenceCategory mCategory = (PreferenceCategory) findPreference("advanced_category");
        mCategory.removePreference(removeAdmin);
    }
    Preference.OnPreferenceClickListener preferenceListener = (new OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (preference.getKey().equals(ADVANCED_PREFERENCES_REMOVE_ADMIN)) {
                if (mDPM.isAdminActive(AegisActivity.DEVICE_ADMIN_COMPONENT)) {
                    removeAdmin(mDPM, removeAdmin);
                }
            }
            if (preference.getKey().equals(ADVANCED_PREFERENCES_INSTALL_TO_SYSTEM)) {
                DialogFragment dialog = new InstallToSystemDialogFragment();
                dialog.show(getActivity().getFragmentManager(), "InstallToSystemDialogFragment");
            }
            return false;
        }
    });
    removeAdmin.setOnPreferenceClickListener(preferenceListener);
    installToSystem.setOnPreferenceClickListener(preferenceListener);
}
Also used : DevicePolicyManager(android.app.admin.DevicePolicyManager) OnPreferenceClickListener(android.preference.Preference.OnPreferenceClickListener) OnPreferenceClickListener(android.preference.Preference.OnPreferenceClickListener) DialogFragment(android.app.DialogFragment)

Example 18 with DialogFragment

use of android.app.DialogFragment in project Aegis by Decad3nce.

the class BackupGoogleAccountsActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.backup_layout);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    progressBar.setVisibility(View.VISIBLE);
    context = this;
    Intent intent;
    cr = getContentResolver();
    credential = GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE);
    try {
        intent = getIntent();
        if (intent.hasExtra("fromReceiver")) {
            address = intent.getStringExtra("fromReceiver");
            Log.i(TAG, "Backup intent from receiver");
            recoverData();
        } else {
            Log.i(TAG, "Backup intent from elsewhere");
            DialogFragment dialog = new BackupAccountsDialogFragment();
            dialog.show(getFragmentManager(), "BackupAccountsDialogFragment");
        }
    } catch (Exception e) {
        recoverData();
    }
}
Also used : BackupAccountsDialogFragment(com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment) DialogFragment(android.app.DialogFragment) BackupAccountsDialogFragment(com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment) GoogleAuthException(com.google.android.gms.auth.GoogleAuthException) UserRecoverableAuthIOException(com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException) IOException(java.io.IOException)

Example 19 with DialogFragment

use of android.app.DialogFragment in project android-gps-test-tool by Esri.

the class GPSTesterActivityController method startLocation.

/**
	 * Start and reset everything
	 */
public void startLocation() {
    if (_locationManager == null) {
        if (_startButton != null) {
            _startButton.setTextColor(Color.RED);
            _startButton.setText("Stop");
        }
        _elapsedTimer.startTimer(1000, _elapsedTime);
        _initialGPSTime = _elapsedTimer.getElapsedtime();
        _initialNetworkTime = _elapsedTimer.getElapsedtime();
        _locationManager = (LocationManager) _activity.getSystemService(Context.LOCATION_SERVICE);
        final Boolean gpsProviderEnabled = _locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
        final Boolean networkProviderEnabled = _locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
        final Boolean gpsPreferences = _preferences.getBoolean("pref_key_gps", true);
        final Boolean networkPreferences = _preferences.getBoolean("pref_key_network", true);
        final Boolean useCriteria = _preferences.getBoolean("pref_key_useCriteria", false);
        //Check network availability on startup. This version of the app cannot use maps offline
        final Boolean isNetworkAvailable = CheckConnectivity.checkNow(_activity.getApplicationContext());
        final DialogFragment networkFragment = new NetworkAlertDialogFragment();
        if (useCriteria == true) {
            _imCriteria.setImageResource(R.drawable.greensphere31);
        } else {
            _imCriteria.setImageResource(R.drawable.redsphere31);
        }
        //			setMapListeners();
        setUI();
        setLocationManagerUI(gpsProviderEnabled, networkProviderEnabled);
        if (gpsProviderEnabled == true && gpsPreferences == true) {
            Log.d("GPSTester", "CHECK1 CHECK1 CHECK1");
            if (networkProviderEnabled == true && networkPreferences == true && isNetworkAvailable == true) {
                Log.d("GPSTester", "Startup: GPS enabled true. GPS prefs true. Network enabled. Network Prefs true");
                delayedStartLocationProvider(null, true);
                _imGPS.setImageResource(R.drawable.greensphere31);
                _imNetwork.setImageResource(R.drawable.greensphere31);
            } else {
                Log.d("GPSTester", "Startup: GPS enabled true. GPS prefs true. Network not enabled.");
                delayedStartLocationProvider(true, false);
                _imGPS.setImageResource(R.drawable.greensphere31);
                _imNetwork.setImageResource(R.drawable.redsphere31);
                displayToast("No network connection available.", Toast.LENGTH_LONG);
                //Inflate alert dialog
                networkFragment.show(_activity.getFragmentManager(), "NetworkAlert");
            }
        } else if (gpsProviderEnabled == true && gpsPreferences == false) {
            Log.d("GPSTester", "CHECK2 CHECK2 CHECK2");
            if (networkProviderEnabled == true && networkPreferences == true && isNetworkAvailable == true) {
                Log.d("GPSTester", "Startup: GPS enabled. GPS prefs false. Network enabled. Network Prefs true ");
                delayedStartLocationProvider(false, true);
                _imGPS.setImageResource(R.drawable.redsphere31);
                _imNetwork.setImageResource(R.drawable.greensphere31);
            } else {
                Log.d("GPSTester", "Startup: GPS enabled true. GPS prefs false. Network not enabled.");
                _imGPS.setImageResource(R.drawable.redsphere31);
                _imNetwork.setImageResource(R.drawable.redsphere31);
                displayToast("No network connection available.", Toast.LENGTH_LONG);
                //Inflate alert dialog
                networkFragment.show(_activity.getFragmentManager(), "NetworkAlert");
            }
        } else if (gpsProviderEnabled == false) {
            Log.d("GPSTester", "CHECK3 CHECK3 CHECK3");
            if (networkProviderEnabled == true && networkPreferences == true && isNetworkAvailable == true) {
                Log.d("GPSTester", "Startup: GPS not enabled. Network enabled. Network Prefs true.");
                delayedStartLocationProvider(false, true);
                _imGPS.setImageResource(R.drawable.redsphere31);
                _imNetwork.setImageResource(R.drawable.greensphere31);
            } else if (networkProviderEnabled == true && networkPreferences == false) {
                Log.d("GPSTester", "Startup: GPS not enabled. Network enabled. Network Prefs false.");
                _imGPS.setImageResource(R.drawable.redsphere31);
                _imNetwork.setImageResource(R.drawable.redsphere31);
                networkFragment.show(_activity.getFragmentManager(), "NetworkAlert");
            } else {
                Log.d("GPSTester", "Startup: check your GPS and network settings.");
                _imGPS.setImageResource(R.drawable.redsphere31);
                _imNetwork.setImageResource(R.drawable.redsphere31);
                networkFragment.show(_activity.getFragmentManager(), "NetworkAlert");
            }
            //Inflate alert dialog
            DialogFragment gpsFragment = new GPSAlertDialogFragment();
            gpsFragment.show(_activity.getFragmentManager(), "GPSAlert");
        }
    }
}
Also used : GPSAlertDialogFragment(com.agup.gps.fragments.GPSAlertDialogFragment) DialogFragment(android.app.DialogFragment) NetworkAlertDialogFragment(com.agup.gps.fragments.NetworkAlertDialogFragment) GPSAlertDialogFragment(com.agup.gps.fragments.GPSAlertDialogFragment) NetworkAlertDialogFragment(com.agup.gps.fragments.NetworkAlertDialogFragment)

Example 20 with DialogFragment

use of android.app.DialogFragment in project android-gps-test-tool by Esri.

the class GPSTesterActivityController method startNetworkLocation.

private void startNetworkLocation() {
    final Boolean networkProviderEnabled = _locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
    final Boolean networkPreferences = _preferences.getBoolean("pref_key_network", true);
    //Check network availability on startup. This version of the app cannot use maps offline
    final Boolean isNetworkAvailable = CheckConnectivity.checkNow(_activity.getApplicationContext());
    final DialogFragment networkFragment = new NetworkAlertDialogFragment();
    if (networkProviderEnabled == true && networkPreferences == true && isNetworkAvailable == true) {
        Log.d("GPSTester", "Startup: GPS not enabled. Network enabled. Network Prefs true.");
        delayedStartLocationProvider(false, true);
        _imNetwork.setImageResource(R.drawable.greensphere31);
    } else if (networkProviderEnabled == true && networkPreferences == false) {
        Log.d("GPSTester", "Startup: GPS not enabled. Network enabled. Network Prefs false.");
        _imNetwork.setImageResource(R.drawable.redsphere31);
        networkFragment.show(_activity.getFragmentManager(), "NetworkAlert");
    } else {
        Log.d("GPSTester", "Startup: check your GPS and network settings.");
        _imNetwork.setImageResource(R.drawable.redsphere31);
        networkFragment.show(_activity.getFragmentManager(), "NetworkAlert");
    }
}
Also used : GPSAlertDialogFragment(com.agup.gps.fragments.GPSAlertDialogFragment) DialogFragment(android.app.DialogFragment) NetworkAlertDialogFragment(com.agup.gps.fragments.NetworkAlertDialogFragment) NetworkAlertDialogFragment(com.agup.gps.fragments.NetworkAlertDialogFragment)

Aggregations

DialogFragment (android.app.DialogFragment)45 Fragment (android.app.Fragment)10 FragmentManager (android.app.FragmentManager)7 FragmentTransaction (android.app.FragmentTransaction)7 ConfirmationDialogFragment (com.fsck.k9.fragment.ConfirmationDialogFragment)3 Intent (android.content.Intent)2 Bundle (android.os.Bundle)2 View (android.view.View)2 TextView (android.widget.TextView)2 GPSAlertDialogFragment (com.agup.gps.fragments.GPSAlertDialogFragment)2 NetworkAlertDialogFragment (com.agup.gps.fragments.NetworkAlertDialogFragment)2 BackupAccountsDialogFragment (com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment)2 ProgressDialogFragment (com.fsck.k9.fragment.ProgressDialogFragment)2 BaseFragment (it.gmariotti.cardslib.demo.fragment.BaseFragment)2 Activity (android.app.Activity)1 DevicePolicyManager (android.app.admin.DevicePolicyManager)1 BroadcastReceiver (android.content.BroadcastReceiver)1 ComponentName (android.content.ComponentName)1 Context (android.content.Context)1 IntentFilter (android.content.IntentFilter)1