List of usage examples for android.widget ProgressBar getProgress
@ViewDebug.ExportedProperty(category = "progress") public synchronized int getProgress()
Get the progress bar's current level of progress.
From source file:com.frostwire.android.gui.adapters.TransferListAdapter.java
private static void setProgress(ProgressBar v, int progress) { int old = v.getProgress(); if (old != progress) { v.setProgress(progress);/*from w w w. j a va 2 s . c o m*/ } }
From source file:app.android.example.com.commontcents.ListContentFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View recyclerView = inflater.inflate(R.layout.item_list, container, false); final ProgressBar progressBar = (ProgressBar) recyclerView.findViewById(R.id.progress_bar); progressBar.setScaleY(3f);//w w w . java 2 s. c om final Handler mHandler = new Handler(); mHandler.post(new Runnable() { public void run() { progressBar.incrementProgressBy(10 * poolCounter.getCount()); progressBar.setProgress(progressBar.getProgress()); } }); return recyclerView; }
From source file:com.somethoughts.chinmay.game.Dice.DiceFragment.java
void spin() { if (inProgress) { Toast.makeText(getActivity(), "Please Wait", Toast.LENGTH_SHORT).show(); return;/* w ww. ja v a 2 s. co m*/ } Typeface custom_font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/myfnt.ttf"); final TextView textView = (TextView) view.findViewById(R.id.dice_result_textview); final TextView textViewrun = (TextView) view.findViewById(R.id.result_textView_run); final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.dice_progressBar); progressBar.setIndeterminate(false); progressBar.setMax(3000); textView.setTypeface(custom_font); textViewrun.setTypeface(custom_font); progressBar.setVisibility(View.VISIBLE); countDownTimer = new CountDownTimer(3000, 250) { @Override public void onTick(long l) { inProgress = true; Random random = new Random(); progressBar.setProgress(3000 - (int) l); Log.v("Progress", Integer.toString(progressBar.getProgress())); textViewrun.setVisibility(View.VISIBLE); textViewrun.setText("Waiting"); textView.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark)); textView.setText(Integer.toString(random.nextInt(6) + 1)); } @Override public void onFinish() { inProgress = false; view.setBackgroundColor(getResources().getColor(R.color.colorWin)); textViewrun.setText("Here you go"); progressBar.setProgress(3000); return; } }.start(); }
From source file:com.somethoughts.chinmay.game.Coin.CoinTossMainFragment.java
private void toss_it(final Boolean userChoice) { if (inProgress) { Toast.makeText(getActivity(), "Please Wait", Toast.LENGTH_SHORT).show(); return;//from ww w . j a va 2 s . c om } final TextView textViewResult = (TextView) view.findViewById(R.id.coin_result_textview); final TextView textViewStatus = (TextView) view.findViewById(R.id.coin_status_textView); final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.coin_progressBar); Random random = new Random(); progressBar.setVisibility(View.VISIBLE); progressBar.setMax(2500); progressBar.setIndeterminate(false); final Boolean b = random.nextBoolean(); countDownTimer = new CountDownTimer(3000, 125) { @Override public void onTick(long l) { inProgress = true; Random random = new Random(); progressBar.setProgress(3000 - (int) l); Log.v("Progress", Integer.toString(progressBar.getProgress())); textViewStatus.setVisibility(View.VISIBLE); textViewStatus.setText(toss[random.nextInt(2)]); textViewResult.setText(getResources().getText(R.string.Waiting)); } @Override public void onFinish() { inProgress = false; if ((b && userChoice) || (!b && !userChoice)) { textViewStatus.setText(getResources().getText(R.string.Voila)); view.setBackgroundColor(getColor(getActivity().getBaseContext(), R.color.colorWin)); if (userChoice) textViewResult.setText(toss[0]); else textViewResult.setText(toss[1]); } else { textViewStatus.setText(getResources().getText(R.string.oops)); view.setBackgroundColor(getColor(getActivity().getBaseContext(), R.color.colorLose)); if (userChoice) textViewResult.setText(toss[1]); else textViewResult.setText(toss[0]); } progressBar.setProgress(3000); } }.start(); }