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");
}
}
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);
}
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();
}
}
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");
}
}
}
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");
}
}
Aggregations