List of usage examples for android.view Window FEATURE_INDETERMINATE_PROGRESS
int FEATURE_INDETERMINATE_PROGRESS
To view the source code for android.view Window FEATURE_INDETERMINATE_PROGRESS.
Click Source Link
From source file:com.SecUpwN.AIMSICD.AIMSICD.java
/** * Called when the activity is first created. *///from w w w .j a v a2s. co m @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS); mNavConf = getNavDrawerConfiguration(); setContentView(mNavConf.getMainLayout()); mDrawerLayout = (DrawerLayout) findViewById(mNavConf.getDrawerLayoutId()); mDrawerList = (ListView) findViewById(mNavConf.getLeftDrawerId()); mActionBar = getActionBar(); mTitle = mDrawerTitle = getTitle(); mDrawerList.setAdapter(mNavConf.getBaseAdapter()); mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description */ R.string.drawer_close /* "close drawer" description */ ) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); mActionBar.setTitle(mTitle); invalidateOptionsMenu(); } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); mActionBar.setTitle(mDrawerTitle); invalidateOptionsMenu(); } }; // Set the drawer toggle as the DrawerListener mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); mDrawerLayout.setDrawerListener(mDrawerToggle); mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setHomeButtonEnabled(true); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); prefs = mContext.getSharedPreferences(AimsicdService.SHARED_PREFERENCES_BASENAME, 0); mDisclaimerAccepted = getResources().getString(R.string.disclaimer_accepted); if (!prefs.getBoolean(mDisclaimerAccepted, false)) { final AlertDialog.Builder disclaimer = new AlertDialog.Builder(this).setTitle(R.string.disclaimer_title) .setMessage(R.string.disclaimer) .setPositiveButton(R.string.text_agree, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { prefsEditor = prefs.edit(); prefsEditor.putBoolean(mDisclaimerAccepted, true); prefsEditor.apply(); startService(); } }).setNegativeButton(R.string.text_disagree, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { prefsEditor = prefs.edit(); prefsEditor.putBoolean(mDisclaimerAccepted, false); prefsEditor.apply(); Uri packageUri = Uri.parse("package:com.SecUpwN.AIMSICD"); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageUri); startActivity(uninstallIntent); finish(); if (mAimsicdService != null) mAimsicdService.onDestroy(); } }); AlertDialog disclaimerAlert = disclaimer.create(); disclaimerAlert.show(); } else { startService(); } }
From source file:com.example.slidingmenuexample.ui.NXTRemoteControl.java
/** Called when the activity is first created. */ @SuppressWarnings("deprecation") @Override//from w w w. jav a 2 s . com public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); readPreferences(prefs, null); prefs.registerOnSharedPreferenceChangeListener(this); if (savedInstanceState != null) { mNewLaunch = false; mDeviceAddress = savedInstanceState.getString("device_address"); if (mDeviceAddress != null) { mSavedState = NXTTalker.STATE_CONNECTED; } if (savedInstanceState.containsKey("power")) { mPower = savedInstanceState.getInt("power"); } if (savedInstanceState.containsKey("controls_mode")) { mControlsMode = savedInstanceState.getInt("controls_mode"); } } mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "NXT Remote Control"); if (!NO_BT) { mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (mBluetoothAdapter == null) { Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show(); finish(); return; } } setupUI(); mNXTTalker = new NXTTalker(mHandler); pagelist = getSlidingMenu(); pagelist.setShadowDrawable(R.drawable.shadow); pagelist.setBehindOffset(600); pagelist.setShadowWidth(15); pagelist.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setIcon(R.drawable.ic_launcher); if (savedInstanceState != null) mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent"); if (mContent == null) mContent = new NXTRemoteControlView(); setContentView(R.layout.content_frame); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, mContent).commit(); setBehindContentView(R.layout.menu_frame); getSupportFragmentManager().beginTransaction().replace(R.id.menu_frame, new MenuListPages()).commit(); setSlidingActionBarEnabled(true); }
From source file:th.in.ffc.person.visit.VisitAncActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); setContentView(R.layout.visit_anc_activity); setSupportProgressBarIndeterminateVisibility(false); doInitailizeView(savedInstanceState); if (savedInstanceState == null) { getSupportLoaderManager().initLoader(LOAD_PREGNANT, null, this); getSupportLoaderManager().initLoader(LOAD_LAST_ANC, null, this); getSupportLoaderManager().initLoader(LOAD_WEIGHT_HEIGHT, null, this); } else {/*from ww w . j a v a 2 s . c o m*/ mAction = savedInstanceState.getString("action"); mPreg = savedInstanceState.getString("pregno"); mDtAnc = savedInstanceState.getString("dtanc"); } }
From source file:com.google.ytdl.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ensureFetcher();//from w w w . j av a2s . c o m mButton = (Button) findViewById(R.id.upload_button); mButton.setEnabled(false); int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (errorCode != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) { Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode, this, REQUEST_GMS_ERROR_DIALOG); if (errorDialog != null) { errorDialog.show(); } } else { Toast.makeText(this, R.string.google_play_not_available, Toast.LENGTH_SHORT).show(); finish(); } } if (savedInstanceState != null) { mToken = savedInstanceState.getString(TOKEN_KEY); mChosenAccountName = savedInstanceState.getString(ACCOUNT_KEY); } else { loadAccount(); } mHandler.post(new Runnable() { @Override public void run() { loadData(); } }); mUploadsListFragment = (UploadsListFragment) getFragmentManager().findFragmentById(R.id.list_fragment); mDirectFragment = (DirectFragment) getFragmentManager().findFragmentById(R.id.direct_fragment); }
From source file:joshuatee.wx.ModelInterfaceActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); preferences3 = PreferenceManager.getDefaultSharedPreferences(this); editor = preferences3.edit();/*from w w w . j a v a2 s.c o m*/ String theme_blue_current = preferences3.getString("THEME_BLUE", ""); setTheme(Utility.Theme(theme_blue_current)); setContentView(R.layout.activity_model_interface); tv_time = (TextView) findViewById(R.id.tv_time); tv_status = (TextView) findViewById(R.id.tv_status); iv = (ImageView) findViewById(R.id.iv2); button_for = (TextView) findViewById(R.id.tv); img = (TouchImageView2) findViewById(R.id.iv); model = preferences3.getString("MODEL_LAST_USED", "GFS"); setTitle(model); dm = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(dm); int width = dm.widthPixels; int height = width * good_height / good_width; LayoutParams params_iv = (LayoutParams) img.getLayoutParams(); params_iv.height = height; params_iv.width = width; img.setLayoutParams(params_iv); addItemsOnSpinner1(); addItemsOnSpinner2(); addItemsOnSpinner3(); addListenerOnButton(); addListenerOnSpinnerItemSelection(); ImageButton button_back = (ImageButton) findViewById(R.id.button_back); button_back.setOnClickListener(this); ImageButton button_forward = (ImageButton) findViewById(R.id.button_forward); button_forward.setOnClickListener(this); ImageButton button_animate = (ImageButton) findViewById(R.id.button_animate); button_animate.setOnClickListener(this); if (theme_blue_current.contains("white")) { button_back.setImageResource(R.drawable.previous_dark); button_forward.setImageResource(R.drawable.next_dark); button_animate.setImageResource(R.drawable.refresh_dark); } model_params_labels = UtilityModelInterface.model_gfs_params_labels; model_params = UtilityModelInterface.model_gfs_params; mLocations = model_params_labels; mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mLocations)); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); 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); if (model.equals("GFS")) { SetupGFS("00Z"); } else if (model.equals("NAM")) { SetupNAM(); } else if (model.equals("RAP")) { SetupRAP(); } else if (model.equals("NAM4KM")) { SetupNam4km(); } else if (model.equals("HRRR")) { SetupHrrr(); } else if (model.equals("ECMWF")) { SetupEcmwf(); } else if (model.equals("UKMET")) { //SetupUkmet(); } else if (model.equals("SREF")) { SetupSref(); } new GetContent().execute(); new GetRunStatus().execute(); }
From source file:com.androguide.honamicontrol.MainActivity.java
@SuppressLint("NewApi") @SuppressWarnings("deprecation") @Override//from ww w . j a v a2 s. c o m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_main); headers.add("Welcome"); headers.add("Kernel Control"); headers.add("Sound Control"); headers.add("Touch Screen"); headers.add("Help Center"); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); ArrayAdapter<String> pimpAdapter = new ArrayAdapter<String>(this, R.layout.drawer_list_item, mDrawerHeaders); mDrawerList.setAdapter(pimpAdapter); 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()); /** * ActionBarDrawerToggle ties together the proper interactions between * the sliding drawer and the action bar app icon */ mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.open_drawer, R.string.close_drawer) { public void onDrawerClosed(View view) { invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { invalidateOptionsMenu(); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); /** Tabs adapter using the PagerSlidingStrip library */ tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); 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(mAppColor)); pager.setOffscreenPageLimit(5); }
From source file:com.tlulybluemonochrome.minimarurss.ItemListActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); /* Preferences? */ final String thme_preference = sharedPreferences.getString("theme_preference", "Metal"); int theme = R.style.LightMetal; if (thme_preference.equals("Metal")) theme = R.style.LightMetal;/*w ww . j av a 2 s . c o m*/ else if (thme_preference.equals("White")) theme = R.style.WhiteGlass; else if (thme_preference.equals("Dark")) theme = R.style.DarkGlass; else if (thme_preference.equals("Simple")) theme = R.style.Cards; else if (thme_preference.equals("Gray")) theme = R.style.NoiseGray; setTheme(theme); // ????? requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); getActionBar().setHomeButtonEnabled(true); // try { FileInputStream fis = openFileInput("SaveData.txt"); ObjectInputStream ois = new ObjectInputStream(fis); items = ((ArrayList<RssFeed>) ois.readObject()); ois.close(); } catch (Exception e) { items = new ArrayList<RssFeed>(); } if (items.isEmpty() || sharedPreferences.getInt("save_version", 0) != 1) {// ???? items = new ArrayList<RssFeed>(); items.add(new RssFeed("Google", "http://news.google.com/news?hl=ja&ned=us&ie=UTF-8&oe=UTF-8&output=rss", 0xff00aeef, true)); items.add(new RssFeed("4Gamer.net", "http://www.4gamer.net/rss/index.xml", 0xffffc0cb, true)); items.add(new RssFeed("ORICON ", "http://rss.rssad.jp/rss/oricon/news/total", 0xff99cc00, true)); items.add(new RssFeed(".com", "http://feeds.eiga.com/eiga_news", 0xffcc0000, true)); items.add(new RssFeed("ASCII.jp", "http://rss.rssad.jp/rss/ascii/rss.xml", 0xfff9f903, true)); items.add(new RssFeed("", "http://ggsoku.com/feed/", 0xffda31e5, true)); items.add(new RssFeed("Engadget", "http://feed.rssad.jp/rss/engadget/rss", 0xff0000cd, true)); items.add(new RssFeed("GIGAZINE", "http://feed.rssad.jp/rss/gigazine/rss_2.0", 0xff2f4f4f, true)); items.add(new RssFeed("lifehacker", "http://feeds.lifehacker.jp/rss/lifehacker/index.xml", 0xff808000, true)); items.add(new RssFeed("?(`)", "http://blog.livedoor.jp/dqnplus/index.rdf", 0xff8b4513, true)); items.add(new RssFeed("", "http://alfalfalfa.com/index.rdf", 0xff808080, true)); items.add(new RssFeed("andronavi", "http://andronavi.com/feed", 0xffadd8e6, true)); items.add(new RssFeed("?", "http://octoba.net/feed", 0xff9370db, true)); items.add(new RssFeed("?", "http://androidnavi.net/feed/", 0xfffcb414, true)); items.add(new RssFeed("", "https://androider.jp/rss/home/", 0xff33b5e5, true)); saveItem(items);// ??? final Editor editor = sharedPreferences.edit(); editor.putInt("save_version", 1); editor.commit(); } try {// FileInputStream fis = openFileInput("RssData.dat"); ObjectInputStream ois = new ObjectInputStream(fis); hp.clear(); hp.putAll((HashMap<String, ArrayList<RssItem>>) ois.readObject()); ois.close(); alllist.clear(); for (String key : hp.keySet()) { alllist.addAll(hp.get(key)); } Collections.sort(alllist, new Comparator<RssItem>() { @Override public int compare(RssItem lhs, RssItem rhs) { if (lhs.getDate() == null) return 1; else if (rhs.getDate() == null) return -1; else if (lhs.getDate().before(rhs.getDate())) return 1; else return -1; } }); } catch (Exception e) { } super.onCreate(savedInstanceState); setContentView(R.layout.activity_action_content); // ??? final PullToRefreshAttacher.Options ptrOptions = new PullToRefreshAttacher.Options(); ptrOptions.refreshScrollDistance = 0.4f; mPullToRefreshAttacher = PullToRefreshAttacher.get(this, ptrOptions); final DefaultHeaderTransformer ht = (DefaultHeaderTransformer) mPullToRefreshAttacher .getHeaderTransformer(); ht.setPullText(getString(R.string.pull_down_to_update)); ht.setRefreshingText(getString(R.string.loading)); ht.setProgressBarColor(getResources().getColor(android.R.color.holo_orange_dark)); final String animation = sharedPreferences.getString("animation", "Cube"); int effect = 3; if (animation.equals("None")) effect = 0; else if (animation.equals("Tablet")) effect = 1; else if (animation.equals("Cube")) effect = 3; else if (animation.equals("Flip")) effect = 5; else if (animation.equals("Zoom")) effect = 7; else if (animation.equals("Rotate")) effect = 9; efectViewPager = (EfectViewPager) findViewById(R.id.jazzy_pager); EfectViewPager.setTransitionEffect(effect); efectViewPager.setAdapter(mSectionsPagerAdapter); efectViewPager.setOffscreenPageLimit(3); // efectViewPager.setPageMargin( (int) // (getResources().getDisplayMetrics().density * -8) ); // Create the adapter that will return a fragment for each of the three // primary sections of the app. // View efectViewPager.setCurrentItem(getIntent().getIntExtra(ItemDetailFragment.ARG_ITEM_ID, 1), false); efectViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { if (position == 0) { getActionBar().setTitle(" Setting"); getActionBar().setDisplayHomeAsUpEnabled(true); } else if (position == 1) { getActionBar().setTitle("minimaruRSS"); getActionBar().setDisplayHomeAsUpEnabled(false); } else { getActionBar().setTitle(" " + items.get(position - 2).getTitle()); getActionBar().setDisplayHomeAsUpEnabled(true); } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); if (findViewById(R.id.item_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. ((ItemListFragment) getFragmentManager().findFragmentById(R.id.item_list)).setActivateOnItemClick(true); } viewActionsContentView = (ActionsContentView) findViewById(R.id.actionsContentView); viewActionsContentView.setSwipingType(ActionsContentView.SWIPING_EDGE); if (sharedPreferences.getBoolean("ref_switch", true) && savedInstanceState == null) { getLoaderManager().initLoader(0, null, this); // ref.setVisible(false); // ??? setProgressBarIndeterminateVisibility(true); } }
From source file:jupiter.broadcasting.live.holo.ShowActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); sharedPref.getBoolean("pref_sync_audio", false); shows = new String[] { getString(R.string.allshows), "BSD Now", "Coder Radio", "Faux Show", "Linux Action Show", "LINUX Unplugged", "Plan B", "SciByte", "Tech Talk Today", "Techsnap", "Unfilter" }; audioFeedTable = new Hashtable<String, String>(); audioFeedTable.put(getString(R.string.allshows), "http://feeds.feedburner.com/JupiterBroadcasting"); audioFeedTable.put("Coder Radio", "http://feeds.feedburner.com/coderradiomp3"); audioFeedTable.put("Faux Show", "http://www.jupiterbroadcasting.com/feeds/FauxShowMP3.xml"); audioFeedTable.put("Linux Action Show", "http://feeds.feedburner.com/TheLinuxActionShow"); audioFeedTable.put("LINUX Unplugged", "http://feeds.feedburner.com/linuxunplugged"); audioFeedTable.put("SciByte", "http://feeds.feedburner.com/scibyteaudio"); audioFeedTable.put("Techsnap", "http://feeds.feedburner.com/techsnapmp3"); audioFeedTable.put("Unfilter", "http://www.jupiterbroadcasting.com/feeds/unfilterMP3.xml"); audioFeedTable.put("Plan B", "http://feeds.feedburner.com/planbmp3"); audioFeedTable.put("BSD Now", "http://feeds.feedburner.com/BsdNowMp3"); audioFeedTable.put("Tech Talk Today", "http://feedpress.me/t3mp3"); videoFeedTable = new Hashtable<String, String>(); videoFeedTable.put(getString(R.string.allshows), "http://feeds2.feedburner.com/AllJupiterVideos"); videoFeedTable.put("Coder Radio", "http://feeds.feedburner.com/coderradiovideo"); videoFeedTable.put("LINUX Unplugged", "http://feeds.feedburner.com/linuxunvid"); videoFeedTable.put("SciByte", "http://feeds.feedburner.com/scibytelarge"); videoFeedTable.put("Plan B", "http://feeds.feedburner.com/PlanBVideo"); videoFeedTable.put("Tech Talk Today", "http://feedpress.me/t3mob"); if (sharedPref.getBoolean("pref_sync_video", false)) { //load low quality video feeds videoFeedTable.put("Techsnap", "http://feeds.feedburner.com/techsnapmobile"); videoFeedTable.put("Linux Action Show", "http://feeds.feedburner.com/linuxactionshowipodvid"); videoFeedTable.put("Faux Show", "http://www.jupiterbroadcasting.com/feeds/FauxShowMobile.xml"); videoFeedTable.put("BSD Now", "http://feeds.feedburner.com/BsdNowMobile"); videoFeedTable.put("Unfilter", "http://www.jupiterbroadcasting.com/feeds/unfilterMob.xml"); } else {/*from w w w . j a v a2 s. co m*/ //if set, load high quality videos videoFeedTable.put("Techsnap", "http://feeds.feedburner.com/techsnaphd"); videoFeedTable.put("Linux Action Show", "http://feeds.feedburner.com/linuxashd"); videoFeedTable.put("Faux Show", "http://www.jupiterbroadcasting.com/feeds/FauxShowHD.xml"); videoFeedTable.put("BSD Now", "http://feeds.feedburner.com/BsdNowHd"); videoFeedTable.put("Unfilter", "http://www.jupiterbroadcasting.com/feeds/unfilterHD.xml"); } supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.main); mTitle = mDrawerTitle = getTitle(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.showlist); // 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 shows mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, shows)); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); // enable ActionBar app icon to behave as action to toggle nav drawer (Not working for some reason) getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getSupportActionBar().setTitle(mTitle); } public void onDrawerOpened(View drawerView) { getSupportActionBar().setTitle(mDrawerTitle); } }; //set the drawer icon to be clickable mDrawerLayout.setDrawerListener(mDrawerToggle); //first start opens the drawer if (savedInstanceState == null) { mDrawerLayout.openDrawer(mDrawerList); } }
From source file:com.akop.bach.activity.RibbonedMultiPane.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(getLayout());//from w w w .j a v a2 s . com if ((mAccount = (BasicAccount) getIntent().getParcelableExtra("account")) == null && !allowNullAccounts()) { if (App.getConfig().logToConsole()) App.logv("Account is null"); finish(); return; } if (android.os.Build.VERSION.SDK_INT >= 11) { new ActionBarHelper().init(); } // this part was under each activity if (!initializeParameters()) { finish(); return; } FragmentManager fm = getSupportFragmentManager(); Fragment titleFrag; FragmentTransaction ft = fm.beginTransaction(); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); if ((titleFrag = fm.findFragmentByTag("title")) == null) { titleFrag = instantiateTitleFragment(); ft.replace(R.id.fragment_titles, titleFrag, "title"); } if (isDualPane()) { if ((mDetailFragment = fm.findFragmentByTag("details")) == null) { if ((mDetailFragment = instantiateDetailFragment()) != null) ft.replace(R.id.fragment_details, mDetailFragment, "details"); } else if (mDetailFragment.isDetached()) { ft.attach(mDetailFragment); } } else { Fragment detailFragment; if ((detailFragment = fm.findFragmentByTag("details")) != null) { ft.detach(detailFragment); } } ft.commit(); }
From source file:com.andrewshu.android.reddit.reddits.PickSubredditActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CookieSyncManager.createInstance(getApplicationContext()); mSettings.loadRedditPreferences(this, mClient); setRequestedOrientation(mSettings.getRotation()); requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setTheme(mSettings.getTheme());/*from www. j av a 2 s.c o m*/ setContentView(R.layout.pick_subreddit_view); registerForContextMenu(getListView()); resetUI(null); mSubredditsList = cacheSubredditsList(mSubredditsList); if (CollectionUtils.isEmpty(mSubredditsList)) restoreLastNonConfigurationInstance(); if (CollectionUtils.isEmpty(mSubredditsList)) { new DownloadRedditsTask().execute(); } else { addFakeSubredditsUnlessSuppressed(); resetUI(new PickSubredditAdapter(this, mSubredditsList)); } }