Java Code Examples for android.app.DialogFragment

The following are top voted examples for showing how to use android.app.DialogFragment. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: q-mail   File: AccountSetupCheckSettings.java   Source Code and License 7 votes vote down vote up
private void showDialogFragment(int dialogId, String customMessage) {
    if (mDestroyed) {
        return;
    }
    mProgressBar.setIndeterminate(false);

    DialogFragment fragment;
    switch (dialogId) {
        case R.id.dialog_account_setup_error: {
            fragment = ConfirmationDialogFragment.newInstance(dialogId,
                    getString(R.string.account_setup_failed_dlg_title),
                    customMessage,
                    getString(R.string.account_setup_failed_dlg_edit_details_action),
                    getString(R.string.account_setup_failed_dlg_continue_action)
            );
            break;
        }
        default: {
            throw new RuntimeException("Called showDialog(int) with unknown dialog id.");
        }
    }

    FragmentTransaction ta = getFragmentManager().beginTransaction();
    ta.add(fragment, getDialogTag(dialogId));
    ta.commitAllowingStateLoss();

    // TODO: commitAllowingStateLoss() is used to prevent https://code.google.com/p/android/issues/detail?id=23761
    // but is a bad...
    //fragment.show(ta, getDialogTag(dialogId));
}
 
Example 2
Project: TimeTrix   File: DialogAddNewNote.java   Source Code and License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mNum = getArguments().getInt("num");

    // Pick a style based on the num.
    int style = DialogFragment.STYLE_NORMAL, theme = 0;
    switch ((mNum-1)%6) {
        case 1: style = DialogFragment.STYLE_NO_TITLE; break;
        case 2: style = DialogFragment.STYLE_NO_FRAME; break;
        case 3: style = DialogFragment.STYLE_NO_INPUT; break;
        case 4: style = DialogFragment.STYLE_NORMAL; break;
        case 5: style = DialogFragment.STYLE_NORMAL; break;
        case 6: style = DialogFragment.STYLE_NO_TITLE; break;
        case 7: style = DialogFragment.STYLE_NO_FRAME; break;
        case 8: style = DialogFragment.STYLE_NORMAL; break;
    }
    switch ((mNum-1)%6) {
        case 4: theme = android.R.style.Theme_Holo; break;
        case 5: theme = android.R.style.Theme_Holo_Light_Dialog; break;
        case 6: theme = android.R.style.Theme_Holo_Light; break;
        case 7: theme = android.R.style.Theme_Holo_Light_Panel; break;
        case 8: theme = android.R.style.Theme_Holo_Light; break;
    }
    setStyle(style, theme);
}
 
Example 3
Project: AndroidBackendlessChat   File: ChatSDKIntentClickListener.java   Source Code and License 6 votes vote down vote up
public static View.OnClickListener getPickImageClickListener(final FragmentActivity activity,final DialogFragment fragment, final int requestCode){
    return new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            pickIntent();
        }

        private void pickIntent(){
            Intent intent = new Intent();
            intent.setType("image/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);

            activity.startActivityFromFragment(fragment, Intent.createChooser(intent,
                    "Complete action using"), requestCode);
        }
    };
}
 
Example 4
Project: GoalsAndHabits   File: ViewEventActivity.java   Source Code and License 6 votes vote down vote up
/**
 *  Location button clicked, record location.
 * @param dialog
 * @return currentLoc
 */
@Override
public Location onLocButtonClick(DialogFragment dialog) {
    if (checkLocationPermission()){
        mFusedLocationClient.getLastLocation()
                .addOnSuccessListener(this, new OnSuccessListener<Location>() {
                    @Override
                    public void onSuccess(Location location) {
                        // Got last known location. In some rare situations this can be null.
                        if (location != null) {
                            currentLoc = location;
                        }
                    }
                });
    }else{requestPermission();}

    return currentLoc;
}
 
Example 5
Project: GoalsAndHabits   File: ViewHabitActivity.java   Source Code and License 6 votes vote down vote up
/**
 * Handles the call back from the date picker
 * @param dialog DatePicker
 * @param date Habit Date
 */
@Override
public void onDatePicked(DialogFragment dialog, Date date) {
    boolean allowed=true;
    ArrayList<HabitEvent> events = habit.getEvents();
    if (events!=null){
        for (HabitEvent event : events){
            if (Util.isDateAfter(event.getDate(),date)){
                allowed=false;
                break;
            }
        }
    }
    if (allowed) {
        TextView habitDate = (TextView) findViewById(R.id.textHabitDate);
        habitDate.setText(dateFormat.format(date));
        habit.setStartDate(date);
    }else{
        Toast.makeText(ViewHabitActivity.this,"An event already exists prior to " + dateFormat.format(date) + "!",Toast.LENGTH_LONG).show();
    }
}
 
Example 6
Project: GoalsAndHabits   File: SearchResultsActivity.java   Source Code and License 6 votes vote down vote up
/**
 * User clicked the request dialog's positive option
 * @param dialog Send Request Dialog Fragment
 * @param userName Username of profile to follow
 */
public void onDialogPositiveClick(DialogFragment dialog, String userName) {
    Log.i("Info", "requested to follow "+userName);
    ElasticSearchController.GetProfilesTask sendARequest = new ElasticSearchController.GetProfilesTask();
    sendARequest.execute(userName);
    try {
        matches = sendARequest.get();
    }catch (Exception e){
        Log.i("Error", "Failed to get profiles from async object");
    }
    followee = matches.get(0);
    if (followee.getFollowRequests()==null) {
        followee.setFollowRequests(new ArrayList<Profile>());
    }
    followee.addFollowReq(me);
    if (!followee.getFollowRequests().isEmpty()) {
        Log.i("Info", "Added " + me.getUsername() + " to " + followee.getUsername());
    }
    saveData();
}
 
Example 7
Project: GoalsAndHabits   File: FollowerRequestsActivity.java   Source Code and License 6 votes vote down vote up
/**
 * User clicked the Accept Follower Dialog's positive option. The follow request is deleted, and
 * the follower adds the user to their users follower.
 * @param dialog Accept Follower Dialog Fragment
 * @param followerName Username of new follower profile
 */
@Override
public void onDialogPositiveClick(DialogFragment dialog, String followerName) {
    Log.i("Info", "accepted follow from "+followerName);
    ElasticSearchController.GetProfilesTask acceptFollow = new ElasticSearchController.GetProfilesTask();
    acceptFollow.execute(followerName);
    try {
        followers = acceptFollow.get();
    }catch (Exception e){
        Log.i("Error", "Failed to get profiles from async object");
    }
    follower = followers.get(0);
    if (follower.getUsersFollowed()==null) {
        follower.setUsersFollowed(new ArrayList<Profile>());
    }
    follower.addFollowee(me);
    if (follower.getUsersFollowed().get(follower.getUsersFollowed().size()-1).getUsername().equals(me.getUsername())) {
        Log.i("Info", "Added " + me.getUsername() + " as user followed to " + follower.getUsername());
    }
    saveData();
    me.removeFollowReq(pos);
    saveProfile();
    usersArrayAdapter.notifyDataSetChanged();
}
 
Example 8
Project: PinchToZoom   File: MainActivity.java   Source Code and License 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if(R.id.add_photo == id) {
        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, getResources().getString(R.string.add_photo)), PICK_IMAGE);
    } else if(R.id.clear == id) {
        List<Drawable> drawables = imageViewPagerAdapter.drawables;
        drawables.clear();
        addDefaultImages(drawables);
        imageViewPagerAdapter.notifyDataSetChanged();
    } else if(R.id.info == id) {
        DialogFragment infoDialogFragment = new InfoDialogFragment();
        infoDialogFragment.show(getFragmentManager(), "info");
    }
    return super.onOptionsItemSelected(item);
}
 
Example 9
Project: Show_Chat   File: SettingsActivity.java   Source Code and License 6 votes vote down vote up
private void updateSummary(String key, boolean changing) {
    switch (key) {
        case Constants.PREF_APP_LANGUAGE:
            entrySummary(key);
            if (changing) {
                DialogFragment dialogFragment = new SettingsAlertDialog().newInstance(R.string.restart_dialog_message);
                dialogFragment.show(getActivity().getFragmentManager(), "restartApp");
            }
            break;
        case Constants.PREF_MOVIES_LANGUAGE:
            entrySummary(key);
            break;
        case Constants.PREF_IMAGES_CACHE:
            File cacheDir = getActivity().getCacheDir();
            File picassoCacheDir = new File(cacheDir, "picasso-cache");
            double size = AppUtils.getDirSize(picassoCacheDir);
            preferenceSummary(key, getString(R.string.pref_summary_cache_size, size));
            break;
    }
}
 
Example 10
Project: localcloud_fe   File: AdvancedGeolocation.java   Source Code and License 6 votes vote down vote up
/**
 * For working with pre-Android M security permissions
 * @param gpsEnabled If the cacheManifest and system allow gps
 * @param networkLocationEnabled If the cacheManifest and system allow network location access
 * @param cellularEnabled If the cacheManifest and system allow cellular data access
 */
private void alertDialog(boolean gpsEnabled, boolean networkLocationEnabled, boolean cellularEnabled){

    if(!gpsEnabled || !networkLocationEnabled){
        sendCallback(PluginResult.Status.ERROR,
                JSONHelper.errorJSON(PROVIDER_PRIMARY, ErrorMessages.LOCATION_SERVICES_UNAVAILABLE()));

        final DialogFragment gpsFragment = new GPSAlertDialogFragment();
        gpsFragment.show(_cordovaActivity.getFragmentManager(), "GPSAlert");
    }

    if(!cellularEnabled){
        sendCallback(PluginResult.Status.ERROR,
                JSONHelper.errorJSON(PROVIDER_PRIMARY, ErrorMessages.CELL_DATA_NOT_AVAILABLE()));

        final DialogFragment networkUnavailableFragment = new NetworkUnavailableDialogFragment();
        networkUnavailableFragment.show(_cordovaActivity.getFragmentManager(), "NetworkUnavailableAlert");
    }
}
 
Example 11
Project: localcloud_fe   File: AdvancedGeolocation.java   Source Code and License 6 votes vote down vote up
/**
 * For working with pre-Android M security permissions
 * @param gpsEnabled If the cacheManifest and system allow gps
 * @param networkLocationEnabled If the cacheManifest and system allow network location access
 * @param cellularEnabled If the cacheManifest and system allow cellular data access
 */
private void alertDialog(boolean gpsEnabled, boolean networkLocationEnabled, boolean cellularEnabled){

    if(!gpsEnabled || !networkLocationEnabled){
        sendCallback(PluginResult.Status.ERROR,
                JSONHelper.errorJSON(PROVIDER_PRIMARY, ErrorMessages.LOCATION_SERVICES_UNAVAILABLE()));

        final DialogFragment gpsFragment = new GPSAlertDialogFragment();
        gpsFragment.show(_cordovaActivity.getFragmentManager(), "GPSAlert");
    }

    if(!cellularEnabled){
        sendCallback(PluginResult.Status.ERROR,
                JSONHelper.errorJSON(PROVIDER_PRIMARY, ErrorMessages.CELL_DATA_NOT_AVAILABLE()));

        final DialogFragment networkUnavailableFragment = new NetworkUnavailableDialogFragment();
        networkUnavailableFragment.show(_cordovaActivity.getFragmentManager(), "NetworkUnavailableAlert");
    }
}
 
Example 12
Project: CodeCompilerApp   File: DialogHelper.java   Source Code and License 6 votes vote down vote up
private static void showDialog(Activity activity, Class clazz, String tag) {
    FragmentManager fm = activity.getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(tag);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    try {
        ((DialogFragment) clazz.newInstance()).show(ft, tag);
    } catch (InstantiationException | IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
Example 13
Project: arrispwgen-android   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onDialogPositiveClick(DialogFragment dialog) {
    Dialog dialogView = dialog.getDialog();
    EditText txt_seed = (EditText) dialogView.findViewById(R.id.txt_seed);
    seed = txt_seed.getText().toString();
    generate_potd_list();
}
 
Example 14
Project: FingerPrint-Authentication-With-React-Native-Android   File: FingerprintAuthenticationDialogFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Do not create a new Fragment when the Activity is re-created such as orientation changes.
    setRetainInstance(true);
    setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Material_Light_Dialog);
}
 
Example 15
Project: Show_Chat   File: SettingsActivity.java   Source Code and License 5 votes vote down vote up
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
    if (preference.equals(findPreference(Constants.PREF_IMAGES_CACHE))) {
        File cacheDir = getActivity().getCacheDir();
        File picassoCacheDir = new File(cacheDir, "picasso-cache");
        int messageId = AppUtils.deleteDir(picassoCacheDir) ? R.string.clear_cache_message_ok : R.string.clear_cache_message_fail;
        DialogFragment dialogFragment = new SettingsAlertDialog().newInstance(messageId);
        dialogFragment.show(getActivity().getFragmentManager(), "clearCache");
        updateSummary(Constants.PREF_IMAGES_CACHE, false);
    }
    return super.onPreferenceTreeClick(preferenceScreen, preference);
}
 
Example 16
Project: aftercare-app-android   File: DCDialogFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
    getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    setStyle(DialogFragment.STYLE_NO_FRAME, android.R.style.Theme);
}
 
Example 17
Project: MVVMFrames   File: BaseDialogFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Black_NoTitleBar_Fullscreen);

    if (openBlur()) {// 是否开启模糊效果
        dialogEngine = new BlurEngine(getActivity());
        dialogEngine.setBlurDegree(getBlurDegree());
        dialogEngine.setBlurRadius(getBlurRadius());
        dialogEngine.setSwitchEngine(isSwitchEngine());
        dialogEngine.setDebugMode(isDebugMode());
    }
}
 
Example 18
Project: happy-news   File: NotificationSettingsActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_notification_settings);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setTitle(R.string.title_settings_notification);
    notificationListView = (ListView) findViewById(R.id.notificationListView);

    preferences = getApplicationContext().getSharedPreferences(
        getString(R.string.preference_file_key), Context.MODE_PRIVATE);

    addNotificationFab = (FloatingActionButton) findViewById(R.id.timePickerFAB);
    addNotificationFab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            DialogFragment newFragment = new TimePickerFragment();
            newFragment.show(getFragmentManager(), "timePicker");
        }
    });

    notifications = new ArrayList<>();
    String notificationsGsonString = preferences.getString(getString(R.string.preference_notifications), "");
    Type type = new TypeToken<List<NotificationSetting>>() {
    }.getType();
    if (!notificationsGsonString.equals("")) {
        notifications = new Gson().fromJson(notificationsGsonString, type);
    }
    refreshList();
}
 
Example 19
Project: citizen-sdk-android   File: FingerprintAuthenticationDialogFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);

	setRetainInstance(true);
	setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Material_Light_Dialog);

       fingerprintLoginTask = new FingerprintLoginTask(this, userService);
	passwordLoginTask = new PasswordLoginTask(this, userService);
   }
 
Example 20
Project: citizen-sdk-android   File: FingerprintTokenSignDialogFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setRetainInstance(true);
	setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Material_Light_Dialog);
}
 
Example 21
Project: open-rmbt   File: CheckNewsTask.java   Source Code and License 5 votes vote down vote up
@Override
protected void onPostExecute(final JSONArray newsList)
{
    
    if (newsList != null && newsList.length() > 0 && !serverConn.hasError())
        for (int i = 0; i < newsList.length(); i++)
            if (!isCancelled() && !Thread.interrupted())
                try
                {
                    
                    final JSONObject newsItem = newsList.getJSONObject(i);
                    
                    final DialogFragment newFragment = RMBTAlertDialogFragment.newInstance(
                            newsItem.optString("title", activity.getString(R.string.news_title)),
                            newsItem.optString("text", activity.getString(R.string.news_no_message)), null);
                    
                    newFragment.show(activity.getFragmentManager(), "dialog");
                    
                    if (newsItem.has("uid"))
                    {
                        if (lastNewsUid < newsItem.getLong("uid"))
                            lastNewsUid = newsItem.getLong("uid");
                    }
                }
                catch (final JSONException e)
                {
                    e.printStackTrace();
                }
    
    ConfigHelper.setLastNewsUid(activity.getApplicationContext(), lastNewsUid);
}
 
Example 22
Project: GoalsAndHabits   File: ViewEventActivity.java   Source Code and License 5 votes vote down vote up
/**
 * When accept button clicked,save changes
 * @param dialog
 * @param newcomment
 * @param newloc
 */
@Override
public void onDialogPositiveClick(DialogFragment dialog, String newcomment, Location newloc) {
    if (newloc != null) {
        event.setLocation(newloc);
    }
    event.setComment(newcomment);
    comment.setText(newcomment);
}
 
Example 23
Project: GoalsAndHabits   File: ViewHabitActivity.java   Source Code and License 5 votes vote down vote up
/**
 * Receives new information from edit habit dialog and makes appropriate updates to the habit.
 * Closes dialog.
 * @param dialog Edit Habit Dialog Fragment
 * @param newreason Updated habit reason string
 * @param newtitle Updated habit name string
 */

@Override
public void onDialogPositiveClick(DialogFragment dialog, String newreason, String newtitle, HashSet<Integer> newschedule) {
    reason.setText(newreason);
    toolbar.setTitle(newtitle);
    schedule.setText(getScheduleString(newschedule));
    habit.setReason(newreason);
    habit.setTitle(newtitle);
    habit.setSchedule(newschedule);
}
 
Example 24
Project: GoalsAndHabits   File: FollowActivity.java   Source Code and License 5 votes vote down vote up
/**
 * User clicked the positive option of the dialog, and the app searches for the requested user
 * @param dialog User Search Dialog Fragment
 * @param userSearch Username input
 */
@Override
public void onDialogPositiveClick(DialogFragment dialog, String userSearch) {
    if (userSearch.equals("")) {
        Toast.makeText(FollowActivity.this,"Please enter a user to search for!", Toast.LENGTH_SHORT).show();
    }
    else {
        Intent results = new Intent(FollowActivity.this, SearchResultsActivity.class);
        results.putExtra("search", userSearch);
        startActivity(results);
    }

}
 
Example 25
Project: AcademApp   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onPositiveClick(DialogFragment dialog, String title, String desc) {
    // add the post to Firebase Database
    DatabaseReference ref = postsRef.push();
    ref.child("post_title").setValue(title);
    ref.child("post_desc").setValue(desc);
    ref.child("uid").setValue(firebaseUser.getUid());
    List<String> joinedUsers = new ArrayList<>();
    for (int i = 1; i <= 7; i++)
        joinedUsers.add("uid" + i);
    ref.child("joined_users").setValue(joinedUsers);
    ref.child("name").setValue(firebaseUser.getDisplayName());
    ref.child("type").setValue(User.getInstance().getType());
}
 
Example 26
Project: chromium-for-android-56-debug-video   File: ConfirmSyncDataStateMachine.java   Source Code and License 5 votes vote down vote up
private static void cancelDialog(FragmentManager fragmentManager, String tag) {
    Fragment fragment = fragmentManager.findFragmentByTag(tag);

    if (fragment == null) return;
    DialogFragment dialogFragment = (DialogFragment) fragment;

    if (dialogFragment.getDialog() == null) return;
    dialogFragment.getDialog().cancel();
}
 
Example 27
Project: chromium-for-android-56-debug-video   File: SyncCustomizationFragment.java   Source Code and License 5 votes vote down vote up
private void closeDialogIfOpen(String tag) {
    FragmentManager manager = getFragmentManager();
    if (manager == null) {
        // Do nothing if the manager doesn't exist yet; see http://crbug.com/480544.
        return;
    }
    DialogFragment df = (DialogFragment) manager.findFragmentByTag(tag);
    if (df != null) {
        df.dismiss();
    }
}
 
Example 28
Project: keemob   File: FingerprintAuthenticationDialogFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Do not create a new Fragment when the Activity is re-created such as orientation changes.
    setRetainInstance(true);
    setStyle(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Material_Light_Dialog);

    mKeyguardManager = (KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE);
    mFingerprintUiHelperBuilder = new FingerprintUiHelper.FingerprintUiHelperBuilder(
            getContext(), getContext().getSystemService(FingerprintManager.class));

}
 
Example 29
Project: keemob   File: FingerprintAuthenticationDialogFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Do not create a new Fragment when the Activity is re-created such as orientation changes.
    setRetainInstance(true);
    setStyle(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Material_Light_Dialog);

    mKeyguardManager = (KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE);
    mFingerprintUiHelperBuilder = new FingerprintUiHelper.FingerprintUiHelperBuilder(
            getContext(), getContext().getSystemService(FingerprintManager.class));

}
 
Example 30
Project: Brevent   File: DonateActivity.java   Source Code and License 5 votes vote down vote up
void hideDonateDialog() {
    DialogFragment fragment = (DialogFragment) getFragmentManager()
            .findFragmentByTag(FRAGMENT_DONATION_PROGRESS);
    if (fragment != null && !isStopped()) {
        fragment.dismiss();
    }
}
 
Example 31
Project: Brevent   File: BreventActivity.java   Source Code and License 5 votes vote down vote up
private void dismissDialog(String tag, boolean allowStateLoss) {
    DialogFragment fragment = (DialogFragment) getFragmentManager().findFragmentByTag(tag);
    if (fragment != null) {
        if (Log.isLoggable(UILog.TAG, Log.DEBUG)) {
            UILog.d("dismiss " + tag + ", " + allowStateLoss + ": " + allowStateLoss
                    + ", stopped: " + isStopped());
        }
        if (allowStateLoss) {
            fragment.dismissAllowingStateLoss();
        } else if (!isStopped()) {
            fragment.dismiss();
        }
    }
}
 
Example 32
Project: boohee_v5.6   File: ErrorDialogManager.java   Source Code and License 5 votes vote down vote up
public void onEventMainThread(ThrowableFailureEvent event) {
    if (ErrorDialogManager.isInExecutionScope(this.executionScope, event)) {
        ErrorDialogManager.checkLogException(event);
        FragmentManager fm = getFragmentManager();
        fm.executePendingTransactions();
        DialogFragment existingFragment = (DialogFragment) fm.findFragmentByTag(ErrorDialogManager.TAG_ERROR_DIALOG);
        if (existingFragment != null) {
            existingFragment.dismiss();
        }
        DialogFragment errorFragment = (DialogFragment) ErrorDialogManager.factory.prepareErrorFragment(event, this.finishAfterDialog, this.argumentsForErrorDialog);
        if (errorFragment != null) {
            errorFragment.show(fm, ErrorDialogManager.TAG_ERROR_DIALOG);
        }
    }
}
 
Example 33
Project: boohee_v5.6   File: ErrorDialogManager.java   Source Code and License 5 votes vote down vote up
public void onEventMainThread(ThrowableFailureEvent event) {
    if (ErrorDialogManager.isInExecutionScope(this.executionScope, event)) {
        ErrorDialogManager.checkLogException(event);
        android.support.v4.app.FragmentManager fm = getFragmentManager();
        fm.executePendingTransactions();
        android.support.v4.app.DialogFragment existingFragment = (android.support.v4.app.DialogFragment) fm.findFragmentByTag(ErrorDialogManager.TAG_ERROR_DIALOG);
        if (existingFragment != null) {
            existingFragment.dismiss();
        }
        android.support.v4.app.DialogFragment errorFragment = (android.support.v4.app.DialogFragment) ErrorDialogManager.factory.prepareErrorFragment(event, this.finishAfterDialog, this.argumentsForErrorDialog);
        if (errorFragment != null) {
            errorFragment.show(fm, ErrorDialogManager.TAG_ERROR_DIALOG);
        }
    }
}
 
Example 34
Project: bluewatcher   File: WhatsNew.java   Source Code and License 5 votes vote down vote up
public static void show(Activity activity) {
	if(!InstallationInfo.isVersionFirstExecution(activity))
		return;
	
	DialogFragment dialog = new WhatsNewDialogFragment(activity);
	dialog.setCancelable(false);
	dialog.show(activity.getFragmentManager(), "WhatsNewDialogFragment");
}
 
Example 35
Project: bluewatcher   File: License.java   Source Code and License 5 votes vote down vote up
@Override
public void dontAllow(int reason) {
	if (activity.isFinishing())
		return;
	activity.runOnUiThread(new Runnable() {
	    public void run() {
	    	DialogFragment dialogFragment = new LicenseDialogFragment(activity);
	    	dialogFragment.setCancelable(false);
	    	dialogFragment.show(activity.getFragmentManager(), "LicenseDialogFragment");
	    }
	});
}
 
Example 36
Project: bluewatcher   File: License.java   Source Code and License 5 votes vote down vote up
@Override
public void applicationError(int errorCode) {
	activity.runOnUiThread(new Runnable() {
	    public void run() {
			DialogFragment dialogFragment = new LicenseDialogFragment(activity);
			dialogFragment.setCancelable(false);
			dialogFragment.show(activity.getFragmentManager(), "LicenseDialogFragment");
	    }
	});
		
}
 
Example 37
Project: bluewatcher   File: LollipopDetection.java   Source Code and License 5 votes vote down vote up
public static void show(Activity activity) {
	if( !android.os.Build.VERSION.RELEASE.startsWith("5.") )
		return;
	if( InstallationInfo.consentLollipopProblems() )
		return;
	DialogFragment dialog = new LollipopDialogFragment(activity);
	dialog.setCancelable(false);
	dialog.show(activity.getFragmentManager(), "LollipopDialogFragment");
}
 
Example 38
Project: Goalie_Android   File: NewGoalFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void showTimePicker(int viewID) {
    SublimePickerDialog pickerFrag = new SublimePickerDialog();
    SublimePickerDialog.Callback onTimePickedCallback = mNewGoalPresenter.getTimePickerCallbackListener();
    pickerFrag.setCallback(onTimePickedCallback);

    Bundle bundle = new Bundle();
    bundle.putParcelable("SUBLIME_OPTIONS", mNewGoalPresenter.getSublimePickerOptions(viewID));
    bundle.putInt("viewID", viewID);

    pickerFrag.setArguments(bundle);
    pickerFrag.setStyle(DialogFragment.STYLE_NO_TITLE, 0);
    pickerFrag.show(getActivity().getSupportFragmentManager(), "SublimePickerDialog");
}
 
Example 39
Project: android-mobile-engage-sdk   File: IamDialog.java   Source Code and License 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(DialogFragment.STYLE_NO_FRAME, android.R.style.Theme_Dialog);
}
 
Example 40
Project: an2linuxclient   File: EnabledApplicationsActivity.java   Source Code and License 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(DialogFragment.STYLE_NO_TITLE, R.style.ProgressDialogStyle);
}