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.android.mms.ui.MailBoxMessageContent.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setProgressBarIndeterminateVisibility(true); setContentView(R.layout.message_detail_viewpaper); mContentResolver = getContentResolver(); mBackgroundHandler = new BackgroundHandler(mContentResolver); mSlidePaperItemTextViews = new ArrayList<TextView>(); handleIntent();/*from www. ja v a 2 s .co m*/ startQuerySmsContent(); }
From source file:com.mooshim.mooshimeter.main.DeviceActivity.java
@Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); isRunning = true;//from w w w . ja va 2s. co m // GUI setContentView(R.layout.activity_meter); AUTO_GRADIENT.setStroke(1, 0xFF999999); MANUAL_GRADIENT.setStroke(1, 0xFF999999); DISABLE_GRADIENT.setStroke(1, 0xFF999999); ENABLE_GRADIENT.setStroke(1, 0xFF999999); // Bind the GUI elements value_labels[0] = (TextView) findViewById(R.id.ch1_value_label); value_labels[1] = (TextView) findViewById(R.id.ch2_value_label); display_set_buttons[0] = (Button) findViewById(R.id.ch1_display_set_button); input_set_buttons[0] = (Button) findViewById(R.id.ch1_input_set_button); range_auto_buttons[0] = (Button) findViewById(R.id.ch1_range_auto_button); range_buttons[0] = (Button) findViewById(R.id.ch1_range_button); units_buttons[0] = (Button) findViewById(R.id.ch1_units_button); display_set_buttons[1] = (Button) findViewById(R.id.ch2_display_set_button); input_set_buttons[1] = (Button) findViewById(R.id.ch2_input_set_button); range_auto_buttons[1] = (Button) findViewById(R.id.ch2_range_auto_button); range_buttons[1] = (Button) findViewById(R.id.ch2_range_button); units_buttons[1] = (Button) findViewById(R.id.ch2_units_button); rate_auto_button = (Button) findViewById(R.id.rate_auto_button); rate_button = (Button) findViewById(R.id.rate_button); logging_button = (Button) findViewById(R.id.logging_button); depth_auto_button = (Button) findViewById(R.id.depth_auto_button); depth_button = (Button) findViewById(R.id.depth_button); zero_button = (Button) findViewById(R.id.zero_button); }
From source file:com.paranoid.gerrit.GerritControllerActivity.java
@Override public void onCreate(Bundle savedInstanceState) { mTheme = Prefs.getCurrentThemeID(this); setTheme(mTheme);// www . ja va2 s . c o m super.onCreate(savedInstanceState); // check if caller has a gerrit instance start screen preference String suppliedGerritInstance = getIntent().getStringExtra(GERRIT_INSTANCE); if (suppliedGerritInstance != null && !suppliedGerritInstance.isEmpty() && suppliedGerritInstance.contains("http")) { // just set the prefs and allow normal loading Prefs.setCurrentGerrit(this, suppliedGerritInstance); } GoogleAnalytics googleAnalytics = GoogleAnalytics.getInstance(this); String trackingId = getString(R.string.ga_trackingId); Tracker tracker = googleAnalytics.getTracker(trackingId); googleAnalytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); tracker.send(MapBuilder.createAppView().build()); // keep a log of what ROM our users run EasyTracker easyTracker = EasyTracker.getInstance(this); easyTracker.send(MapBuilder.createEvent(AnalyticsConstants.GA_APP_OPEN, // Event category (required) AnalyticsConstants.GA_ROM_VERSION, // Event action (required) ROMHelper.determineRom(this), // Event label null) // Event value (long) .build()); // note this screen as viewed easyTracker.send(MapBuilder.createAppView().build()); // Keep track of what theme is being used easyTracker.send(MapBuilder.createEvent(AnalyticsConstants.GA_APP_OPEN, AnalyticsConstants.GA_THEME_SET_ON_OPEN, Prefs.getCurrentTheme(this), null).build()); // note this screen as viewed easyTracker.send(MapBuilder.createAppView().build()); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.main); FragmentManager fm = getSupportFragmentManager(); if (findViewById(R.id.change_detail_fragment) != 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; mChangeDetail = (PatchSetViewerFragment) fm.findFragmentById(R.id.change_detail_fragment); } Prefs.setTabletMode(this, mTwoPane); mChangeList = (ChangeListFragment) fm.findFragmentById(R.id.change_list_fragment); mGerritWebsite = Prefs.getCurrentGerrit(this); /* Initially set the current Gerrit globally here. * We can rely on callbacks to know when they change */ GerritURL.setGerrit(Prefs.getCurrentGerrit(this)); GerritURL.setProject(Prefs.getCurrentProject(this)); // Don't register listeners here. It is registered in onResume instead. mChangeListener = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String changeid = intent.getStringExtra(PatchSetViewerFragment.CHANGE_ID); String status = intent.getStringExtra(PatchSetViewerFragment.STATUS); boolean expand = intent.getBooleanExtra(PatchSetViewerFragment.EXPAND_TAG, false); onChangeSelected(changeid, status, expand); } }; handleIntent(this.getIntent()); }
From source file:com.andrewshu.android.reddit.mail.InboxListActivity.java
/** * Called when the activity starts up. Do activity initialization * here, not in a constructor./*from www . j a v a 2s. c om*/ * * @see Activity#onCreate */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CookieSyncManager.createInstance(getApplicationContext()); mSettings.loadRedditPreferences(this, mClient); setRequestedOrientation(mSettings.getRotation()); setTheme(mSettings.getTheme()); requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.inbox_list_content); registerForContextMenu(getListView()); if (mSettings.isLoggedIn()) { if (savedInstanceState != null) { mReplyTargetName = savedInstanceState.getString(Constants.REPLY_TARGET_NAME_KEY); mAfter = savedInstanceState.getString(Constants.AFTER_KEY); mBefore = savedInstanceState.getString(Constants.BEFORE_KEY); mCount = savedInstanceState.getInt(Constants.THREAD_COUNT_KEY); mLastAfter = savedInstanceState.getString(Constants.LAST_AFTER_KEY); mLastBefore = savedInstanceState.getString(Constants.LAST_BEFORE_KEY); mLastCount = savedInstanceState.getInt(Constants.THREAD_LAST_COUNT_KEY); mVoteTargetThingInfo = savedInstanceState.getParcelable(Constants.VOTE_TARGET_THING_INFO_KEY); mWhichInbox = savedInstanceState.getString(Constants.WHICH_INBOX_KEY); restoreLastNonConfigurationInstance(); if (mMessagesList == null) { // Load previous view of threads if (mLastAfter != null) { new DownloadMessagesTask(mWhichInbox, mLastAfter, null, mLastCount) .execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } else if (mLastBefore != null) { new DownloadMessagesTask(mWhichInbox, null, mLastBefore, mLastCount) .execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } else { new DownloadMessagesTask(mWhichInbox).execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } } else { // Orientation change. Use prior instance. resetUI(new MessagesListAdapter(this, mMessagesList)); } } else { Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.containsKey(Constants.WHICH_INBOX_KEY)) mWhichInbox = extras.getString(Constants.WHICH_INBOX_KEY); } new DownloadMessagesTask(mWhichInbox).execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } } else { showDialog(Constants.DIALOG_LOGIN); } setTitle(String.format(getResources().getString(R.string.inbox_title), mSettings.getUsername())); }
From source file:com.example.mydemos.view.RingtonePickerActivity.java
/** Called when the activity is first created. */ @Override//from w w w. j av a 2 s .c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.ringtone_picker); CharSequence sysTitle = (CharSequence) getResources().getText(R.string.sys_tone); CharSequence MusicTitle = (CharSequence) getResources().getText(R.string.sd_music); CharSequence RecordTitle = (CharSequence) getResources().getText(R.string.record_tone); Intent intent = getIntent(); toneType = intent.getIntExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, -1); Log.e("duwenhua", "ringPick get toneType:" + toneType); //! by duwenhua //if(toneType == RingtoneManager.TYPE_RINGTONE_SECOND) // toneType = RINGTONE_TYPE; //! by duwenhua mHasDefaultItem = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true); mUriForDefaultItem = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI); //Log.i("lys", "mUriForDefaultItem == " + mUriForDefaultItem); if (savedInstanceState != null) { mSelectedId = savedInstanceState.getLong(SAVE_CLICKED_POS, -1); } //Log.i("lys", "mUriForDefaultItem 1== " + mUriForDefaultItem+", mSelectedId =="+mSelectedId); mHasSilentItem = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true); mExistingUri = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI); //if(mUriForDefaultItem != null) //{ // mSelectedId = ContentUris.parseId(mUriForDefaultItem); //} //Log.i("lys", "RingtonePickerActivity.java onCreate mExistingUri == " + mExistingUri); //String action = getIntent().getAction(); //Log.i("lys", "PT Intent action == " + action); if (toneType == NOTIFICATION_TYPE) { mUriForDefaultItem = Settings.System.DEFAULT_NOTIFICATION_URI; } else if (toneType == RINGTONE_TYPE) { mUriForDefaultItem = Settings.System.DEFAULT_RINGTONE_URI; } else if (toneType == ALARM_TYPE) { mUriForDefaultItem = Settings.System.DEFAULT_ALARM_ALERT_URI; } if (isAvailableToCheckRingtone() == true) { Ringtone ringtone_DefaultItem = checkRingtone_reflect(this, mUriForDefaultItem, toneType); if (ringtone_DefaultItem != null && ringtone_DefaultItem.getUri() != null) { mUriForDefaultItem = ringtone_DefaultItem.getUri(); Log.i("lys", "RingtoneManager.getRingtone mUriForDefaultItem== " + mUriForDefaultItem); } else { //mUriForDefaultItem = 'content/medial/'; /*ZTE_AUDIO_LIYANG 2014/06/30 fix bug for ringtone when remove sdcard start */ String originalRingtone = Settings.System.getString(getApplicationContext().getContentResolver(), "ringtone_original"); if (originalRingtone != null && !TextUtils.isEmpty(originalRingtone)) { mUriForDefaultItem = Uri.parse(originalRingtone); Log.e("liyang", "select riongtone error ,change to originalRingtone == " + mExistingUri); } /*ZTE_AUDIO_LIYANG 2014/06/30 fix bug for ringtone when remove sdcard end */ Log.i("lys", "mUriForDefaultItem set as default mUriForDefaultItem== 222"); } if (mExistingUri != null) { Ringtone ringtone = checkRingtone_reflect(this, mExistingUri, toneType); if (ringtone != null && ringtone.getUri() != null) { //mUriForDefaultItem = ringtone.getUri(); mExistingUri = ringtone.getUri(); Log.i("lys", "RingtoneManager.getRingtone mExistingUri== " + mExistingUri); } else { mExistingUri = mUriForDefaultItem; Log.i("lys", "mExistingUri set as default mExistingUri== " + mExistingUri); } } } boolean includeDrm = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_INCLUDE_DRM, false); Log.e("lys", "includeDrm ==" + includeDrm); mRingtoneManager = new RingtoneManager(this); mRingtoneManager.setIncludeDrm(includeDrm); if (toneType != -1) { mRingtoneManager.setType(toneType); } setVolumeControlStream(mRingtoneManager.inferStreamType()); // toneActivityType = mRingtoneManager.getActivityType(); if (toneType == ALARM_TYPE) { sysTitle = (CharSequence) getResources().getText(R.string.alarm_tone); } else if (toneType == NOTIFICATION_TYPE) { sysTitle = (CharSequence) getResources().getText(R.string.notification_tone); } listView = new ListView(this); listView.setOnItemClickListener(this); //listView.setBackgroundColor(#ff5a5a5a); listView.setFastScrollEnabled(true); //listView.setFastScrollAlwaysVisible(true); listView.setEmptyView(findViewById(android.R.id.empty)); //mHasSilentItem = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true); //mHasDefaultItem = true; //temp if (mHasDefaultItem) { //chengcheng addDefaultStaticItem(listView, com.android.internal.R.string.ringtone_default); } setDefaultRingtone(); if (mHasSilentItem) { // chengcheng addSilendStaticItem(listView, com.android.internal.R.string.ringtone_silent); } audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); mAudioFocusListener = new OnAudioFocusChangeListener() { public void onAudioFocusChange(int focusChange) { } }; okBtn = (Button) findViewById(R.id.ok); okBtn.setOnClickListener(this); cancelBtn = (Button) findViewById(R.id.cancel); cancelBtn.setOnClickListener(this); TabHost mTabHost = (TabHost) findViewById(android.R.id.tabhost); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("tab_system").setIndicator(sysTitle, null).setContent(this)); mTabHost.addTab(mTabHost.newTabSpec("tab_music").setIndicator(MusicTitle, null).setContent(this)); mTabHost.addTab(mTabHost.newTabSpec("tab_record").setIndicator(RecordTitle, null).setContent(this)); mTabHost.setCurrentTab(0); mTabHost.setOnTabChangedListener(new OnTabChangeListener() { @Override public void onTabChanged(String tabId) { // stopMediaPlayer(); createTabContent(tabId); } }); }
From source file:org.openhab.habdroid.ui.OpenHABWidgetListActivity.java
/** * This is called when activity is created. Initializes the state, performs network * state based selection for app initialization and starts the widget list *//*from www . j a v a 2 s .c o m*/ @Override public void onCreate(Bundle savedInstanceState) { Log.d("OpenHABWidgetListActivity", "onCreate"); // Set default values, false means do it one time during the very first launch PreferenceManager.setDefaultValues(this, R.xml.preferences, false); // Set non-persistant HABDroid version preference to current version from application package try { PreferenceManager.getDefaultSharedPreferences(this).edit().putString("default_openhab_appversion", getPackageManager().getPackageInfo(getPackageName(), 0).versionName).commit(); } catch (NameNotFoundException e1) { if (e1 != null) Log.d(TAG, e1.getMessage()); } // Set the theme to one from preferences Util.setActivityTheme(this); // Fetch openHAB service type name from strings.xml openHABServiceType = getString(R.string.openhab_service_type); // Enable progress ring bar requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_PROGRESS); setProgressBarIndeterminateVisibility(true); // Initialize crittercism reporting JSONObject crittercismConfig = new JSONObject(); try { crittercismConfig.put("shouldCollectLogcat", true); } catch (JSONException e) { if (e.getMessage() != null) Log.e(TAG, e.getMessage()); else Log.e(TAG, "Crittercism JSON exception"); } Crittercism.init(getApplicationContext(), "5117659f59e1bd4ba9000004", crittercismConfig); // Initialize activity view super.onCreate(savedInstanceState); setContentView(R.layout.openhabwidgetlist); // Disable screen timeout if set in preferences SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); if (settings.getBoolean("default_openhab_screentimeroff", false)) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } // Check if we got all needed permissions PackageManager pm = getPackageManager(); if (!(pm.checkPermission(permission.CHANGE_WIFI_MULTICAST_STATE, getPackageName()) == PackageManager.PERMISSION_GRANTED)) { showAlertDialog(getString(R.string.erorr_no_wifi_mcast_permission)); serviceDiscoveryEnabled = false; } if (!(pm.checkPermission(permission.ACCESS_WIFI_STATE, getPackageName()) == PackageManager.PERMISSION_GRANTED)) { showAlertDialog(getString(R.string.erorr_no_wifi_state_permission)); serviceDiscoveryEnabled = false; } // Get username/password from preferences openHABUsername = settings.getString("default_openhab_username", null); openHABPassword = settings.getString("default_openhab_password", null); // Create new data source and adapter and set it to list view openHABWidgetDataSource = new OpenHABWidgetDataSource(); openHABWidgetAdapter = new OpenHABWidgetAdapter(OpenHABWidgetListActivity.this, R.layout.openhabwidgetlist_genericitem, widgetList); getListView().setAdapter(openHABWidgetAdapter); // Set adapter parameters openHABWidgetAdapter.setOpenHABUsername(openHABUsername); openHABWidgetAdapter.setOpenHABPassword(openHABPassword); // Enable app logo as home button this.getActionBar().setHomeButtonEnabled(true); // Check if we have openHAB page url in saved instance state? if (savedInstanceState != null) { displayPageUrl = savedInstanceState.getString("displayPageUrl"); openHABBaseUrl = savedInstanceState.getString("openHABBaseUrl"); sitemapRootUrl = savedInstanceState.getString("sitemapRootUrl"); openHABWidgetAdapter.setOpenHABBaseUrl(openHABBaseUrl); } // Check if this is a launch from myself (drill down navigation) if (getIntent() != null) { if (getIntent().getAction() != null) { if (getIntent().getAction().equals("org.openhab.habdroid.ui.OpwnHABWidgetListActivity")) { displayPageUrl = getIntent().getExtras().getString("displayPageUrl"); openHABBaseUrl = getIntent().getExtras().getString("openHABBaseUrl"); sitemapRootUrl = getIntent().getExtras().getString("sitemapRootUrl"); this.setTitle(getIntent().getExtras().getString("pageTitle")); openHABWidgetAdapter.setOpenHABBaseUrl(openHABBaseUrl); } } } // If yes, then just go to it (means restore activity from it's saved state) if (displayPageUrl.length() > 0) { Log.d(TAG, "displayPageUrl = " + displayPageUrl); showPage(displayPageUrl, false); // If not means it is a clean start } else { if (getIntent() != null) { Log.i(TAG, "Launch intent = " + getIntent().getAction()); // If this is a launch through NFC tag reading if (getIntent().getAction() != null) { if (getIntent().getAction().equals("android.nfc.action.NDEF_DISCOVERED")) { // Save url which we got from NFC tag nfcTagData = getIntent().getDataString(); } } } // If we are in demo mode, ignore all settings and use demo url from strings if (settings.getBoolean("default_openhab_demomode", false)) { openHABBaseUrl = getString(R.string.openhab_demo_url); Log.i(TAG, "Demo mode, connecting to " + openHABBaseUrl); Toast.makeText(getApplicationContext(), getString(R.string.info_demo_mode), Toast.LENGTH_LONG) .show(); showTime(); } else { openHABBaseUrl = normalizeUrl(settings.getString("default_openhab_url", "")); // Check if we have a direct URL in preferences, if yes - use it if (openHABBaseUrl.length() > 0) { Log.i(TAG, "Connecting to configured URL = " + openHABBaseUrl); Toast.makeText(getApplicationContext(), getString(R.string.info_conn_url), Toast.LENGTH_SHORT) .show(); showTime(); } else { // Get current network information ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService( Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); if (activeNetworkInfo != null) { Log.i(TAG, "Network is connected"); // If network is mobile, try to use remote URL if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_MOBILE || serviceDiscoveryEnabled == false) { if (!serviceDiscoveryEnabled) { Log.i(TAG, "openHAB discovery is disabled"); } else { Log.i(TAG, "Network is Mobile (" + activeNetworkInfo.getSubtypeName() + ")"); } openHABBaseUrl = normalizeUrl(settings.getString("default_openhab_alturl", "")); // If remote URL is configured if (openHABBaseUrl.length() > 0) { Toast.makeText(getApplicationContext(), getString(R.string.info_conn_rem_url), Toast.LENGTH_SHORT).show(); Log.i(TAG, "Connecting to remote URL " + openHABBaseUrl); showTime(); } else { Toast.makeText(getApplicationContext(), getString(R.string.error_no_url), Toast.LENGTH_LONG).show(); } // If network is WiFi or Ethernet } if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI || activeNetworkInfo.getType() == ConnectivityManager.TYPE_ETHERNET) { Log.i(TAG, "Network is WiFi or Ethernet"); // Start service discovery this.serviceResolver = new AsyncServiceResolver(this, openHABServiceType); progressDialog = ProgressDialog.show(this, "", "Discovering openHAB. Please wait...", true); this.serviceResolver.start(); // We don't know how to handle this network type } else { Log.i(TAG, "Network type (" + activeNetworkInfo.getTypeName() + ") is unsupported"); } // Network is not available } else { Log.i(TAG, "Network is not available"); Toast.makeText(getApplicationContext(), getString(R.string.error_network_not_available), Toast.LENGTH_LONG).show(); } } } } }
From source file:org.odk.collect.android.activities.GoogleDriveActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setProgressBarVisibility(true);/* w w w . ja v a2s .c o m*/ setContentView(R.layout.drive_layout); listView = (ListView) findViewById(android.R.id.list); listView.setOnItemClickListener(this); emptyView = (TextView) findViewById(android.R.id.empty); initToolbar(); parentId = null; alertShowing = false; toDownload = new ArrayList<>(); if (savedInstanceState != null && savedInstanceState.containsKey(MY_DRIVE_KEY)) { // recover state on rotate myDrive = savedInstanceState.getBoolean(MY_DRIVE_KEY); String[] patharray = savedInstanceState.getStringArray(PATH_KEY); currentPath = buildPath(patharray); parentId = savedInstanceState.getString(PARENT_KEY); alertMsg = savedInstanceState.getString(ALERT_MSG_KEY); alertShowing = savedInstanceState.getBoolean(ALERT_SHOWING_KEY); ArrayList<DriveListItem> dl = savedInstanceState.getParcelableArrayList(DRIVE_ITEMS_KEY); adapter = new FileArrayAdapter(GoogleDriveActivity.this, R.layout.two_item_image, dl); listView.setAdapter(adapter); adapter.setEnabled(true); } else { // new myDrive = false; if (!isDeviceOnline()) { createAlertDialog(getString(R.string.no_connection)); } } // restore any task state if (getLastCustomNonConfigurationInstance() instanceof RetrieveDriveFileContentsAsyncTask) { retrieveDriveFileContentsAsyncTask = (RetrieveDriveFileContentsAsyncTask) getLastNonConfigurationInstance(); setProgressBarIndeterminateVisibility(true); } else { getFileTask = (GetFileTask) getLastNonConfigurationInstance(); if (getFileTask != null) { getFileTask.setGoogleDriveFormDownloadListener(this); } } if (getFileTask != null && getFileTask.getStatus() == AsyncTask.Status.FINISHED) { try { dismissDialog(PROGRESS_DIALOG); } catch (Exception e) { Timber.i("Exception was thrown while dismissing a dialog."); } } if (alertShowing) { try { dismissDialog(PROGRESS_DIALOG); } catch (Exception e) { // don't care... Timber.i("Exception was thrown while dismissing a dialog."); } createAlertDialog(alertMsg); } rootButton = (Button) findViewById(R.id.root_button); if (myDrive) { rootButton.setText(getString(R.string.go_shared)); } else { rootButton.setText(getString(R.string.go_drive)); } rootButton.setOnClickListener(this); backButton = (Button) findViewById(R.id.back_button); backButton.setEnabled(parentId != null); backButton.setOnClickListener(this); downloadButton = (Button) findViewById(R.id.download_button); downloadButton.setOnClickListener(this); searchText = (EditText) findViewById(R.id.search_text); searchText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { executeSearch(); return true; } return false; } }); searchButton = (ImageButton) findViewById(R.id.search_button); searchButton.setOnClickListener(this); // Initialize credentials and service object. credential = GoogleAccountCredential .usingOAuth2(getApplicationContext(), Collections.singletonList(DriveScopes.DRIVE)) .setBackOff(new ExponentialBackOff()); HttpTransport transport = AndroidHttp.newCompatibleTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); driveService = new com.google.api.services.drive.Drive.Builder(transport, jsonFactory, credential) .setApplicationName("ODK-Collect").build(); getResultsFromApi(); }
From source file:de.egore911.drilog.ShowActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); String[] intentChannels = getIntent().getStringArrayExtra(Constants.INTENT_CHANNELS); if (intentChannels == null) { channels = Arrays.asList(Constants.DEFAULT_CHANNELS); } else {//from w w w . j a v a 2 s. c o m channels = Arrays.asList(intentChannels); } DbOpenHelper.instance = new DbOpenHelper(this); mWatchesDao = new WatchesDao(); mWatchesDao.open(); setContentView(R.layout.activity_main); 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 mDrawerList.setAdapter(new ArrayAdapter<>(this, R.layout.drawer_list_item, channels)); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); // enable ActionBar app icon to behave as action to toggle nav drawer getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); Bundle extras = getIntent().getExtras(); if (extras != null) { setAnchor(extras.getString("anchor")); if (extras.containsKey(Constants.STATE_DATE)) { mSelectedDate = (SimpleDate) extras.getSerializable(Constants.STATE_DATE); } if (extras.containsKey("channel")) { setPosition(channels.indexOf(extras.getString("channel"))); } } // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) { public void onDrawerClosed(View view) { getSupportActionBar().setTitle(channels.get(mPosition)); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getSupportActionBar().setTitle(R.string.app_name); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); setPosition(mPosition); if (savedInstanceState == null) { loadData(); } }
From source file:org.videolan.vlc.gui.MyFragment.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!VLCInstance.testCompatibleCPU(this)) { finish();//from w w w .ja v a 2s.c o m return; } /* Enable the indeterminate progress feature */ supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); /* Get the current version from package */ mVersionNumber = Config.VERSION_CODE; /* Check if it's the first run */ mFirstRun = mSettings.getInt(PREF_FIRST_RUN, -1) != mVersionNumber; if (mFirstRun) { Editor editor = mSettings.edit(); editor.putInt(PREF_FIRST_RUN, mVersionNumber); Util.commitPreferences(editor); } mMediaLibrary = MediaLibrary.getInstance(); if (mMediaLibrary.getMediaItems().isEmpty()) { if (mSettings.getBoolean(PreferencesActivity.AUTO_RESCAN, true)) mMediaLibrary.scanMediaItems(); else mMediaLibrary.loadMedaItems(); } /*** Start initializing the UI ***/ setContentView(R.layout.my_fragment); // image1=(ImageView) findViewById(R.id.image); // AlphaAnimation animation = new AlphaAnimation(1.0,0.); // animation.setDuration(5000); //?5 // image1.startAnimation(animation); mDrawerLayout = (HackyDrawerLayout) findViewById(R.id.root_container); // mListView = (ListView)findViewById(R.id.sidelist); // mListView.setFooterDividersEnabled(true); // mSidebarAdapter = new SidebarAdapter(this); // mListView.setAdapter(mSidebarAdapter); initAudioPlayerContainerActivity(); //mSlidingPane.setActivated(false); if (savedInstanceState != null) { mCurrentFragment = savedInstanceState.getString("current"); // if (mCurrentFragment != null) //mSidebarAdapter.setCurrentFragment(mCurrentFragment); } /* Initialize UI variables */ mInfoLayout = findViewById(R.id.info_layout); mInfoProgress = (ProgressBar) findViewById(R.id.info_progress); mInfoText = (TextView) findViewById(R.id.info_text); /* Set up the action bar */ prepareActionBar(); /* Set up the sidebar click listener * no need to invalidate menu for now */ mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); if (getSupportFragmentManager() .findFragmentById(R.id.fragment_placeholder) instanceof MediaBrowserFragment) ((MediaBrowserFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder)) .setReadyToDisplay(true); } }; // Set the drawer toggle as the DrawerListener // mDrawerLayout.setDrawerListener(mDrawerToggle); // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); /* Reload the latest preferences */ reloadPreferences(); /*--------------------------------------------- */ titleList = new ArrayList<String>(); titleList.add("Libray"); titleList.add("File"); initIndView(); fragment1 = new VideoGridFragment(); // Fragment fragment2 = getSupportFragmentManager() // .findFragmentById(R.id.fragment_placeholder); // fragment2=new FileBrowserFragment(); fragment2 = new MyPageFragment1(); btn = (Button) findViewById(R.id.back_btn); pager = (ViewPager) findViewById(R.id.pager); pager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub Matrix matrix = new Matrix(); switch (arg0) { case 0: matrix.postTranslate(offset + (one - offset) * arg1, 0); break; case 1: matrix.postTranslate(one + (two - one) * arg1, 0); break; default: break; } cursor.setImageMatrix(matrix); } @Override public void onPageSelected(int currentID) { if (currentID == 0) { libray.setTextColor(Color.BLUE); file1.setTextColor(Color.BLACK); } else { libray.setTextColor(Color.BLACK); file1.setTextColor(Color.BLUE); } mCurrentViewID = currentID; } }); fragList = new ArrayList<Fragment>(); fragList.add(fragment1); fragList.add(fragment2); // FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); //// ft.replace(R.id.fragment_placeholder, new FileBrowserFragment(), mCurrentFragment); // ft.replace(R.id.fragment_placeholder, new FileBrowserFragment()); // ft.commit(); libray = (TextView) findViewById(R.id.libray); file1 = (TextView) findViewById(R.id.file1); file1.setOnClickListener(listener); libray.setOnClickListener(listener); MyFragmentPagerAdapter adapter2 = new MyFragmentPagerAdapter(getSupportFragmentManager(), fragList, titleList); pager.setAdapter(adapter2); /*--------------------------------------------- */ }
From source file:in.shick.diode.user.ProfileActivity.java
/** * Called when the activity starts up. Do activity initialization * here, not in a constructor.//from w w w . j ava2 s. c o m * * @see Activity#onCreate */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CookieSyncManager.createInstance(getApplicationContext()); mSettings.loadRedditPreferences(this, mClient); setRequestedOrientation(mSettings.getRotation()); setTheme(mSettings.getTheme()); requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.profile_list_content); registerForContextMenu(getListView()); if (savedInstanceState != null) { if (Constants.LOGGING) Log.d(TAG, "using savedInstanceState"); mUsername = savedInstanceState.getString(Constants.USERNAME_KEY); mAfter = savedInstanceState.getString(Constants.AFTER_KEY); mBefore = savedInstanceState.getString(Constants.BEFORE_KEY); mCount = savedInstanceState.getInt(Constants.THREAD_COUNT_KEY); mLastAfter = savedInstanceState.getString(Constants.LAST_AFTER_KEY); mLastBefore = savedInstanceState.getString(Constants.LAST_BEFORE_KEY); mLastCount = savedInstanceState.getInt(Constants.THREAD_LAST_COUNT_KEY); mKarma = savedInstanceState.getIntArray(Constants.KARMA_KEY); mSortByUrl = savedInstanceState.getString(Constants.CommentsSort.SORT_BY_KEY); mJumpToThreadId = savedInstanceState.getString(Constants.JUMP_TO_THREAD_ID_KEY); mVoteTargetThingInfo = savedInstanceState.getParcelable(Constants.VOTE_TARGET_THING_INFO_KEY); // try to restore mThingsList using getLastNonConfigurationInstance() // (separate function to avoid a compiler warning casting ArrayList<ThingInfo> restoreLastNonConfigurationInstance(); if (mThingsList == null) { // Load previous page of profile items if (mLastAfter != null) { new DownloadProfileTask(mUsername, mLastAfter, null, mLastCount).execute(); } else if (mLastBefore != null) { new DownloadProfileTask(mUsername, null, mLastBefore, mLastCount).execute(); } else { new DownloadProfileTask(mUsername).execute(); } } else { // Orientation change. Use prior instance. resetUI(new ThingsListAdapter(this, mThingsList)); setTitle(String.format(getResources().getString(R.string.user_profile), mUsername)); } return; } // Handle subreddit Uri passed via Intent else if (getIntent().getData() != null) { Matcher userPathMatcher = USER_PATH_PATTERN.matcher(getIntent().getData().getPath()); if (userPathMatcher.matches()) { mUsername = userPathMatcher.group(1); new DownloadProfileTask(mUsername).execute(); return; } } // No username specified by Intent, so load the logged in user's profile if (mSettings.isLoggedIn()) { mUsername = mSettings.getUsername(); new DownloadProfileTask(mUsername).execute(); return; } // Can't find a username to use. Quit. if (Constants.LOGGING) Log.e(TAG, "Could not find a username to use for ProfileActivity"); finish(); }