List of usage examples for android.widget ProgressBar ProgressBar
public ProgressBar(Context context)
From source file:org.spinsuite.util.SFAAsyncTask.java
/** * Create Progress Bar//from ww w. j av a 2 s. c o m * @author <a href="mailto:carlosapardam@gmail.com">Carlos Parada</a> 05/03/2014, 23:02:20 * @return void */ public void createProgressBar() { if (m_ProgressBar == null) m_ProgressBar = new ProgressBar(m_ctx); }
From source file:org.telegram.ui.BlockedUsersActivity.java
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); actionBar.setTitle(LocaleController.getString("BlockedUsers", R.string.BlockedUsers)); actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override//from w w w . j a va2 s.co m public void onItemClick(int id) { if (id == -1) { finishFragment(); } else if (id == block_user) { Bundle args = new Bundle(); args.putBoolean("onlyUsers", true); args.putBoolean("destroyAfterSelect", true); args.putBoolean("returnAsResult", true); ContactsActivity fragment = new ContactsActivity(args); fragment.setDelegate(BlockedUsersActivity.this); presentFragment(fragment); } } }); ActionBarMenu menu = actionBar.createMenu(); menu.addItem(block_user, R.drawable.plus); fragmentView = new FrameLayout(context); FrameLayout frameLayout = (FrameLayout) fragmentView; emptyTextView = new TextView(context); emptyTextView.setTextColor(ContextCompat.getColor(context, R.color.disabled_text)); emptyTextView.setTextSize(20); emptyTextView.setGravity(Gravity.CENTER); emptyTextView.setVisibility(View.INVISIBLE); emptyTextView.setText(LocaleController.getString("NoBlocked", R.string.NoBlocked)); frameLayout.addView(emptyTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT)); emptyTextView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); progressView = new FrameLayout(context); frameLayout.addView(progressView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); ProgressBar progressBar = new ProgressBar(context); progressView.addView(progressBar, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER)); listView = new ListView(context); listView.setEmptyView(emptyTextView); listView.setVerticalScrollBarEnabled(false); listView.setDivider(null); listView.setDividerHeight(0); listView.setAdapter(listViewAdapter = new ListAdapter(context)); listView.setVerticalScrollbarPosition( LocaleController.isRTL ? ListView.SCROLLBAR_POSITION_LEFT : ListView.SCROLLBAR_POSITION_RIGHT); frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { if (i < MessagesController.getInstance().blockedUsers.size()) { Bundle args = new Bundle(); args.putInt("user_id", MessagesController.getInstance().blockedUsers.get(i)); presentFragment(new ProfileActivity(args)); } } }); listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) { if (i < 0 || i >= MessagesController.getInstance().blockedUsers.size() || getParentActivity() == null) { return true; } selectedUserId = MessagesController.getInstance().blockedUsers.get(i); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); CharSequence[] items = new CharSequence[] { LocaleController.getString("Unblock", R.string.Unblock) }; builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { MessagesController.getInstance().unblockUser(selectedUserId); } } }); showDialog(builder.create()); return true; } }); if (MessagesController.getInstance().loadingBlockedUsers) { progressView.setVisibility(View.VISIBLE); emptyTextView.setVisibility(View.GONE); listView.setEmptyView(null); } else { progressView.setVisibility(View.GONE); listView.setEmptyView(emptyTextView); } return fragmentView; }
From source file:com.chute.components.android.imagesharer.activity.DialogActivity.java
@Override public View getWebView() { webView = new WebView(getApplicationContext()); webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webView.setWebViewClient(new BaseWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.setKeepScreenOn(true);/* w w w . ja v a 2 s. c o m*/ webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setUserAgentString( "Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17"); webView.getSettings().setAllowFileAccess(true); webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); FrameLayout frameLayout = new FrameLayout(getApplicationContext()); frameLayout.setMinimumHeight(150); progressBar = new ProgressBar(getApplicationContext()); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(100, 100); layoutParams.gravity = Gravity.CENTER; progressBar.setLayoutParams(layoutParams); frameLayout.addView(webView); frameLayout.addView(progressBar); return frameLayout; }
From source file:com.stepinmobile.fantasticbutton.api.ButtonHandle.java
/** * Method authenticate in facebook and if authentication would be successful it will call share method. * * @param textToShare text, which wold be shared. *///from ww w . j a v a2s . co m private void authFacebookSsoAndShare(final String textToShare) { fbHandle.sso(ACTIVITY_SSO); String url = "https://graph.facebook.com/me"; aq.auth(fbHandle).progress(new ProgressBar(aq.getContext())).ajax(url, JSONObject.class, new AjaxCallback<JSONObject>() { @Override public void callback(String url, JSONObject object, AjaxStatus status) { if (object != null) { postOnFb(textToShare); } } }); }
From source file:com.money.manager.ex.home.DashboardFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { // add progress bar ProgressBar progressBar = new ProgressBar(getActivity()); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);/*from w w w .j a v a2 s. co m*/ layoutParams.gravity = Gravity.CENTER; progressBar.setLayoutParams(layoutParams); progressBar.setIndeterminate(true); if (id <= ID_LOADER_SCREEN4) { linearScreens[id].removeAllViews(); // add view linearScreens[id].addView(progressBar); } Select query; // start loader switch (id) { case ID_LOADER_SCREEN1: QueryReportIncomeVsExpenses report = new QueryReportIncomeVsExpenses(getActivity()); query = new Select(report.getAllColumns()).where(IncomeVsExpenseReportEntity.Month + "=" + Integer.toString(Calendar.getInstance().get(Calendar.MONTH) + 1) + " AND " + IncomeVsExpenseReportEntity.YEAR + "=" + Integer.toString(Calendar.getInstance().get(Calendar.YEAR))); return new MmxCursorLoader(getActivity(), report.getUri(), query); case ID_LOADER_SCREEN2: query = new Select().where(prepareQueryTopWithdrawals()); return new MmxCursorLoader(getActivity(), new SQLDataSet().getUri(), query); case ID_LOADER_SCREEN3: query = new Select().where(prepareQueryTopPayees()); return new MmxCursorLoader(getActivity(), new SQLDataSet().getUri(), query); case ID_LOADER_SCREEN4: QueryBillDeposits billDeposits = new QueryBillDeposits(getActivity()); query = new Select(billDeposits.getAllColumns()).where(QueryBillDeposits.DAYSLEFT + "<=10") .orderBy(QueryBillDeposits.DAYSLEFT); return new MmxCursorLoader(getActivity(), billDeposits.getUri(), query); } return null; }
From source file:com.ndn.menurandom.ImageDownloader.java
private void makeFrameLayout(ImageView imageView) { boolean isExist = false; ViewGroup vg = (ViewGroup) imageView.getParent(); if (vg instanceof FrameLayout) { FrameLayout frameLayout = (FrameLayout) vg; String tag = (String) frameLayout.getTag(); if (tag != null && tag.equals("fl_imagedownloader")) { isExist = true;//from ww w . ja v a 2s. c om } } if (!isExist) { int childCount = vg.getChildCount(); int index = 0; while (index < childCount) { if (imageView == vg.getChildAt(index)) { break; } index++; } vg.removeViewAt(index); FrameLayout frameLayout = new FrameLayout(vg.getContext().getApplicationContext()); frameLayout.setTag("fl_imagedownloader"); ViewGroup.LayoutParams lpImageView = (ViewGroup.LayoutParams) imageView.getLayoutParams(); frameLayout.setLayoutParams(lpImageView); imageView.setLayoutParams(new LayoutParams(lpImageView.width, lpImageView.height)); frameLayout.setPadding(imageView.getPaddingLeft(), imageView.getPaddingTop(), imageView.getPaddingRight(), imageView.getPaddingBottom()); imageView.setPadding(0, 0, 0, 0); frameLayout.addView(imageView); vg.addView(frameLayout, index); ProgressBar progressBar = new ProgressBar(frameLayout.getContext()); progressBar.setTag("pb_imagedownloader"); int leftRightPadding = (imageView.getLayoutParams().width - 50) / 2; int topBottomPadding = (imageView.getLayoutParams().height - 50) / 2; progressBar.setPadding(leftRightPadding, topBottomPadding, leftRightPadding, topBottomPadding); frameLayout.addView(progressBar); } }
From source file:com.facebook.notifications.internal.activity.CardActivity.java
private void beginLoadingContent() { if (assetManager == null || contentManager == null) { Log.e(LOG_TAG, "Asset & content manager should be available!"); return;//from w w w. j a v a2s. com } if (configurationPayload == null) { Log.e(LOG_TAG, "No card payload is available!"); return; } ProgressBar loadingView = new ProgressBar(this); loadingView.setIndeterminate(true); int backgroundColor = ColorAssetHandler.fromRGBAHex(configurationPayload.optString("backdropColor")); FrameLayout loadingViewFrame = new FrameLayout(this); loadingViewFrame.setBackgroundColor(backgroundColor); LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.CENTER; loadingViewFrame.addView(loadingView, layoutParams); setContentView(loadingViewFrame); final Handler handler = new Handler(); if (configurationPayload == null) { return; } assetManager.cachePayload(configurationPayload, new AssetManager.CacheCompletionCallback() { @Override public void onCacheCompleted(@NonNull JSONObject payload) { final CardConfiguration configuration; try { configuration = new CardConfiguration(configurationPayload, assetManager, contentManager); } catch (JSONException ex) { Log.e(LOG_TAG, "Error while parsing JSON", ex); return; } handler.post(new Runnable() { @Override public void run() { displayConfiguration(configuration); } }); } }); }
From source file:obdii.starter.automotive.iot.ibm.com.iot4a_obdii.Home.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); provider = locationManager.getBestProvider(new Criteria(), false); progressBar = new ProgressBar(this); progressBar.setVisibility(View.GONE); progressBar.setIndeterminate(true);// w w w. ja va 2 s . c o m progressBar.setScaleX(0.5f); progressBar.setScaleY(0.5f); supportActionBar = getSupportActionBar(); supportActionBar.setDisplayShowCustomEnabled(true); supportActionBar.setCustomView(progressBar); changeNetwork = (Button) findViewById(R.id.changeNetwork); changeFrequency = (Button) findViewById(R.id.changeFrequency); obdBridge.initializeObdParameterList(this); try { checkForDisclaimer(); } catch (IOException e) { e.printStackTrace(); } // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); }
From source file:edu.mum.ml.group7.guessasketch.android.EasyPaint.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // it removes the title from the actionbar(more space for icons?) // this.getActionBar().setDisplayShowTitleEnabled(false); pixels5 = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics()); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); LinearLayout parent = new LinearLayout(this); parent.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); parent.setOrientation(LinearLayout.VERTICAL); LinearLayout scrollViewParent = new LinearLayout(this); scrollViewParent.setLayoutParams(//from www.java2s . co m new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); scrollViewParent.setOrientation(LinearLayout.HORIZONTAL); HorizontalScrollView predictionsHorizontalScrollView = new HorizontalScrollView(this); //predictionsHorizontalScrollView.setLayoutParams(new ViewGroup.LayoutParams()); predictions = new LinearLayout(this); LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); params.gravity = Gravity.CENTER_VERTICAL; predictions.setLayoutParams(params); predictions.setOrientation(LinearLayout.HORIZONTAL); resetPredictionsView(predictions, true); predictionsHorizontalScrollView.addView(predictions); saveButton = new Button(this); saveButton.setText("Send Feedback"); predictionsHorizontalScrollView.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 10.0f)); saveButton.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, 1.0f)); saveButton.setVisibility(View.INVISIBLE); FrameLayout frameLayout = new FrameLayout(this); frameLayout .setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); frameLayout.addView(saveButton); loader = new ProgressBar(this); loader.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); loader.setIndeterminate(true); loader.setVisibility(ProgressBar.INVISIBLE); frameLayout.addView(loader); scrollViewParent.addView(predictionsHorizontalScrollView); scrollViewParent.addView(frameLayout); contentView = new MyView(this); parent.addView(scrollViewParent); parent.addView(contentView); setContentView(parent); otherLabelOnClickListener = new View.OnClickListener() { @Override public void onClick(View view) { Log.e("Clicked", "Other Label label '" + (String) view.getTag() + "'"); sendScreenshot(false, feedbackType, (String) view.getTag()); } }; mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setDither(true); mPaint.setColor(Color.BLACK); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(DEFAULT_BRUSH_SIZE); // Where did these magic numbers come from? What do they mean? Can I change them? ~TheOpenSourceNinja // Absolutely random numbers in order to see the emboss. asd! ~Valerio mEmboss = new EmbossMaskFilter(new float[] { 1, 1, 1 }, 0.4f, 6, 3.5f); mBlur = new BlurMaskFilter(5, BlurMaskFilter.Blur.NORMAL); if (isFirstTime()) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.app_name); alert.setMessage(R.string.app_description); alert.setNegativeButton(R.string.continue_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Toast.makeText(getApplicationContext(), R.string.here_is_your_canvas, Toast.LENGTH_SHORT) .show(); } }); alert.show(); } else { Toast.makeText(getApplicationContext(), R.string.here_is_your_canvas, Toast.LENGTH_SHORT).show(); } loadFromIntents(); }
From source file:com.king.base.BaseActivity.java
protected void showProgressDialog() { showProgressDialog(new ProgressBar(getContext())); }