Example usage for android.view Window PROGRESS_END

List of usage examples for android.view Window PROGRESS_END

Introduction

In this page you can find the example usage for android.view Window PROGRESS_END.

Prototype

int PROGRESS_END

To view the source code for android.view Window PROGRESS_END.

Click Source Link

Document

Ending value for the (primary) progress.

Usage

From source file:com.zbrown.droidsteal.activities.HijackActivity.java

private void setupWebView() {
    webview = (WebView) findViewById(R.id.webviewhijack);
    webview.setWebViewClient(new MyWebViewClient());
    WebSettings webSettings = webview.getSettings();
    webSettings.setUserAgentString(/*from w  ww.  j a  va2  s  . c  o m*/
            "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36");
    webSettings.setJavaScriptEnabled(true); //Blah blah JavaScript is scary blah blah
    webSettings.setAppCacheEnabled(false);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setDisplayZoomControls(false);
    webview.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int progress) {
            HijackActivity.this.setProgress(progress * 100);
            int fprogress = (Window.PROGRESS_END) / 100 * progress;
            setProgress(fprogress);

            if (progress == 100) {
                setProgressBarIndeterminateVisibility(false);
            }
        }
    });
}

From source file:com.andrewshu.android.reddit.reddits.PickSubredditActivity.java

private void disableLoadingScreen() {
    resetUI(mSubredditsAdapter);
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_END);
}

From source file:in.shick.diode.reddits.PickSubredditActivity.java

private void disableLoadingScreen() {
    findViewById(R.id.loading_dark).setVisibility(View.GONE);
    findViewById(R.id.loading_light).setVisibility(View.GONE);
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_END);
}

From source file:com.nttec.everychan.ui.gallery.GalleryActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
        requestWindowFeature(Window.FEATURE_PROGRESS);
    settings = getIntent().getParcelableExtra(EXTRA_SETTINGS);
    if (settings == null)
        settings = GallerySettings.fromSettings(new ApplicationSettings(
                PreferenceManager.getDefaultSharedPreferences(getApplication()), getResources()));
    settings.getTheme().setTo(this, R.style.Transparent);
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        CompatibilityImpl.setActionBarNoIcon(this);

    inflater = getLayoutInflater();//from w  w w . j  a  va 2 s .c o  m
    instantiatedViews = new SparseArray<View>();
    tnDownloadingExecutor = Executors.newFixedThreadPool(4, Async.LOW_PRIORITY_FACTORY);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && settings.fullscreenGallery()) {
        setContentView(R.layout.gallery_layout_fullscreen);
        GalleryFullscreen.initFullscreen(this);
    } else {
        setContentView(R.layout.gallery_layout);
    }

    progressBar = (ProgressBar) findViewById(android.R.id.progress);
    progressBar.setMax(Window.PROGRESS_END);
    viewPager = (ViewPager) findViewById(R.id.gallery_viewpager);
    navigationInfo = (TextView) findViewById(R.id.gallery_navigation_info);
    for (int id : new int[] { R.id.gallery_navigation_previous, R.id.gallery_navigation_next })
        findViewById(id).setOnClickListener(this);

    bindService(new Intent(this, GalleryBackend.class), new ServiceConnection() {
        {
            serviceConnection = this;
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            GalleryBinder galleryBinder = GalleryBinder.Stub.asInterface(service);
            try {
                GalleryInitData initData = new GalleryInitData(getIntent(), savedInstanceState);
                boardModel = initData.boardModel;
                chan = boardModel.chan;
                remote = new GalleryRemote(galleryBinder, galleryBinder.initContext(initData));
                GalleryInitResult initResult = remote.getInitResult();
                if (initResult != null) {
                    attachments = initResult.attachments;
                    currentPosition = initResult.initPosition;
                    if (initResult.shouldWaitForPageLoaded)
                        waitForPageLoaded(savedInstanceState);
                } else {
                    attachments = Collections.singletonList(
                            Triple.of(initData.attachment, initData.attachmentHash, (String) null));
                    currentPosition = 0;
                }

                viewPager.setAdapter(new GalleryAdapter());
                viewPager.setCurrentItem(currentPosition);
                viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
                    @Override
                    public void onPageSelected(int position) {
                        currentPosition = position;
                        updateItem();
                    }
                });
            } catch (Exception e) {
                Logger.e(TAG, e);
                finish();
            }
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
            Logger.e(TAG, "backend service disconnected");
            remote = null;
            System.exit(0);
        }
    }, BINDING_FLAGS);

    GalleryExceptionHandler.init();
}

From source file:nya.miku.wishmaster.ui.GalleryActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
        requestWindowFeature(Window.FEATURE_PROGRESS);
    settings = MainApplication.getInstance().settings;
    settings.getTheme().setTo(this, R.style.Transparent);

    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        CompatibilityImpl.setActionBarNoIcon(this);

    downloadingLocker = MainApplication.getInstance().downloadingLocker;
    inflater = getLayoutInflater();/*w ww  . ja  v  a  2s  . c om*/
    instantiatedViews = new SparseArray<View>();
    tnDownloadingTask = new CancellableTask.BaseCancellableTask();
    tnDownloadingExecutor = Executors.newFixedThreadPool(4, PriorityThreadFactory.LOW_PRIORITY_FACTORY);
    fileCache = MainApplication.getInstance().fileCache;
    bitmapCache = MainApplication.getInstance().bitmapCache;

    AttachmentModel attachment = (AttachmentModel) getIntent().getSerializableExtra(EXTRA_ATTACHMENT);
    boardModel = (BoardModel) getIntent().getSerializableExtra(EXTRA_BOARDMODEL);
    if (boardModel == null)
        return;
    String pagehash = getIntent().getStringExtra(EXTRA_PAGEHASH);
    String localFilename = getIntent().getStringExtra(EXTRA_LOCALFILENAME);
    if (localFilename != null) {
        try {
            localFile = ReadableContainer.obtain(new File(localFilename));
        } catch (Exception e) {
            Logger.e(TAG, "cannot open local file", e);
        }
    }

    chan = MainApplication.getInstance().getChanModule(boardModel.chan);
    PresentationModel presentationModel = MainApplication.getInstance().pagesCache
            .getPresentationModel(pagehash);
    if (presentationModel != null) {
        boolean isThread = presentationModel.source.pageModel.type == UrlPageModel.TYPE_THREADPAGE;
        customSubdir = BoardFragment.getCustomSubdir(presentationModel.source.pageModel);
        List<Triple<AttachmentModel, String, String>> list = presentationModel.getAttachments();
        presentationModel = null;
        if (list != null) {
            int index = -1;
            String attachmentHash = ChanModels.hashAttachmentModel(attachment);
            for (int i = 0; i < list.size(); ++i) {
                if (list.get(i).getMiddle().equals(attachmentHash)) {
                    index = i;
                    break;
                }
            }
            if (index != -1) {
                if (isThread) {
                    attachments = list;
                    currentPosition = index;
                } else {
                    int leftOffset = 0, rightOffset = 0;
                    String threadNumber = list.get(index).getRight();
                    int it = index;
                    while (it > 0 && list.get(--it).getRight().equals(threadNumber))
                        ++leftOffset;
                    it = index;
                    while (it < (list.size() - 1) && list.get(++it).getRight().equals(threadNumber))
                        ++rightOffset;
                    attachments = list.subList(index - leftOffset, index + rightOffset + 1);
                    currentPosition = leftOffset;
                }
            }
        }
    }
    if (attachments == null) {
        attachments = Collections.singletonList(
                Triple.of(attachment, ChanModels.hashAttachmentModel(attachment), (String) null));
        currentPosition = 0;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && settings.fullscreenGallery()) {
        setContentView(R.layout.gallery_layout_fullscreen);
        GalleryFullscreen.initFullscreen(this);
    } else {
        setContentView(R.layout.gallery_layout);
    }
    progressBar = (ProgressBar) findViewById(android.R.id.progress);
    progressBar.setMax(Window.PROGRESS_END);
    viewPager = (ViewPager) findViewById(R.id.gallery_viewpager);
    navigationInfo = (TextView) findViewById(R.id.gallery_navigation_info);
    for (int id : new int[] { R.id.gallery_navigation_previous, R.id.gallery_navigation_next })
        findViewById(id).setOnClickListener(this);
    viewPager.setAdapter(new GalleryAdapter());
    viewPager.setCurrentItem(currentPosition);
    viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            currentPosition = position;
            updateItem();
        }
    });
}

From source file:android.support.v7.app.ActionBarActivityDelegateBase.java

/**
 * Progress Bar function. Mostly extracted from PhoneWindow.java
 *///from ww w  .  j av a 2 s. co m
private void updateProgressBars(int value) {
    ProgressBar circularProgressBar = getCircularProgressBar();
    ProgressBar horizontalProgressBar = getHorizontalProgressBar();

    if (value == Window.PROGRESS_VISIBILITY_ON) {
        if (mFeatureProgress) {
            int level = horizontalProgressBar.getProgress();
            int visibility = (horizontalProgressBar.isIndeterminate() || level < 10000) ? View.VISIBLE
                    : View.INVISIBLE;
            horizontalProgressBar.setVisibility(visibility);
        }
        if (mFeatureIndeterminateProgress) {
            circularProgressBar.setVisibility(View.VISIBLE);
        }
    } else if (value == Window.PROGRESS_VISIBILITY_OFF) {
        if (mFeatureProgress) {
            horizontalProgressBar.setVisibility(View.GONE);
        }
        if (mFeatureIndeterminateProgress) {
            circularProgressBar.setVisibility(View.GONE);
        }
    } else if (value == Window.PROGRESS_INDETERMINATE_ON) {
        horizontalProgressBar.setIndeterminate(true);
    } else if (value == Window.PROGRESS_INDETERMINATE_OFF) {
        horizontalProgressBar.setIndeterminate(false);
    } else if (Window.PROGRESS_START <= value && value <= Window.PROGRESS_END) {
        // We want to set the progress value before testing for visibility
        // so that when the progress bar becomes visible again, it has the
        // correct level.
        horizontalProgressBar.setProgress(value - Window.PROGRESS_START);

        if (value < Window.PROGRESS_END) {
            showProgressBars(horizontalProgressBar, circularProgressBar);
        } else {
            hideProgressBars(horizontalProgressBar, circularProgressBar);
        }
    }
}

From source file:com.andrewshu.android.reddit.mail.InboxListActivity.java

private void disableLoadingScreen() {
    resetUI(mMessagesAdapter);
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_END);
}

From source file:com.andrewshu.android.reddit.user.ProfileActivity.java

private void disableLoadingScreen() {
    resetUI(mThingsAdapter);
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_END);
}

From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

private void updateProgressBars(int value) {
    IcsProgressBar circularProgressBar = getCircularProgressBar(true);
    IcsProgressBar horizontalProgressBar = getHorizontalProgressBar(true);

    final int features = mFeatures;//getLocalFeatures();
    if (value == Window.PROGRESS_VISIBILITY_ON) {
        if ((features & (1 << Window.FEATURE_PROGRESS)) != 0) {
            int level = horizontalProgressBar.getProgress();
            int visibility = (horizontalProgressBar.isIndeterminate() || level < 10000) ? View.VISIBLE
                    : View.INVISIBLE;
            horizontalProgressBar.setVisibility(visibility);
        }//from  ww w .  j  a v  a  2 s. co  m
        if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0) {
            circularProgressBar.setVisibility(View.VISIBLE);
        }
    } else if (value == Window.PROGRESS_VISIBILITY_OFF) {
        if ((features & (1 << Window.FEATURE_PROGRESS)) != 0) {
            horizontalProgressBar.setVisibility(View.GONE);
        }
        if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0) {
            circularProgressBar.setVisibility(View.GONE);
        }
    } else if (value == Window.PROGRESS_INDETERMINATE_ON) {
        horizontalProgressBar.setIndeterminate(true);
    } else if (value == Window.PROGRESS_INDETERMINATE_OFF) {
        horizontalProgressBar.setIndeterminate(false);
    } else if (Window.PROGRESS_START <= value && value <= Window.PROGRESS_END) {
        // We want to set the progress value before testing for visibility
        // so that when the progress bar becomes visible again, it has the
        // correct level.
        horizontalProgressBar.setProgress(value - Window.PROGRESS_START);

        if (value < Window.PROGRESS_END) {
            showProgressBars(horizontalProgressBar, circularProgressBar);
        } else {
            hideProgressBars(horizontalProgressBar, circularProgressBar);
        }
    } else if (Window.PROGRESS_SECONDARY_START <= value && value <= Window.PROGRESS_SECONDARY_END) {
        horizontalProgressBar.setSecondaryProgress(value - Window.PROGRESS_SECONDARY_START);

        showProgressBars(horizontalProgressBar, circularProgressBar);
    }
}

From source file:com.andrewshu.android.reddit.threads.ThreadsListActivity.java

private void disableLoadingScreen() {
    resetUI(mThreadsAdapter);
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_END);
}