Example usage for android.view Window FEATURE_PROGRESS

List of usage examples for android.view Window FEATURE_PROGRESS

Introduction

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

Prototype

int FEATURE_PROGRESS

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

Click Source Link

Document

Flag for the progress indicator feature.

Usage

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

private void enableLoadingScreen() {
    if (Util.isLightTheme(mSettings.getTheme())) {
        findViewById(R.id.loading_light).setVisibility(View.VISIBLE);
        findViewById(R.id.loading_dark).setVisibility(View.GONE);
    } else {//from  w  ww .  j a v  a 2  s.c  om
        findViewById(R.id.loading_light).setVisibility(View.GONE);
        findViewById(R.id.loading_dark).setVisibility(View.VISIBLE);
    }
    synchronized (ADAPTER_LOCK) {
        if (mSubredditsAdapter != null)
            mSubredditsAdapter.mLoading = true;
    }
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_START);
}

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();//from ww  w . j a  v  a2s. c o m
    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

@Override
public boolean supportRequestWindowFeature(int featureId) {
    switch (featureId) {
    case WindowCompat.FEATURE_ACTION_BAR:
        mHasActionBar = true;// w w w.ja  v  a2  s  .com
        return true;
    case WindowCompat.FEATURE_ACTION_BAR_OVERLAY:
        mOverlayActionBar = true;
        return true;
    case Window.FEATURE_PROGRESS:
        mFeatureProgress = true;
        return true;
    case Window.FEATURE_INDETERMINATE_PROGRESS:
        mFeatureIndeterminateProgress = true;
        return true;
    default:
        return mActivity.requestWindowFeature(featureId);
    }
}

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();/*  ww  w .  ja  v  a2 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:com.klinker.android.twitter.activities.tweet_viewer.TweetPager.java

public void setUpWindow(boolean youtube) {

    requestWindowFeature(Window.FEATURE_ACTION_BAR | Window.FEATURE_PROGRESS);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND,
            WindowManager.LayoutParams.FLAG_DIM_BEHIND);

    // Params for the window.
    // You can easily set the alpha and the dim behind the window from here
    WindowManager.LayoutParams params = getWindow().getAttributes();
    params.alpha = 1.0f; // lower than one makes it more transparent
    if (!youtube) {
        params.dimAmount = .75f; // set it higher if you want to dim behind the window
    } else {//w ww  .  jav  a 2  s .c o  m
        params.dimAmount = 0f;
    }
    getWindow().setAttributes(params);

    // Gets the display size so that you can set the window to a percent of that
    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    int width = size.x;
    int height = size.y;

    // You could also easily used an integer value from the shared preferences to set the percent
    if (height > width) {
        getWindow().setLayout((int) (width * .9), (int) (height * .8));
    } else {
        getWindow().setLayout((int) (width * .7), (int) (height * .8));
    }
}

From source file:org.peterbaldwin.vlcremote.fragment.PlaylistFragment.java

@Override
public void onProgress(final int progress) {
    if (getActivity() != null) {
        getActivity().runOnUiThread(new Runnable() {
            public void run() {
                if (getActivity() != null) {
                    getActivity().getWindow().setFeatureInt(Window.FEATURE_PROGRESS, progress);
                }/*from w  w  w  .  j av  a 2 s.c o m*/
            }
        });
    }
}

From source file:org.smilec.smile.student.CourseList.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_PROGRESS);

    Resources res = getResources(); //get resources
    language_list = res.getStringArray(R.array.language_list);
    category_arr = res.getStringArray(R.array.category_list);

    // First Extract the bundle from intent
    Bundle bundle = getIntent().getExtras();
    // Next extract the values using the key as
    curusertype = 1; // fixed (student)

    curusername = bundle.getString("USERNAME");
    cururi = bundle.getString("URI");
    curlanguage = bundle.getString("CHOSEN_LANGUAGE");
    String manufacturer = android.os.Build.MANUFACTURER;
    //showToast(manufacturer);

    resultSize1 = returnPixels(16.0f);/*from  ww  w .  j ava 2 s  .  c  om*/
    resultSize2 = returnPixels(18.0f);

    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) { // 480x640 dp units
        draw_piechart = new piechart(this, returnPixels(200.0f));
        titleSize1 = "<big>";
        titleSize2 = "</big>";
        resultSize1 = returnPixels(24.0f);
        resultSize2 = returnPixels(26.0f);
    } else if (manufacturer != null && manufacturer.toLowerCase().equals("samsung")) {
        draw_piechart = new piechart(this, returnPixels(150.0f));
        draw_piechart.setFontSize(returnPixels(12.0f));
    } else
        draw_piechart = new piechart(this, returnPixels(150.0f)); // to draw the piechart

    draw_piechart.onStart(100, 0);

    add_pic_g = new AndroidCustomGallery(this); // on 3/19/2012s

    answer_arr = new Vector<Integer>();
    rating_arr = new Vector<Integer>();
    my_score = new Vector<Integer>();
    right_answer = new Vector<Integer>();

    score_winner_name = new Vector<String>();
    rating_winner_name = new Vector<String>();
    final_avg_ratings = new Vector<String>();
    r_answer_percents = new Vector<String>();

    // connection_created = false;
    _act = this;

    chkimg = 0; // no image
    image_qa = null;

    student = null; // student communicator is created by make_connection()

    // Adding quick action menu
    image_quickaction();

    MY_IP = get_IP();

    getStoredFileURL();
    create_connection();
    show_todo_view();

    // student.send_initial_message();
    uploadErrorLog(cururi);
}