List of usage examples for android.widget ProgressBar ProgressBar
public ProgressBar(Context context)
From source file:Main.java
public static ProgressBar createProgress(Context context) { ProgressBar p = new ProgressBar(context); p.setIndeterminate(true);//from w ww . j ava 2 s . c o m RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(40, 40); lp.addRule(RelativeLayout.CENTER_IN_PARENT); p.setLayoutParams(lp); return p; }
From source file:Main.java
public static ProgressBar createProgress(final Context context) { final ProgressBar p = new ProgressBar(context); p.setIndeterminate(true);// w w w .ja v a 2 s . com final RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(40, 40); lp.addRule(RelativeLayout.CENTER_IN_PARENT); p.setLayoutParams(lp); return p; }
From source file:Main.java
public static LinearLayout setProgressBarLayout(Activity activity) { LinearLayout progressBarLayout = new LinearLayout(activity); progressBarLayout.setGravity(Gravity.CENTER); ProgressBar spinner = new ProgressBar(activity); progressBarLayout.addView(spinner);/* w w w . ja v a 2 s .c om*/ activity.addContentView(progressBarLayout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); return progressBarLayout; }
From source file:com.todoroo.astrid.helper.ProgressBarSyncResultCallback.java
public ProgressBarSyncResultCallback(Activity activity, Fragment fragment, int progressBarId, Runnable onFinished) {/*from w w w .j av a 2 s.co m*/ this.progressBar = (ProgressBar) fragment.getView().findViewById(progressBarId); this.activity = activity; this.onFinished = onFinished; if (progressBar == null) progressBar = new ProgressBar(activity); progressBar.setProgress(0); progressBar.setMax(0); }
From source file:simonlang.coastdove.core.ui.LoadableListFragment.java
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); this.loaderID = 0; // Progress bar while the list loads this.progressBar = new ProgressBar(getActivity()); this.progressBar.setVisibility(View.VISIBLE); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.CENTER; layoutParams.weight = 2;/*from w w w . j a va 2 s .co m*/ this.progressBar.setLayoutParams(layoutParams); this.progressBar.setIndeterminate(true); setUpListAdapter(); getListView().setEmptyView(this.progressBar); addProgressBarToViewGroup(); getLoaderManager().initLoader(loaderID, null, this); }
From source file:simonlang.coastdove.usagestatistics.ui.app_usage_data_details.DataEntryListFragment.java
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); this.loaderID = 300; // Progress bar while the list loads this.progressBar = new ProgressBar(getActivity()); this.progressBar.setVisibility(View.VISIBLE); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.CENTER; layoutParams.weight = 2;/* w w w . j a va2 s. c o m*/ this.progressBar.setLayoutParams(layoutParams); this.progressBar.setIndeterminate(true); ExpandableListView elv = (ExpandableListView) getView().findViewById(android.R.id.list); elv.setEmptyView(this.progressBar); addProgressBarToViewGroup(); AppUsageDataDetailsActivity activity = (AppUsageDataDetailsActivity) getActivity(); this.appPackageName = activity.getAppPackageName(); this.appID = activity.getAppID(); this.adapter = new DataEntryListAdapter(getActivity(), this.appPackageName); elv.setAdapter(this.adapter); elv.setGroupIndicator(null); getLoaderManager().initLoader(this.loaderID, null, this); }
From source file:com.givenhansco.keystonenavigation.Activities.PTT.PTTMainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mProgressBar = new ProgressBar(PTTMainActivity.this); setContentView(R.layout.activity_signin); _settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); signInView = (RelativeLayout) findViewById(R.id.signInView); networkEdit = (EditText) findViewById(R.id.networkEdit); usernameEdit = (EditText) findViewById(R.id.usernameEdit); passwordEdit = (EditText) findViewById(R.id.passwordEdit); loginButton = (Button) findViewById(R.id.loginButton); textView = (TextView) findViewById(R.id.statusTextView); perishableCheckBox = (CheckBox) findViewById(R.id.checkBox); signingInView = (RelativeLayout) findViewById(R.id.signingInView); cancelButton = (Button) findViewById(R.id.cancelButton); errorTextView = (TextView) findViewById(R.id.incorrectPasswordTextView); loginButton.setOnClickListener(new View.OnClickListener() { @Override/* w w w .ja va 2s .c o m*/ public void onClick(View view) { mProgressBar.setVisibility(View.VISIBLE); String network = networkEdit.getText().toString(); String username = usernameEdit.getText().toString(); String password = passwordEdit.getText().toString(); boolean perishable = perishableCheckBox.isChecked(); if (appState.isSignedIn()) { updateUI(); if (mProgressBar.isShown()) mProgressBar.setVisibility(View.GONE); } signInAttempted = true; boolean signin = Zello.getInstance().signIn(network.trim(), username.trim(), password.trim(), perishable); Log.e("signin", "" + signin); Zello.getInstance().getAppState(appState); Log.e("appstate", "" + appState.isSignedIn()); Log.e("error", "" + appState.getLastError()); hideKeyboard(); } }); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Zello.getInstance().cancelSignIn(); } }); }
From source file:de.escoand.readdaily.CalendarDialogFragment.java
@NonNull @Override/*from ww w.j a va 2 s .co m*/ public Dialog onCreateDialog(final Bundle savedInstanceState) { FrameLayout v = new FrameLayout(getContext()); progress = new ProgressBar(new ContextThemeWrapper(getContext(), R.style.Progress_Circular)); cal = new MaterialCalendarView(getContext()); v.addView(progress); v.addView(cal); progress.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER)); cal.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); cal.addDecorator(new AvailableDecorator()); cal.addDecorator(new ReadDecorator()); cal.setOnDateChangedListener(this); new DataLoader().execute(); return new AlertDialog.Builder(getContext()).setTitle(R.string.navigation_calendar).setView(v) .setNegativeButton(R.string.button_cancel, null).create(); }
From source file:re.neutrino.kanji_assist.dictionary_popup.DictionaryBackgroundTask.java
DictionaryBackgroundTask(DictionaryPopup dictionaryPopup) { this.context = dictionaryPopup.getContext(); this.scrollView = (ScrollView) dictionaryPopup.findViewById(R.id.scrollView); this.scrollView.removeAllViews(); ProgressBar progress = new ProgressBar(this.context); progress.setLayoutParams(matchParentLayout); this.scrollView.addView(progress); this.colorRotator = new ColorRotator(); }
From source file:com.ymt.demo1.plates.hub.FireHubMainFragment.java
protected void initView(View view) { //??/* w w w .j ava2s .c o m*/ ExpandableListView expandableListView = (ExpandableListView) view.findViewById(R.id.hub_list_view); //? ProgressBar progressBar = new ProgressBar(getActivity()); progressBar.setIndeterminate(true); expandableListView.setEmptyView(progressBar); hubPlateAdapter = new HubPlateAdapter(getActivity()); expandableListView.setAdapter(hubPlateAdapter); //item expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { //??? Intent intent = new Intent(getActivity(), SubjectsActivity.class); intent.putExtra("plate", childList.get(groupPosition).get(childPosition)); intent.putExtra("group_name", parentList.get(groupPosition).getName()); startActivity(intent); getActivity().overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right); return true; } }); ImageView doPostView = (ImageView) view.findViewById(R.id.hub_act_post); // ImageView topPostView = (ImageView) view.findViewById(R.id.hub_act_top); ImageView newPostView = (ImageView) view.findViewById(R.id.hub_act_new); ImageView hotPostView = (ImageView) view.findViewById(R.id.hub_act_hot); ImageView myPostView = (ImageView) view.findViewById(R.id.hub_act_my); View.OnClickListener onClickListener = new View.OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.hub_act_post: //? Intent intent1 = new Intent(getActivity(), DoPostActivity.class); ArrayList<HubPlate> parents = new ArrayList<>(); for (HubPlate plate : parentList) { parents.add(plate); } ArrayList<HubPlate> childs = new ArrayList<>(); for (List<HubPlate> pList : childList) { for (HubPlate plate : pList) { childs.add(plate); } } intent1.putParcelableArrayListExtra("parent", parents); intent1.putParcelableArrayListExtra("child", childs); getActivity().startActivity(intent1); getActivity().overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right); break; // case R.id.hub_act_top: //?? // // break; case R.id.hub_act_new: //? Intent intentN = new Intent(getActivity(), HotNewPostActivity.class); intentN.putExtra("type", HotNewPostActivity.TYPE_NEW); startActivity(intentN); getActivity().overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right); break; case R.id.hub_act_hot: //? Intent intentH = new Intent(getActivity(), HotNewPostActivity.class); intentH.putExtra("type", HotNewPostActivity.TYPE_HOT); startActivity(intentH); getActivity().overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right); break; case R.id.hub_act_my: //? startActivity(new Intent(getActivity(), MyHubTabActivity.class)); getActivity().overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right); break; } } }; doPostView.setOnClickListener(onClickListener); // topPostView.setOnClickListener(onClickListener); newPostView.setOnClickListener(onClickListener); hotPostView.setOnClickListener(onClickListener); myPostView.setOnClickListener(onClickListener); }