本文整理汇总了Java中android.app.ProgressDialog.setCanceledOnTouchOutside方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressDialog.setCanceledOnTouchOutside方法的具体用法?Java ProgressDialog.setCanceledOnTouchOutside怎么用?Java ProgressDialog.setCanceledOnTouchOutside使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.ProgressDialog
的用法示例。
在下文中一共展示了ProgressDialog.setCanceledOnTouchOutside方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPreExecute
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
protected void onPreExecute()
{
super.onPreExecute();
ControlHelper.lockScreenOrientation(mActivity);
mProgress = new ProgressDialog(mActivity);
mProgress.setMessage(mActivity.getString(R.string.message_loading));
mProgress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgress.setIndeterminate(true);
mProgress.setCanceledOnTouchOutside(false);
mProgress.setOnCancelListener(new DialogInterface.OnCancelListener()
{
@Override
public void onCancel(DialogInterface dialog)
{
cancel(true);
Toast.makeText(mActivity, mActivity.getString(R.string.cancel_download),
Toast.LENGTH_SHORT).show();
}
});
mProgress.show();
}
示例2: onCreate
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//初始化ProgressDialog
final ProgressDialog dialog = new ProgressDialog(this);
dialog.setMessage(getResources().getString(R.string.str_loading));
dialog.setCanceledOnTouchOutside(false);
dlg = dialog;
}
示例3: onCreateDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
protected Dialog onCreateDialog(int id) {
//pDialog.show();
switch (id) {
case progress_bar_type:
progressDialog = new ProgressDialog(this);
progressDialog.setMessage("Uploading " + u + ".pdf");
progressDialog.setIndeterminate(false);
progressDialog.setMax(100);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setCancelable(true);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setButton(ProgressDialog.BUTTON_NEGATIVE, "Background", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//Cancel download task
progressDialog.cancel();
Toast.makeText(Topics.this,
"Uploading in background", Toast.LENGTH_SHORT).show();
startActivity(new Intent(Topics.this, Subjects.class));
//finish();
}
});
progressDialog.show();
return progressDialog;
default:
return null;
}
}
示例4: moveToBlacklist
import android.app.ProgressDialog; //导入方法依赖的package包/类
/**
* move user to blacklist
*/
protected void moveToBlacklist(final String username){
final ProgressDialog pd = new ProgressDialog(getActivity());
String st1 = getResources().getString(R.string.Is_moved_into_blacklist);
final String st2 = getResources().getString(R.string.Move_into_blacklist_success);
final String st3 = getResources().getString(R.string.Move_into_blacklist_failure);
pd.setMessage(st1);
pd.setCanceledOnTouchOutside(false);
pd.show();
new Thread(new Runnable() {
public void run() {
try {
//move to blacklist
EMClient.getInstance().contactManager().addUserToBlackList(username,false);
getActivity().runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
Toast.makeText(getActivity(), st2, Toast.LENGTH_SHORT).show();
refresh();
}
});
} catch (HyphenateException e) {
e.printStackTrace();
getActivity().runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
Toast.makeText(getActivity(), st3, Toast.LENGTH_SHORT).show();
}
});
}
}
}).start();
}
示例5: showLoadingDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
public static ProgressDialog showLoadingDialog(Context context) {
ProgressDialog progressDialog = new ProgressDialog(context);
progressDialog.show();
if (progressDialog.getWindow() != null) {
progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
progressDialog.setContentView(R.layout.progress_dialog);
progressDialog.setIndeterminate(true);
progressDialog.setCancelable(true);
progressDialog.setCanceledOnTouchOutside(false);
return progressDialog;
}
示例6: openRedPacket
import android.app.ProgressDialog; //导入方法依赖的package包/类
/**
* 拆红包方法
*
* @param activity FragmentActivity(由于使用了DialogFragment,这个参数类型必须为FragmentActivity)
* @param chatType 聊天类型
* @param redPacketId 红包id
* @param redPacketType 红包类型
* @param receiverId 接收者id
* @param messageDirect 消息的方向
*/
public static void openRedPacket(final FragmentActivity activity, final int chatType, String redPacketId, String redPacketType, String receiverId, String messageDirect) {
final ProgressDialog progressDialog = new ProgressDialog(activity);
progressDialog.setCanceledOnTouchOutside(false);
RedPacketInfo redPacketInfo = new RedPacketInfo();
redPacketInfo.redPacketId = redPacketId;
redPacketInfo.messageDirect = messageDirect;
redPacketInfo.chatType = chatType;
RPRedPacketUtil.getInstance().openRedPacket(redPacketInfo, activity, new RPRedPacketUtil.RPOpenPacketCallback() {
@Override
public void onSuccess(String senderId, String senderNickname, String myAmount) {
//领取红包成功 发送回执消息到聊天窗口
Toast.makeText(activity, "拆红包成功,红包金额" + myAmount + "元", Toast.LENGTH_LONG).show();
}
@Override
public void showLoading() {
progressDialog.show();
}
@Override
public void hideLoading() {
progressDialog.dismiss();
}
@Override
public void onError(String code, String message) {
Toast.makeText(activity, message, Toast.LENGTH_SHORT).show();
}
});
}
示例7: ProgressDialogHelper
import android.app.ProgressDialog; //导入方法依赖的package包/类
public ProgressDialogHelper(Context context, boolean isCancelable, boolean isCancelledOnTouchOutside) {
progressDialog = new ProgressDialog(context);
if (isCancelable) {
progressDialog.setCancelable(false);
}
if (isCancelledOnTouchOutside) {
progressDialog.setCanceledOnTouchOutside(false);
}
}
示例8: onGoalItemClicked
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
public void onGoalItemClicked(GoalItem goalItem) {
if (!NetworkUtils.isNetworkUp(context)) {
displayInternetErrorSnackBar();
return;
}
goalDetailProgressDialog = new ProgressDialog(context);
goalDetailProgressDialog.setMessage(context.getString(R.string.loading_goal_details));
goalDetailProgressDialog.setCancelable(false);
goalDetailProgressDialog.setCanceledOnTouchOutside(false);
goalDetailProgressDialog.show();
switch (goalItem.getType()) {
case LANGUAGE_GOAL:
new FetchTimeSpentOnLanguageTask(goalItem).execute();
break;
case PROJECT_DAILY_GOAL:
new FetchTimeSpentOnProjectTask(goalItem).execute();
break;
case PROJECT_DEADLINE_GOAL:
ProjectGoal projectGoal = new ProjectGoal();
projectGoal.setProjectName(goalItem.getName());
projectGoal.setDeadline(goalItem.getData());
projectGoal.setStartDate(goalItem.getExtraData());
String gsonData = new Gson().toJson(projectGoal, ProjectGoal.class);
onGoalDetailsDownloaded(gsonData, goalItem);
break;
default:
throw new IllegalArgumentException("Incorrect goal item");
}
}
示例9: createProgressDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
public static Dialog createProgressDialog(Context context, boolean needCancle) {
ProgressDialog dialog = new ProgressDialog(context);
dialog.setMessage("Loading ...");
dialog.setCancelable(needCancle);
dialog.setCanceledOnTouchOutside(false);
return dialog;
}
示例10: initProgressDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
private void initProgressDialog() {
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setIndeterminate(true);
mProgressDialog.setTitle("提示");
mProgressDialog.setMessage("正在加载...");
mProgressDialog.setCanceledOnTouchOutside(false);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
}
示例11: showProgressDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
private void showProgressDialog() {
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setMessage(getString(R.string.creating_new_issue));
mProgressDialog.setCancelable(false);
mProgressDialog.setCanceledOnTouchOutside(false);
mProgressDialog.show();
}
示例12: showLoadingDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
public static ProgressDialog showLoadingDialog(Context context) {
ProgressDialog progressDialog = new ProgressDialog(context);
progressDialog.show();
if (progressDialog.getWindow() != null) {
progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
progressDialog.setContentView(R.layout.progress_dialog);
progressDialog.setIndeterminate(true);
progressDialog.setCancelable(false);
progressDialog.setCanceledOnTouchOutside(false);
return progressDialog;
}
示例13: uploadFileWithUri
import android.app.ProgressDialog; //导入方法依赖的package包/类
private void uploadFileWithUri(Uri uri) {
String filePath = getFilePath(uri);
if (filePath == null) {
Toast.makeText(this, "only support upload image when android os >= 4.4", Toast.LENGTH_SHORT).show();
return;
}
File file = new File(filePath);
if (!file.exists()) {
Toast.makeText(this, R.string.File_does_not_exist, Toast.LENGTH_SHORT).show();
return;
}
//limit the size < 10M
if (file.length() > 10 * 1024 * 1024) {
Toast.makeText(this, R.string.The_file_is_not_greater_than_10_m, Toast.LENGTH_SHORT).show();
return;
}
final ProgressDialog pd = new ProgressDialog(this);
pd.setCanceledOnTouchOutside(false);
pd.setMessage("Uploading...");
pd.show();
EMClient.getInstance().groupManager().asyncUploadGroupSharedFile(groupId, filePath, new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
@Override
public void run() {
pd.dismiss();
if(adapter != null){
fileList.clear();
fileList.addAll(group.getShareFileList());
adapter.notifyDataSetChanged();
Toast.makeText(SharedFilesActivity.this, "Upload success", Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
public void onError(int code, final String error) {
runOnUiThread(new Runnable() {
@Override
public void run() {
pd.dismiss();
Toast.makeText(SharedFilesActivity.this, "Upload fail, " + error, Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
});
}
示例14: onCreate
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
if (savedInstanceState != null) {
selectedPosition = savedInstanceState.getInt(SELECTED_POSITION);
exampleId = savedInstanceState.getString(EXAMPLE_ID);
}
progress = new ProgressDialog(this, R.style.SciChart_ExportProgressDialogStyle);
progress.setTitle("");
progress.setMessage("Loading data...");
progress.setIndeterminate(true);
progress.setCancelable(false);
progress.setCanceledOnTouchOutside(false);
progress.show();
toolbar = (Toolbar) findViewById(R.id.appToolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
navMenu = navigationView.getMenu();
catTitle = (TextView) findViewById(R.id.category_title);
catIcon = (ImageView) findViewById(R.id.category_icon);
initLayout(savedInstanceState);
Thread.setDefaultUncaughtExceptionHandler(this);
}
示例15: addContact
import android.app.ProgressDialog; //导入方法依赖的package包/类
/**
* add contact
*/
public void addContact(String searchContent) {
// if (EMClient.getInstance().getCurrentUser().equals(nameText.getText().toString())) {
// new EaseAlertDialog(this, R.string.not_add_myself).show();
// return;
// }
if (DemoHelper.getInstance().getContactList().containsKey(searchContent)) {
//let the user know the contact already in your contact list
if (EMClient.getInstance().contactManager().getBlackListUsernames().contains(searchContent)) {
new EaseAlertDialog(this, R.string.user_already_in_contactlist).show();
return;
}
new EaseAlertDialog(this, R.string.This_user_is_already_your_friend).show();
return;
}
progressDialog = new ProgressDialog(this);
String stri = getResources().getString(R.string.Is_sending_a_request);
progressDialog.setMessage(stri);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.show();
new Thread(new Runnable() {
public void run() {
try {
//demo use a hardcode reason here, you need let user to input if you like
String s = getResources().getString(R.string.Add_a_friend);
EMClient.getInstance().contactManager().addContact(toAddUsername, s);
runOnUiThread(new Runnable() {
public void run() {
progressDialog.dismiss();
String s1 = getResources().getString(R.string.send_successful);
Toast.makeText(getApplicationContext(), s1, Toast.LENGTH_LONG).show();
}
});
} catch (final Exception e) {
runOnUiThread(new Runnable() {
public void run() {
progressDialog.dismiss();
String s2 = getResources().getString(R.string.Request_add_buddy_failure);
Toast.makeText(getApplicationContext(), s2 + e.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
}
}).start();
}