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 Project: NoiseCapture   Author: Ifsttar   File: MainActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
@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 Project: RetrofitClient   Author: Jadyli   File: FileUploadFragment.java    License: MIT License 6 votes vote down vote up
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 #3
Source Project: hacker-news-android   Author: dinosaurwithakatana   File: SettingsActivity.java    License: Apache License 2.0 6 votes vote down vote up
@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 #4
Source Project: kute   Author: scorelab   File: GetSeatsInfo.java    License: Apache License 2.0 6 votes vote down vote up
@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 #5
Source Project: BigApp_Discuz_Android   Author: BigAppOS   File: LoadingDialog.java    License: Apache License 2.0 6 votes vote down vote up
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 #6
Source Project: physical-web   Author: google   File: BluetoothSite.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 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 #7
Source Project: android   Author: tvportal   File: MirrorsFragment.java    License: Apache License 2.0 6 votes vote down vote up
@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 #8
Source Project: music_player   Author: htqqdd   File: netMusicActivity.java    License: Open Software License 3.0 6 votes vote down vote up
@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 #9
Source Project: Travel-Mate   Author: project-travel-mate   File: CurrencyActivity.java    License: MIT License 6 votes vote down vote up
@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 #10
Source Project: PowerFileExplorer   Author: PowerExplorer   File: Search.java    License: GNU General Public License v3.0 6 votes vote down vote up
@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 Project: Airbnb-Android-Google-Map-View   Author: SkyTreasure   File: MovingMarkerActivity.java    License: MIT License 5 votes vote down vote up
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 #12
Source Project: cim   Author: farsunset   File: LoginActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void initViews() {

        progressDialog = new ProgressDialog(this);
        progressDialog.setTitle("提示");
        progressDialog.setMessage("正在登录,请稍候......");
        progressDialog.setCancelable(false);
        progressDialog.setCanceledOnTouchOutside(false);
        accountEdit = (EditText) this.findViewById(R.id.account);
        loginButton = (Button) this.findViewById(R.id.login);
        loginButton.setOnClickListener(this);

    }
 
Example #13
Source Project: EosCommander   Author: playerone-id   File: UiUtils.java    License: MIT License 5 votes vote down vote up
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;
}
 
Example #14
Source Project: react-native-android-vitamio   Author: sejoker   File: InitActivity.java    License: MIT License 5 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  uiHandler = new UIHandler(this);

  new AsyncTask<Object, Object, Boolean>() {
    @Override
    protected void onPreExecute() {
      mPD = new ProgressDialog(InitActivity.this);
      mPD.setCancelable(false);
      mPD.setMessage(InitActivity.this.getString(getResources().getIdentifier("vitamio_init_decoders", "string", getPackageName())));
      mPD.show();
    }

    @Override
    protected Boolean doInBackground(Object... params) {
      return Vitamio.initialize(InitActivity.this, getResources().getIdentifier("libarm", "raw", getPackageName()));
    }

    @Override
    protected void onPostExecute(Boolean inited) {
      if (inited) {
        uiHandler.sendEmptyMessage(0);
      }
    }

  }.execute();
}
 
Example #15
Source Project: fanfouapp-opensource   Author: mcxiaoke   File: ClearCacheDialogPreference.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    this.pd = new ProgressDialog(this.c);
    this.pd.setTitle("清空缓存图片");
    this.pd.setMessage("正在清空缓存图片...");
    this.pd.setCancelable(false);
    this.pd.setIndeterminate(true);
    this.pd.show();
}
 
Example #16
Source Project: Vitamio   Author: CharonChui   File: InitActivity.java    License: Apache License 2.0 5 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  uiHandler = new UIHandler(this);

  new AsyncTask<Object, Object, Boolean>() {
    @Override
    protected void onPreExecute() {
      mPD = new ProgressDialog(InitActivity.this);
      mPD.setCancelable(false);
      mPD.setMessage(InitActivity.this.getString(getResources().getIdentifier("vitamio_init_decoders", "string", getPackageName())));
      mPD.show();
    }

    @Override
    protected Boolean doInBackground(Object... params) {
      return Vitamio.initialize(InitActivity.this, getResources().getIdentifier("libarm", "raw", getPackageName()));
    }

    @Override
    protected void onPostExecute(Boolean inited) {
      if (inited) {
        uiHandler.sendEmptyMessage(0);
      }
    }

  }.execute();
}
 
Example #17
Source Project: kute   Author: scorelab   File: NotificationActivity.java    License: Apache License 2.0 5 votes vote down vote up
/********************** Overrides **************/
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.notification_activity);
    head_text=(TextView)findViewById(R.id.headText);
    head_detail=(TextView)findViewById(R.id.headDetailRest);
    start_place=(TextView)findViewById(R.id.startPlace);
    drop_place=(TextView)findViewById(R.id.dropText);
    start_head=(TextView)findViewById(R.id.startHead);
    drop_head=(TextView)findViewById(R.id.dropHead);

    row_start=(TableRow)findViewById(R.id.rowStart);
    row_start_text=(TableRow)findViewById(R.id.rowStartPlace);
    row_drop=(TableRow)findViewById(R.id.rowDrop);
    row_drop_text=(TableRow)findViewById(R.id.rowDropText);

    confirm_trip=(Button)findViewById(R.id.confirmTrip);
    backnav=(ImageButton)findViewById(R.id.backNav);

    progress_dialog = new ProgressDialog(NotificationActivity.this);
    progress_dialog.setCanceledOnTouchOutside(false);

    confirm_trip.setOnClickListener(this);
    backnav.setOnClickListener(this);

    //Setting up a place holder for the person
    PlaceHolderFragment plc=new PlaceHolderFragment();
    Bundle b=new Bundle();
    b.putString("Label","Loading.....");
    plc.setArguments(b);
    getSupportFragmentManager().beginTransaction().replace(R.id.personItem, plc, "PlaceHolder").commit();

    not=(Notification)getIntent().getSerializableExtra("Notification");
    processNotification(not);
}
 
Example #18
Source Project: AndroidNetwork   Author: BaoBaoJianqiang   File: AppBaseActivity.java    License: MIT License 5 votes vote down vote up
@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;
}
 
Example #19
Source Project: caffe-android-demo   Author: sh1r0   File: MainActivity.java    License: MIT License 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if ((requestCode == REQUEST_IMAGE_CAPTURE || requestCode == REQUEST_IMAGE_SELECT) && resultCode == RESULT_OK) {
        String imgPath;

        if (requestCode == REQUEST_IMAGE_CAPTURE) {
            imgPath = fileUri.getPath();
        } else {
            Uri selectedImage = data.getData();
            String[] filePathColumn = {MediaStore.Images.Media.DATA};
            Cursor cursor = MainActivity.this.getContentResolver().query(selectedImage, filePathColumn, null, null, null);
            cursor.moveToFirst();
            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            imgPath = cursor.getString(columnIndex);
            cursor.close();
        }

        bmp = BitmapFactory.decodeFile(imgPath);
        Log.d(LOG_TAG, imgPath);
        Log.d(LOG_TAG, String.valueOf(bmp.getHeight()));
        Log.d(LOG_TAG, String.valueOf(bmp.getWidth()));

        dialog = ProgressDialog.show(MainActivity.this, "Predicting...", "Wait for one sec...", true);

        CNNTask cnnTask = new CNNTask(MainActivity.this);
        cnnTask.execute(imgPath);
    } else {
        btnCamera.setEnabled(true);
        btnSelect.setEnabled(true);
    }

    super.onActivityResult(requestCode, resultCode, data);
}
 
Example #20
Source Project: SmartPack-Kernel-Manager   Author: SmartPack   File: SmartPackFragment.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    mExecuteDialog = new ProgressDialog(getActivity());
    mExecuteDialog.setMessage(getString(R.string.executing) + ("..."));
    mExecuteDialog.setCancelable(false);
    mExecuteDialog.show();
}
 
Example #21
Source Project: hr   Author: Odoo-mobile   File: MailChatterCompose.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    progressDialog = new ProgressDialog(MailChatterCompose.this);
    progressDialog.setTitle(R.string.title_working);
    progressDialog.setMessage(((mType == MessageType.Message) ? "Sending message" :
            "Logging internal note") + "...");
    progressDialog.setCancelable(false);
    progressDialog.show();
}
 
Example #22
Source Project: Theogony   Author: VernonLee   File: SetWallpaperTask.java    License: MIT License 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    mProgressDialog = new ProgressDialog(mContext);
    mProgressDialog.setMessage("操作中...");
    mProgressDialog.show();
}
 
Example #23
Source Project: NetEasyNews   Author: liaozhoubei   File: InitActivity.java    License: GNU General Public License v3.0 5 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
   uiHandler = new UIHandler(this);

   new AsyncTask<Object, Object, Boolean>() {
     @Override
     protected void onPreExecute() {
       mPD = new ProgressDialog(InitActivity.this);
       mPD.setCancelable(false);
       mPD.setMessage(InitActivity.this.getString(getResources().getIdentifier("vitamio_init_decoders", "string", getPackageName())));
       mPD.show();
     }


     @Override
     protected void onPostExecute(Boolean inited) {
       if (inited) {
         uiHandler.sendEmptyMessage(0);
       }
     }


@Override
protected Boolean doInBackground(Object... arg0) {
	// TODO Auto-generated method stub
	return null;
}

   }.execute();
 }
 
Example #24
Source Project: WayHoo   Author: way1989   File: ContextUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * show progress dialog
 * 
 * @param context
 * @param title
 *            Dialog title
 * @param message
 *            Dialog message
 * @return
 */
public static ProgressDialog showProgressDialog(Context context, int title,
		int message) {
	ProgressDialog dialog = new ProgressDialog(context);
	dialog.setTitle(title);
	dialog.setMessage(context.getResources().getString(message));
	dialog.setIndeterminate(true);
	dialog.setCancelable(true);
	dialog.show();
	return dialog;
}
 
Example #25
Source Project: AndroidChromium   Author: JackyAndroid   File: ClearBrowsingDataPreferences.java    License: Apache License 2.0 5 votes vote down vote up
private final void showProgressDialog() {
    if (getActivity() == null) return;
    mProgressDialog = ProgressDialog.show(getActivity(),
            getActivity().getString(R.string.clear_browsing_data_progress_title),
            getActivity().getString(R.string.clear_browsing_data_progress_message), true,
            false);
}
 
Example #26
Source Project: firebase-chat   Author: crazyhitty   File: RegisterFragment.java    License: MIT License 5 votes vote down vote up
private void init() {
    mRegisterPresenter = new RegisterPresenter(this);
    mAddUserPresenter = new AddUserPresenter(this);

    mProgressDialog = new ProgressDialog(getActivity());
    mProgressDialog.setTitle(getString(R.string.loading));
    mProgressDialog.setMessage(getString(R.string.please_wait));
    mProgressDialog.setIndeterminate(true);

    mBtnRegister.setOnClickListener(this);
}
 
Example #27
Source Project: WhatsApp-Cleaner   Author: Pawan0411   File: FilesFragment.java    License: MIT License 5 votes vote down vote up
@Override
protected void onPreExecute() {
    // display a progress dialog for good user experiance
    filesFragmentWeakReference.get().progressDialog = new ProgressDialog(filesFragmentWeakReference.get().getContext());
    filesFragmentWeakReference.get().progressDialog.setMessage("Please Wait");
    filesFragmentWeakReference.get().progressDialog.setCancelable(false);
    if (!filesFragmentWeakReference.get().progressDialog.isShowing()) {
        filesFragmentWeakReference.get().progressDialog.show();
    }
}
 
Example #28
Source Project: OpenMapKitAndroid   Author: posm   File: OSMDownloader.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void setupProgressDialog() {
    progressDialog = new ProgressDialog(activity);
    progressDialog.setTitle("Downloading OSM Data");
    progressDialog.setMessage("Starting download...");
    progressDialog.setIndeterminate(true);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setCancelable(true);
    progressDialog.show();        
}
 
Example #29
Source Project: augmentedreality   Author: JimSeker   File: ModelViewer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
  public void surfaceCreated(SurfaceHolder holder) {
  	super.surfaceCreated(holder);

  	if(model == null) {
	waitDialog = ProgressDialog.show(this, "", 
               getResources().getText(R.string.loading), true);
	waitDialog.show();
	new ModelLoader().execute();
}
  }
 
Example #30
Source Project: Android-GiphySearch   Author: klinker24   File: DownloadGif.java    License: MIT License 5 votes vote down vote up
@Override
public void onPreExecute() {
    dialog = new ProgressDialog(activity);
    dialog.setIndeterminate(true);
    dialog.setCancelable(false);
    dialog.setMessage(activity.getString(R.string.downloading));
    dialog.show();
}