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:de.vanita5.twittnuker.activity.support.LinkHandlerActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    mMultiSelectHandler = new MultiSelectEventHandler(this);
    mMultiSelectHandler.dispatchOnCreate();
    final Intent intent = getIntent();
    final Uri data = intent.getData();
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setUiOptions(getWindow(), data);/* ww  w .j  a  va  2  s . c  o  m*/
    super.onCreate(savedInstanceState);
    mActionBar = getActionBar();
    mActionBar.setDisplayHomeAsUpEnabled(true);
    mActionBar.setDisplayShowTitleEnabled(true);
    mActionBar.setDisplayShowCustomEnabled(false);
    mActionBar.setCustomView(R.layout.link_handler_actionbar);
    final View view = mActionBar.getCustomView();
    mGoTopView = view.findViewById(R.id.go_top);
    mTitleView = (TextView) view.findViewById(R.id.actionbar_title);
    mSubtitleView = (TextView) view.findViewById(R.id.actionbar_subtitle);
    mGoTopView.setOnClickListener(this);
    mGoTopView.setOnLongClickListener(this);
    setProgressBarIndeterminateVisibility(false);
    if (data == null || !showFragment(data)) {
        finish();
    }
}

From source file:com.androguide.apkreator.MainActivity.java

@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
@Override/*ww  w  . ja v a 2 s . co  m*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_main);

    /**
     * Before anything we need to check if the config files exist to avoid
     * FC is they don't
     *
     * @see #checkIfConfigExists()
     */
    checkIfConfigExists();

    /**
     * Now it's all good because if no configuration was found we have
     * copied a default one over.
     *
     * @see #checkIfConfigExists()
     */
    setAppConfigInPrefs();

    headers = getPluginTabs();

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);

    /*
       * set a custom shadow that overlays the main content when the drawer
     * opens
     */
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

    /* set up the drawer's list view with items and click listener */
    ArrayAdapter<String> pimpAdapter = new ArrayAdapter<String>(this, R.layout.drawer_list_item,
            mDrawerHeaders);
    mDrawerList.setAdapter(pimpAdapter);
    Log.e("FIRST POS", mDrawerList.getFirstVisiblePosition() + "");
    Log.e("LAST POS", mDrawerList.getLastVisiblePosition() + "");
    View child = mDrawerList.getChildAt(mDrawerList.getFirstVisiblePosition());
    if (child != null && android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        child.setBackground(getColouredTouchFeedback());
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

    /** Set the user-defined ActionBar icon */
    File file = new File(getFilesDir() + "/.APKreator/icon.png");
    if (file.exists()) {
        try {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setHomeButtonEnabled(true);
            Uri iconUri = Uri.fromFile(new File(getFilesDir() + "/.APKreator/icon.png"));
            Bitmap icon = BitmapFactory.decodeFile(iconUri.getPath());
            Drawable ic = new BitmapDrawable(icon);
            getSupportActionBar().setIcon(ic);
        } catch (NullPointerException e) {
            Log.e("NPE", e.getMessage());
        }
    }
    /*
     * ActionBarDrawerToggle ties together the proper interactions between
    * the sliding drawer and the action bar app icon
    */
    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
            R.string.app_name, /* "open drawer" description for accessibility */
            R.string.app_name /* "close drawer" description for accessibility */
    ) {
        public void onDrawerClosed(View view) {
            invalidateOptionsMenu(); /*
                                     * creates call to
                                     * onPrepareOptionsMenu()
                                     */

        }

        public void onDrawerOpened(View drawerView) {
            invalidateOptionsMenu(); /*
                                     * creates call to
                                     * onPrepareOptionsMenu()
                                     */
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    /** Tabs adapter using the PagerSlidingStrip library */
    tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    MyPagerAdapter adapter = new MyPagerAdapter(this.getSupportFragmentManager());
    pager.setAdapter(adapter);
    pager.setOnPageChangeListener(new OnPageChangeListener() {

        @Override
        public void onPageSelected(int arg0) {
        }

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

        @Override
        public void onPageScrollStateChanged(int arg0) {
        }
    });

    final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4,
            getResources().getDisplayMetrics());
    pager.setPageMargin(pageMargin);

    tabs.setViewPager(pager);
    tabs.setOnPageChangeListener(this);

    changeColor(Color.parseColor(getPluginColor()));
    pager.setOffscreenPageLimit(5);
}

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

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSubredditsList = new ArrayList<SubredditInfo>();

    CookieSyncManager.createInstance(getApplicationContext());

    mSettings.loadRedditPreferences(this, mClient);
    setRequestedOrientation(mSettings.getRotation());
    requestWindowFeature(Window.FEATURE_PROGRESS);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setTheme(mSettings.getTheme());//from  ww  w .j av a  2 s  .com
    setContentView(R.layout.pick_subreddit_view);
    registerForContextMenu(getListView());

    mSubredditsList = getCachedSubredditsList();

    if (CollectionUtils.isEmpty(mSubredditsList))
        restoreLastNonConfigurationInstance();

    if (CollectionUtils.isEmpty(mSubredditsList)) {
        new DownloadRedditsTask().execute();
    } else {
        resetUI(new PickSubredditAdapter(this, mSubredditsList));
    }
}

From source file:org.uribeacon.sample.UriBeaconScanActivity.java

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

    mSwipeWidget = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_widget);
    mSwipeWidget.setOnRefreshListener(this);

    // Initializes list view adapter.
    mLeDeviceListAdapter = new DeviceListAdapter(getLayoutInflater());
    setListAdapter(mLeDeviceListAdapter);

    // Use this check to determine whether BLE is supported on the device. Then you can
    // selectively disable BLE-related features.
    if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
        Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show();
        finish();// w  w  w .j a va 2s  .co m
    }

    // Initializes a Bluetooth adapter. For API version 18 and above,
    // get a reference to BluetoothAdapter through BluetoothManager.
    final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
    mBluetoothAdapter = bluetoothManager.getAdapter();

    // Checks if Bluetooth is supported on the device.
    if (mBluetoothAdapter == null) {
        Toast.makeText(this, R.string.error_bluetooth_not_supported, Toast.LENGTH_SHORT).show();
        finish();
    }
}

From source file:fr.simon.marquis.secretcodes.ui.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    getSupportActionBar().setTitle(Utils.applyCustomTypeFace(getString(R.string.app_name), this));
    setContentView(R.layout.activity_main);
    mEmptyView = findViewById(R.id.emptyView);
    mGridView = (GridView) findViewById(R.id.gridView);
    mGridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE_MODAL);
    mGridView.setAdapter(new SecretCodeAdapter(this, Utils.getSecretCodes(this)));
    mGridView.setEmptyView(mEmptyView);//from  w ww  .  j  a v a  2  s .com
    mEmptyView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mEmptyView.setEnabled(false);
            mEmptyView.animate().alpha(0)
                    .setDuration(getResources().getInteger(android.R.integer.config_longAnimTime));
            startService(new Intent(MainActivity.this, CrawlerService.class));
        }
    });
    mGridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            String code = ((SecretCode) arg0.getItemAtPosition(arg2)).getCode();
            Toast.makeText(MainActivity.this, getString(R.string.execute_code, code), Toast.LENGTH_SHORT)
                    .show();
            try {
                sendBroadcast(new Intent("android.provider.Telephony.SECRET_CODE",
                        Uri.parse("android_secret_code://" + code)));
            } catch (java.lang.SecurityException se) {
                Toast.makeText(MainActivity.this, R.string.security_exception, Toast.LENGTH_LONG).show();
            }
        }
    });

    mGridView.setMultiChoiceModeListener(new MultiChoiceModeListener() {

        @Override
        public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
            ((SecretCodeAdapter) mGridView.getAdapter()).itemCheckedStateChanged(position, checked);
            mode.setTitle(Html.fromHtml("<b>" + mGridView.getCheckedItemCount() + "</b>"));
        }

        @Override
        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
            switch (item.getItemId()) {
            case R.id.action_delete:
                ((SecretCodeAdapter) mGridView.getAdapter()).deleteSelection(getApplicationContext());
                mode.finish();
                return true;
            case R.id.action_select_all:
                boolean check = mGridView.getCheckedItemCount() != mGridView.getCount();
                for (int i = 0; i < mGridView.getCount(); i++) {
                    mGridView.setItemChecked(i, check);
                }
                return true;
            default:
                return false;
            }
        }

        @Override
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            MenuInflater inflater = mode.getMenuInflater();
            if (inflater != null) {
                inflater.inflate(R.menu.cab, menu);
            }
            return true;
        }

        @Override
        public void onDestroyActionMode(ActionMode mode) {
            ((SecretCodeAdapter) mGridView.getAdapter()).resetSelection();
            supportInvalidateOptionsMenu();
        }

        @Override
        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            return false;
        }

    });

    supportInvalidateOptionsMenu();
}

From source file:com.sickboots.ytube.MainActivity.java

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

    // Check to see if the proper keys and playlist IDs have been set up
    if (!isCorrectlyConfigured()) {
        setContentView(R.layout.developer_setup_required);
        showMissingConfigurations();//from w w w  .  j  a va 2s. co m
    } else {
        setContentView(R.layout.activity_main);

        ensureFetcher();

        credential = GoogleAccountCredential.usingOAuth2(getApplicationContext(), Arrays.asList(Auth.SCOPES));
        // set exponential backoff policy
        credential.setBackOff(new ExponentialBackOff());

        if (savedInstanceState != null) {
            mChosenAccountName = savedInstanceState.getString(ACCOUNT_KEY);
        } else {
            loadAccount();
        }

        credential.setSelectedAccountName(mChosenAccountName);

        mUploadsListFragment = (UploadsListFragment) getFragmentManager().findFragmentById(R.id.list_fragment);
    }
}

From source file:com.google.yydw.MainActivity.java

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

    mUploadsListFragment = new UploadsListFragment(getApplicationContext());

    // Check to see if the proper keys and playlist IDs have been set up
    if (!isCorrectlyConfigured()) {
        setContentView(R.layout.developer_setup_required);
        showMissingConfigurations();/*  w w  w  . j a va2s.  c  om*/
    } else {
        setContentView(R.layout.activity_main);

        ensureLoader();

        credential = GoogleAccountCredential.usingOAuth2(getApplicationContext(), Arrays.asList(Auth.SCOPES));
        // set exponential backoff policy
        credential.setBackOff(new ExponentialBackOff());

        if (savedInstanceState != null) {
            mChosenAccountName = savedInstanceState.getString(ACCOUNT_KEY);
        } else {
            loadAccount();
        }

        credential.setSelectedAccountName(mChosenAccountName);

        mUploadsListFragment = (UploadsListFragment) getFragmentManager().findFragmentById(R.id.list_fragment);

    }
}

From source file:com.andreadec.musicplayer.MainActivity.java

@SuppressLint({ "InlinedApi", "NewApi" })
@Override//  w ww .  j  av  a 2s .c  o  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    if (preferences.getBoolean(Constants.PREFERENCE_DISABLELOCKSCREEN, Constants.DEFAULT_DISABLELOCKSCREEN)) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); // Disable lock screen for this activity
    }

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    if (preferences.getBoolean(Constants.PREFERENCE_SHOWHELPOVERLAYMAINACTIVITY, true)) {
        final FrameLayout frameLayout = new FrameLayout(this);
        LayoutInflater layoutInflater = getLayoutInflater();
        layoutInflater.inflate(R.layout.layout_main, frameLayout);
        layoutInflater.inflate(R.layout.layout_helpoverlay_main, frameLayout);
        final View overlayView = frameLayout.getChildAt(1);
        overlayView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                frameLayout.removeView(overlayView);
                SharedPreferences.Editor editor = preferences.edit();
                editor.putBoolean(Constants.PREFERENCE_SHOWHELPOVERLAYMAINACTIVITY, false);
                editor.commit();
            }
        });
        setContentView(frameLayout);
    } else {
        setContentView(R.layout.layout_main);
    }

    pages = new String[4];
    pages[PAGE_BROWSER] = getResources().getString(R.string.browser);
    pages[PAGE_PLAYLISTS] = getResources().getString(R.string.playlist);
    pages[PAGE_RADIOS] = getResources().getString(R.string.radio);
    pages[PAGE_PODCASTS] = getResources().getString(R.string.podcasts);
    fragmentManager = getSupportFragmentManager();
    setTitle(pages[currentPage]);

    /* NAVIGATION DRAWER */
    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.drawer_open,
            R.string.drawer_close) {
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            setTitle(pages[currentPage]);
        }

        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            setTitle(getResources().getString(R.string.app_name));
        }
    };
    drawerLayout.setDrawerListener(drawerToggle);
    if (Build.VERSION.SDK_INT >= 11)
        getActionBar().setDisplayHomeAsUpEnabled(true);
    drawerContainer = (RelativeLayout) findViewById(R.id.navigation_container);
    drawerList = (ListView) findViewById(R.id.navigation_list);
    navigationAdapter = new NavigationDrawerArrayAdapter(this, pages);
    drawerList.setAdapter(navigationAdapter);
    drawerList.setOnItemClickListener(new ListView.OnItemClickListener() {
        @Override
        public void onItemClick(@SuppressWarnings("rawtypes") AdapterView parent, View view, int position,
                long id) {
            openPage(position);
            drawerLayout.closeDrawer(drawerContainer);
        }
    });
    buttonQuit = findViewById(R.id.navigation_buttonQuit);
    buttonQuit.setOnClickListener(this);

    if (Build.VERSION.SDK_INT >= 19) {
        // Android 4.4+ only
        boolean translucentStatus = preferences.getBoolean(Constants.PREFERENCE_TRANSLUCENTSTATUSBAR,
                Constants.DEFAULT_TRANSLUCENTSTATUSBAR);
        boolean translucentNavigation = preferences.getBoolean(Constants.PREFERENCE_TRANSLUCENTNAVIGATIONBAR,
                Constants.DEFAULT_TRANSLUCENTNAVIGATIONBAR);

        if (translucentStatus)
            getWindow().addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS);
        if (translucentNavigation)
            getWindow().addFlags(LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        if (translucentStatus) {
            tintManager.setStatusBarTintEnabled(true);
            tintManager.setStatusBarTintResource(R.color.actionBarBackground);
        }
    }

    textViewArtist = (TextView) findViewById(R.id.textViewArtist);
    textViewTitle = (TextView) findViewById(R.id.textViewTitle);
    textViewTime = (TextView) findViewById(R.id.textViewTime);
    imageViewSongImage = (ImageView) findViewById(R.id.imageViewSongImage);
    imageButtonPrevious = (ImageButton) findViewById(R.id.imageButtonPrevious);
    imageButtonPlayPause = (ImageButton) findViewById(R.id.imageButtonPlayPause);
    imageButtonNext = (ImageButton) findViewById(R.id.imageButtonNext);
    seekBar1 = (SeekBar) findViewById(R.id.seekBar1);
    seekBar2 = (SeekBar) findViewById(R.id.seekBar2);
    imageButtonShowSeekbar2 = (ImageButton) findViewById(R.id.imageButtonShowSeekbar2);
    imageButtonShuffle = (ImageButton) findViewById(R.id.imageButtonShuffle);
    imageButtonRepeat = (ImageButton) findViewById(R.id.imageButtonRepeat);
    imageButtonRepeatAll = (ImageButton) findViewById(R.id.imageButtonRepeatAll);
    buttonBassBoost = (Button) findViewById(R.id.buttonBassBoost);
    buttonEqualizer = (Button) findViewById(R.id.buttonEqualizer);
    buttonShake = (Button) findViewById(R.id.buttonShake);

    imageButtonShuffle.setOnClickListener(this);
    imageButtonRepeat.setOnClickListener(this);
    imageButtonRepeatAll.setOnClickListener(this);
    buttonBassBoost.setOnClickListener(this);
    buttonEqualizer.setOnClickListener(this);
    buttonShake.setOnClickListener(this);

    imageButtonShowSeekbar2.setOnClickListener(this);
    imageButtonPrevious.setOnClickListener(this);
    imageButtonPlayPause.setOnClickListener(this);
    imageButtonNext.setOnClickListener(this);
    seekBar1.setOnSeekBarChangeListener(this);
    seekBar1.setClickable(false);
    seekBar2.setOnSeekBarChangeListener(this);
    textViewTime.setOnClickListener(this);

    showSongImage = preferences.getBoolean(Constants.PREFERENCE_SHOWSONGIMAGE, Constants.DEFAULT_SHOWSONGIMAGE);
    imagesCache = new LruCache<String, Bitmap>(Constants.IMAGES_CACHE_SIZE);

    serviceIntent = new Intent(this, MusicService.class);
    startService(serviceIntent); // Starts the service if it is not running

    if (preferences.getBoolean(Constants.PREFERENCE_OPENLASTPAGEONSTART,
            Constants.DEFAULT_OPENLASTPAGEONSTART)) {
        openPage(preferences.getInt(Constants.PREFERENCE_LASTPAGE, Constants.DEFAULT_LASTPAGE));
    } else {
        openPage(PAGE_BROWSER);
    }
    loadSongFromIntent();

    layoutPlaybackControls = findViewById(R.id.layoutPlaybackControls);
    if (preferences.getBoolean(Constants.PREFERENCE_ENABLEGESTURES, Constants.DEFAULT_ENABLEGESTURES)) {
        final GestureDetectorCompat gestureDetector = new GestureDetectorCompat(this,
                new PlayerGestureListener());
        View layoutTop = findViewById(R.id.layoutTop);
        layoutTop.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return gestureDetector.onTouchEvent(event);
            }
        });
        if (preferences.getBoolean(Constants.PREFERENCE_SHOWPLAYBACKCONTROLS,
                Constants.DEFAULT_SHOWPLAYBACKCONTROLS)) {
            layoutPlaybackControls.setVisibility(View.VISIBLE);
        }
    } else {
        layoutPlaybackControls.setVisibility(View.VISIBLE);
    }
}

From source file:gov.wa.wsdot.android.wsdot.ui.TrafficMapActivity.java

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

    supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.map);//w w w  .ja  v  a2s.c  o m

    AnalyticsUtils.getInstance(this).trackPageView("/Traffic Map");

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    // Setup bounding box for Seattle area.
    seattleArea.add(new LatLonItem(48.01749, -122.46185));
    seattleArea.add(new LatLonItem(48.01565, -121.86584));
    seattleArea.add(new LatLonItem(47.27737, -121.86310));
    seattleArea.add(new LatLonItem(47.28109, -122.45911));

    // Initialize AsyncTask
    mCamerasOverlayTask = new CamerasOverlayTask();
    mHighwayAlertsOverlayTask = new HighwayAlertsOverlayTask();

    // Check preferences and set defaults if none set
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
    showCameras = settings.getBoolean("KEY_SHOW_CAMERAS", true);
    latitude = Double.parseDouble(settings.getString("KEY_TRAFFICMAP_LAT", "47.5990"));
    longitude = Double.parseDouble(settings.getString("KEY_TRAFFICMAP_LON", "-122.3350"));
    zoom = settings.getInt("KEY_TRAFFICMAP_ZOOM", 12);

    // Set up Service Intents.
    camerasIntent = new Intent(this, CamerasSyncService.class);
    alertsIntent = new Intent(this, HighwayAlertsSyncService.class);
}

From source file:org.youtube.Youtube_MainActivity.java

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

    mYoutubeUploadsListFragment = new Youtube_UploadsListFragment(getApplicationContext());

    // Check to see if the proper keys and playlist IDs have been set up
    if (!isCorrectlyConfigured()) {
        setContentView(R.layout.youtube_developer_setup_required);
        showMissingConfigurations();/*ww  w .  ja  v a  2  s.c om*/
    } else {
        setContentView(R.layout.youtube_activity_main);

        ensureLoader();

        credential = GoogleAccountCredential.usingOAuth2(getApplicationContext(),
                Arrays.asList(Youtube_Auth.SCOPES));
        // set exponential backoff policy
        credential.setBackOff(new ExponentialBackOff());

        if (savedInstanceState != null) {
            mChosenAccountName = savedInstanceState.getString(ACCOUNT_KEY);
        } else {
            loadAccount();
        }

        credential.setSelectedAccountName(mChosenAccountName);

        mYoutubeUploadsListFragment = (Youtube_UploadsListFragment) getFragmentManager()
                .findFragmentById(R.id.list_fragment);

    }
}