android.app.progressdialog Java Examples
The following examples show how to use
android.app.progressdialog.
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: MainActivity.java From NoiseCapture with GNU General Public License v3.0 | 6 votes |
@Override public void run() { // Export try { mainActivity.progress = ProgressDialog.show(mainActivity, mainActivity .getText(R.string .upload_progress_title), mainActivity.getText(R.string.upload_progress_message), true); } catch (RuntimeException ex) { // This error may arise on some system // The display of progression are not vital so cancel the crash by handling the // error MAINLOGGER.error(ex.getLocalizedMessage(), ex); } new Thread(new SendZipToServer(mainActivity, recordsToTransfer, mainActivity .progress, new OnUploadedListener() { @Override public void onMeasurementUploaded() { mainActivity.onTransferRecord(); } })).start(); }
Example #2
Source File: SettingsActivity.java From hacker-news-android with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if(key.equals(UserPreferenceManager.PREF_NIGHT_MODE)){ new AlertDialog.Builder(getActivity()) .setMessage("This requires an application restart") .setPositiveButton("Ok", (dialog, which) -> { Intent mStartActivity = new Intent(getActivity(), MainActivity.class); mStartActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); int mPendingIntentId = 123456; PendingIntent mPendingIntent = PendingIntent.getActivity(getActivity(), mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager mgr = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE); mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent); ProgressDialog.show(getActivity(), null, "Restarting...", true, false); }) .create() .show(); } }
Example #3
Source File: netMusicActivity.java From music_player with Open Software License 3.0 | 6 votes |
@Override protected void onPreExecute() { dialog = ProgressDialog.show(netMusicActivity.this, "请稍后", "正在玩命加载更多歌曲"); dialog.setOnKeyListener(new Dialog.OnKeyListener() { @Override public boolean onKey(DialogInterface arg0, int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK) { dialog.dismiss(); //停止http call.cancel(); } return true; } }); super.onPreExecute(); }
Example #4
Source File: FileUploadFragment.java From RetrofitClient with MIT License | 6 votes |
private void uploadSingleFile(String path) { final ProgressDialog progressDialog = new ProgressDialog(getActivity()); progressDialog.show(); API.testSingleFileUpload(UrlConfig.SINGLE_FILE_UPLOAD, path, "上传的文件", new FileResponseResult() { @Override public void onSuccess() { progressDialog.dismiss(); showToast("上传成功"); } @Override public void onFailure(Throwable throwable, String content) { progressDialog.dismiss(); showToast("上传失败:" + throwable.getMessage()); } }); }
Example #5
Source File: MirrorsFragment.java From android with Apache License 2.0 | 6 votes |
@Override public void onDestroy() { if (mAsyncLinkParser != null) { ProgressDialog dialog = mAsyncLinkParser.mProgressDialog; if (dialog != null) { dialog.cancel(); } } if (mCastManager != null && mCastConsumer != null) { mCastManager.removeVideoCastConsumer(mCastConsumer); } super.onDestroy(); }
Example #6
Source File: CurrencyActivity.java From Travel-Mate with MIT License | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_utilities_currency_converter); ButterKnife.bind(this); setTitle(R.string.text_currency); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); mToken = sharedPreferences.getString(USER_TOKEN, null); mDialog = new ProgressDialog(this); mDialog.setMessage(getResources().getString(R.string.progress_wait)); mDialog.setTitle(R.string.app_name); mDialog.setCancelable(false); sDefSystemLanguage = Locale.getDefault().getLanguage(); currences_names = new ArrayList<>(); mHandler = new Handler(Looper.getMainLooper()); mContext = this; Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); }
Example #7
Source File: BluetoothSite.java From physical-web with Apache License 2.0 | 6 votes |
/** * Connects to the Gatt service of the device to download a web page and displays a progress bar * for the title. * @param deviceAddress The mac address of the bar * @param title The title of the web page being downloaded */ public void connect(String deviceAddress, String title) { running = true; String progressTitle = activity.getString(R.string.page_loading_title) + " " + title; progress = new ProgressDialog(activity); progress.setCancelable(true); progress.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { Log.i(TAG, "Dialog box canceled"); close(); } }); progress.setTitle(progressTitle); progress.setMessage(activity.getString(R.string.page_loading_message)); progress.show(); activity.runOnUiThread(new Runnable() { @Override public void run() { mBluetoothGatt = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(deviceAddress) .connectGatt(activity, false, BluetoothSite.this); } }); }
Example #8
Source File: LoadingDialog.java From BigApp_Discuz_Android with Apache License 2.0 | 6 votes |
public static ProgressDialog createProgressDialog(Context context, String text) { final ProgressDialog dlg = new ProgressDialog(context, R.style.Theme_Dialog_Default); dlg.show(); dlg.setContentView(R.layout.loading_layout); LinearLayout root = (LinearLayout) dlg .findViewById(R.id.progressDialog); root.setGravity(android.view.Gravity.CENTER); root.getBackground().setAlpha(100);// 0~255透明度值 ,0为完全透明,255为不透明 LoadingView mLoadView = new LoadingView(context); mLoadView.setDrawableResId(R.drawable.loading_img); root.addView(mLoadView); TextView alert = new TextView(context); alert.setGravity(android.view.Gravity.CENTER); alert.setHeight(50); alert.setText(text); alert.setTextColor(0xFFFFFFFF); root.addView(alert); dlg.setCanceledOnTouchOutside(false); return dlg; }
Example #9
Source File: GetSeatsInfo.java From kute with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.get_seats_info); back_nav=(ImageButton)findViewById(R.id.backNav); go_button=(Button)findViewById(R.id.goButton); back_nav.setOnClickListener(this); go_button.setOnClickListener(this); Bundle b=getIntent().getExtras(); source_string=(String) b.get("source"); destination_string=(String)b.get("destination"); source_address=(String)b.get("sourceAdd"); destination_address=(String)b.get("destinationAdd"); dest_cords=(String)b.get("destinationCords"); source_cords=(String)b.get("sourceCords"); seats=(AppCompatEditText)findViewById(R.id.seatsAvailable); progress_dialog = new ProgressDialog(this); progress_dialog.setMessage("Registering Trip Request.."); progress_dialog.setCanceledOnTouchOutside(false); request_queue= VolleySingleton.getInstance(getApplicationContext()).getRequestQueue(); //Get the selected latlng for source and destination }
Example #10
Source File: Search.java From PowerFileExplorer with GNU General Public License v3.0 | 6 votes |
@Override protected void onPreExecute() { mCancelled=false; mProgressDialog = new ProgressDialog(mParent); mProgressDialog.setTitle(R.string.spinner_message); mProgressDialog.setMessage(mQuery); mProgressDialog.setIndeterminate(true); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mProgressDialog.setCancelable(true); mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { mCancelled=true; cancel(false); } }); mProgressDialog.show(); mParent = null; }
Example #11
Source File: CropUtil.java From LockDemo with Apache License 2.0 | 5 votes |
public BackgroundJob(MonitoredActivity activity, Runnable job, ProgressDialog dialog, Handler handler) { this.activity = activity; this.dialog = dialog; this.job = job; this.activity.addLifeCycleListener(this); this.handler = handler; }
Example #12
Source File: PAudioRecorder.java From PHONK with GNU General Public License v3.0 | 5 votes |
@PhonkMethod(description = "Starts recording", example = "") @PhonkMethodParam(params = {"showProgressBoolean"}) public PAudioRecorder record(String fileName) { init(); recorder.setOutputFile(getAppRunner().getProject().getFullPathForFile(fileName)); try { recorder.prepare(); } catch (Exception e) { e.printStackTrace(); } if (showProgress && getActivity() != null) { mProgressDialog = new ProgressDialog(getActivity()); mProgressDialog.setTitle("Record!"); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mProgressDialog.setButton(DialogInterface.BUTTON_POSITIVE, "Stop recording", (dialog, whichButton) -> { mProgressDialog.dismiss(); stop(); }); mProgressDialog.setOnCancelListener(p1 -> stop()); mProgressDialog.show(); } recorder.start(); return this; }
Example #13
Source File: PlacesSearchItemActivity.java From Place-Search-Service with MIT License | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); EventBus.getDefault().register(this); dialog = new ProgressDialog(this); dialog.setCancelable(false); dialog.setIndeterminate(true); dialog.setMessage("Fetching Details"); dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); context = this; setContentView(R.layout.places_search_result_item_activity); obj = (PlacesSearchResultObj.PlacesSearchResultItemObj) getIntent().getSerializableExtra("data"); mBack = findViewById(R.id.back); titleName = findViewById(R.id.name); shareImg = findViewById(R.id.share); favoriteImg = findViewById(R.id.favorite); layout = findViewById(R.id.layout); tab = findViewById(R.id.tab); pager = findViewById(R.id.viewpager); mBack.setOnClickListener(this); favoriteImg.setOnClickListener(this); shareImg.setOnClickListener(this); layout.setVisibility(View.INVISIBLE); dialog.show(); init(); initData(); reqDetails (); }
Example #14
Source File: MainActivity.java From YoutubeDown with MIT License | 5 votes |
protected void showWaitDialog() { if (mProgressDialog == null) { mProgressDialog = ProgressDialog.show(this, "Loading...", "Please wait...", true, true); mProgressDialog.setCanceledOnTouchOutside(false); mProgressDialog.setOnCancelListener(new ProgressDialog.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { } }); } else { mProgressDialog.show(); } }
Example #15
Source File: HttpFetchActionOffline.java From BotLibre with Eclipse Public License 1.0 | 5 votes |
@Override protected void onPreExecute() { this.dialog = new ProgressDialog(this.activity); this.dialog.setCancelable(false); this.dialog.setMessage("Initializing Bot"); this.dialog.show(); }
Example #16
Source File: DeviceListFragment.java From Demo_Public with MIT License | 5 votes |
public void onInitiateDiscovery(){ if(progressDialog != null && progressDialog.isShowing()) progressDialog.dismiss(); progressDialog = ProgressDialog.show(getActivity(), "Press back to channel", "finding peers",true,true, new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { } }); }
Example #17
Source File: SocialApiIml.java From letv with Apache License 2.0 | 5 votes |
private void a(Activity activity, Bundle bundle, IUiListener iUiListener) { Intent agentIntentWithTarget = getAgentIntentWithTarget(SocialConstants.ACTIVITY_VOICE); String envUrl = ServerSetting.getInstance().getEnvUrl(Global.getContext(), ServerSetting.DEFAULT_URL_VOICE); if (agentIntentWithTarget == null && a()) { if (this.mProgressDialog == null || !this.mProgressDialog.isShowing()) { this.mProgressDialog = new ProgressDialog(activity); this.mProgressDialog.setTitle("请稍候"); this.mProgressDialog.show(); } a(activity, SocialConstants.ACTION_VOICE, new a(this, a(bundle, SocialConstants.ACTION_VOICE, envUrl, iUiListener))); return; } a(activity, agentIntentWithTarget, SocialConstants.ACTION_VOICE, bundle, envUrl, iUiListener, true); }
Example #18
Source File: EditorFragment.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
private void showDialog(String msg) { dismissDialog(); ProgressDialog progressDialog = new ProgressDialog(getContext()); progressDialog.setMessage(msg); progressDialog.show(); this.dialog = progressDialog; }
Example #19
Source File: PlacesFragment.java From android-mvvm-with-tests with MIT License | 5 votes |
private void setupView() { // Progress dialog setup mProgressDialog = new ProgressDialog(getActivity()); mProgressDialog.setMessage(getString(R.string.loading)); mProgressDialog.setCancelable(false); // Actionbar setup ((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar); ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Recyclerview setup mPlacesAdapter = new PlacesAdapter(getActivity()); mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); mRecyclerView.setAdapter(mPlacesAdapter); }
Example #20
Source File: DeleteConversationAsyncTask.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected void onPreExecute() { super.onPreExecute(); if (isThreaddelete) { progressDialog = ProgressDialog.show(context, "", context.getString(R.string.delete_thread_text), true); } }
Example #21
Source File: CommonUtils.java From InstantAppStarter with MIT License | 5 votes |
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; }
Example #22
Source File: CropUtil.java From ImageChoose with MIT License | 5 votes |
public static void startBackgroundJob(MonitoredActivity activity, String title, String message, Runnable job, Handler handler) { // Make the progress dialog uncancelable, so that we can gurantee // the thread will be done before the activity getting destroyed ProgressDialog dialog = ProgressDialog.show( activity, title, message, true, false); new Thread(new BackgroundJob(activity, job, dialog, handler)).start(); }
Example #23
Source File: ImportWhitelistTask.java From Ninja with Apache License 2.0 | 5 votes |
@Override protected void onPreExecute() { dialog = new ProgressDialog(context); dialog.setCancelable(false); dialog.setMessage(context.getString(R.string.toast_wait_a_minute)); dialog.show(); }
Example #24
Source File: MovingMarkerActivity.java From Airbnb-Android-Google-Map-View with MIT License | 5 votes |
public void route() { if (start == null || end == null) { if (start == null) { if (starting.getText().length() > 0) { starting.setError("Choose location from dropdown."); } else { Toast.makeText(this, "Please choose a starting point.", Toast.LENGTH_SHORT).show(); } } if (end == null) { if (destination.getText().length() > 0) { destination.setError("Choose location from dropdown."); } else { Toast.makeText(this, "Please choose a destination.", Toast.LENGTH_SHORT).show(); } } } else { progressDialog = ProgressDialog.show(this, "Please wait.", "Fetching route information.", true); Routing routing = new Routing.Builder() .travelMode(AbstractRouting.TravelMode.DRIVING) .withListener(this) .alternativeRoutes(true) .waypoints(start, end) .build(); routing.execute(); CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(mLatitude, mLongitude)); CameraUpdate zoom = CameraUpdateFactory.zoomTo(14); mGoogleMap.moveCamera(center); mGoogleMap.animateCamera(zoom); hideKeyboard(); } }
Example #25
Source File: MainActivity.java From SecondScreen with Apache License 2.0 | 5 votes |
@Override protected void onPreExecute() { dialog = new ProgressDialog(MainActivity.this); dialog.setMessage(getResources().getString(R.string.checking_for_superuser)); dialog.setIndeterminate(true); dialog.setCancelable(false); dialog.show(); }
Example #26
Source File: LoginActivity.java From hawkular-android-client with Apache License 2.0 | 5 votes |
@OnClick(R.id.button_login) public void login() { if(!validForm()) { return; } try { String host = mHost.getText().toString().trim(); String port = mPort.getText().toString().trim(); String user = mUsername.getText().toString().trim(); String pass = mPassword.getText().toString().trim(); if (port.isEmpty()) { backendUrl = Urls.getUrl(host); } else { backendUrl = Urls.getUrl(host, Integer.valueOf(port)); } BackendClient.of(this).configureAuthorization(backendUrl.toString(), user, pass); BackendClient.of(this).authorize(new AuthorizeCallback(this)); // Progress authIndicator = new ProgressDialog(this); authIndicator.setCancelable(false); authIndicator.setMessage(getString(R.string.logging)); authIndicator.show(); } catch (RuntimeException e) { Timber.d(e, "Authorization failed."); showError(R.string.error_authorization_host_port); } }
Example #27
Source File: TraitEditorActivity.java From Field-Book with GNU General Public License v2.0 | 5 votes |
@Override protected void onPreExecute() { super.onPreExecute(); dialog = new ProgressDialog(thisActivity); dialog.setIndeterminate(true); dialog.setCancelable(false); dialog.setMessage(Html .fromHtml(thisActivity.getString(R.string.import_dialog_importing))); dialog.show(); }
Example #28
Source File: CognitoSyncTask.java From aws-mobile-self-paced-labs-samples with Apache License 2.0 | 5 votes |
public void doSync() { ProgressDialog dialog = ProgressDialog.show(callingActivity, "Syncing", "Please wait"); Dataset dataset = AWSClientManager.getDataset(); printDataset(); dataset.synchronize(new SimpleCallback(dialog)); }
Example #29
Source File: HttpFragment.java From Cangol-appcore with Apache License 2.0 | 5 votes |
private void request(){ RequestParams params=new RequestParams(); params.put("appVersion","1.0.1"); params.put("apiVersion","1"); params.put("osVersion","5.0.2"); params.put("appId","Hunao"); params.put("sign","56d24ee613b70d9fc1d80c05e80737b8"); params.put("deviceId","9cf64d9c047c36a9"); params.put("platform","Android"); params.put("channelId","google"); String url="http://192.168.1.2:8080/Hunao/api/user/autoRegister.do"; mAsyncHttpClient.post(getActivity(),url,params,new JsonHttpResponseHandler(){ ProgressDialog progressDialog; @Override public void onStart() { super.onStart(); progressDialog=ProgressDialog.show(getActivity(),null,"loading..."); printLog("onStart\n"); } @Override public void onSuccess(int statusCode, JSONObject response) { super.onSuccess(statusCode, response); progressDialog.dismiss(); printLog("onSuccess "+response+"\n"); } @Override public void onFailure(Throwable e, JSONObject errorResponse) { super.onFailure(e, errorResponse); progressDialog.dismiss(); printLog("onFailure "+e.getMessage()+",error="+errorResponse+"\n"); } }); }
Example #30
Source File: Utils.java From medic-android with GNU Affero General Public License v3.0 | 5 votes |
public static ProgressDialog showSpinner(Context ctx, String message) { ProgressDialog p = new ProgressDialog(ctx); p.setProgressStyle(ProgressDialog.STYLE_SPINNER); if(message != null) p.setMessage(message); p.setIndeterminate(true); p.setCanceledOnTouchOutside(false); p.show(); return p; }