Java Code Examples for android.app.Activity#isRestricted()

The following examples show how to use android.app.Activity#isRestricted() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogUtil.java    From letv with Apache License 2.0 6 votes vote down vote up
public static void showDialog(Activity context, CharSequence title, CharSequence centerText, OnClickListener centerListener) {
    if (mCommonDialog != null && mCommonDialog.isShowing()) {
        mCommonDialog.dismiss();
    }
    mCommonDialog = new LetvCommonDialog(context);
    mCommonDialog.setTitle(title);
    mCommonDialog.setButtonText(centerText);
    if (centerListener != null) {
        mCommonDialog.setCenterOnClickListener(centerListener);
    }
    if (!context.isFinishing() && !context.isRestricted()) {
        try {
            mCommonDialog.show();
        } catch (Exception e) {
        }
    }
}
 
Example 2
Source File: DialogUtil.java    From letv with Apache License 2.0 6 votes vote down vote up
public static void showDialog(Activity context, CharSequence title, CharSequence content, CharSequence leftText, CharSequence rightText, OnClickListener leftListener, OnClickListener rightListener, int layoutId) {
    if (mCommonDialog != null && mCommonDialog.isShowing()) {
        mCommonDialog.dismiss();
    }
    mCommonDialog = new CommonDialog(context, layoutId);
    mCommonDialog.setTitle(title);
    mCommonDialog.setContent(content.toString());
    mCommonDialog.setButtonText(leftText, rightText);
    if (leftListener != null) {
        mCommonDialog.setLeftOnClickListener(leftListener);
    }
    if (rightListener != null) {
        mCommonDialog.setRightOnClickListener(rightListener);
    }
    if (!context.isFinishing() && !context.isRestricted()) {
        mCommonDialog.show();
    }
}
 
Example 3
Source File: UIsUtils.java    From letv with Apache License 2.0 6 votes vote down vote up
public static void callDialogMsgPosNeg(Activity activity, String msgId, int yes, int no, OnClickListener yesListener, OnClickListener noListener) {
    TipBean dialogMsgByMsg = TipUtils.getTipBean(msgId);
    if (activity != null && dialogMsgByMsg != null) {
        CharSequence string;
        Builder builder = new Builder(activity);
        if ("".equals(dialogMsgByMsg.title) || dialogMsgByMsg.title == null) {
            string = activity.getString(R.string.dialog_default_title);
        } else {
            string = dialogMsgByMsg.title;
        }
        Dialog dialog = builder.setTitle(string).setIcon(R.drawable.dialog_icon).setMessage(dialogMsgByMsg.message).setCancelable(false).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
 
Example 4
Source File: UIs.java    From letv with Apache License 2.0 6 votes vote down vote up
public static void callDialogMsgPosNeg(Activity activity, String msgId, int yes, int no, OnClickListener yesListener, OnClickListener noListener) {
    TipBean dialogMsgByMsg = TipUtils.getTipBean(msgId);
    if (activity != null && dialogMsgByMsg != null) {
        CharSequence string;
        Builder builder = new Builder(activity);
        if ("".equals(dialogMsgByMsg.title) || dialogMsgByMsg.title == null) {
            string = activity.getString(2131100003);
        } else {
            string = dialogMsgByMsg.title;
        }
        Dialog dialog = builder.setTitle(string).setIcon(2130837921).setMessage(dialogMsgByMsg.message).setCancelable(false).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
 
Example 5
Source File: UIs.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, int messageId, OnClickListener yes) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(2131100003).setIcon(2130837921).setMessage(messageId).setPositiveButton(2131100002, yes).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
 
Example 6
Source File: DialogUtil.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, int messageId, OnClickListener yes) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(R.string.dialog_default_title).setIcon(R.drawable.dialog_icon).setMessage(messageId).setPositiveButton(R.string.dialog_default_ok, yes).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            dialog.show();
        }
    }
}
 
Example 7
Source File: UIs.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, int titleId, int messageId, OnClickListener yes, OnClickListener no) {
    if (activity != null) {
        try {
            Dialog dialog = new Builder(activity).setTitle(titleId).setIcon(2130837921).setMessage(messageId).setPositiveButton(2131100002, yes).setNegativeButton(2131100001, no).create();
            if (!activity.isFinishing() && !activity.isRestricted()) {
                try {
                    dialog.show();
                } catch (Exception e) {
                }
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }
}
 
Example 8
Source File: UIs.java    From letv with Apache License 2.0 5 votes vote down vote up
public static boolean call(Activity activity, int messageId, int yes, int no, OnClickListener yesListener, OnClickListener noListener, View view, boolean cancelable) {
    if (activity == null) {
        return false;
    }
    Dialog dialog = new Builder(activity).setTitle(2131100003).setIcon(2130837921).setMessage(messageId).setCancelable(cancelable).setView(view).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
    if (activity.isFinishing() || activity.isRestricted()) {
        return false;
    }
    try {
        dialog.show();
    } catch (Exception e) {
    }
    return true;
}
 
Example 9
Source File: DialogUtil.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, String message, OnClickListener yes) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(R.string.dialog_default_title).setIcon(R.drawable.dialog_icon).setMessage(message).setPositiveButton(R.string.dialog_default_ok, yes).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            dialog.show();
        }
    }
}
 
Example 10
Source File: DialogUtil.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, int titleId, int messageId, OnClickListener yes, OnClickListener no) {
    if (activity != null) {
        try {
            Dialog dialog = new Builder(activity).setTitle(titleId).setIcon(R.drawable.dialog_icon).setMessage(messageId).setPositiveButton(R.string.dialog_default_ok, yes).setNegativeButton(R.string.dialog_default_no, no).create();
            if (!activity.isFinishing() && !activity.isRestricted()) {
                dialog.show();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example 11
Source File: UIs.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, int messageId, OnClickListener yes, OnClickListener no) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(2131100003).setIcon(2130837921).setMessage(messageId).setPositiveButton(2131100002, yes).setNegativeButton(2131100001, no).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 12
Source File: DialogUtil.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, String messageId, int yesId, int noId, OnClickListener yes, OnClickListener no) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setIcon(R.drawable.dialog_icon).setMessage(messageId).setPositiveButton(yesId, yes).setNegativeButton(noId, no).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
 
Example 13
Source File: DialogUtil.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, String messageId, OnClickListener yes, OnClickListener no) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setIcon(R.drawable.dialog_icon).setMessage(messageId).setPositiveButton(R.string.dialog_default_ok, yes).setNegativeButton(R.string.dialog_default_no, no).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
 
Example 14
Source File: DialogUtil.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, int messageId, int yes, int no, OnClickListener yesListener, OnClickListener noListener, boolean cancelable) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setMessage(messageId).setCancelable(cancelable).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
 
Example 15
Source File: DialogUtil.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, int messageId, int yes, int no, OnClickListener yesListener, OnClickListener noListener, boolean cancelable) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setMessage(messageId).setCancelable(cancelable).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            dialog.show();
        }
    }
}
 
Example 16
Source File: UIs.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, String message, OnClickListener yes, boolean cancelable) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(2131100003).setIcon(2130837921).setMessage(message).setPositiveButton(2131100002, yes).create();
        dialog.setCancelable(cancelable);
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
 
Example 17
Source File: DialogUtil.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, int title, int messageId, int yes, OnClickListener yesListener, boolean cancelable) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(title).setIcon(R.drawable.dialog_icon).setMessage(messageId).setCancelable(cancelable).setPositiveButton(yes, yesListener).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
 
Example 18
Source File: DialogUtil.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void call(Activity activity, int messageId, OnClickListener yes) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(R.string.dialog_default_title).setIcon(R.drawable.dialog_icon).setMessage(messageId).setPositiveButton(R.string.dialog_default_ok, yes).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
 
Example 19
Source File: DialogUtil.java    From letv with Apache License 2.0 5 votes vote down vote up
public static boolean call(Activity activity, int messageId, int yes, int no, OnClickListener yesListener, OnClickListener noListener, View view, boolean cancelable) {
    if (activity == null) {
        return false;
    }
    Dialog dialog = new Builder(activity).setTitle(R.string.dialog_default_title).setIcon(R.drawable.dialog_icon).setMessage(messageId).setCancelable(cancelable).setView(view).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
    if (activity.isFinishing() || activity.isRestricted()) {
        return false;
    }
    try {
        dialog.show();
    } catch (Exception e) {
    }
    return true;
}
 
Example 20
Source File: DialogUtil.java    From letv with Apache License 2.0 5 votes vote down vote up
public static boolean call(Activity activity, int messageId, int yes, int no, OnClickListener yesListener, OnClickListener noListener, View view, boolean cancelable) {
    if (activity == null) {
        return false;
    }
    Dialog dialog = new Builder(activity).setTitle(R.string.dialog_default_title).setIcon(R.drawable.dialog_icon).setMessage(messageId).setCancelable(cancelable).setView(view).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
    if (activity.isFinishing() || activity.isRestricted()) {
        return false;
    }
    dialog.show();
    return true;
}