List of usage examples for android.widget ProgressBar setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.giovanniterlingen.windesheim.view.Fragments.ContentsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { NotificationCenter.getInstance().addObserver(this, NotificationCenter.downloadPending); NotificationCenter.getInstance().addObserver(this, NotificationCenter.downloadUpdated); NotificationCenter.getInstance().addObserver(this, NotificationCenter.downloadFinished); final ViewGroup viewGroup = (ViewGroup) inflater.inflate(R.layout.fragment_contents, container, false); recyclerView = viewGroup.findViewById(R.id.contents_recyclerview); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false); final ProgressBar progressBar = viewGroup.findViewById(R.id.progress_bar); progressBar.setVisibility(View.VISIBLE); Bundle bundle = this.getArguments(); ActionBar toolbar = ((NatschoolActivity) getActivity()).getSupportActionBar(); if (toolbar != null) { String studyRouteName;/*w w w. j av a 2 s .c om*/ if (bundle != null && (studyRouteName = bundle.getString(STUDYROUTE_NAME)) != null && studyRouteName.length() != 0) { toolbar.setTitle(bundle.getString(STUDYROUTE_NAME)); } else { toolbar.setTitle(getResources().getString(R.string.courses)); } toolbar.setDisplayHomeAsUpEnabled(false); toolbar.setDisplayHomeAsUpEnabled(true); } new NatSchoolController((bundle == null ? -1 : (studyRouteId = bundle.getInt(STUDYROUTE_ID))), (bundle == null ? -1 : bundle.getInt(PARENT_ID, -1)), getActivity()) { @Override public void onFinished(final List<NatschoolContent> courses) { progressBar.setVisibility(View.GONE); TextView emptyTextView = viewGroup.findViewById(R.id.empty_textview); if (courses.isEmpty()) { emptyTextView.setVisibility(View.VISIBLE); } else { emptyTextView.setVisibility(View.GONE); } adapter = new NatschoolContentAdapter(getActivity(), courses) { @Override protected void onContentClick(NatschoolContent content, int position) { if (content.url == null || content.url.length() == 0) { Bundle bundle = new Bundle(); if (content.id == -1) { bundle.putInt(STUDYROUTE_ID, content.studyRouteItemId); } else { bundle.putInt(STUDYROUTE_ID, studyRouteId); bundle.putInt(PARENT_ID, content.id); } bundle.putString(STUDYROUTE_NAME, content.name); ContentsFragment contentsFragment = new ContentsFragment(); contentsFragment.setArguments(bundle); getActivity().getSupportFragmentManager().beginTransaction() .replace(R.id.contents_fragment, contentsFragment, "").addToBackStack("") .commit(); } else { if (content.type == 1 || content.type == 3 || content.type == 11) { createWebView(content.url); } else if (content.type == 10) { if (!content.downloading) { new DownloadController(getActivity(), content.url, studyRouteId, content.id, position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } } } }; recyclerView.setAdapter(adapter); } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); return viewGroup; }
From source file:com.tweetlanes.android.core.view.ImageViewActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Constant.ENABLE_CRASH_TRACKING) { Crittercism.initialize(getApplicationContext(), ConsumerKeyConstants.CRITTERCISM_APP_ID); }/*www . j a v a 2 s .c o m*/ String imageUrl = getMediaUrl(); if (imageUrl == null) { finish(); return; } setContentView(R.layout.image_view); GestureImageView zoomableImageView = (GestureImageView) findViewById(R.id.image_view); UrlImageViewHelper.setUrlDrawable(zoomableImageView, imageUrl, new UrlImageViewCallback() { @Override public void onLoaded(ImageView imageView, Drawable loadedDrawable, String url, boolean loadedFromCache) { ProgressBar loadingView = (ProgressBar) findViewById(R.id.imageViewLoading); loadingView.setVisibility(View.GONE); if (loadedDrawable == null) { TextView errorTextView = (TextView) findViewById(R.id.errorTextView); errorTextView.setVisibility(View.VISIBLE); } } }); getActionBar().setTitle("@" + getAuthorScreenName() + "'s image"); getActionBar().setDisplayHomeAsUpEnabled(true); }
From source file:com.rascarlo.aurdroid.ui.InfoResultFragment.java
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Context context = container.getContext(); FragmentInfoResultBinding fragmentInfoResultBinding = FragmentInfoResultBinding.inflate(inflater, container, false);//from w ww . ja v a 2 s .c o m ProgressBar progressBar = fragmentInfoResultBinding.fragmentInfoResultProgressBar; progressBar.setVisibility(View.VISIBLE); InfoViewModelFactory infoViewModelFactory = new InfoViewModelFactory(bundlePkgname); InfoViewModel infoViewModel = ViewModelProviders.of(this, infoViewModelFactory).get(InfoViewModel.class); infoViewModel.getInfoLiveData().observe(this, info -> { if (info != null && info.getInfoResultList().get(0) != null) { this.infoResult = info.getInfoResultList().get(0); fragmentInfoResultBinding.setInfoResult(infoResult); fragmentInfoResultBinding.executePendingBindings(); bindDepends(fragmentInfoResultBinding); } progressBar.setVisibility(View.GONE); }); infoViewModel.getMessageMutableLiveData().observe(this, s -> { if (s != null && !TextUtils.isEmpty(s)) { Toast.makeText(context, TextUtils.equals(AurdroidConstants.RETROFIT_FAILURE, s) ? getString(R.string.retrofit_something_went_wrong) : s, Toast.LENGTH_LONG).show(); } progressBar.setVisibility(View.GONE); }); return fragmentInfoResultBinding.getRoot(); }
From source file:com.example.android.downloadablefonts.MainActivity.java
private void requestDownload(String familyName) { QueryBuilder queryBuilder = new QueryBuilder(familyName) .withWidth(progressToWidth(mWidthSeekBar.getProgress())) .withWeight(progressToWeight(mWeightSeekBar.getProgress())) .withItalic(progressToItalic(mItalicSeekBar.getProgress())).withBestEffort(mBestEffort.isChecked()); String query = queryBuilder.build(); Log.d(TAG, "Requesting a font. Query: " + query); FontRequest request = new FontRequest("com.google.android.gms.fonts", "com.google.android.gms", query, R.array.com_google_android_gms_fonts_certs); final ProgressBar progressBar = findViewById(R.id.progressBar); progressBar.setVisibility(View.VISIBLE); FontsContractCompat.FontRequestCallback callback = new FontsContractCompat.FontRequestCallback() { @Override//from w ww . j a v a 2 s . co m public void onTypefaceRetrieved(Typeface typeface) { mDownloadableFontTextView.setTypeface(typeface); progressBar.setVisibility(View.GONE); mRequestDownloadButton.setEnabled(true); } @Override public void onTypefaceRequestFailed(int reason) { Toast.makeText(MainActivity.this, getString(R.string.request_failed, reason), Toast.LENGTH_LONG) .show(); progressBar.setVisibility(View.GONE); mRequestDownloadButton.setEnabled(true); } }; FontsContractCompat.requestFont(MainActivity.this, request, callback, getHandlerThreadHandler()); }
From source file:com.luorrak.ouroboros.thread.ThreadActivity.java
public void setProgressBarStatus(boolean status) { ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress_bar); if (status) { progressBar.setVisibility(View.VISIBLE); } else {/* w w w . j a v a2 s .co m*/ progressBar.setVisibility(View.INVISIBLE); } }
From source file:com.tweetlanes.android.view.ImageViewActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Constant.ENABLE_CRASH_TRACKING) { Crittercism.init(getApplicationContext(), Constant.CRITTERCISM_APP_ID); }//from w w w.j av a 2 s . c om String imageUrl = getMediaUrl(); if (imageUrl == null) { finish(); return; } setContentView(R.layout.image_view); mZoomableImageView = (GestureImageView) findViewById(R.id.image_view); UrlImageViewHelper.setUrlDrawable(mZoomableImageView, imageUrl, new UrlImageViewHelper.Callback() { @Override public void onComplete(boolean success) { ProgressBar loadingView = (ProgressBar) findViewById(R.id.imageViewLoading); loadingView.setVisibility(View.GONE); if (success == false) { TextView errorTextView = (TextView) findViewById(R.id.errorTextView); errorTextView.setVisibility(View.VISIBLE); } } }); getActionBar().setTitle("@" + getAuthorScreenName() + "'s image"); getActionBar().setDisplayHomeAsUpEnabled(true); }
From source file:de.geeksfactory.opacclient.frontend.InfoFragment.java
@SuppressWarnings("deprecation") @SuppressLint("SetJavaScriptEnabled") @Override// w w w . j a v a 2s .c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); view = inflater.inflate(R.layout.fragment_info, container, false); app = (OpacClient) getActivity().getApplication(); setHasOptionsMenu(true); load(); ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); wvInfo = (WebView) view.findViewById(R.id.wvInfo); wvInfo.getSettings().setSupportZoom(true); wvInfo.getSettings().setJavaScriptEnabled(true); wvInfo.getSettings().setAppCacheMaxSize(5 * 1024 * 1024); wvInfo.getSettings().setAppCacheEnabled(true); wvInfo.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); wvInfo.setWebChromeClient(new WebChromeClient() { @Override public void onProgressChanged(WebView v, int progress) { ProgressBar Pbar = (ProgressBar) view.findViewById(R.id.pbWebProgress); if (progress < 100 && Pbar.getVisibility() == View.GONE) { Pbar.setVisibility(View.VISIBLE); } Pbar.setProgress(progress); if (progress == 100) { Pbar.setVisibility(View.GONE); } } }); wvInfo.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.contains(app.getLibrary().getData().optString("webviewcontain", "NOPE"))) { return false; } if (getActivity() == null) { return false; } Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); return true; } }); return view; }
From source file:com.akop.bach.activity.RibbonedMultiPane.java
protected void toggleProgressBar(boolean show) { ProgressBar bar = (ProgressBar) findViewById(R.id.ribbon_progress_bar); if (bar != null) bar.setVisibility(show ? View.VISIBLE : View.GONE); setProgressBarIndeterminateVisibility(show); }
From source file:com.rascarlo.aurdroid.ui.SearchResultFragment.java
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Context context = container.getContext(); FragmentSearchResultBinding fragmentSearchResultBinding = FragmentSearchResultBinding.inflate(inflater, container, false);// w w w . j av a 2 s. co m ProgressBar progressBar = fragmentSearchResultBinding.fragmentSearchResultProgressBar; progressBar.setVisibility(View.VISIBLE); SearchViewModelFactory searchViewModelFactory = new SearchViewModelFactory(bundleSearchBy, bundleQuery); SearchViewModel searchViewModel = ViewModelProviders.of(this, searchViewModelFactory) .get(SearchViewModel.class); resultAdapter = new SearchResultAdapter(searchResult -> { if (searchResultFragmentCallback != null) { if (searchResult != null && searchResult.getName() != null && !TextUtils.isEmpty(searchResult.getName())) { searchResultFragmentCallback .onSearchResultFragmentCallbackOnResultClicked(searchResult.getName()); } } }); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false); RecyclerView recyclerView = fragmentSearchResultBinding.fragmentSearchResultRecyclerView; recyclerView.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL)); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(linearLayoutManager); searchViewModel.getSearchLiveData().observe(this, aurSearch -> { if (aurSearch != null) { this.searchResultList = aurSearch.getResults(); submitSearchResultList(false); } progressBar.setVisibility(View.GONE); }); searchViewModel.getMessageMutableLiveData().observe(this, s -> { if (s != null && !TextUtils.isEmpty(s)) { Toast.makeText(context, TextUtils.equals(AurdroidConstants.RETROFIT_FAILURE, s) ? getString(R.string.retrofit_something_went_wrong) : s, Toast.LENGTH_LONG).show(); } progressBar.setVisibility(View.GONE); }); recyclerView.setAdapter(resultAdapter); return fragmentSearchResultBinding.getRoot(); }
From source file:com.smashedin.facebook.HelloFacebookSampleActivity.java
public void greetTheUser(View view) { ProgressBar oProgress = (ProgressBar) findViewById(R.id.progressLog); oProgress.setVisibility(View.VISIBLE); getUsername();/*from w w w . ja v a 2 s . co m*/ }