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.iangclifton.auid.appendixc.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    getWindow().requestFeature(Window.FEATURE_PROGRESS);
    setProgressBarIndeterminate(true);// w w w.j a  v  a2s  .  c om

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_section_list);

    if (findViewById(R.id.section_detail_container) != null) {
        // The detail container view will be present only in the
        // large-screen layouts (res/values-large and
        // res/values-sw600dp). If this view is present, then the
        // activity should be in two-pane mode.
        mTwoPane = true;

        // In two-pane mode, list items should be given the
        // 'activated' state when touched.
        ((SectionListFragment) getSupportFragmentManager().findFragmentById(R.id.section_list))
                .setActivateOnItemClick(true);
    }

}

From source file:dentex.youtube.downloader.DonateActivity.java

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

    this.setTitle(R.string.title_activity_donate);

    settings = getSharedPreferences(PREFS_NAME, 0);

    getWindow().requestFeature(Window.FEATURE_PROGRESS);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);

    // Theme init
    Utils.themeInit(this);

    // Language init
    Utils.langInit(this);

    // Load default preferences values
    PreferenceManager.setDefaultValues(this, R.xml.donate, false);

    // Display the fragment as the main content.
    getFragmentManager().beginTransaction().replace(android.R.id.content, new DonateFragment()).commit();
    setupActionBar();/*from   www  .j  ava 2s . c om*/
}

From source file:us.nineworlds.serenity.ui.activity.SerenityDrawerLayoutActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2) {
        supportRequestWindowFeature(Window.FEATURE_PROGRESS);
    }/*from   w  w  w  .j  a  v a 2  s  . co m*/
    actionBar = getSupportActionBar();
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setBackgroundDrawable(new ColorDrawable(R.color.card_background));
}

From source file:itkach.aard2.ArticleCollectionActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_PROGRESS);
    setContentView(R.layout.activity_article_collection_loading);
    final Application app = (Application) getApplication();
    app.push(this);
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setSubtitle("...");
    final Intent intent = getIntent();
    final int position = intent.getIntExtra("position", 0);

    AsyncTask<Void, Void, ArticleCollectionPagerAdapter> createAdapterTask = new AsyncTask<Void, Void, ArticleCollectionPagerAdapter>() {

        @Override// w w  w  .j av  a2 s .c  om
        protected ArticleCollectionPagerAdapter doInBackground(Void... params) {
            ArticleCollectionPagerAdapter result;
            Uri articleUrl = intent.getData();
            if (articleUrl != null) {
                result = createFromUri(app, articleUrl);
            } else {
                String action = intent.getAction();
                if (action == null) {
                    result = createFromLastResult(app);
                } else if (action.equals("showRandom")) {
                    result = createFromRandom(app);
                } else if (action.equals("showBookmarks")) {
                    result = createFromBookmarks(app);
                } else if (action.equals("showHistory")) {
                    result = createFromHistory(app);
                } else {
                    result = createFromIntent(app, intent);
                }
            }
            return result;
        }

        @Override
        protected void onPostExecute(ArticleCollectionPagerAdapter adapter) {
            if (isFinishing() || onDestroyCalled) {
                return;
            }
            articleCollectionPagerAdapter = adapter;
            if (articleCollectionPagerAdapter == null || articleCollectionPagerAdapter.getCount() == 0) {
                Toast.makeText(ArticleCollectionActivity.this, R.string.article_collection_nothing_found,
                        Toast.LENGTH_SHORT).show();
                finish();
                return;
            }

            if (position > articleCollectionPagerAdapter.getCount() - 1) {
                Toast.makeText(ArticleCollectionActivity.this,
                        R.string.article_collection_selected_not_available, Toast.LENGTH_SHORT).show();
                finish();
                return;
            }

            setContentView(R.layout.activity_article_collection);

            findViewById(R.id.pager_title_strip).setVisibility(
                    articleCollectionPagerAdapter.getCount() == 1 ? ViewGroup.GONE : ViewGroup.VISIBLE);

            viewPager = (ViewPager) findViewById(R.id.pager);
            viewPager.setAdapter(articleCollectionPagerAdapter);
            viewPager.setOnPageChangeListener(new OnPageChangeListener() {

                @Override
                public void onPageScrollStateChanged(int arg0) {
                }

                @Override
                public void onPageScrolled(int arg0, float arg1, int arg2) {
                }

                @Override
                public void onPageSelected(final int position) {
                    updateTitle(position);
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            ArticleFragment fragment = (ArticleFragment) articleCollectionPagerAdapter
                                    .getItem(position);
                            fragment.applyTextZoomPref();
                        }
                    });

                }
            });
            viewPager.setCurrentItem(position);

            PagerTitleStrip titleStrip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
            titleStrip.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
            updateTitle(position);
            articleCollectionPagerAdapter.registerDataSetObserver(new DataSetObserver() {
                @Override
                public void onChanged() {
                    if (articleCollectionPagerAdapter.getCount() == 0) {
                        finish();
                    }
                }
            });
        }
    };

    createAdapterTask.execute();

}

From source file:com.owncloud.android.ui.activity.ExternalSiteWebView.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log_OC.v(TAG, "onCreate() start");

    Bundle extras = getIntent().getExtras();
    String title = extras.getString(EXTRA_TITLE);
    String url = extras.getString(EXTRA_URL);
    menuItemId = extras.getInt(EXTRA_MENU_ITEM_ID);
    showSidebar = extras.getBoolean(EXTRA_SHOW_SIDEBAR);

    // show progress
    getWindow().requestFeature(Window.FEATURE_PROGRESS);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.externalsite_webview);

    WebView webview = (WebView) findViewById(R.id.webView);
    WebSettings webSettings = webview.getSettings();

    webview.setFocusable(true);/*from w ww  .j  a v a  2  s. co  m*/
    webview.setFocusableInTouchMode(true);
    webview.setClickable(true);

    // setup toolbar
    setupToolbar();

    // setup drawer
    setupDrawer(menuItemId);

    if (!showSidebar) {
        setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
    }

    getSupportActionBar().setTitle(title);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    // enable zoom
    webSettings.setSupportZoom(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setDisplayZoomControls(false);

    // Non-responsive webs are zoomed out when loaded
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);

    // user agent
    webSettings.setUserAgentString(MainApp.getUserAgent());

    // no private data storing
    webSettings.setSavePassword(false);
    webSettings.setSaveFormData(false);

    // disable local file access
    webSettings.setAllowFileAccess(false);

    // enable javascript
    webview.getSettings().setJavaScriptEnabled(true);

    final Activity activity = this;
    final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);

    webview.setWebChromeClient(new WebChromeClient() {
        public void onProgressChanged(WebView view, int progress) {
            progressBar.setProgress(progress * 1000);
        }
    });

    webview.setWebViewClient(new WebViewClient() {
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            Toast.makeText(activity, getString(R.string.webview_error) + ": " + description, Toast.LENGTH_SHORT)
                    .show();
        }
    });

    webview.loadUrl(url);
}

From source file:ru.sawimmod.activities.SawimActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    setTheme(Scheme.isBlack() ? R.style.BaseTheme : R.style.BaseThemeLight);
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(Window.FEATURE_PROGRESS);

    setContentView(SawimApplication.isManyPane() ? R.layout.main_twopane : R.layout.main);
    if (savedInstanceState == null && !SawimApplication.isManyPane()) {
        RosterView rosterView = new RosterView();
        rosterView.setMode(RosterView.MODE_DEFAULT);
        rosterView.setArguments(getIntent().getExtras());
        getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, rosterView, RosterView.TAG)
                .commit();/*  w  ww  .  ja  va2 s.com*/
    }
}

From source file:fr.eoit.activity.StockActivity.java

public StockActivity() {
    super(Window.FEATURE_PROGRESS);
}

From source file:com.actionbarsherlock.sample.styled.MainActivityICS.java

/** Called when the activity is first created. */
@Override//  w  w w .  j av  a2s . co  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_PROGRESS);

    setContentView(R.layout.main);
    final ActionBar ab = getActionBar();

    // set defaults for logo & home up
    ab.setDisplayHomeAsUpEnabled(showHomeUp);
    ab.setDisplayUseLogoEnabled(useLogo);

    // set up tabs nav
    for (int i = 1; i < 4; i++) {
        ab.addTab(ab.newTab().setText("Tab " + i).setTabListener(this));
    }

    // set up list nav
    ab.setListNavigationCallbacks(
            ArrayAdapter.createFromResource(ab.getThemedContext(), R.array.sections,
                    android.R.layout.simple_spinner_dropdown_item),
            //              .createFromResource(this, R.array.sections,
            //                      android.R.layout.simple_spinner_dropdown_item),
            new OnNavigationListener() {
                @Override
                public boolean onNavigationItemSelected(int itemPosition, long itemId) {
                    // FIXME add proper implementation
                    //rotateLeftFrag();
                    return false;
                }
            });

    // default to tab navigation
    showTabsNav();

    // create a couple of simple fragments as placeholders
    //        final int MARGIN = 16;
    //        leftFrag = new RoundedColourFragment(getResources().getColor(
    //                R.color.android_green), 1f, MARGIN, MARGIN / 2, MARGIN, MARGIN);
    //        rightFrag = new RoundedColourFragment(getResources().getColor(
    //                R.color.honeycombish_blue), 2f, MARGIN / 2, MARGIN, MARGIN,
    //                MARGIN);
    //
    //        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    //        ft.add(R.id.root, leftFrag);
    //        ft.add(R.id.root, rightFrag);
    //        ft.commit();

    ((Button) findViewById(R.id.start)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mMode = startActionMode(new AnActionModeOfEpicProportions());
        }
    });
    ((Button) findViewById(R.id.cancel)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mMode != null) {
                mMode.finish();
            }
        }
    });

    ((Button) findViewById(R.id.progress)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mProgress == 100) {
                mProgress = 0;
                mProgressRunner.run();
            }
        }
    });

}

From source file:org.projecthdata.hhub.ui.HDataWebOauthActivity2.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_PROGRESS);
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
    webView = new WebView(this);
    setContentView(webView);/*from  ww w .j  a  v a2s.co  m*/
    activity = this;
    this.hDataConnectionFactory = new HDataConnectionFactory(clientId, clientSecret, "server here");
    webView.setWebChromeClient(new WebChromeClient() {

        public void onProgressChanged(WebView view, int progress) {
            activity.setTitle("Loading...");
            activity.setProgress(progress * 100);
            if (progress == 100) {
                activity.setTitle(R.string.app_name);
            }
        }
    });
    webView.setWebViewClient(new MyWebViewClient());

}

From source file:org.anhonesteffort.flock.ManageSubscriptionActivity.java

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

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    requestWindowFeature(Window.FEATURE_PROGRESS);

    setContentView(R.layout.simple_fragment_activity);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setTitle(R.string.title_manage_subscription);

    if (savedInstanceState != null && !savedInstanceState.isEmpty()) {
        if (!DavAccount.build(savedInstanceState.getBundle(KEY_DAV_ACCOUNT_BUNDLE)).isPresent()) {
            Log.e(TAG, "where did my dav account bundle go?! :(");
            finish();//from  w  w  w  .j  av a2  s . c  om
            return;
        }

        davAccount = DavAccount.build(savedInstanceState.getBundle(KEY_DAV_ACCOUNT_BUNDLE)).get();
        currentFragment = savedInstanceState.getInt(KEY_CURRENT_FRAGMENT, -1);
        activityRequestCode = Optional.fromNullable(savedInstanceState.getInt(KEY_REQUEST_CODE));
        activityResultCode = Optional.fromNullable(savedInstanceState.getInt(KEY_RESULT_CODE));
        activityResultData = Optional.fromNullable((Intent) savedInstanceState.getParcelable(KEY_RESULT_DATA));
    } else if (getIntent().getExtras() != null) {
        if (!DavAccount.build(getIntent().getExtras().getBundle(KEY_DAV_ACCOUNT_BUNDLE)).isPresent()) {
            Log.e(TAG, "where did my dav account bundle go?! :(");
            finish();
            return;
        }

        davAccount = DavAccount.build(getIntent().getExtras().getBundle(KEY_DAV_ACCOUNT_BUNDLE)).get();
        currentFragment = getIntent().getExtras().getInt(KEY_CURRENT_FRAGMENT, -1);
        activityRequestCode = Optional.fromNullable(getIntent().getExtras().getInt(KEY_REQUEST_CODE));
        activityResultCode = Optional.fromNullable(getIntent().getExtras().getInt(KEY_RESULT_CODE));
        activityResultData = Optional
                .fromNullable((Intent) getIntent().getExtras().getParcelable(KEY_RESULT_DATA));
    }

    Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
    serviceIntent.setPackage("com.android.vending");
    bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE);
}