Example usage for android.view Window FEATURE_INDETERMINATE_PROGRESS

List of usage examples for android.view Window FEATURE_INDETERMINATE_PROGRESS

Introduction

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

Prototype

int FEATURE_INDETERMINATE_PROGRESS

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

Click Source Link

Document

Flag for indeterminate progress.

Usage

From source file:org.mariotaku.twidere.activity.LinkHandlerActivity.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    requestSupportWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    super.onCreate(savedInstanceState);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setSupportProgressBarIndeterminateVisibility(false);
    final Intent intent = getIntent();
    final Uri data = intent.getData();
    if (data != null) {
        if (setFragment(data)) {
            if (mFragment != null) {
                if (isDualPaneMode()) {
                    showFragment(mFragment, true);
                } else {
                    final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                    ft.replace(R.id.main, mFragment);
                    ft.commit();/*from   w  w  w. j  a  va 2 s .  c  om*/
                }
                return;
            } else {
                finish();
            }
        }
    } else {
        finish();
    }
}

From source file:joshuatee.wx.SPCMesoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    editor = preferences.edit();/*w w  w  .  j ava 2 s  .  c  o  m*/
    String theme_blue_current = preferences.getString("THEME_BLUE", "");
    setTheme(Utility.Theme(theme_blue_current));
    setContentView(R.layout.activity_spcmeso);

    InitSectorMap();

    layers = new Drawable[2];
    cd = new ColorDrawable(Color.WHITE);

    param = preferences.getString("SPCMESO_LAST_USED", param);
    sector = preferences.getString("SPCMESO_SECTOR_LAST_USED", sector);
    setTitle(param + " - " + sector_map.get(sector));

    img = (TouchImageView2) findViewById(R.id.iv);

    dm = new DisplayMetrics();
    this.getWindowManager().getDefaultDisplay().getMetrics(dm);

    createData();

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ExpandableListView) findViewById(R.id.left_drawer);
    MyExpandableListAdapter adapter = new MyExpandableListAdapter(this, groups);
    mDrawerList.setAdapter(adapter);
    mDrawerList.setOnChildClickListener(new DrawerItemClickListener2());

    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.drawer, R.string.drawer_open,
            R.string.drawer_close) {
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
        }

        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);

        }
    };

    mDrawerLayout.setDrawerListener(mDrawerToggle);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);

    img_url = "http://www.spc.noaa.gov/exper/mesoanalysis/new/meso_mob.php?sector=" + sector + "&parm=" + param;
    new GetContent().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

}

From source file:th.in.ffc.person.visit.VisitDrugActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.visit_drug_activity);
    setSupportProgressBarIndeterminateVisibility(false);

    if (savedInstanceState == null)
        getSupportLoaderManager().initLoader(0, null, this);
}

From source file:net.xisberto.phonetodesktop.ui.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_main);

    preferences = Preferences.getInstance(this);

    if (savedInstanceState == null) {
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();

        if (preferences.loadAccountName() == null) {
            showWelcome = true;//from w  w w.j  a  v  a2 s . c  om
            currentFragment = WelcomeFragment.newInstance();
            transaction.replace(R.id.main_frame, currentFragment);
        } else {
            showWelcome = false;
            mainFragment = MainFragment.newInstance();
            transaction.replace(R.id.main_frame, mainFragment, TAG_MAIN);
        }
        transaction.commit();
    } else {
        mainFragment = (MainFragment) getSupportFragmentManager().findFragmentByTag(TAG_MAIN);
    }

    checkActionAuth(getIntent());
}

From source file:com.scigames.slidegame.Registration3MassActivity.java

/** Called with the activity is first created. */
@Override/* w w  w .  ja  va2 s. c om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "super.OnCreate");
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    Intent i = getIntent();
    Log.d(TAG, "getIntent");
    firstNameIn = i.getStringExtra("fName");
    lastNameIn = i.getStringExtra("lName");
    studentIdIn = i.getStringExtra("studentId");
    visitIdIn = i.getStringExtra("visitId");
    Log.d(TAG, "...getStringExtra");

    // Inflate our UI from its XML layout description.
    setContentView(R.layout.registration3_mass);
    Log.d(TAG, "...setContentView");

    // Find the text editor view inside the layout, because we
    // want to do various programmatic things with it.
    thisMass = (EditText) findViewById(R.id.mass);
    /* to hide the keyboard on launch, then open when tap in firstname field */
    thisMass.setInputType(InputType.TYPE_NULL);
    thisMass.setOnTouchListener(new View.OnTouchListener() {
        //@Override
        public boolean onTouch(View v, MotionEvent event) {
            thisMass.setInputType(InputType.TYPE_CLASS_TEXT);
            thisMass.onTouchEvent(event); // call native handler
            return true; // consume touch even
        }
    });
    Log.d(TAG, "...instantiateEditTexts");

    //display name in greeting sentence
    Resources res = getResources();
    TextView greets = (TextView) findViewById(R.id.greeting);
    greets.setText(String.format(res.getString(R.string.greeting), firstNameIn, lastNameIn));
    Log.d(TAG, greets.toString());
    Log.d(TAG, "...Greetings");

    //set info to what we know already
    //firstName.setText(firstNameIn);
    //lastName.setText(lastNameIn);

    // Hook up button presses to the appropriate event handler.
    ((Button) findViewById(R.id.back)).setOnClickListener(mBackListener);
    ((Button) findViewById(R.id.continue_button)).setOnClickListener(mContinueButtonListener);
    ((Button) findViewById(R.id.scan)).setOnClickListener(mScanButtonListener);
    Log.d(TAG, "...instantiateButtons");

    //set listener
    task.setOnResultsListener(this);
}

From source file:org.bohrmeista.chan.ui.activity.ImageViewActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP);

    super.onCreate(savedInstanceState);

    if (postAdapter == null) {
        Logger.e(TAG, "Posts in ImageViewActivity was null");
        finish();/*from   w w  w  .  ja  va2s .  c o  m*/
        return;
    }

    threadManager = threadManagerStatic;

    ThemeHelper.setTheme(this);

    progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
    progressBar.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.WRAP_CONTENT));
    progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_no_bg));
    progressBar.setIndeterminate(false);
    progressBar.setMax(1000000);

    final FrameLayout decorView = (FrameLayout) getWindow().getDecorView();
    decorView.addView(progressBar);

    progressBar.post(new Runnable() {
        @Override
        public void run() {
            View contentView = decorView.findViewById(android.R.id.content);
            progressBar.setY(contentView.getY() - progressBar.getHeight() / 2);
        }
    });

    // Get the posts with images
    ArrayList<Post> imagePosts = new ArrayList<>();
    for (Post post : postAdapter.getList()) {
        if (post.images.size() > 0) {
            imagePosts.add(post);
        }
    }

    // Setup our pages and adapter
    setContentView(R.layout.image_pager);
    viewPager = (ViewPager) findViewById(R.id.image_pager);
    imageAdapter = new ImageViewAdapter(getFragmentManager(), this);
    imageAdapter.setList(imagePosts);
    viewPager.setAdapter(imageAdapter);
    viewPager.setOnPageChangeListener(this);

    // Select the right image
    int imageIndex = 0;
    for (Post post : imagePosts) {
        if (post.no == selectedId) {
            viewPager.setCurrentItem(imageIndex);
            onPageSelected(imageIndex);

            thumbList = (TwoWayView) findViewById(R.id.thumbList);
            thumbListAdapter = new ThumbListAdapter(this, post.images, imageIndex);
            thumbList.setAdapter(thumbListAdapter);
            thumbList.setVisibility(post.images.size() <= 1 ? View.GONE : View.VISIBLE);
            return;
        }
        imageIndex += post.images.size();
    }
}

From source file:org.floens.chan.ui.activity.ImageViewActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP);

    super.onCreate(savedInstanceState);

    if (postAdapterStatic == null || threadManagerStatic == null) {
        Logger.e(TAG, "postadapter or threadmanager null");
        finish();//from w  w w.  j  a  va 2s .c  o m
        return;
    }

    threadManager = threadManagerStatic;
    threadManagerStatic = null;
    postAdapter = postAdapterStatic;
    postAdapterStatic = null;
    int selectedId = selectedIdStatic;
    selectedIdStatic = -1;

    ThemeHelper.setTheme(this);

    progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
    progressBar.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.WRAP_CONTENT));
    progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_no_bg));
    progressBar.setIndeterminate(false);
    progressBar.setMax(1000000);

    final FrameLayout decorView = (FrameLayout) getWindow().getDecorView();
    decorView.addView(progressBar);

    progressBar.post(new Runnable() {
        @Override
        public void run() {
            View contentView = decorView.findViewById(android.R.id.content);
            progressBar.setY(contentView.getY() - progressBar.getHeight() / 2);
        }
    });

    // Get the posts with images
    ArrayList<Post> imagePosts = new ArrayList<>();
    for (Post post : postAdapter.getList()) {
        if (post.hasImage) {
            imagePosts.add(post);
        }
    }

    // Setup our pages and adapter
    setContentView(R.layout.image_pager);
    viewPager = (ViewPager) findViewById(R.id.image_pager);
    adapter = new ImageViewAdapter(getFragmentManager(), this);
    adapter.setList(imagePosts);
    viewPager.setAdapter(adapter);
    viewPager.setOnPageChangeListener(this);

    // Select the right image
    for (int i = 0; i < imagePosts.size(); i++) {
        if (imagePosts.get(i).no == selectedId) {
            viewPager.setCurrentItem(i);
            onPageSelected(i);
            break;
        }
    }
}

From source file:net.reichholf.dreamdroid.activities.ScreenShotActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    super.onCreate(savedInstanceState);
    setTitle(getText(R.string.app_name) + " - " + getText(R.string.screenshot));

    mImageView = new ImageView(this);
    setContentView(mImageView);//from   w w  w .java2 s . co m
    mImageView.setBackgroundColor(Color.BLACK);

    Bundle extras = getIntent().getExtras();

    if (extras == null) {
        extras = new Bundle();
    }

    mType = extras.getInt(KEY_TYPE, TYPE_ALL);
    mFormat = extras.getInt(KEY_FORMAT, FORMAT_PNG);
    mSize = extras.getInt(KEY_SIZE, 720);
    mFilename = extras.getString(KEY_FILENAME);

    reload();
}

From source file:com.robandjen.comicsapp.FullscreenActivity.java

@SuppressLint("SetJavaScriptEnabled")
@Override/*from ww w.j  av  a  2 s. co  m*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_fullscreen);

    final WebView v = (WebView) findViewById(R.id.fullscreen_content);
    v.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            updateShare(url);
            return false;
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            setProgressBarIndeterminateVisibility(false);
            super.onPageFinished(view, url);
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            setProgressBarIndeterminateVisibility(true);
            super.onPageStarted(view, url, favicon);
        }
    });

    final WebSettings settings = v.getSettings();
    settings.setBuiltInZoomControls(true);
    settings.setJavaScriptEnabled(true);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.open_drawer,
            R.string.close_drawer);
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    if (mComicList == null) {

        try {
            InputStream is = openFileInput(COMICFILE);
            if (!loadXml(is)) {
                Log.w(TAG, "Downloaded list not parseable, defaulting to built-in");
            }
        } catch (FileNotFoundException e) {
            Log.i(TAG, "Downloaded list not found, defaulting to built-in");

        }
    }

    if (mComicList == null) {
        loadDefaultXML();
    }

    if (savedInstanceState != null) {
        mCurComic = savedInstanceState.getInt(CURCOMICKEY, 0);
        final String url = savedInstanceState.getString(CURURLKEY);
        showCurrentComic(url);
    } else {
        do {
            if (!bSkipOther || !mComicList.get(mCurComic).getOther()) {
                break;
            }

            ++mCurComic;
            mCurComic %= mComicList.size();
        } while (mCurComic != 0);
        showCurrentComic();
    }

}

From source file:com.hybris.mobile.app.commerce.activity.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Allow the system loading spinner icon
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    super.setContentView(mContentViewId);

    // Main menu drawer
    createMainMenuDrawer();/*from ww  w. j a v  a  2s.c  om*/

    // Action bar
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayShowTitleEnabled(false);

    // Cart menu drawer
    mCartDrawer = (DrawerPushLayout) findViewById(R.id.cart_menu_drawer);

    if (mCartDrawer != null) {
        mCartDrawer.setScrimColor(Color.TRANSPARENT);
        mCartDrawer.setDrawerPushLayoutListener(new DrawerPushLayoutListener() {
            @Override
            public void onDrawerOpened() {
                // When the cart is open, we disable the opening by swipe on the main menu
                mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

                UIUtils.hideKeyboard(MainActivity.this);
            }

            @Override
            public void onDrawerClosed() {
                // When the drawer is closed, we enable opening by swipe on the main menu if the opening by swipe is enabled
                if (mIsMainMenuSwipeEnabled) {
                    mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
                }

                UIUtils.hideKeyboard(MainActivity.this);
            }
        });
    }
}