Java Code Examples for android.app.progressdialog#requestWindowFeature()

The following examples show how to use android.app.progressdialog#requestWindowFeature() . 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: StringAsyncTask.java    From geopaparazzi with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPreExecute() {
    if (doProgress) {
        progressDialog = new ProgressDialog(context);
        if (title == null) {
            progressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        } else {
            progressDialog.setTitle(title);
        }
        progressDialog.setMessage(message);
        progressDialog.setCancelable(cancelable);
        if (max == null) {
            progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progressDialog.setIndeterminate(true);
        } else {
            progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            progressDialog.setIndeterminate(false);
            progressDialog.setProgress(0);
            progressDialog.setMax(max);
        }
        progressDialog.show();
    }
}
 
Example 2
Source File: InstagramDialog.java    From social-login-helper-Deprecated- with MIT License 6 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  mSpinner = new ProgressDialog(getContext());
  mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
  mSpinner.setMessage("Loading...");
  mContent = new LinearLayout(getContext());
  mContent.setOrientation(LinearLayout.VERTICAL);
  setUpTitle();
  setUpWebView();
  Display display = getWindow().getWindowManager().getDefaultDisplay();
  final float scale = getContext().getResources().getDisplayMetrics().density;
  float[] dimensions =
      (display.getWidth() < display.getHeight()) ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
  addContentView(mContent, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f),
      (int) (dimensions[1] * scale + 0.5f)));
  CookieSyncManager.createInstance(getContext());
  CookieManager cookieManager = CookieManager.getInstance();
  cookieManager.removeAllCookie();
}
 
Example 3
Source File: LoginDialog.java    From android-auth with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mResultDelivered = false;

    mProgressDialog = new ProgressDialog(getContext());
    mProgressDialog.setMessage(getContext().getString(R.string.com_spotify_sdk_login_progress));
    mProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mProgressDialog.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialogInterface) {
            dismiss();
        }
    });

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    getWindow().setBackgroundDrawableResource(android.R.drawable.screen_background_dark_transparent);

    setContentView(R.layout.com_spotify_sdk_login_dialog);

    setLayoutSize();

    createWebView(mUri);
}
 
Example 4
Source File: LoginDialog.java    From blade-player with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mResultDelivered = false;

    mProgressDialog = new ProgressDialog(getContext());
    mProgressDialog.setMessage(getContext().getString(R.string.com_spotify_sdk_login_progress));
    mProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mProgressDialog.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialogInterface) {
            dismiss();
        }
    });

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    getWindow().setBackgroundDrawableResource(android.R.drawable.screen_background_dark_transparent);

    setContentView(R.layout.com_spotify_sdk_login_dialog);

    setLayoutSize();

    createWebView(mUri);
}
 
Example 5
Source File: StringDialogCallback.java    From okhttp-OkGo with Apache License 2.0 5 votes vote down vote up
public StringDialogCallback(Activity activity) {
    dialog = new ProgressDialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setMessage("请求网络中...");
}
 
Example 6
Source File: CustomUI.java    From socialauth-android with MIT License 5 votes vote down vote up
@Override
public void onComplete(Bundle values) {

	Log.d("Custom-UI", "Successful");

	// Changing Sign In Text to Sign Out
	View v = listview.getChildAt(pos - listview.getFirstVisiblePosition());
	TextView pText = (TextView) v.findViewById(R.id.signstatus);
	pText.setText("Sign Out");

	// Get the provider
	providerName = values.getString(SocialAuthAdapter.PROVIDER);
	Log.d("Custom-UI", "providername = " + providerName);

	Toast.makeText(CustomUI.this, providerName + " connected", Toast.LENGTH_SHORT).show();

	int res = getResources().getIdentifier(providerName + "_array", "array", CustomUI.this.getPackageName());

	AlertDialog.Builder builder = new AlertDialog.Builder(CustomUI.this);
	builder.setTitle("Select Options");
	builder.setCancelable(true);
	builder.setIcon(android.R.drawable.ic_menu_more);

	mDialog = new ProgressDialog(CustomUI.this);
	mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
	mDialog.setMessage("Loading...");

	builder.setSingleChoiceItems(new DialogAdapter(CustomUI.this, R.layout.provider_options, getResources()
			.getStringArray(res)), 0, new DialogInterface.OnClickListener() {
		@Override
		public void onClick(DialogInterface dialog, int item) {

			Events(item, providerName);
			dialog.dismiss();
		}
	});
	dialog = builder.create();
	dialog.show();

}
 
Example 7
Source File: FbDialog.java    From Klyph with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	mSpinner = new ProgressDialog(getContext());
	mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
	mSpinner.setMessage("Loading...");

	requestWindowFeature(Window.FEATURE_NO_TITLE);
	mContent = new FrameLayout(getContext());

	/*
	 * Create the 'x' image, but don't add to the mContent layout yet
	 * at this point, we only need to know its drawable width and height
	 * to place the webview
	 */
	createCrossImage();

	/*
	 * Now we know 'x' drawable width and height,
	 * layout the webivew and add it the mContent layout
	 */
	int crossWidth = mCrossImage.getDrawable().getIntrinsicWidth();
	setUpWebView(crossWidth / 2);

	/*
	 * Finally add the 'x' image to the mContent layout and
	 * add mContent to the Dialog view
	 */
	mContent.addView(mCrossImage, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	addContentView(mContent, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
}
 
Example 8
Source File: WebDialog.java    From drupalfit with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Log8.d();
    spinner = new ProgressDialog(getContext());
    spinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    spinner.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialogInterface) {
            Log8.d();
            WebDialog.this.dismiss();
        }
    });
    Log8.d();

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    contentFrameLayout = new FrameLayout(getContext());

    // First calculate how big the frame layout should be
    getWindow().setGravity(Gravity.CENTER);
    Log8.d();

    // resize the dialog if the soft keyboard comes up
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    Log8.d();
    setUpWebView(500);
    Log8.d();
    setContentView(contentFrameLayout);
    Log8.d();
}
 
Example 9
Source File: BitmapDialogCallback.java    From okhttp-OkGo with Apache License 2.0 5 votes vote down vote up
public BitmapDialogCallback(Activity activity) {
    super(1000, 1000);
    dialog = new ProgressDialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setMessage("请求网络中...");
}
 
Example 10
Source File: DialogCallback.java    From okhttp-OkGo with Apache License 2.0 5 votes vote down vote up
private void initDialog(Activity activity) {
    dialog = new ProgressDialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setMessage("请求网络中...");
}
 
Example 11
Source File: CameraActivity.java    From smart-farmer-android with Apache License 2.0 5 votes vote down vote up
private ProgressDialog showProgressDialog() {
    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setMessage("准备中...");
    dialog.setIndeterminate(true);
    dialog.setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.show();
    return dialog;
}
 
Example 12
Source File: BaiduDialog.java    From dcs-sdk-java with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // 设置ProgressDialog的样式
    mSpinner = new ProgressDialog(getContext());
    mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mSpinner.setMessage("登录中...");
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    mContent = new FrameLayout(getContext());
    setUpWebView();
    addContentView(mContent, MATCH);
}
 
Example 13
Source File: WeiboDialog.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
private void initLoadingDlg()
{
    mLoadingDlg = new ProgressDialog(getContext());
    mLoadingDlg.requestWindowFeature(1);
    mLoadingDlg.setMessage(ResourceManager.getString(mContext, 1));
}
 
Example 14
Source File: TwitterDialog.java    From NewAndroidTwitter with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);

       mSpinner = new ProgressDialog(getContext());
       
       mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
       mSpinner.setMessage("Loading...");

       mContent = new LinearLayout(getContext());
       
       mContent.setOrientation(LinearLayout.VERTICAL);
       
       setUpTitle();
       setUpWebView();
       
       Display display 	= getWindow().getWindowManager().getDefaultDisplay();
	Point outSize		= new Point();
	
	int width			= 0;
	int height			= 0;
	
	double[] dimensions = new double[2];
	        
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
		display.getSize(outSize);
		
		width	= outSize.x;
		height	= outSize.y;
	} else {
		width	= display.getWidth();
		height	= display.getHeight();
	}
	
	if (width < height) {
		dimensions[0]	= 0.87 * width;
        dimensions[1]	= 0.82 * height;
	} else {
		dimensions[0]	= 0.75 * width;
		dimensions[1]	= 0.75 * height;	        
	}
       
       addContentView(mContent, new FrameLayout.LayoutParams((int) dimensions[0], (int) dimensions[1]));
   }
 
Example 15
Source File: InstagramDialog.java    From AndroidInstagram with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	mSpinner = new ProgressDialog(getContext());
        
	mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
	mSpinner.setMessage("Loading...");

	mContent = new LinearLayout(getContext());
        
	mContent.setOrientation(LinearLayout.VERTICAL);
        
	setUpTitle();
	
	setUpWebView();
        
	Display display 	= getWindow().getWindowManager().getDefaultDisplay();
	Point outSize		= new Point();
	
	int width			= 0;
	int height			= 0;
	
	double[] dimensions = new double[2];
	        
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
		display.getSize(outSize);
		
		width	= outSize.x;
		height	= outSize.y;
	} else {
		width	= display.getWidth();
		height	= display.getHeight();
	}
	
	if (width < height) {
		dimensions[0]	= 0.87 * width;
        dimensions[1]	= 0.82 * height;
	} else {
		dimensions[0]	= 0.75 * width;
		dimensions[1]	= 0.75 * height;	        
	}
        
	addContentView(mContent, new FrameLayout.LayoutParams((int) dimensions[0], (int) dimensions[1]));
}
 
Example 16
Source File: SocialAuthDialog.java    From socialauth-android with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	handler = new Handler();
	Util.getDisplayDpi(getContext());

	mSpinner = new ProgressDialog(getContext());
	mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
	mSpinner.setMessage("Loading...");
	mSpinner.setCancelable(true);

	mContent = new LinearLayout(getContext());
	mContent.setOrientation(LinearLayout.VERTICAL);
	setUpTitle();
	setUpWebView();

	Display display = getWindow().getWindowManager().getDefaultDisplay();
	final float scale = getContext().getResources().getDisplayMetrics().density;
	int orientation = getContext().getResources().getConfiguration().orientation;
	float[] dimensions = (orientation == Configuration.ORIENTATION_LANDSCAPE) ? DIMENSIONS_DIFF_LANDSCAPE
			: DIMENSIONS_DIFF_PORTRAIT;

	addContentView(mContent, new LinearLayout.LayoutParams(display.getWidth()
			- ((int) (dimensions[0] * scale + 0.5f)), display.getHeight() - ((int) (dimensions[1] * scale + 0.5f))));

	mSpinner.setOnCancelListener(new OnCancelListener() {
		@Override
		public void onCancel(DialogInterface dialogInterface) {
			mWebView.stopLoading();
			mListener.onBack();
			SocialAuthDialog.this.dismiss();
		}
	});

	this.setOnKeyListener(new DialogInterface.OnKeyListener() {
		@Override
		public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
			if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
				mWebView.stopLoading();
				dismiss();
				mListener.onBack();
				return true;
			}
			return false;
		}
	});
}
 
Example 17
Source File: WebDialog.java    From kognitivo with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    spinner = new ProgressDialog(getContext());
    spinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    spinner.setMessage(getContext().getString(R.string.com_facebook_loading));
    spinner.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialogInterface) {
            cancel();
        }
    });

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    contentFrameLayout = new FrameLayout(getContext());

    // First calculate how big the frame layout should be
    resize();
    getWindow().setGravity(Gravity.CENTER);

    // resize the dialog if the soft keyboard comes up
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

    /* Create the 'x' image, but don't add to the contentFrameLayout layout yet
     * at this point, we only need to know its drawable width and height
     * to place the webview
     */
    createCrossImage();

    /* Now we know 'x' drawable width and height,
     * layout the webview and add it the contentFrameLayout layout
     */
    int crossWidth = crossImageView.getDrawable().getIntrinsicWidth();

    setUpWebView(crossWidth / 2 + 1);

    /* Finally add the 'x' image to the contentFrameLayout layout and
    * add contentFrameLayout to the Dialog view
    */
    contentFrameLayout.addView(crossImageView, new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    setContentView(contentFrameLayout);
}