List of usage examples for android.app ActionBar setDisplayHomeAsUpEnabled
public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp);
From source file:com.smithdtyler.prettygoodmusicplayer.NowPlaying.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent originIntent = getIntent();//from www .j a v a2 s .c o m if (originIntent.getBooleanExtra("From_Notification", false)) { String artistName = originIntent.getStringExtra(ArtistList.ARTIST_NAME); String artistAbsPath = originIntent.getStringExtra(ArtistList.ARTIST_ABS_PATH_NAME); if (artistName != null && artistAbsPath != null) { Log.i(TAG, "Now Playing was launched from a notification, setting up its back stack"); // Reference: https://developer.android.com/reference/android/app/TaskStackBuilder.html TaskStackBuilder tsb = TaskStackBuilder.create(this); Intent intent = new Intent(this, ArtistList.class); tsb.addNextIntent(intent); intent = new Intent(this, AlbumList.class); intent.putExtra(ArtistList.ARTIST_NAME, artistName); intent.putExtra(ArtistList.ARTIST_ABS_PATH_NAME, artistAbsPath); tsb.addNextIntent(intent); String albumName = originIntent.getStringExtra(AlbumList.ALBUM_NAME); if (albumName != null) { intent = new Intent(this, SongList.class); intent.putExtra(AlbumList.ALBUM_NAME, albumName); intent.putExtra(ArtistList.ARTIST_NAME, artistName); intent.putExtra(ArtistList.ARTIST_ABS_PATH_NAME, artistAbsPath); tsb.addNextIntent(intent); } intent = new Intent(this, NowPlaying.class); tsb.addNextIntent(intent); tsb.startActivities(); } } SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); String theme = sharedPref.getString("pref_theme", getString(R.string.light)); String size = sharedPref.getString("pref_text_size", getString(R.string.medium)); Log.i(TAG, "got configured theme " + theme); Log.i(TAG, "got configured size " + size); // These settings were fixed in english for a while, so check for old style settings as well as language specific ones. if (theme.equalsIgnoreCase(getString(R.string.dark)) || theme.equalsIgnoreCase("dark")) { Log.i(TAG, "setting theme to " + theme); if (size.equalsIgnoreCase(getString(R.string.small)) || size.equalsIgnoreCase("small")) { setTheme(R.style.PGMPDarkSmall); } else if (size.equalsIgnoreCase(getString(R.string.medium)) || size.equalsIgnoreCase("medium")) { setTheme(R.style.PGMPDarkMedium); } else { setTheme(R.style.PGMPDarkLarge); } } else if (theme.equalsIgnoreCase(getString(R.string.light)) || theme.equalsIgnoreCase("light")) { Log.i(TAG, "setting theme to " + theme); if (size.equalsIgnoreCase(getString(R.string.small)) || size.equalsIgnoreCase("small")) { setTheme(R.style.PGMPLightSmall); } else if (size.equalsIgnoreCase(getString(R.string.medium)) || size.equalsIgnoreCase("medium")) { setTheme(R.style.PGMPLightMedium); } else { setTheme(R.style.PGMPLightLarge); } } boolean fullScreen = sharedPref.getBoolean("pref_full_screen_now_playing", false); currentFullScreen = fullScreen; if (fullScreen) { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } else { ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); } setContentView(R.layout.activity_now_playing); if (savedInstanceState == null) { doBindService(true); startPlayingRequired = true; } else { doBindService(false); startPlayingRequired = false; } // Get the message from the intent Intent intent = getIntent(); if (intent.getBooleanExtra(KICKOFF_SONG, false)) { desiredArtistName = intent.getStringExtra(ArtistList.ARTIST_NAME); desiredAlbumName = intent.getStringExtra(AlbumList.ALBUM_NAME); desiredArtistAbsPath = intent.getStringExtra(ArtistList.ARTIST_ABS_PATH_NAME); desiredSongAbsFileNames = intent.getStringArrayExtra(SongList.SONG_ABS_FILE_NAME_LIST); desiredAbsSongFileNamesPosition = intent.getIntExtra(SongList.SONG_ABS_FILE_NAME_LIST_POSITION, 0); desiredSongProgress = intent.getIntExtra(MusicPlaybackService.TRACK_POSITION, 0); Log.d(TAG, "Got song names " + desiredSongAbsFileNames + " position " + desiredAbsSongFileNamesPosition); TextView et = (TextView) findViewById(R.id.artistName); et.setText(desiredArtistName); et = (TextView) findViewById(R.id.albumName); et.setText(desiredAlbumName); } // The song name field will be set when we get our first update update from the service. final ImageButton pause = (ImageButton) findViewById(R.id.playPause); pause.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { playPause(); } }); ImageButton previous = (ImageButton) findViewById(R.id.previous); previous.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { previous(); } }); previous.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { jumpBack(); return true; } }); ImageButton next = (ImageButton) findViewById(R.id.next); next.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { next(); } }); final ImageButton shuffle = (ImageButton) findViewById(R.id.shuffle); shuffle.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { toggleShuffle(); } }); final ImageButton jumpback = (ImageButton) findViewById(R.id.jumpback); jumpback.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { jumpBack(); } }); SeekBar seekBar = (SeekBar) findViewById(R.id.songProgressBar); seekBar.setEnabled(true); seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { private int requestedProgress; @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { Log.v(TAG, "drag location updated..." + progress); this.requestedProgress = progress; updateSongProgressLabel(progress); } } @Override public void onStartTrackingTouch(SeekBar seekBar) { NowPlaying.this.userDraggingProgress = true; } @Override public void onStopTrackingTouch(SeekBar seekBar) { Message msg = Message.obtain(null, MusicPlaybackService.MSG_SEEK_TO); msg.getData().putInt(MusicPlaybackService.TRACK_POSITION, requestedProgress); try { Log.i(TAG, "Sending a request to seek!"); mService.send(msg); } catch (RemoteException e) { e.printStackTrace(); } NowPlaying.this.userDraggingProgress = false; } }); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("com.smithdtyler.ACTION_EXIT"); exitReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.i(TAG, "Received exit request, shutting down..."); Intent msgIntent = new Intent(getBaseContext(), MusicPlaybackService.class); msgIntent.putExtra("Message", MusicPlaybackService.MSG_STOP_SERVICE); startService(msgIntent); finish(); } }; registerReceiver(exitReceiver, intentFilter); }
From source file:com.moro.synapsemod.MainActivity.java
@SuppressWarnings("ConstantConditions") private void continueCreate() { View v = LayoutInflater.from(this).inflate(R.layout.activity_main, null); mViewPager = (ViewPager) v.findViewById(R.id.mainPager); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPagerPageChangeListener()); mDrawerList = (ListView) v.findViewById(R.id.left_drawer); String[] section_titles = new String[Utils.configSections.size()]; for (int i = 0; i < Utils.configSections.size(); i++) section_titles[i] = Utils.localise(((JSONObject) Utils.configSections.get(i)).get("name")); mDrawerList.setAdapter(new ArrayAdapter<>(this, R.layout.drawer_item, section_titles)); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); mDrawerList.setItemChecked(0, true); mDrawerLayout = (DrawerLayout) v.findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_action_drawer, R.string.drawer_open, R.string.drawer_close); mDrawerLayout.setDrawerListener(mDrawerToggle); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); mDrawerToggle.syncState();//from ww w . j av a2s. c o m // Comprobamos "aplicar_cambios_auto" si esta activo cancelamos para que deje entrar al nuevo perfil SharedPreferences prefs = getSharedPreferences("moro_prefs", Context.MODE_PRIVATE); int auto = prefs.getInt("aplicar_cambios_auto", 0); // Si es 1 cancelamos para que entre el perfil y reiniciamos if (auto == 1) { SharedPreferences.Editor editor = prefs.edit(); editor.putInt("aplicar_cambios_auto", 2); editor.commit(); // cancelamos ActionValueUpdater.cancelElements(); // reiniciamos Utils.runCommand("/res/synapse/uci restart", false); } // Si es 2 aplicamos para que coja los voltajes else if (auto == 2) { SharedPreferences.Editor editor = prefs.edit(); editor.putInt("aplicar_cambios_auto", 0); editor.commit(); // aplicamos ActionValueUpdater.applyElements(); } // Si es 0 no hacemos nada else if (auto == 0) ActionValueUpdater.refreshButtons(true); for (TabSectionFragment f : fragments) f.onElementsMainStart(); setContentView(v); actionBar.show(); Utils.appStarted = true; setPaddingDimensions(); L.i("Interface creation finished in " + (System.nanoTime() - startTime) + "ns"); if (!BootService.getBootFlag() && !BootService.getBootFlagPending()) { new AlertDialog.Builder(this).setTitle(R.string.popup_failed_boot_title) .setMessage(R.string.popup_failed_boot_message).setCancelable(true) .setPositiveButton(R.string.popup_failed_boot_ack, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).show(); } }
From source file:com.klinker.android.twitter.activities.tweet_viewer.TweetPager.java
public void setUpTheme() { Utils.setUpPopupTheme(context, settings); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); if (settings.addonTheme) { getWindow().getDecorView().setBackgroundColor(settings.backgroundColor); }//from w ww.ja v a2 s.co m Utils.setActionBar(context, !settings.advanceWindowed); }
From source file:com.bt.download.android.gui.activities.MainActivity.java
private void setupActionBar() { ActionBar bar = getActionBar(); bar.setCustomView(R.layout.view_custom_actionbar); bar.setDisplayShowCustomEnabled(true); bar.setDisplayHomeAsUpEnabled(true); bar.setHomeButtonEnabled(true);//from ww w.j a v a 2 s . c o m }
From source file:com.buddi.client.dfu.DfuActivity.java
private void setGUI() { final ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); mDeviceNameView = (TextView) findViewById(R.id.device_name); mFileNameView = (TextView) findViewById(R.id.file_name); mFileTypeView = (TextView) findViewById(R.id.file_type); mFileSizeView = (TextView) findViewById(R.id.file_size); mFileStatusView = (TextView) findViewById(R.id.file_status); mSelectFileButton = (Button) findViewById(R.id.action_select_file); mUploadButton = (Button) findViewById(R.id.action_upload); mConnectButton = (Button) findViewById(R.id.action_connect); mTextPercentage = (TextView) findViewById(R.id.textviewProgress); mTextUploading = (TextView) findViewById(R.id.textviewUploading); mProgressBar = (ProgressBar) findViewById(R.id.progressbar_file); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); final boolean uploadInProgress = preferences.getBoolean(DfuService.DFU_IN_PROGRESS, false); if (uploadInProgress) { // Restore image file information mDeviceNameView.setText(preferences.getString(PREFS_DEVICE_NAME, "")); mFileNameView.setText(preferences.getString(PREFS_FILE_NAME, "")); mFileTypeView.setText(preferences.getString(PREFS_FILE_TYPE, "")); mFileSizeView.setText(preferences.getString(PREFS_FILE_SIZE, "")); mFileStatusView.setText(R.string.dfu_file_status_ok); mStatusOk = true;//from w w w .j a v a 2 s .com showProgressBar(); } }
From source file:com.concentricsky.android.khanacademy.app.VideoListActivity.java
@Override protected void onStart() { Log.d(LOG_TAG, "onStart"); super.onStart(); stopped = false;/* ww w . j a v a 2s. c o m*/ mainMenuDelegate = new MainMenuDelegate(this); listView = (AbsListView) findViewById(android.R.id.list); listView.setOnItemClickListener(clickListener); if (listView instanceof ListView) { // It is important that this is inflated with listView passed as the parent, despite the attach false parameter. // Otherwise, the view ends up with incorrect LayoutParams and we see crazy, crazy behavior. headerView = getLayoutInflater().inflate(R.layout.header_video_list, listView, false); ListView lv = (ListView) listView; if (lv.getHeaderViewsCount() == 0) { lv.addHeaderView(headerView); } } else { // GridView, fixed header headerView = findViewById(R.id.header_video_list); } /** Responsive layout stuff * * Based on screen width, we will find either * narrow * a listview with a header view * items are a thumbnail to the left and a title on white space to the right. * header is a thumbnail with overlaid title across the bottom * * middle * a fixed header on top and a grid view below * header is thumb to left, title above scrolling description to right * items are thumbs with title overlaid across the bottom (3 across) * * wide * a fixed header to the left and a grid view on the right * header is thumb on top, title next, description at bottom * items are thumbs with title overlaid across the bottom (3 across) * * * So in this class, we * find view by id 'list' * if it's a ListView, inflate and attach header view * if not, then the header is fixed and already in the layout * either way, now we can find header views by id * adapter is the same either way * * * * **/ ActionBar ab = getActionBar(); displayOptionsAdapter = new ArrayAdapter<String>(getActionBar().getThemedContext(), android.R.layout.simple_list_item_1, displayOptions); ab.setDisplayHomeAsUpEnabled(true); ab.setTitle(""); ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); ab.setListNavigationCallbacks(displayOptionsAdapter, navListener); ab.setSelectedNavigationItem(isShowingDownloadedVideosOnly ? 1 : 0); requestDataService(new ObjectCallback<KADataService>() { @Override public void call(KADataService dataService) { VideoListActivity.this.dataService = dataService; if (topicId != null) { Dao<Topic, String> topicDao; try { topicDao = dataService.getHelper().getTopicDao(); topic = topicDao.queryForId(topicId); } catch (SQLException e) { e.printStackTrace(); } } else { Log.e(LOG_TAG, "Topic id not set for video list"); topic = dataService.getRootTopic(); topicId = topic.getId(); } thumbnailManager = dataService.getThumbnailManager(); api = dataService.getAPIAdapter(); api.registerUserUpdateListener(userUpdateListener); // This instead happens in ActionBar.OnNavigationListener#onNavigationItemSelected, which // fires after onResume. // setParentTopic(topic); } }); IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_LIBRARY_UPDATE); filter.addAction(ACTION_BADGE_EARNED); filter.addAction(ACTION_OFFLINE_VIDEO_SET_CHANGED); filter.addAction(ACTION_DOWNLOAD_PROGRESS_UPDATE); filter.addAction(ACTION_TOAST); LocalBroadcastManager.getInstance(this).registerReceiver(receiver, filter); thumbExecutor = Executors.newSingleThreadExecutor(); }
From source file:nl.mpcjanssen.simpletask.AddTask.java
@Override public void onCreate(Bundle savedInstanceState) { Log.v(TAG, "onCreate()"); m_app = (TodoApplication) getApplication(); m_app.setActionBarStyle(getWindow()); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Constants.BROADCAST_UPDATE_UI); intentFilter.addAction(Constants.BROADCAST_SYNC_START); intentFilter.addAction(Constants.BROADCAST_SYNC_DONE); localBroadcastManager = m_app.getLocalBroadCastManager(); m_broadcastReceiver = new BroadcastReceiver() { @Override/* w w w .ja v a 2 s .com*/ public void onReceive(Context context, @NotNull Intent intent) { if (intent.getAction().equals(Constants.BROADCAST_SYNC_START)) { setProgressBarIndeterminateVisibility(true); } else if (intent.getAction().equals(Constants.BROADCAST_SYNC_DONE)) { setProgressBarIndeterminateVisibility(false); } } }; localBroadcastManager.registerReceiver(m_broadcastReceiver, intentFilter); ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } final Intent intent = getIntent(); ActiveFilter mFilter = new ActiveFilter(); mFilter.initFromIntent(intent); final String action = intent.getAction(); // create shortcut and exit if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) { Log.d(TAG, "Setting up shortcut icon"); setupShortcut(); finish(); return; } else if (Intent.ACTION_SEND.equals(action)) { Log.d(TAG, "Share"); if (intent.hasExtra(Intent.EXTRA_TEXT)) { share_text = intent.getCharSequenceExtra(Intent.EXTRA_TEXT).toString(); } else { share_text = ""; } if (!m_app.hasShareTaskShowsEdit()) { if (!share_text.equals("")) { addBackgroundTask(share_text); } finish(); return; } } else if ("com.google.android.gm.action.AUTO_SEND".equals(action)) { // Called as note to self from google search/now noteToSelf(intent); finish(); return; } else if (Constants.INTENT_BACKGROUND_TASK.equals(action)) { Log.v(TAG, "Adding background task"); if (intent.hasExtra(Constants.EXTRA_BACKGROUND_TASK)) { addBackgroundTask(intent.getStringExtra(Constants.EXTRA_BACKGROUND_TASK)); } else { Log.w(TAG, "Task was not in extras"); } finish(); return; } getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); setContentView(R.layout.add_task); // text textInputField = (EditText) findViewById(R.id.taskText); m_app.setEditTextHint(textInputField, R.string.tasktexthint); if (share_text != null) { textInputField.setText(share_text); } Task iniTask = null; setTitle(R.string.addtask); m_backup = m_app.getTaskCache(this).getTasksToUpdate(); if (m_backup != null && m_backup.size() > 0) { ArrayList<String> prefill = new ArrayList<String>(); for (Task t : m_backup) { prefill.add(t.inFileFormat()); } String sPrefill = Util.join(prefill, "\n"); textInputField.setText(sPrefill); setTitle(R.string.updatetask); } else { if (textInputField.getText().length() == 0) { iniTask = new Task(1, ""); iniTask.initWithFilter(mFilter); } if (iniTask != null && iniTask.getTags().size() == 1) { List<String> ps = iniTask.getTags(); String project = ps.get(0); if (!project.equals("-")) { textInputField.append(" +" + project); } } if (iniTask != null && iniTask.getLists().size() == 1) { List<String> cs = iniTask.getLists(); String context = cs.get(0); if (!context.equals("-")) { textInputField.append(" @" + context); } } } // Listen to enter events, use IME_ACTION_NEXT for soft keyboards // like Swype where ENTER keyCode is not generated. int inputFlags = InputType.TYPE_CLASS_TEXT; if (m_app.hasCapitalizeTasks()) { inputFlags |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; } textInputField.setRawInputType(inputFlags); textInputField.setImeOptions(EditorInfo.IME_ACTION_NEXT); textInputField.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int actionId, @Nullable KeyEvent keyEvent) { boolean hardwareEnterUp = keyEvent != null && keyEvent.getAction() == KeyEvent.ACTION_UP && keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER; boolean hardwareEnterDown = keyEvent != null && keyEvent.getAction() == KeyEvent.ACTION_DOWN && keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER; boolean imeActionNext = (actionId == EditorInfo.IME_ACTION_NEXT); if (imeActionNext || hardwareEnterUp) { // Move cursor to end of line int position = textInputField.getSelectionStart(); String remainingText = textInputField.getText().toString().substring(position); int endOfLineDistance = remainingText.indexOf('\n'); int endOfLine; if (endOfLineDistance == -1) { endOfLine = textInputField.length(); } else { endOfLine = position + endOfLineDistance; } textInputField.setSelection(endOfLine); replaceTextAtSelection("\n", false); if (hasCloneTags()) { String precedingText = textInputField.getText().toString().substring(0, endOfLine); int lineStart = precedingText.lastIndexOf('\n'); String line; if (lineStart != -1) { line = precedingText.substring(lineStart, endOfLine); } else { line = precedingText; } Task t = new Task(0, line); LinkedHashSet<String> tags = new LinkedHashSet<String>(); for (String ctx : t.getLists()) { tags.add("@" + ctx); } for (String prj : t.getTags()) { tags.add("+" + prj); } replaceTextAtSelection(Util.join(tags, " "), true); } endOfLine++; textInputField.setSelection(endOfLine); } return (imeActionNext || hardwareEnterDown || hardwareEnterUp); } }); setCloneTags(m_app.isAddTagsCloneTags()); setWordWrap(m_app.isWordWrap()); findViewById(R.id.cb_wrap).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setWordWrap(hasWordWrap()); } }); int textIndex = 0; textInputField.setSelection(textIndex); // Set button callbacks findViewById(R.id.btnContext).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showContextMenu(); } }); findViewById(R.id.btnProject).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showTagMenu(); } }); findViewById(R.id.btnPrio).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showPrioMenu(); } }); findViewById(R.id.btnDue).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { insertDate(Task.DUE_DATE); } }); findViewById(R.id.btnThreshold).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { insertDate(Task.THRESHOLD_DATE); } }); if (m_backup != null && m_backup.size() > 0) { textInputField.setSelection(textInputField.getText().length()); } }
From source file:ro.ui.pttdroid.Client_Main.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.client_main); userName = (TextView) findViewById(R.id.userName_client); title = (TextView) findViewById(R.id.title); content = (TextView) findViewById(R.id.content); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); getActionBar().setBackgroundDrawable(getResources().getDrawable(R.color.bar)); //? //???//ww w . j a v a2s .co m getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); //ml.release(); /*ImageButton ready_image_guide; ready_image_guide=(ImageButton)findViewById(R.id.ready_image_guide); ready_image_guide.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub change_to_client_online_fragment(); } }); */ //getActionBar().setBackgroundDrawable(null); System.out.println("start main!!!!!!!!!!"); Intent intent = this.getIntent(); //??? if_Global_local = intent.getIntExtra("if_Global_local", -2); System.out.println("if_Global_local" + if_Global_local); try { ParseHelper.initParse(this); EventBus.getDefault().postSticky("Parse init success!"); } catch (Exception e) { EventBus.getDefault().postSticky("Failed to int parse!"); } /*ImageButton listen_guide = (ImageButton) findViewById(R.id.listen_guide); listen_guide .setOnClickListener(new View.OnClickListener() { public void onClick(View v) { }});*/ init(); /*change_to_client_online_fragment(); playerIntent = new Intent(this, Client_Player.class); startService(playerIntent); */ if (if_Global_local == 1) { System.out.println("local"); if (if_clientL_offline_mode) { if_clientL_offline_mode = false; change_to_client_online_fragment(); playerIntent = new Intent(this, Client_Player.class); startService(playerIntent); } } if (if_Global_local == 0) { System.out.println("global"); if (if_clientL_offline_mode) { if_loading_final = true; if_clientL_offline_mode = false; microphoneSwitcher.hide(); change_to_client_Global_online_fragment(); } invalidateOptionsMenu(); } //microphoneSwitcher.hide(); intentFilter.addAction(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION); intentFilter.addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION); intentFilter.addAction(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION); intentFilter.addAction(WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION); manager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE); channel = manager.initialize(this, getMainLooper(), null); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); EventBus.getDefault().register(this); // test_connect(); }
From source file:com.bluros.updater.UpdatesSettings.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDownloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); // Load the layouts if (!Utils.hasLeanback(this)) { addPreferencesFromResource(R.xml.main); } else {/* w w w . j a va 2 s . c o m*/ addPreferencesFromResource(R.xml.main_tv); } mUpdatesList = (PreferenceCategory) findPreference(UPDATES_CATEGORY); mUpdateCheck = (ListPreference) findPreference(Constants.UPDATE_CHECK_PREF); // Load the stored preference data mPrefs = PreferenceManager.getDefaultSharedPreferences(this); if (mUpdateCheck != null) { int check = mPrefs.getInt(Constants.UPDATE_CHECK_PREF, Constants.UPDATE_FREQ_WEEKLY); mUpdateCheck.setValue(String.valueOf(check)); mUpdateCheck.setSummary(mapCheckValue(check)); mUpdateCheck.setOnPreferenceChangeListener(this); } // Force a refresh if UPDATE_TYPE_PREF does not match release type int updateType = Utils.getUpdateType(); int updateTypePref = mPrefs.getInt(Constants.UPDATE_TYPE_PREF, Constants.UPDATE_TYPE_SNAPSHOT); if (updateTypePref != updateType) { updateUpdatesType(updateType); } // Set 'HomeAsUp' feature of the actionbar to fit better into Settings if (!Utils.hasLeanback(this)) { final ActionBar bar = getActionBar(); if (bar != null) { bar.setDisplayHomeAsUpEnabled(true); } // Turn on the Options Menu invalidateOptionsMenu(); } }
From source file:com.boko.vimusic.ui.activities.AudioPlayerActivity.java
/** * {@inheritDoc}//from w w w. j a v a 2s. c o m */ @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Initialze the theme resources mResources = new ThemeUtils(this); // Set the overflow style mResources.setOverflowStyle(this); // Fade it in overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); // Control the media volume setVolumeControlStream(AudioManager.STREAM_MUSIC); // Bind Apollo's service mToken = MusicUtils.bindToService(this, this); // Initialize the image fetcher/cache mImageFetcher = CommonUtils.getImageFetcher(this); // Initialize the handler used to update the current time mTimeHandler = new TimeHandler(this); // Initialize the broadcast receiver mPlaybackStatus = new PlaybackStatus(this); // Theme the action bar final ActionBar actionBar = getActionBar(); mResources.themeActionBar(actionBar, getString(R.string.app_name)); actionBar.setDisplayHomeAsUpEnabled(true); // Set the layout setContentView(R.layout.activity_player_base); // Cache all the items initPlaybackControls(); }