android.app.Activity.isFinishing()

Here are the examples of the java api android.app.Activity.isFinishing() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

65 Examples 7

19 Source : ActivityHelper.java
with Apache License 2.0
from yuanhoujun

public static void convertToTranslucent(@NonNull Activity activity, TranslucentConversionListener listener) {
    if (activity.isFinishing())
        return;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        convertToTranslucentAfterLollipop(activity, listener);
    } else {
        if (null != listener) {
            listener.onTranslucentConversionComplete(true);
        }
    }
}

19 Source : PlayerUtils.java
with Apache License 2.0
from yangchong211

/**
 * 判断某Activity是否挂掉
 * @param activity      activity
 * @return
 */
public static boolean isActivityLiving(@Nullable Activity activity) {
    if (activity == null) {
        return false;
    }
    if (activity.isFinishing()) {
        return false;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed()) {
        return false;
    }
    return true;
}

19 Source : Utils.java
with Apache License 2.0
from xiaojinzi123

/**
 * Activity 是否被销毁了
 */
public static boolean isActivityDestoryed(@NonNull Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return activity.isFinishing() || activity.isDestroyed();
    } else {
        return activity.isFinishing();
    }
}

19 Source : RouterUtil.java
with Apache License 2.0
from xiaojinzi123

/**
 * 是否 Activity 已经 GG
 *
 * @param activity {@link Activity}
 * @return Activity 已经 GG
 */
private static boolean isActivityUnavailabled(@NonNull Activity activity) {
    boolean isUseful = true;
    if (activity.isFinishing()) {
        isUseful = false;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed()) {
        isUseful = false;
    }
    return !isUseful;
}

19 Source : KnitAppListener.java
with Apache License 2.0
from travelbank

/**
 * Called when an {@link Activity} has been destroyed. It tells knit to destroy the components
 * used by the activity.
 *
 * @param activity Activity that has been destroyed
 */
@Override
public void onActivityDestroyed(Activity activity) {
    if (activity.isFinishing()) {
        knit.destroyComponent(activity);
        return;
    }
    knit.releaseViewFromComponent(activity);
}

19 Source : MvpBinding.java
with Apache License 2.0
from tikivn

void destroy(Activity activity) {
    if (activity.isFinishing()) {
        presenter.destroy();
    }
}

19 Source : LoyaltyCardViewActivityTest.java
with GNU General Public License v3.0
from TheLastProject

@Test
public void startWithMissingLoyaltyCard() throws IOException {
    ActivityController activityController = createActivityWithLoyaltyCard(true);
    Activity activity = (Activity) activityController.get();
    activityController.start();
    activityController.visible();
    activityController.resume();
    // The activity should find that the card is missing and shut down
    replacedertTrue(activity.isFinishing());
    // Make sure the activity can close down
    activityController.pause();
    activityController.stop();
    activityController.destroy();
}

19 Source : LoyaltyCardViewActivityTest.java
with GNU General Public License v3.0
from TheLastProject

@Test
public void startWithoutParametersBack() {
    ActivityController activityController = Robolectric.buildActivity(LoyaltyCardEditActivity.clreplaced).create();
    activityController.start();
    activityController.visible();
    activityController.resume();
    Activity activity = (Activity) activityController.get();
    replacedertEquals(false, activity.isFinishing());
    shadowOf(activity).clickMenuItem(android.R.id.home);
    replacedertEquals(true, activity.isFinishing());
}

19 Source : LoyaltyCardViewActivityTest.java
with GNU General Public License v3.0
from TheLastProject

@Test
public void startWithoutColors() {
    ActivityController activityController = createActivityWithLoyaltyCard(false);
    Activity activity = (Activity) activityController.get();
    DBHelper db = new DBHelper(activity);
    db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, BARCODE_TYPE, null, 0);
    activityController.start();
    activityController.visible();
    activityController.resume();
    replacedertEquals(false, activity.isFinishing());
    shadowOf(activity).clickMenuItem(android.R.id.home);
    replacedertEquals(true, activity.isFinishing());
    db.close();
}

19 Source : LoyaltyCardViewActivityTest.java
with GNU General Public License v3.0
from TheLastProject

@Test
public void checkPushStarIcon() {
    ActivityController activityController = createActivityWithLoyaltyCard(false);
    Activity activity = (Activity) activityController.get();
    DBHelper db = new DBHelper(activity);
    db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, BARCODE_TYPE, Color.BLACK, 0);
    activityController.start();
    activityController.visible();
    activityController.resume();
    replacedertEquals(false, activity.isFinishing());
    shadowOf(getMainLooper()).idle();
    final Menu menu = shadowOf(activity).getOptionsMenu();
    replacedertTrue(menu != null);
    // The share, settings and star button should be present
    replacedertEquals(menu.size(), 3);
    replacedertEquals("Add to favorites", menu.findItem(R.id.action_star_unstar).getreplacedle().toString());
    shadowOf(activity).clickMenuItem(R.id.action_star_unstar);
    shadowOf(getMainLooper()).idle();
    replacedertEquals("Remove from favorites", menu.findItem(R.id.action_star_unstar).getreplacedle().toString());
    shadowOf(activity).clickMenuItem(R.id.action_star_unstar);
    shadowOf(getMainLooper()).idle();
    replacedertEquals("Add to favorites", menu.findItem(R.id.action_star_unstar).getreplacedle().toString());
    db.close();
}

19 Source : LoyaltyCardViewActivityTest.java
with GNU General Public License v3.0
from TheLastProject

@Test
public void startWithoutParametersViewBack() {
    ActivityController activityController = createActivityWithLoyaltyCard(false);
    Activity activity = (Activity) activityController.get();
    DBHelper db = new DBHelper(activity);
    db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, BARCODE_TYPE, Color.BLACK, 0);
    activityController.start();
    activityController.visible();
    activityController.resume();
    replacedertEquals(false, activity.isFinishing());
    shadowOf(activity).clickMenuItem(android.R.id.home);
    replacedertEquals(true, activity.isFinishing());
    db.close();
}

19 Source : LoyaltyCardViewActivityTest.java
with GNU General Public License v3.0
from TheLastProject

@Test
public void checkScreenOrientationLockSetting() {
    for (boolean locked : new boolean[] { false, true }) {
        ActivityController activityController = createActivityWithLoyaltyCard(false);
        Activity activity = (Activity) activityController.get();
        DBHelper db = new DBHelper(activity);
        db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, BARCODE_TYPE, Color.BLACK, 0);
        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity);
        settings.edit().putBoolean(activity.getResources().getString(R.string.settings_key_lock_barcode_orientation), locked).apply();
        activityController.start();
        activityController.resume();
        activityController.visible();
        replacedertEquals(false, activity.isFinishing());
        MenuItem item = shadowOf(activity).getOptionsMenu().findItem(R.id.action_lock_unlock);
        if (locked) {
            replacedertEquals(item.isVisible(), false);
        } else {
            replacedertEquals(item.isVisible(), true);
            String replacedle = item.getreplacedle().toString();
            replacedertEquals(replacedle, activity.getString(R.string.lockScreen));
        }
        db.close();
    }
}

19 Source : NavigationLifecycleMonitor.java
with MIT License
from maplibre

@Override
public void onActivityDestroyed(Activity activity) {
    NavigationTelemetry.getInstance().endSession(activity.isChangingConfigurations());
    if (activity.isFinishing()) {
        activity.getApplication().unregisterActivityLifecycleCallbacks(this);
    }
}

19 Source : PluginSimplePlayer.java
with Apache License 2.0
from luocheng1111

public void alertRetry(final Activity c, final int msgId) {
    if (c.isFinishing())
        return;
    c.runOnUiThread(new Runnable() {

        @Override
        public void run() {
            hideLoading();
            hideLoadinfo();
            if (null != mMediaPlayerDelegate)
                mMediaPlayerDelegate.release();
            ((Activity) mActivity).runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    disableController();
                    showRetryLayout();
                }
            });
            if (null != mMediaPlayerDelegate && !mMediaPlayerDelegate.isFullScreen) {
                mMediaPlayerDelegate.isStartPlay = false;
                if (null != mMediaPlayerDelegate.videoInfo && Orientation.VERTICAL.equals(mMediaPlayerDelegate.currentOriention))
                    mMediaPlayerDelegate.onVVEnd();
            }
        }
    });
}

19 Source : AppActivityTaskManager.java
with Apache License 2.0
from Jerry-1123

/**
 * 移除指定的Act
 *
 * @param activity
 */
public void removeActivity(Activity activity) {
    LogUtil.i("AppActivityTaskManager-->>removeActivity", activity != null ? activity.toString() : "");
    if (null != activity) {
        // 为与系统Activity栈保持一致,
        // 且考虑到手机设置项里的"不保留活动"选项引起的Activity生命周期调用onDestroy()方法所带来的问题,此处需要作出如下修正
        if (activity.isFinishing()) {
            activityStack.remove(activity);
            activity = null;
        }
    }
}

19 Source : ActivityWrapper.java
with Apache License 2.0
from iqiyi

@Override
public boolean isFinishing() {
    return mOriginActivity.isFinishing();
}

19 Source : ContextUtil.java
with Apache License 2.0
from hss01248

/**
 * 注意: 这里不要使用isDetached()来判断,因为Fragment被detach之后,它的isDetached()方法依然可能返回false
 *     2.如果Fragment A是因为被replace而detach的,那么它的isDetached()将返回false
 *     3.如果Fragment A对应的FragmentTransaction被加入到返回栈中,因为出栈而detach,那么它的isDetached()将返回true
 * @param context
 * @return
 */
public static boolean isUseable(Object context) {
    if (context == null) {
        return false;
    }
    if (context instanceof Fragment) {
        Fragment fragment = (Fragment) context;
        if (fragment.getActivity() == null) {
            return false;
        }
        /*if(fragment.isRemoving()){
                return false;
            }
            if(fragment.isDetached()){
                return false;
            }*/
        return true;
    } else if (context instanceof android.app.Fragment) {
        android.app.Fragment fragment = (android.app.Fragment) context;
        if (fragment.getActivity() == null) {
            return false;
        }
        /* if(fragment.isRemoving()){
                return false;
            }
            if(fragment.isDetached()){
                return false;
            }*/
        return true;
    } else if (context instanceof Activity) {
        Activity activity = (Activity) context;
        if (activity.isFinishing()) {
            return false;
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            return !activity.isDestroyed();
        } else {
            if (ImageLoader.config != null && ImageLoader.config.getActivityStack() != null) {
                return ImageLoader.config.getActivityStack().contains(activity);
            } else {
                return true;
            }
        }
    } else if (context instanceof Context) {
        /* Context context1 = (Context) context;
            Activity activity = getActivityFromContext(context1);
            if(activity == null){
                return true;
            }
            if(activity.isFinishing()){
                return false;
            }
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                if(activity.isDestroyed()){
                    return false;
                }
            }*/
        return true;
    } else {
        return false;
    }
}

19 Source : Tool.java
with Apache License 2.0
from hss01248

public static boolean isUsable(Activity activity) {
    if (activity == null) {
        return false;
    }
    if (activity.isFinishing()) {
        return false;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        if (activity.isDestroyed()) {
            return false;
        }
    }
    // 是否attached
    /*if(activity.getWindowManager() ==null){
            return false;
        }
        if(!activity.getWindow().isActive()){
            return false;
        }*/
    return true;
}

19 Source : ViperHelper.java
with Apache License 2.0
from Helmisek

/**
 * Use in case this Presenter is replacedociated with an {@link Activity}
 * Call from {@link Activity#onDestroy()}
 *
 * @param activity the activity
 */
public void onDestroy(@NonNull Activity activity) {
    if (this.mPresenter == null)
        return;
    if (activity.isFinishing()) {
        this.mPresenter.onPresenterDetached(true);
        removePresenter();
    } else
        this.mPresenter.onPresenterDetached(false);
    this.mAlreadyCreated = false;
}

19 Source : VideoControlExecutor.java
with GNU General Public License v2.0
from HaarigerHarald

private void setActionBar(final boolean playing, final boolean seekAble) {
    if (calledActivity.isFinishing()) {
        return;
    }
    calledActivity.runOnUiThread(new Runnable() {

        @Override
        public void run() {
            ((OverflowMenuFragActivity) calledActivity).changePlayPauseIcon(playing, seekAble);
        }
    });
}

19 Source : HostingActivity.java
with Apache License 2.0
from grandcentrix

public Activity getMockActivityInstance() {
    // always update with latest data
    when(mActivityMock.isFinishing()).thenReturn(mIsFinishing);
    return mActivityMock;
}

19 Source : PermissionChecker.java
with Apache License 2.0
from getActivity

/**
 * 检查 Activity 的状态是否正常
 *
 * @param debugMode         是否是调试模式
 * @return                  是否检查通过
 */
static boolean checkActivityStatus(Activity activity, boolean debugMode) {
    // 检查当前 Activity 状态是否是正常的,如果不是则不请求权限
    if (activity == null) {
        if (debugMode) {
            // 这个 Activity 对象必须是 FragmentActivity 的子类,请直接继承 AppCompatActivity
            throw new IllegalArgumentException("The Activity must be a subclreplaced of FragmentActivity, Please directly inherit AppCompatActivity");
        }
        return false;
    }
    if (activity.isFinishing()) {
        if (debugMode) {
            // 这个 Activity 对象当前不能是结束状态,这种情况常出现在执行异步请求后申请权限,请手动在外层代码做判断
            throw new IllegalStateException("The Activity has been finishing, Please manually determine the status of the Activity");
        }
        return false;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed()) {
        if (debugMode) {
            // 这个 Activity 对象当前不能是销毁状态,这种情况常出现在执行异步请求后申请权限,请手动在外层代码做判断
            throw new IllegalStateException("The Activity has been destroyed, Please manually determine the status of the Activity");
        }
        return false;
    }
    return true;
}

19 Source : UtilsGUI.java
with GNU General Public License v3.0
from cgeo

public static void dialogDoItem(final Activity activity, final CharSequence replacedle, final int icon, final CharSequence msg, final String posText, final DialogInterface.OnClickListener posLis, final String negText, final DialogInterface.OnClickListener negLis, final String cancelText, final DialogInterface.OnClickListener cancelLis) {
    activity.runOnUiThread(() -> {
        if (activity.isFinishing())
            return;
        AlertDialog.Builder b = new AlertDialog.Builder(activity);
        b.setCancelable(true);
        b.setreplacedle(replacedle);
        b.setIcon(icon);
        b.setMessage(msg);
        if (!TextUtils.isEmpty(posText)) {
            b.setPositiveButton(posText, posLis);
        }
        if (!TextUtils.isEmpty(negText)) {
            b.setNegativeButton(negText, negLis);
        }
        if (!TextUtils.isEmpty(cancelText)) {
            b.setNeutralButton(cancelText, cancelLis);
        }
        if (!activity.isFinishing())
            b.show();
    });
}

19 Source : DialogScene.java
with Apache License 2.0
from bytedance

public void show(@NonNull Scene hostScene) {
    if (hostScene.getLifecycle().getCurrentState() == Lifecycle.State.DESTROYED) {
        return;
    }
    Activity activity = hostScene.getActivity();
    if (activity == null) {
        return;
    }
    if (activity.isFinishing()) {
        return;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed()) {
        return;
    }
    NavigationScene navigationScene = hostScene.getNavigationScene();
    if (navigationScene == null) {
        return;
    }
    navigationScene.push(this, new PushOptions.Builder().setAnimation(new DialogSceneAnimatorExecutor()).setTranslucent(true).build());
}

19 Source : Utility.java
with Apache License 2.0
from bytedance

public static boolean isActivityStatusValid(@Nullable Activity activity) {
    if (activity == null) {
        return false;
    }
    if (activity.isFinishing()) {
        return false;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed()) {
        return false;
    }
    return true;
}

19 Source : ActorActivityLifeCycleCallbacks.java
with Apache License 2.0
from Ahmed-Adel-Ismail

@Override
public void onActivityDestroyed(Activity activity) {
    if (ON_DESTROY == configuration.unregisterActors) {
        unregisterActor(activity);
    }
    if (activity.isFinishing()) {
        ActorScheduler.cancel(activity.getClreplaced());
    }
}

18 Source : InnerDialog.java
with Apache License 2.0
from zguop

/**
 * 是否可以显示Dialog
 *
 * @param context context
 * @return true 可以展示,false不能展示
 */
private boolean activityIsRunning(final Context context) {
    Activity activity = scanForActivity(context);
    if (activity.isFinishing()) {
        return false;
    }
    if (activity.isDestroyed()) {
        return false;
    }
    if (context instanceof FragmentActivity) {
        FragmentActivity fragmentActivity = (FragmentActivity) context;
        return !fragmentActivity.getSupportFragmentManager().isDestroyed();
    }
    return true;
}

18 Source : Snake.java
with Apache License 2.0
from yuanhoujun

/**
 * Enable or disable swipe up to home for the specified activity.
 *
 * @param activity the specified activity
 * @param enable true: enable, false: disable
 */
public static void enableSwipeUpToHome(@NonNull Activity activity, boolean enable) {
    if (activity.isFinishing())
        return;
    if (enable) {
        EnableDragToClose enableDragToClose = activity.getClreplaced().getAnnotation(EnableDragToClose.clreplaced);
        if (null == enableDragToClose || !enableDragToClose.value()) {
            throw new SnakeConfigException("If you want to dynamically turn the swipe up to home feature on or off, add the EnableDragToClose annotation to " + activity.getClreplaced().getName() + " and set true.");
        }
    }
    ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
    View topWindowView = decorView.getChildAt(0);
    if (!(topWindowView instanceof SnakeHackLayout)) {
        throw new SnakeConfigException("Did you enable the keep activities option in the settings? if not, commit issue please");
    }
    ((SnakeHackLayout) topWindowView).enableSwipeUpToHome(enable);
}

18 Source : Snake.java
with Apache License 2.0
from yuanhoujun

/**
 * Turn the slide-off function on or off for activity.
 *
 * @param activity the specified activity
 * @param enable true: turn on, false: turn off
 */
public static void enableDragToClose(@NonNull Activity activity, boolean enable) {
    if (activity.isFinishing())
        return;
    EnableDragToClose enableDragToClose = activity.getClreplaced().getAnnotation(EnableDragToClose.clreplaced);
    if (null == enableDragToClose) {
        throw new SnakeConfigException("If you want to dynamically turn the slide-off feature on or off, add the EnableDragToClose annotation to " + activity.getClreplaced().getName() + " and set to true");
    }
    boolean isEnabled = Snake.dragToCloseEnabled(activity);
    if (enable == isEnabled)
        return;
    ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
    View topWindowView = decorView.getChildAt(0);
    if (!(topWindowView instanceof SnakeHackLayout)) {
        throw new SnakeConfigException("Did you enable the keep activities option in the settings? if not, commit issue please");
    }
    ((SnakeHackLayout) topWindowView).ignoreDragEvent(!enable);
}

18 Source : DialogUtils.java
with Apache License 2.0
from vanhung1710

/**
 * Show confirm dialog (Yes/No dialog)
 *
 * @param context     context that dialog will be shown
 * @param okResId
 * @param cancelResId
 * @param listener    handle event when click button Yes/No
 * @return
 */
public static Dialog showConfirmDialog(Context context, int replacedleResId, int messageResId, int okResId, int cancelResId, final ConfirmDialogOnClickListener listener) {
    // check context. If not check here, sometimes it can be crashed
    if (context == null)
        return null;
    Activity activity = (Activity) context;
    if (activity.isFinishing())
        return null;
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setreplacedle(replacedleResId).setMessage(messageResId).setCancelable(false).setPositiveButton(okResId, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            if (listener != null)
                listener.onOKButtonOnClick();
        }
    }).setNegativeButton(cancelResId, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            if (listener != null)
                listener.onCancelButtonOnClick();
            dialog.cancel();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
    return alert;
}

18 Source : DialogUtils.java
with Apache License 2.0
from vanhung1710

/**
 * Show dialog click ok action
 *
 * @param context context that dialog will be shown
 * @return
 */
public static Dialog showDialogOkClick(Context context, int replacedleResId, int messageResId, int replacedleOk, DialogInterface.OnClickListener clickListener) {
    // check context. If not check here, sometimes it can be crashed
    if (context == null)
        return null;
    Activity activity = (Activity) context;
    if (activity.isFinishing())
        return null;
    String replacedle = context.getResources().getString(replacedleResId);
    String message = context.getResources().getString(messageResId);
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setreplacedle(replacedle).setMessage(message).setCancelable(false).setPositiveButton(replacedleOk, clickListener);
    AlertDialog alert = builder.create();
    alert.show();
    return alert;
}

18 Source : DialogUtils.java
with Apache License 2.0
from vanhung1710

/**
 * Show dialog
 *
 * @param context context that dialog will be shown
 * @param replacedle   replacedle of dialog
 * @param message message of dialog
 * @return
 */
public static Dialog showDialog(Context context, String replacedle, String message, final DialogOnClickListener listener) {
    // check context. If not check here, sometimes it can be crashed
    if (context == null)
        return null;
    Activity activity = (Activity) context;
    if (activity.isFinishing())
        return null;
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setreplacedle(replacedle).setMessage(message).setCancelable(false).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            if (listener != null) {
                listener.onOKButtonOnClick();
            }
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
    return alert;
}

18 Source : DialogUtils.java
with Apache License 2.0
from vanhung1710

/**
 * Show confirm dialog (Yes/No dialog)
 *
 * @param context  context that dialog will be shown
 * @param replacedle    replacedle of dialog
 * @param message  message of dialog
 * @param listener handle event when click button Yes/No
 * @return
 */
public static Dialog showConfirmDialog(Context context, String replacedle, String message, final ConfirmDialogOnClickListener listener) {
    // check context. If not check here, sometimes it can be crashed
    if (context == null)
        return null;
    Activity activity = (Activity) context;
    if (activity.isFinishing())
        return null;
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setreplacedle(replacedle).setMessage(message).setCancelable(false).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            if (listener != null)
                listener.onOKButtonOnClick();
        }
    }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            if (listener != null)
                listener.onCancelButtonOnClick();
            dialog.cancel();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
    return alert;
}

18 Source : DialogUtils.java
with Apache License 2.0
from vanhung1710

/**
 * Show dialog click ok action
 *
 * @param context      context that dialog will be shown
 * @param replacedleResId   replacedle of dialog
 * @param messageResId message of dialog
 * @return
 */
public static Dialog showDialogOkClick(Context context, int replacedleResId, int messageResId, int replacedleOk, DialogInterface.OnClickListener clickListener) {
    // check context. If not check here, sometimes it can be crashed
    if (context == null)
        return null;
    Activity activity = (Activity) context;
    if (activity.isFinishing())
        return null;
    String replacedle = context.getResources().getString(replacedleResId);
    String message = context.getResources().getString(messageResId);
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setreplacedle(replacedle).setMessage(message).setCancelable(false).setPositiveButton(replacedleOk, clickListener);
    AlertDialog alert = builder.create();
    alert.show();
    return alert;
}

18 Source : DialogUtils.java
with Apache License 2.0
from vanhung1710

/**
 * Show confirm dialog (Yes/No dialog)
 *
 * @param context      context that dialog will be shown
 * @param replacedleResId   replacedle of dialog
 * @param messageResId message of dialog
 * @param okResId
 * @param cancelResId
 * @param listener     handle event when click button Yes/No
 * @return
 */
public static Dialog showConfirmDialog(Context context, int replacedleResId, int messageResId, int okResId, int cancelResId, final ConfirmDialogOnClickListener listener) {
    // check context. If not check here, sometimes it can be crashed
    if (context == null)
        return null;
    Activity activity = (Activity) context;
    if (activity.isFinishing())
        return null;
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setreplacedle(replacedleResId).setMessage(messageResId).setCancelable(false).setPositiveButton(okResId, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            if (listener != null)
                listener.onOKButtonOnClick();
        }
    }).setNegativeButton(cancelResId, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            if (listener != null)
                listener.onCancelButtonOnClick();
            dialog.cancel();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
    return alert;
}

18 Source : LoyaltyCardViewActivityTest.java
with GNU General Public License v3.0
from TheLastProject

@Test
public void startCheckFontSizes() {
    ActivityController activityController = createActivityWithLoyaltyCard(false);
    Activity activity = (Activity) activityController.get();
    DBHelper db = new DBHelper(activity);
    db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, BARCODE_TYPE, Color.BLACK, 0);
    final int STORE_FONT_SIZE = 50;
    final int CARD_FONT_SIZE = 40;
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity);
    settings.edit().putInt(activity.getResources().getString(R.string.settings_key_card_replacedle_font_size), STORE_FONT_SIZE).putInt(activity.getResources().getString(R.string.settings_key_card_id_font_size), CARD_FONT_SIZE).apply();
    activityController.start();
    activityController.visible();
    activityController.resume();
    replacedertEquals(false, activity.isFinishing());
    TextView storeName = activity.findViewById(R.id.storeName);
    TextView cardIdFieldView = activity.findViewById(R.id.cardIdView);
    TextViewCompat.getAutoSizeMaxTextSize(storeName);
    TextViewCompat.getAutoSizeMaxTextSize(storeName);
    replacedertEquals(STORE_FONT_SIZE, (int) storeName.getTextSize());
    replacedertEquals(CARD_FONT_SIZE, TextViewCompat.getAutoSizeMaxTextSize(cardIdFieldView));
    shadowOf(activity).clickMenuItem(android.R.id.home);
    replacedertEquals(true, activity.isFinishing());
    db.close();
}

18 Source : AlertUtil.java
with MIT License
from SoftwareEngineeringDaily

public static void displayMessage(Context context, String message) {
    AlertDialog.Builder builder;
    // Ensure context is active
    if (context instanceof Activity) {
        Activity activity = (Activity) context;
        if (activity.isFinishing()) {
            return;
        }
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        builder = new AlertDialog.Builder(context, android.R.style.Theme_Material_Dialog_Alert);
    } else {
        builder = new AlertDialog.Builder(context);
    }
    builder.setreplacedle("Error").setMessage(message).setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
        }
    }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
        }
    }).setIcon(android.R.drawable.ic_dialog_alert).show();
}

18 Source : BrightnessHelper.java
with Apache License 2.0
from saki4510t

public static void setBrightness(@NonNull final Activity activity, final float brightness) {
    if (activity.isFinishing())
        return;
    final Window win = activity.getWindow();
    final WindowManager.LayoutParams lp = win.getAttributes();
    float _brightness = brightness;
    if (brightness > 1.0f) {
        _brightness = 1.0f;
    } else if (brightness < -1.0f) {
        _brightness = -1.0f;
    }
    lp.screenBrightness = _brightness;
    lp.buttonBrightness = _brightness;
    win.setAttributes(lp);
}

18 Source : ULoading.java
with Apache License 2.0
from KosmoSakura

public synchronized void dialogShow(CharSequence msg) {
    Context context = getContext();
    if (context instanceof Activity) {
        Activity activity = ((Activity) context);
        if (activity.isFinishing())
            return;
        if (activity.isDestroyed())
            return;
    }
    tMsg.setText(msg);
    super.show();
// if (dialog != null && dialog.isShowing()) dialog.dismiss();
// if (dialog != null && !dialog.isShowing()) dialog.show();
}

18 Source : DialogLoading.java
with Apache License 2.0
from KosmoSakura

public void showLoading(String content) {
    if (context == null)
        return;
    if (context instanceof Activity) {
        Activity activity = ((Activity) context);
        if (activity.isFinishing())
            return;
        if (activity.isDestroyed())
            return;
    }
    if (dialog == null) {
        dialog = ProgressDialog.show(context, null, content, false, true);
        dialog.setCanceledOnTouchOutside(false);
        dialog.setCancelable(true);
    } else if (!dialog.isShowing()) {
        dialog = ProgressDialog.show(context, null, content, false, true);
        dialog.setCanceledOnTouchOutside(false);
        dialog.setCancelable(true);
    }
}

18 Source : ActivityInstanceObserver.java
with Apache License 2.0
from grandcentrix

@Override
public void onActivityDestroyed(final Activity activity) {
    TiLog.v(TAG, "destroying " + activity);
    TiLog.v(TAG, "isFinishing = " + activity.isFinishing());
    if (activity.isFinishing()) {
        // detected Activity finish, no new Activity instance will be created
        // with savedInstanceState, clear saved presenters
        final String scopeId = mScopeIdForActivity.remove(activity);
        mListener.onActivityFinished(activity, scopeId);
    } else {
        // don't leak old activity instances
        // scopeId is saved in savedInstanceState of finishing Activity.
        mScopeIdForActivity.remove(activity);
    }
}

18 Source : PreferencesFastFragment.java
with GNU General Public License v3.0
from Gedsh

private void setUpdateTimeLast(Context context) {
    if (context == null) {
        return;
    }
    Activity activity = getActivity();
    String updateTimeLastStr = new PrefManager(context).getStrPref("updateTimeLast");
    String lastUpdateResult = new PrefManager(context).getStrPref("LastUpdateResult");
    final Preference prefLastUpdate = findPreference("pref_fast_chek_update");
    if (prefLastUpdate == null)
        return;
    if (!updateTimeLastStr.isEmpty() && updateTimeLastStr.trim().matches("\\d+")) {
        long updateTimeLast = Long.parseLong(updateTimeLastStr);
        Date date = new Date(updateTimeLast);
        String dateString = android.text.format.DateFormat.getDateFormat(context).format(date);
        String timeString = android.text.format.DateFormat.getTimeFormat(context).format(date);
        prefLastUpdate.setSummary(getString(R.string.update_last_check) + " " + dateString + " " + timeString + System.lineSeparator() + lastUpdateResult);
    } else if (lastUpdateResult.equals(getString(R.string.update_fault)) && new PrefManager(context).getStrPref("updateTimeLast").isEmpty() && appVersion.startsWith("p")) {
        Preference pref_fast_auto_update = findPreference("pref_fast_auto_update");
        if (pref_fast_auto_update != null) {
            pref_fast_auto_update.setEnabled(false);
        }
        prefLastUpdate.setSummary(lastUpdateResult);
    } else {
        prefLastUpdate.setSummary(lastUpdateResult);
    }
    if (activity == null || activity.isFinishing())
        return;
    prefLastUpdate.setOnPreferenceClickListener(preference -> {
        if (prefLastUpdate.isEnabled() && handler != null) {
            handler.post(() -> {
                if (activity.isFinishing()) {
                    return;
                }
                Intent intent = new Intent(context, MainActivity.clreplaced);
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
                intent.setAction("check_update");
                activity.overridePendingTransition(0, 0);
                activity.finish();
                startActivity(intent);
            });
            return true;
        } else {
            return false;
        }
    });
}

18 Source : DialogUtils.java
with Apache License 2.0
from Equalzys

public static void show(Activity mActivity, String msg) {
    if (mActivity.isFinishing()) {
        return;
    }
    if (mLoadingDialog != null) {
        dismiss();
    }
    mLoadingDialog = new LoadingDialog(mActivity, msg);
    mLoadingDialog.show();
    LogUtil.e("DialogUtils---show1----");
}

18 Source : Splash.java
with MIT License
from DoFabien

/**
 * Show the Splash Screen
 * @param a
 * @param showDuration how long to show the splash for if autoHide is enabled
 * @param fadeInDuration how long to fade the splash screen in
 * @param fadeOutDuration how long to fade the splash screen out
 * @param autoHide whether to auto hide after showDuration ms
 * @param splashListener A listener to handle the finish of the animation (if any)
 */
public static void show(final Activity a, final int showDuration, final int fadeInDuration, final int fadeOutDuration, final boolean autoHide, final SplashListener splashListener, final boolean isLaunchSplash) {
    wm = (WindowManager) a.getSystemService(Context.WINDOW_SERVICE);
    if (a.isFinishing()) {
        return;
    }
    buildViews(a);
    if (isVisible) {
        return;
    }
    final Animator.AnimatorListener listener = new Animator.AnimatorListener() {

        @Override
        public void onAnimationEnd(Animator animator) {
            isVisible = true;
            if (autoHide) {
                new Handler().postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        Splash.hide(a, fadeOutDuration, isLaunchSplash);
                        if (splashListener != null) {
                            splashListener.completed();
                        }
                    }
                }, showDuration);
            }
        }

        @Override
        public void onAnimationCancel(Animator animator) {
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }

        @Override
        public void onAnimationStart(Animator animator) {
        }
    };
    Handler mainHandler = new Handler(a.getMainLooper());
    mainHandler.post(new Runnable() {

        @Override
        public void run() {
            WindowManager.LayoutParams params = new WindowManager.LayoutParams();
            params.gravity = Gravity.CENTER;
            params.flags = a.getWindow().getAttributes().flags & (WindowManager.LayoutParams.FLAG_FULLSCREEN);
            // Required to enable the view to actually fade
            params.format = PixelFormat.TRANSLUCENT;
            wm.addView(splashImage, params);
            splashImage.setAlpha(0f);
            splashImage.animate().alpha(1f).setInterpolator(new LinearInterpolator()).setDuration(fadeInDuration).setListener(listener).start();
            splashImage.setVisibility(View.VISIBLE);
            if (spinnerBar != null) {
                Boolean showSpinner = Config.getBoolean(CONFIG_KEY_PREFIX + "showSpinner", false);
                spinnerBar.setVisibility(View.INVISIBLE);
                if (spinnerBar.getParent() != null) {
                    wm.removeView(spinnerBar);
                }
                params.height = WindowManager.LayoutParams.WRAP_CONTENT;
                params.width = WindowManager.LayoutParams.WRAP_CONTENT;
                wm.addView(spinnerBar, params);
                if (showSpinner) {
                    spinnerBar.setAlpha(0f);
                    spinnerBar.animate().alpha(1f).setInterpolator(new LinearInterpolator()).setDuration(fadeInDuration).start();
                    spinnerBar.setVisibility(View.VISIBLE);
                }
            }
        }
    });
}

18 Source : Modals.java
with MIT License
from DoFabien

@PluginMethod()
public void alert(final PluginCall call) {
    final Activity c = this.getActivity();
    final String replacedle = call.getString("replacedle");
    final String message = call.getString("message");
    final String buttonreplacedle = call.getString("buttonreplacedle", "OK");
    if (replacedle == null || message == null) {
        call.error("Please provide a replacedle or message for the alert");
        return;
    }
    if (c.isFinishing()) {
        call.error("App is finishing");
        return;
    }
    Dialogs.alert(c, message, replacedle, buttonreplacedle, new Dialogs.OnResultListener() {

        @Override
        public void onResult(boolean value, boolean didCancel, String inputValue) {
            call.success();
        }
    });
}

17 Source : LoyaltyCardViewActivityTest.java
with GNU General Public License v3.0
from TheLastProject

@Test
public void checkBarcodeFullscreenWorkflow() {
    ActivityController activityController = createActivityWithLoyaltyCard(false);
    Activity activity = (Activity) activityController.get();
    DBHelper db = new DBHelper(activity);
    db.insertLoyaltyCard("store", "note", null, new BigDecimal("0"), null, BARCODE_DATA, BARCODE_TYPE, Color.BLACK, 0);
    activityController.start();
    activityController.visible();
    activityController.resume();
    replacedertEquals(false, activity.isFinishing());
    ImageView barcodeImage = activity.findViewById(R.id.barcode);
    View collapsingToolbarLayout = activity.findViewById(R.id.collapsingToolbarLayout);
    View bottomSheet = activity.findViewById(R.id.bottom_sheet);
    ImageButton maximizeButton = activity.findViewById(R.id.maximizeButton);
    ImageButton minimizeButton = activity.findViewById(R.id.minimizeButton);
    FloatingActionButton editButton = activity.findViewById(R.id.fabEdit);
    SeekBar barcodeScaler = activity.findViewById(R.id.barcodeScaler);
    // Android should not be in fullscreen mode
    int uiOptions = activity.getWindow().getDecorView().getSystemUiVisibility();
    replacedertNotEquals(uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY, uiOptions);
    replacedertNotEquals(uiOptions | View.SYSTEM_UI_FLAG_FULLSCREEN, uiOptions);
    // Elements should be visible (except minimize button and scaler)
    replacedertEquals(View.VISIBLE, collapsingToolbarLayout.getVisibility());
    replacedertEquals(View.VISIBLE, bottomSheet.getVisibility());
    replacedertEquals(View.VISIBLE, maximizeButton.getVisibility());
    replacedertEquals(View.GONE, minimizeButton.getVisibility());
    replacedertEquals(View.VISIBLE, editButton.getVisibility());
    replacedertEquals(View.GONE, barcodeScaler.getVisibility());
    // Click barcode to toggle fullscreen
    barcodeImage.performClick();
    shadowOf(getMainLooper()).idle();
    // Android should be in fullscreen mode
    uiOptions = activity.getWindow().getDecorView().getSystemUiVisibility();
    replacedertEquals(uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY, uiOptions);
    replacedertEquals(uiOptions | View.SYSTEM_UI_FLAG_FULLSCREEN, uiOptions);
    // Elements should not be visible (except minimize button and scaler)
    replacedertEquals(View.GONE, collapsingToolbarLayout.getVisibility());
    replacedertEquals(View.GONE, bottomSheet.getVisibility());
    replacedertEquals(View.GONE, maximizeButton.getVisibility());
    replacedertEquals(View.VISIBLE, minimizeButton.getVisibility());
    replacedertEquals(View.GONE, editButton.getVisibility());
    replacedertEquals(View.VISIBLE, barcodeScaler.getVisibility());
    // Clicking barcode again should deactivate fullscreen mode
    barcodeImage.performClick();
    shadowOf(getMainLooper()).idle();
    uiOptions = activity.getWindow().getDecorView().getSystemUiVisibility();
    replacedertNotEquals(uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY, uiOptions);
    replacedertNotEquals(uiOptions | View.SYSTEM_UI_FLAG_FULLSCREEN, uiOptions);
    replacedertEquals(View.VISIBLE, collapsingToolbarLayout.getVisibility());
    replacedertEquals(View.VISIBLE, bottomSheet.getVisibility());
    replacedertEquals(View.VISIBLE, maximizeButton.getVisibility());
    replacedertEquals(View.GONE, minimizeButton.getVisibility());
    replacedertEquals(View.VISIBLE, editButton.getVisibility());
    replacedertEquals(View.GONE, barcodeScaler.getVisibility());
    // Another click back to fullscreen
    barcodeImage.performClick();
    shadowOf(getMainLooper()).idle();
    uiOptions = activity.getWindow().getDecorView().getSystemUiVisibility();
    replacedertEquals(uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY, uiOptions);
    replacedertEquals(uiOptions | View.SYSTEM_UI_FLAG_FULLSCREEN, uiOptions);
    replacedertEquals(View.GONE, collapsingToolbarLayout.getVisibility());
    replacedertEquals(View.GONE, bottomSheet.getVisibility());
    replacedertEquals(View.GONE, maximizeButton.getVisibility());
    replacedertEquals(View.VISIBLE, minimizeButton.getVisibility());
    replacedertEquals(View.GONE, editButton.getVisibility());
    replacedertEquals(View.VISIBLE, barcodeScaler.getVisibility());
    // In full screen mode, back button should disable fullscreen
    activity.onBackPressed();
    shadowOf(getMainLooper()).idle();
    uiOptions = activity.getWindow().getDecorView().getSystemUiVisibility();
    replacedertNotEquals(uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY, uiOptions);
    replacedertNotEquals(uiOptions | View.SYSTEM_UI_FLAG_FULLSCREEN, uiOptions);
    replacedertEquals(View.VISIBLE, collapsingToolbarLayout.getVisibility());
    replacedertEquals(View.VISIBLE, bottomSheet.getVisibility());
    replacedertEquals(View.VISIBLE, maximizeButton.getVisibility());
    replacedertEquals(View.GONE, minimizeButton.getVisibility());
    replacedertEquals(View.VISIBLE, editButton.getVisibility());
    replacedertEquals(View.GONE, barcodeScaler.getVisibility());
    // Pressing back when not in full screen should finish activity
    activity.onBackPressed();
    shadowOf(getMainLooper()).idle();
    replacedertEquals(true, activity.isFinishing());
    db.close();
}

17 Source : LoyaltyCardViewActivityTest.java
with GNU General Public License v3.0
from TheLastProject

/**
 * Save a loyalty card and check that the database contains the
 * expected values
 */
private void saveLoyaltyCardWithArguments(final Activity activity, final String store, final String note, final Date expiry, final BigDecimal balance, final Currency balanceType, final String cardId, final String barcodeType, boolean creatingNewCard) {
    DBHelper db = new DBHelper(activity);
    if (creatingNewCard) {
        replacedertEquals(0, db.getLoyaltyCardCount());
    } else {
        replacedertEquals(1, db.getLoyaltyCardCount());
    }
    final EditText storeField = activity.findViewById(R.id.storeNameEdit);
    final EditText noteField = activity.findViewById(R.id.noteEdit);
    final TextInputLayout expiryView = activity.findViewById(R.id.expiryView);
    final EditText balanceView = activity.findViewById(R.id.balanceField);
    final EditText balanceCurrencyField = activity.findViewById(R.id.balanceCurrencyField);
    final TextView cardIdField = activity.findViewById(R.id.cardIdView);
    final TextView barcodeTypeField = activity.findViewById(R.id.barcodeTypeField);
    storeField.setText(store);
    noteField.setText(note);
    expiryView.setTag(expiry);
    if (balance != null) {
        balanceView.setText(balance.toPlainString());
    }
    if (balanceType != null) {
        balanceCurrencyField.setText(balanceType.getSymbol());
    }
    cardIdField.setText(cardId);
    barcodeTypeField.setText(barcodeType);
    replacedertEquals(false, activity.isFinishing());
    activity.findViewById(R.id.fabSave).performClick();
    replacedertEquals(true, activity.isFinishing());
    replacedertEquals(1, db.getLoyaltyCardCount());
    LoyaltyCard card = db.getLoyaltyCard(1);
    replacedertEquals(store, card.store);
    replacedertEquals(note, card.note);
    replacedertEquals(expiry, card.expiry);
    if (balance != null) {
        replacedertEquals(balance, card.balance);
    } else {
        replacedertEquals(new BigDecimal("0"), card.balance);
    }
    replacedertEquals(balanceType, card.balanceType);
    replacedertEquals(cardId, card.cardId);
    // The special "No barcode" string shouldn't actually be written to the loyalty card
    if (barcodeType.equals(activity.getApplicationContext().getString(R.string.noBarcode))) {
        replacedertEquals("", card.barcodeType);
    } else {
        replacedertEquals(barcodeType, card.barcodeType);
    }
    replacedertNotNull(card.headerColor);
    replacedertNotNull(card.headerTextColor);
    db.close();
}

17 Source : RealCall.java
with Apache License 2.0
from jjerry

private Context getStartContext(Context context) {
    if (context instanceof Activity) {
        Activity activity = (Activity) context;
        boolean isDestroyed = false;
        if (activity.isFinishing()) {
            isDestroyed = true;
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            if (activity.isDestroyed()) {
                isDestroyed = true;
            }
        }
        FragmentManager fragmentManager = activity.getFragmentManager();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            if (fragmentManager.isDestroyed()) {
                isDestroyed = true;
            }
        }
        if (context instanceof FragmentActivity) {
            FragmentActivity fragmentActivity = (FragmentActivity) context;
            android.support.v4.app.FragmentManager fragmentManagerV4 = fragmentActivity.getSupportFragmentManager();
            if (fragmentManagerV4.isDestroyed()) {
                isDestroyed = true;
            }
        }
        if (isDestroyed) {
            return context.getApplicationContext();
        }
    }
    return context;
}

17 Source : DialogUtils.java
with Apache License 2.0
from Equalzys

public static void show(Activity mActivity, String msg, DialogInterface.OnDismissListener listener) {
    if (mActivity.isFinishing()) {
        return;
    }
    if (activity != null) {
        if (activity == mActivity) {
            if (null != mLoadingDialog) {
                if (mLoadingDialog.isShowing()) {
                    return;
                }
            }
        }
    }
    activity = mActivity;
    if (null != mLoadingDialog) {
        dismiss();
    }
    mLoadingDialog = null;
    mLoadingDialog = new LoadingDialog(mActivity, msg);
    mLoadingDialog.show();
    if (listener != null) {
        mLoadingDialog.setOnDismissListener(listener);
    }
    LogUtil.e("DialogUtils---show2----");
}

17 Source : DialogUtils.java
with Apache License 2.0
from Equalzys

public static void show(Activity mActivity, DialogInterface.OnDismissListener listener) {
    if (mActivity.isFinishing()) {
        return;
    }
    if (activity != null) {
        if (activity == mActivity) {
            if (null != mLoadingDialog) {
                if (mLoadingDialog.isShowing()) {
                    return;
                }
            }
        }
    }
    activity = mActivity;
    if (null != mLoadingDialog) {
        dismiss();
    }
    mLoadingDialog = new LoadingDialog(mActivity, "");
    mLoadingDialog.show();
    if (listener != null) {
        mLoadingDialog.setOnDismissListener(listener);
    }
    LogUtil.e("DialogUtils---show3----");
}

See More Examples