List of usage examples for android.app ProgressDialog show
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable)
From source file:com.lugia.timetable.LoginActivity.java
public void onClick(View v) { // not continue button? i really not sure what you have clicked. if (v.getId() != R.id.button_continue) return;//from w w w. j ava 2 s . c o m String mmuid = mMmuIdInput.getText().toString(); String password = mPasswordInput.getText().toString(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0); mProgressDialog = ProgressDialog.show(LoginActivity.this, "", "Please wait...", true, false); mProgressDialog.setCancelable(false); LoginThread thread = new LoginThread(mmuid, password); thread.start(); }
From source file:com.facebook.android.UploadPhotoResultDialog.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHandler = new Handler(); setContentView(R.layout.upload_photo_response); LayoutParams params = getWindow().getAttributes(); params.width = LayoutParams.FILL_PARENT; params.height = LayoutParams.FILL_PARENT; getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); mOutput = (TextView) findViewById(R.id.apiOutput); mUsefulTip = (TextView) findViewById(R.id.usefulTip); mViewPhotoButton = (Button) findViewById(R.id.view_photo_button); mTagPhotoButton = (Button) findViewById(R.id.tag_photo_button); mUploadedPhoto = (ImageView) findViewById(R.id.uploadedPhoto); JSONObject json;/*from w w w. j a v a 2s. c o m*/ try { json = Util.parseJson(response); final String photo_id = json.getString("id"); this.photo_id = photo_id; mOutput.setText(json.toString(2)); mUsefulTip.setText(activity.getString(R.string.photo_tip)); Linkify.addLinks(mUsefulTip, Linkify.WEB_URLS); mViewPhotoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (hidePhoto) { mViewPhotoButton.setText(R.string.view_photo); hidePhoto = false; mUploadedPhoto.setImageBitmap(null); } else { hidePhoto = true; mViewPhotoButton.setText(R.string.hide_photo); /* * Source tag: view_photo_tag */ Bundle params = new Bundle(); params.putString("fields", "picture"); dialog = ProgressDialog.show(activity, "", activity.getString(R.string.please_wait), true, true); dialog.show(); Utility.mAsyncRunner.request(photo_id, params, new ViewPhotoRequestListener()); } } }); mTagPhotoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /* * Source tag: tag_photo_tag */ setTag(); } }); } catch (JSONException e) { setText(activity.getString(R.string.exception) + e.getMessage()); } catch (FacebookError e) { setText(activity.getString(R.string.facebook_error) + e.getMessage()); } }
From source file:com.example.android.wifidirect.DeviceDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mContentView = inflater.inflate(R.layout.device_detail, null); mContentView.findViewById(R.id.btn_connect).setOnClickListener(new View.OnClickListener() { @Override/*from w ww .j a v a 2 s. c o m*/ public void onClick(View v) { WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = device.deviceAddress; config.wps.setup = WpsInfo.PBC; if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } progressDialog = ProgressDialog.show(getActivity(), "Press back to cancel", "Connecting to :" + device.deviceAddress, true, true // new DialogInterface.OnCancelListener() { // // @Override // public void onCancel(DialogInterface dialog) { // ((DeviceActionListener) getActivity()).cancelDisconnect(); // } // } ); ((DeviceActionListener) getActivity()).connect(config); } }); mContentView.findViewById(R.id.btn_send_data); mContentView.findViewById(R.id.btn_disconnect).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((DeviceActionListener) getActivity()).disconnect(); } }); mContentView.findViewById(R.id.btn_start_client).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Allow user to pick an image from Gallery or other // registered apps Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); startActivityForResult(intent, CHOOSE_FILE_RESULT_CODE); } }); return mContentView; }
From source file:com.ibuildapp.romanblack.CataloguePlugin.model.ShoppingCart.java
/** * Send order to endpoint//from ww w.j a va 2 s. c o m * * @param context context * @param userProfile userProfile */ public static void sendOrder(final Context context, final UserProfile userProfile) { SqlAdapter.insertUserProfile(userProfile); progressDialog = ProgressDialog.show(context, null, context.getResources().getString(R.string.shopping_cart_loading), true, true); CatalogApi api = (new CatalogApiService(com.appbuilder.sdk.android.Statics.BASE_DOMEN)).getCatalogApi(); api.sendOrder(String.valueOf(com.ibuildapp.romanblack.CataloguePlugin.Statics.appId), String.valueOf(com.ibuildapp.romanblack.CataloguePlugin.Statics.widgetId), toShippingForm(), toItems()).subscribeOn(Schedulers.io()).subscribe(new Subscriber<ApiResponse>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { if (context instanceof Activity) ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { progressDialog.dismiss(); progressDialog = null; } }); } @Override public void onNext(ApiResponse apiResponse) { if ("complete".equals(apiResponse.getStatus())) { if (context instanceof Activity) { Intent intent = new Intent(context, ThankYouPage.class); intent.putExtra(EXTRA_ORDER_NUMBER, apiResponse.getOrderNumber()); ((Activity) context).startActivityForResult(intent, ShoppingCartPage.REQUEST_EXIT); } } else { if (context instanceof Activity) ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, context.getString(R.string.shopping_cart_send_error), Toast.LENGTH_SHORT).show(); } }); } if (context instanceof Activity) ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { progressDialog.dismiss(); progressDialog = null; } }); } }); }
From source file:com.facebook.android.GraphExplorer.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHandler = new Handler(); setContentView(R.layout.graph_explorer); url = BASE_GRAPH_URL; // Base URL mInputId = (EditText) findViewById(R.id.inputId); mOutput = (TextView) findViewById(R.id.output); mSubmitButton = (Button) findViewById(R.id.submitButton); mViewURLButton = (Button) findViewById(R.id.viewURLButton); mGetPermissionsButton = (Button) findViewById(R.id.accessTokenButton); mFieldsConnectionsButton = (Button) findViewById(R.id.fieldsAndConnectionsButton); mBackParentButton = (Button) findViewById(R.id.backParentButton); mScrollView = (ScrollView) findViewById(R.id.ScrollView01); mTextDeleteButton = (Button) findViewById(R.id.textDeleteButton); mMeButton = (Button) findViewById(R.id.meButton); if (Utility.mFacebook.isSessionValid()) { mMeButton.setVisibility(View.VISIBLE); }/* w w w .java 2 s . c o m*/ params = new Bundle(); mSubmitButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(mInputId.getWindowToken(), 0); // Prepare the URL to be shown on 'View URL' click action. This // is not used by the SDK url = BASE_GRAPH_URL; // Base URL /* * Source Tag: graph_explorer */ rootString = mInputId.getText().toString(); if (!TextUtils.isEmpty(rootString)) { dialog = ProgressDialog.show(GraphExplorer.this, "", getString(R.string.please_wait), true, true); params.putString("metadata", "1"); Utility.mAsyncRunner.request(rootString, params, new graphApiRequestListener()); url += "/" + rootString; // Relative Path provided by you } } }); mViewURLButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setText(url); Linkify.addLinks(mOutput, Linkify.WEB_URLS); } }); mGetPermissionsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (Utility.mFacebook.isSessionValid()) { dialog = ProgressDialog.show(GraphExplorer.this, "", getString(R.string.fetching_current_permissions), true, true); Bundle params = new Bundle(); params.putString("access_token", Utility.mFacebook.getAccessToken()); Utility.mAsyncRunner.request("me/permissions", params, new permissionsRequestListener()); } else { new PermissionsDialog(GraphExplorer.this).show(); } } }); mFieldsConnectionsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (metadataObject == null) { makeToast("No fields, connections availalbe for this object."); } else { new FieldsConnectionsDialog(GraphExplorer.this, metadataObject).show(); } } }); mTextDeleteButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { url = BASE_GRAPH_URL; // Base URL mParentObjectId = ""; mInputId.setText(""); params.clear(); metadataObject = null; setText(""); mBackParentButton.setVisibility(View.INVISIBLE); } }); mMeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mInputId.setText("me"); mSubmitButton.performClick(); } }); mBackParentButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mInputId.setText(mParentObjectId); mParentObjectId = ""; mSubmitButton.performClick(); } }); }
From source file:org.aerogear.diffsync.android.demo.DiffSyncMainActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);//www .j a v a 2 s. co m clientId = UUID.randomUUID().toString(); documentId = getString(R.string.documentId); name = (TextView) findViewById(R.id.name); profession = (TextView) findViewById(R.id.profession); hobby0 = (TextView) findViewById(R.id.hobby0); hobby1 = (TextView) findViewById(R.id.hobby1); hobby2 = (TextView) findViewById(R.id.hobby2); hobby3 = (TextView) findViewById(R.id.hobby3); content = new Info("Luke Skywalker", "Jedi", "Fighting the Dark Side", "going into Tosche Station to pick up some power converters", "Kissing his sister", "Bulls eyeing Womprats on his T-16"); setFields(content); JsonPatchClientSynchronizer synchronizer = new JsonPatchClientSynchronizer(); ClientInMemoryDataStore<JsonNode, JsonPatchEdit> dataStore = new ClientInMemoryDataStore<JsonNode, JsonPatchEdit>(); ClientSyncEngine<JsonNode, JsonPatchEdit> clientSyncEngine = new ClientSyncEngine<JsonNode, JsonPatchEdit>( synchronizer, dataStore); Log.i("onCreate", "observer :" + this); syncClient = SyncClient.<JsonNode, JsonPatchEdit>forHost(getString(R.string.serverHost)) .port(Integer.parseInt(getString(R.string.serverPort))).syncEngine(clientSyncEngine).observer(this) .build(); new AsyncTask<Void, Void, String>() { @Override protected String doInBackground(Void... params) { try { syncClient.connect(); final ClientDocument<JsonNode> clientDocument = clientDoc(documentId, clientId, JsonUtil.toJsonNode(content)); Log.i("onCreate", "Seed Document:" + clientDocument); syncClient.addDocument(clientDocument); } catch (final InterruptedException e) { e.printStackTrace(); } return null; } }.execute(); final Button sync = (Button) findViewById(R.id.sync); sync.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { dialog = ProgressDialog.show(DiffSyncMainActivity.this, getString(R.string.wait), getString(R.string.syncing), true, false); new AsyncTask<ClientDocument<JsonNode>, Void, String>() { @Override protected String doInBackground(final ClientDocument<JsonNode>... params) { Log.i("doInBackground", "Document:" + params[0]); syncClient.diffAndSend(params[0]); return null; } @Override protected void onPostExecute(final String s) { dialog.dismiss(); } }.execute(clientDoc(documentId, clientId, JsonUtil.toJsonNode(gatherUpdates()))); } }); }
From source file:com.lge.friendsCamera.RecordVideoActivity.java
/** * Captures an image during recordings, saving lat/long coordinates to EXIF * This api is enable only during recording and half mode (180 degree picture) * API : /osc/commands/execute (camera._liveSnapshot) *///from w ww. ja va 2s .c o m private void liveSnapShot() { mProgressDialog = ProgressDialog.show(mContext, "", "Processing...", true, false); OSCCommandsExecute commandsExecute = new OSCCommandsExecute("camera._liveSnapshot", null); commandsExecute.setListener(new HttpAsyncTask.OnHttpListener() { @Override public void onResponse(OSCReturnType type, Object response) { String state = Utils.getCommandState(response); if (state != null && state.equals(OSCParameterNameMapper.STATE_INPROGRESS)) { String commandId = Utils.getCommandId(response); checkCommandsStatus(commandId); } else { if (mProgressDialog.isShowing()) mProgressDialog.cancel(); Utils.showTextDialog(mContext, "Response ", Utils.parseString(response)); } } }); commandsExecute.execute(); }
From source file:com.p2c.thelife.SettingsFragment.java
public boolean setUserProfile(View view) { // set the updated user record TextView textView = null;/*from w ww . java 2s .c om*/ textView = (TextView) getActivity().findViewById(R.id.settings_first_name); String firstName = textView.getText().toString(); textView = (TextView) getActivity().findViewById(R.id.settings_last_name); String lastName = textView.getText().toString(); textView = (TextView) getActivity().findViewById(R.id.settings_email); String email = textView.getText().toString(); textView = (TextView) getActivity().findViewById(R.id.settings_phone); String phone = textView.getText().toString(); m_updatedUser = new UserModel(TheLifeConfiguration.getOwnerDS().getId(), firstName, lastName, email, phone, TheLifeConfiguration.getOwnerDS().getProvider()); // call the server m_progressDialog = ProgressDialog.show(getActivity(), getResources().getString(R.string.waiting), getResources().getString(R.string.storing_account), true, true); Server server = new Server(getActivity()); server.updateUserProfile(TheLifeConfiguration.getOwnerDS().getId(), firstName, lastName, email, phone, GCMSupport.getInstance().getRegistrationId(), // keep the current value this, "updateUserProfile"); return true; }
From source file:foo.fruitfox.evend.LoginActivity.java
public void register(View view) { verificationLayout = (LinearLayout) findViewById(R.id.verificationLayout); verificationLayout.setVisibility(View.VISIBLE); username = (EditText) findViewById(R.id.username); String identifier = ""; JSONObject requestJSON = new JSONObject(); try {/*w w w. j a v a 2 s. co m*/ switch (registrationType) { case "email": String email = username.getText().toString(); if (userData == null) { userData = new UserData(registrationType, email); } else { userData.setEmail(email); } identifier = email; requestJSON.put("email", email); break; case "phone": String phone = username.getText().toString(); if (userData == null) { userData = new UserData(registrationType, phone); } else { userData.setPhone(phone); } identifier = phone; requestJSON.put("phone", phone); break; } } catch (JSONException e1) { e1.printStackTrace(); } StorageHelper.PreferencesHelper.setIdentifier(this, identifier); StorageHelper.PreferencesHelper.setUserData(this, identifier, userData); if (NetworkHelper.Utilities.isConnected(this)) { UserDataWebAPITask udwTask = new UserDataWebAPITask(this, this); try { progDialog = ProgressDialog.show(this, "Processing...", "Fetching data", true, false); udwTask.execute("POST", getResources().getString(R.string.server_url) + "authenticate", requestJSON.toString()); } catch (Exception e) { if (progDialog.isShowing()) { progDialog.dismiss(); } udwTask.cancel(true); } } else { DebugHelper.ShowMessage.t(this, "Connection error"); } }
From source file:com.lge.friendsCamera.RecordVideoActivity.java
/** * start/resume/pause recording video//w ww.ja v a 2 s. com */ private void startVideo() { mProgressDialog = ProgressDialog.show(mContext, "", "Waiting..", true, false); if (currentRecordState == recordState.STOP_RECORDING) { changeRecordingStatus(START); } else if (currentRecordState == recordState.PAUSE_RECORDING) { changeRecordingStatus(RESUME); } else { //is recording changeRecordingStatus(PAUSE); } }