List of usage examples for android.widget ProgressBar getVisibility
@ViewDebug.ExportedProperty(mapping = { @ViewDebug.IntToString(from = VISIBLE, to = "VISIBLE"), @ViewDebug.IntToString(from = INVISIBLE, to = "INVISIBLE"), @ViewDebug.IntToString(from = GONE, to = "GONE") }) @Visibility public int getVisibility()
From source file:au.com.cybersearch2.classyfy.MainActivityTest.java
public void test_parseIntent_action_view() throws Throwable { Intent intent = getNewIntent();/* ww w . j a va 2 s . com*/ intent.setAction(Intent.ACTION_VIEW); Uri actionUri = Uri.withAppendedPath(ClassyFySearchEngine.CONTENT_URI, "34"); intent.setData(actionUri); setActivityIntent(intent); final MainActivity mainActivity = getActivity(); synchronized (mainActivity.taskHandle) { try { mainActivity.taskHandle.wait(10000); } catch (InterruptedException e) { e.printStackTrace(); } } assertThat(mainActivity.taskHandle.getStatus()).isEqualTo(WorkStatus.FINISHED); PropertiesListAdapter adapter = mainActivity.adapter; for (int i = 0; (i < adapter.getCount()) && (i < RECORD_DETAILS_ARRAY.length); i++) { Value item = (Value) adapter.getItem(i); assertThat(item.getName().equals(RECORD_DETAILS_ARRAY[i][0])); assertThat(item.getValue().equals(RECORD_DETAILS_ARRAY[i][1])); } ProgressBar spinner = mainActivity.progressFragment.getSpinner(); assertThat(spinner).isNotNull(); assertThat(spinner.getVisibility()).isEqualTo(View.GONE); }
From source file:de.geeksfactory.opacclient.frontend.InfoFragment.java
@SuppressWarnings("deprecation") @SuppressLint("SetJavaScriptEnabled") @Override//w w w . j a va 2 s.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:yet.another.hackernews.reader.ViewFragment.java
public void update(ProgressBar progressBar) { if (news == null) { return;//from ww w .ja va2 s . c om } if (progressBar == null) { progressBar = (ProgressBar) getSherlockActivity().findViewById(R.id.view_progress); } if (progressBar.getVisibility() != View.VISIBLE) { progressBar.setVisibility(View.VISIBLE); } if (menuBrowser.getProgress() < 100) { menuBrowser.stopLoading(); } menuBrowser.loadUrl(news.getURL()); }
From source file:com.cjones.taskforcemamba.activity.WebActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTitle = mDrawerTitle = getTitle();//from ww w . j a va 2s . co m //WebView Intent launchingIntent = getIntent(); // String content = launchingIntent.getData().toString(); String home = "http://www.tfmamba.com"; // Log.i(TAG, "Content = " + content + " . Home = " + home); // if(content == home){ // content = content + "&styleid=2"; // Log.i(TAG, "IF Statement - Content = " + content + " . Home = " + home); // } else { // Log.i(TAG, "Else Statement - Content = " + content + " . Home = " + home); // } // Log.i(TAG, "conte = " + content); myWebView = (WebView) findViewById(R.id.webview); // if(content == null){ myWebView.loadUrl(home); // }else { // myWebView.loadUrl(content); // } myWebView.setWebViewClient(new WebViewClient()); myWebView.getSettings().setBuiltInZoomControls(true); myWebView.getSettings().setJavaScriptEnabled(true); myWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); final ProgressBar Pbar; Pbar = (ProgressBar) findViewById(R.id.pB1); myWebView.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { if (progress < 100 && Pbar.getVisibility() == ProgressBar.GONE) { Pbar.setVisibility(ProgressBar.VISIBLE); } Pbar.setProgress(progress); if (progress == 100) { Pbar.setVisibility(ProgressBar.GONE); } } }); if (savedInstanceState != null) { myWebView.restoreState(savedInstanceState); } else { // if(content == null && !content.isEmpty()){ // myWebView.loadUrl("http://www.tfmamba.com"); } }
From source file:in.ac.dtu.subtlenews.InstapaperViewer.java
@SuppressLint("NewApi") @Override// www.jav a 2 s . c om protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setImmersive(true); } setTheme(R.style.AppTheme_NoActionBar); setContentView(R.layout.activity_instapaper_viewer); //setupActionBar(); Bundle extras = getIntent().getExtras(); if (extras != null) { urlId = extras.getInt("URLID"); urlList = extras.getStringArrayList("URLList"); } final WebView instapaperView = (WebView) findViewById(R.id.instapaper_viewer); final Activity activity = this; final ProgressBar progressBar; progressBar = (ProgressBar) findViewById(R.id.progressBar); instapaperView.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { if (progress < 100 && progressBar.getVisibility() == ProgressBar.GONE) { progressBar.setVisibility(ProgressBar.VISIBLE); //txtview.setVisibility(View.VISIBLE); } progressBar.setProgress(progress); if (progress == 100) { progressBar.setVisibility(ProgressBar.GONE); //txtview.setVisibility(View.GONE); } } }); final View controlsView = findViewById(R.id.fullscreen_content_controls); final View contentView = findViewById(R.id.instapaper_viewer); final Button prevButton = (Button) findViewById(R.id.summary_prev_button); final Button nextButton = (Button) findViewById(R.id.summary_next_button); // Set up an instance of SystemUiHider to control the system UI for // this activity. mSystemUiHider = SystemUiHider.getInstance(this, contentView, HIDER_FLAGS); mSystemUiHider.setup(); mSystemUiHider.setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() { // Cached values. int mControlsHeight; int mShortAnimTime; @Override @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) public void onVisibilityChange(boolean visible) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { // If the ViewPropertyAnimator API is available // (Honeycomb MR2 and later), use it to animate the // in-layout UI controls at the bottom of the // screen. if (mControlsHeight == 0) { mControlsHeight = controlsView.getHeight(); } if (mShortAnimTime == 0) { mShortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); } controlsView.animate().translationY(visible ? 0 : mControlsHeight).setDuration(mShortAnimTime); } else { // If the ViewPropertyAnimator APIs aren't // available, simply show or hide the in-layout UI // controls. controlsView.setVisibility(visible ? View.VISIBLE : View.GONE); } if (visible && AUTO_HIDE) { // Schedule a hide(). delayedHide(AUTO_HIDE_DELAY_MILLIS); } } }); // Set up the user interaction to manually show or hide the system UI. contentView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (TOGGLE_ON_CLICK) { mSystemUiHider.toggle(); } else { mSystemUiHider.show(); } } }); // Upon interacting with UI controls, delay any scheduled hide() // operations to prevent the jarring behavior of controls going away // while interacting with the UI. prevButton.setOnTouchListener(mDelayHideTouchListener); nextButton.setOnTouchListener(mDelayHideTouchListener); try { summaryUrl = "http://www.instapaper.com/text?u=" + urlList.get(urlId); } catch (Exception e) { e.printStackTrace(); } instapaperView.loadUrl(summaryUrl); prevButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { summaryUrl = "http://www.instapaper.com/text?u=" + urlList.get(--urlId); } catch (Exception e) { e.printStackTrace(); } instapaperView.loadUrl(summaryUrl); } }); nextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { summaryUrl = "http://www.instapaper.com/text?u=" + urlList.get(++urlId); } catch (Exception e) { e.printStackTrace(); } instapaperView.loadUrl(summaryUrl); } }); }
From source file:com.cw.litenote.note.Note_adapter.java
private void setWebView(final CustomWebView webView, Object object, int whichView) { final SharedPreferences pref_web_view = act.getSharedPreferences("web_view", 0); final ProgressBar spinner = (ProgressBar) ((View) object).findViewById(R.id.loading); if (whichView == CustomWebView.TEXT_VIEW) { int scale = pref_web_view.getInt("KEY_WEB_VIEW_SCALE", 0); webView.setInitialScale(scale);/*from w w w. j ava 2s .c om*/ } else if (whichView == CustomWebView.LINK_VIEW) { bWebViewIsShown = false; webView.setInitialScale(30); } int style = Note.getStyle(); webView.setBackgroundColor(ColorSet.mBG_ColorArray[style]); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setSupportZoom(true); webView.getSettings().setUseWideViewPort(true); // customWebView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setJavaScriptEnabled(true);//warning: Using setJavaScriptEnabled can introduce XSS vulnerabilities // // speed up // if (Build.VERSION.SDK_INT >= 19) { // // chromium, enable hardware acceleration // webView.setLayerType(View.LAYER_TYPE_HARDWARE, null); // } else { // // older android version, disable hardware acceleration // webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); // } if (whichView == CustomWebView.TEXT_VIEW) { webView.setWebViewClient(new WebViewClient() { @Override public void onScaleChanged(WebView web_view, float oldScale, float newScale) { super.onScaleChanged(web_view, oldScale, newScale); // System.out.println("Note_adapter / onScaleChanged"); // System.out.println(" oldScale = " + oldScale); // System.out.println(" newScale = " + newScale); int newDefaultScale = (int) (newScale * 100); pref_web_view.edit().putInt("KEY_WEB_VIEW_SCALE", newDefaultScale).apply(); //update current position NoteUi.setFocus_notePos(pager.getCurrentItem()); } @Override public void onPageFinished(WebView view, String url) { } }); } if (whichView == CustomWebView.LINK_VIEW) { webView.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { System.out.println("---------------- spinner progress = " + progress); if (spinner != null) { if (bWebViewIsShown) { if (progress < 100 && (spinner.getVisibility() == ProgressBar.GONE)) { webView.setVisibility(View.GONE); spinner.setVisibility(ProgressBar.VISIBLE); } spinner.setProgress(progress); if (progress > 30) bWebViewIsShown = true; } if (bWebViewIsShown || (progress == 100)) { spinner.setVisibility(ProgressBar.GONE); webView.setVisibility(View.VISIBLE); } } } @Override public void onReceivedTitle(WebView view, String title) { super.onReceivedTitle(view, title); if (!TextUtils.isEmpty(title) && !title.equalsIgnoreCase("about:blank")) { System.out.println("Note_adapter / _onReceivedTitle / title = " + title); int position = NoteUi.getFocus_notePos(); String tag = "current" + position + "textWebView"; CustomWebView textWebView = (CustomWebView) pager.findViewWithTag(tag); String strLink = db_page.getNoteLinkUri(position, true); // show title of http link if ((textWebView != null) && !Util.isYouTubeLink(strLink) && strLink.startsWith("http")) { mWebTitle = title; showTextWebView(position, textWebView); } } } }); } }