List of usage examples for android.app ActionBar DISPLAY_SHOW_TITLE
int DISPLAY_SHOW_TITLE
To view the source code for android.app ActionBar DISPLAY_SHOW_TITLE.
Click Source Link
From source file:com.otaupdater.OTAUpdaterActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Context context = getApplicationContext(); cfg = Config.getInstance(context);// w w w . ja v a 2s .c o m if (!cfg.hasProKey()) { bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"), billingSrvConn = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { billingSrvConn = null; } @Override public void onServiceConnected(ComponentName name, IBinder binder) { IInAppBillingService service = IInAppBillingService.Stub.asInterface(binder); try { Bundle owned = service.getPurchases(3, getPackageName(), "inapp", null); ArrayList<String> ownedItems = owned.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); ArrayList<String> ownedItemData = owned .getStringArrayList("INAPP_PURCHASE_DATA_LIST"); if (ownedItems != null && ownedItemData != null) { for (int q = 0; q < ownedItems.size(); q++) { if (ownedItems.get(q).equals(Config.PROKEY_SKU)) { JSONObject itemData = new JSONObject(ownedItemData.get(q)); cfg.setKeyPurchaseToken(itemData.getString("purchaseToken")); break; } } } } catch (RemoteException ignored) { } catch (JSONException e) { e.printStackTrace(); } unbindService(this); billingSrvConn = null; } }, Context.BIND_AUTO_CREATE); } boolean data = Utils.dataAvailable(this); boolean wifi = Utils.wifiConnected(this); if (!data || !wifi) { final boolean nodata = !data && !wifi; if ((nodata && !cfg.getIgnoredDataWarn()) || (!nodata && !cfg.getIgnoredWifiWarn())) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(nodata ? R.string.alert_nodata_title : R.string.alert_nowifi_title); builder.setMessage(nodata ? R.string.alert_nodata_message : R.string.alert_nowifi_message); builder.setCancelable(false); builder.setNegativeButton(R.string.exit, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); } }); builder.setNeutralButton(R.string.alert_wifi_settings, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); Intent i = new Intent(Settings.ACTION_WIFI_SETTINGS); startActivity(i); } }); builder.setPositiveButton(R.string.ignore, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (nodata) { cfg.setIgnoredDataWarn(true); } else { cfg.setIgnoredWifiWarn(true); } dialog.dismiss(); } }); final AlertDialog dlg = builder.create(); dlg.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { onDialogShown(dlg); } }); dlg.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { onDialogClosed(dlg); } }); dlg.show(); } } Utils.updateDeviceRegistration(this); CheckinReceiver.setDailyAlarm(this); if (!PropUtils.isRomOtaEnabled() && !PropUtils.isKernelOtaEnabled() && !cfg.getIgnoredUnsupportedWarn()) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.alert_unsupported_title); builder.setMessage(R.string.alert_unsupported_message); builder.setCancelable(false); builder.setNegativeButton(R.string.exit, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); } }); builder.setPositiveButton(R.string.ignore, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { cfg.setIgnoredUnsupportedWarn(true); dialog.dismiss(); } }); final AlertDialog dlg = builder.create(); dlg.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { onDialogShown(dlg); } }); dlg.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { onDialogClosed(dlg); } }); dlg.show(); } setContentView(R.layout.main); Fragment adFragment = getFragmentManager().findFragmentById(R.id.ads); if (adFragment != null) getFragmentManager().beginTransaction().hide(adFragment).commit(); ViewPager mViewPager = (ViewPager) findViewById(R.id.pager); bar = getActionBar(); assert bar != null; bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); bar.setTitle(R.string.app_name); TabsAdapter mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.main_about), AboutTab.class); ActionBar.Tab romTab = bar.newTab().setText(R.string.main_rom); if (cfg.hasStoredRomUpdate()) romTab.setIcon(R.drawable.ic_action_warning); romTabIdx = mTabsAdapter.addTab(romTab, ROMTab.class); ActionBar.Tab kernelTab = bar.newTab().setText(R.string.main_kernel); if (cfg.hasStoredKernelUpdate()) kernelTab.setIcon(R.drawable.ic_action_warning); kernelTabIdx = mTabsAdapter.addTab(kernelTab, KernelTab.class); if (!handleNotifAction(getIntent())) { if (cfg.hasStoredRomUpdate() && !cfg.isDownloadingRom()) { cfg.getStoredRomUpdate().showUpdateNotif(this); } if (cfg.hasStoredKernelUpdate() && !cfg.isDownloadingKernel()) { cfg.getStoredKernelUpdate().showUpdateNotif(this); } if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt(KEY_TAB, 0)); } } }
From source file:android.support.v7.internal.widget.ToolbarWidgetWrapper.java
private void setTitleInt(CharSequence title) { mTitle = title; if ((mDisplayOpts & ActionBar.DISPLAY_SHOW_TITLE) != 0) { mToolbar.setTitle(title); } }
From source file:android.support.v7.internal.widget.ToolbarWidgetWrapper.java
@Override public void setSubtitle(CharSequence subtitle) { mSubtitle = subtitle;//from w ww. jav a 2 s.c o m if ((mDisplayOpts & ActionBar.DISPLAY_SHOW_TITLE) != 0) { mToolbar.setSubtitle(subtitle); } }
From source file:com.geotrackin.gpslogger.GpsMainActivity.java
public void SetUpActionBar() { ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); SpinnerAdapter spinnerAdapter = ArrayAdapter.createFromResource(actionBar.getThemedContext(), R.array.gps_main_views, android.R.layout.simple_spinner_dropdown_item); actionBar.setListNavigationCallbacks(spinnerAdapter, this); //Reload the user's previously selected view f73 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); actionBar.setSelectedNavigationItem(prefs.getInt("dropdownview", 0)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(""); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(R.layout.actionbar); ImageButton helpButton = (ImageButton) actionBar.getCustomView().findViewById(R.id.imgHelp); helpButton.setOnClickListener(new View.OnClickListener() { @Override/*from ww w .ja va2 s. com*/ public void onClick(View view) { Intent faqtivity = new Intent(getApplicationContext(), Faqtivity.class); startActivity(faqtivity); } }); }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * *//*ww w . j a v a 2s . c o m*/ @Override public void onCreate(final Bundle savedInstanceState) { //Log.i("MAIN ACTIVITY", "onCreate"); restoreInstance(savedInstanceState); super.onCreate(savedInstanceState); NetworkInfoCollector.init(this); networkInfoCollector = NetworkInfoCollector.getInstance(); preferencesUpdate(); setContentView(R.layout.main_with_navigation_drawer); if (VIEW_HIERARCHY_SERVER_ENABLED) { ViewServer.get(this).addWindow(this); } ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setDisplayUseLogoEnabled(true); // initialize the navigation drawer with the main menu list adapter: String[] mainTitles = getResources().getStringArray(R.array.navigation_main_titles); int[] navIcons = new int[] { R.drawable.ic_action_home, R.drawable.ic_action_history, R.drawable.ic_action_map, R.drawable.ic_action_stat, R.drawable.ic_action_help, R.drawable.ic_action_about, R.drawable.ic_action_settings, R.drawable.ic_action_about }; MainMenuListAdapter mainMenuAdapter = new MainMenuListAdapter(this, mainTitles, navIcons); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerList = (ListView) findViewById(R.id.left_drawer); drawerLayout.setBackgroundResource(R.drawable.ic_drawer); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.page_title_title_page, R.string.page_title_title_page) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); //refreshActionBar(null); exitAfterDrawerClose = false; } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); } }; drawerLayout.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (KeyEvent.KEYCODE_BACK == event.getKeyCode() && exitAfterDrawerClose) { onBackPressed(); return true; } return false; } }); drawerLayout.setDrawerListener(drawerToggle); drawerList.setAdapter(mainMenuAdapter); drawerList.setOnItemClickListener(new OnItemClickListener() { final int[] menuIds = new int[] { R.id.action_title_page, R.id.action_history, R.id.action_map, R.id.action_stats, R.id.action_help, R.id.action_info, R.id.action_settings, R.id.action_netstat, R.id.action_log }; @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectMenuItem(menuIds[position]); drawerLayout.closeDrawers(); } }); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); // Do something against banding effect in gradients // Dither flag might mess up on certain devices?? final Window window = getWindow(); window.setFormat(PixelFormat.RGBA_8888); window.addFlags(WindowManager.LayoutParams.FLAG_DITHER); // Setzt Default-Werte, wenn noch keine Werte vorhanden PreferenceManager.setDefaultValues(this, R.xml.preferences, false); final String uuid = ConfigHelper.getUUID(getApplicationContext()); fm = getFragmentManager(); final Fragment fragment = fm.findFragmentById(R.id.fragment_content); if (!ConfigHelper.isTCAccepted(this)) { if (fragment != null && fm.getBackStackEntryCount() >= 1) // clear fragment back stack fm.popBackStack(fm.getBackStackEntryAt(0).getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE); getActionBar().hide(); setLockNavigationDrawer(true); showTermsCheck(); } else { currentMapOptions.put("highlight", uuid); if (fragment == null) { if (false) // deactivated for si // ! ConfigHelper.isNDTDecisionMade(this)) { showTermsCheck(); showNdtCheck(); } else initApp(true); } } geoLocation = new MainGeoLocation(getApplicationContext()); mNetworkStateChangedFilter = new IntentFilter(); mNetworkStateChangedFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mNetworkStateIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) { if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) { final boolean connected = !intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false); final boolean isFailover = intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false); if (connected) { if (networkInfoCollector != null) { networkInfoCollector.setHasConnectionFromAndroidApi(true); } } else { if (networkInfoCollector != null) { networkInfoCollector.setHasConnectionFromAndroidApi(false); } } Log.i(DEBUG_TAG, "CONNECTED: " + connected + " FAILOVER: " + isFailover); } } }; }
From source file:org.woltage.irssiconnectbot.ConsoleActivity.java
@Override @TargetApi(11)/*from ww w .j av a2 s. c o m*/ public void onCreate(Bundle icicle) { super.onCreate(icicle); if (!InstallMosh.isInstallStarted()) { new InstallMosh(this); } configureStrictMode(); hardKeyboard = getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY; hardKeyboard = hardKeyboard && !Build.MODEL.contains("Transformer"); this.setContentView(R.layout.act_console); BugSenseHandler.setup(this, "d27a12dc"); clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); prefs = PreferenceManager.getDefaultSharedPreferences(this); // hide action bar if requested by user try { ActionBar actionBar = getActionBar(); if (!prefs.getBoolean(PreferenceConstants.ACTIONBAR, true)) { actionBar.hide(); } actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); } catch (NoSuchMethodError error) { Log.w(TAG, "Android sdk version pre 11. Not touching ActionBar."); } // hide status bar if requested by user if (prefs.getBoolean(PreferenceConstants.FULLSCREEN, false)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } // TODO find proper way to disable volume key beep if it exists. setVolumeControlStream(AudioManager.STREAM_MUSIC); // handle requested console from incoming intent requested = getIntent().getData(); inflater = LayoutInflater.from(this); flip = (ViewFlipper) findViewById(R.id.console_flip); empty = (TextView) findViewById(android.R.id.empty); stringPromptGroup = (RelativeLayout) findViewById(R.id.console_password_group); stringPromptInstructions = (TextView) findViewById(R.id.console_password_instructions); stringPrompt = (EditText) findViewById(R.id.console_password); stringPrompt.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP) return false; if (keyCode != KeyEvent.KEYCODE_ENTER) return false; // pass collected password down to current terminal String value = stringPrompt.getText().toString(); PromptHelper helper = getCurrentPromptHelper(); if (helper == null) return false; helper.setResponse(value); // finally clear password for next user stringPrompt.setText(""); updatePromptVisible(); return true; } }); booleanPromptGroup = (RelativeLayout) findViewById(R.id.console_boolean_group); booleanPrompt = (TextView) findViewById(R.id.console_prompt); booleanYes = (Button) findViewById(R.id.console_prompt_yes); booleanYes.setOnClickListener(new OnClickListener() { public void onClick(View v) { PromptHelper helper = getCurrentPromptHelper(); if (helper == null) return; helper.setResponse(Boolean.TRUE); updatePromptVisible(); } }); booleanNo = (Button) findViewById(R.id.console_prompt_no); booleanNo.setOnClickListener(new OnClickListener() { public void onClick(View v) { PromptHelper helper = getCurrentPromptHelper(); if (helper == null) return; helper.setResponse(Boolean.FALSE); updatePromptVisible(); } }); // preload animations for terminal switching slide_left_in = AnimationUtils.loadAnimation(this, R.anim.slide_left_in); slide_left_out = AnimationUtils.loadAnimation(this, R.anim.slide_left_out); slide_right_in = AnimationUtils.loadAnimation(this, R.anim.slide_right_in); slide_right_out = AnimationUtils.loadAnimation(this, R.anim.slide_right_out); fade_out_delayed = AnimationUtils.loadAnimation(this, R.anim.fade_out_delayed); fade_stay_hidden = AnimationUtils.loadAnimation(this, R.anim.fade_stay_hidden); // Preload animation for keyboard button keyboard_fade_in = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_in); keyboard_fade_out = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_out); inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); final RelativeLayout keyboardGroup = (RelativeLayout) findViewById(R.id.keyboard_group); if (Build.MODEL.contains("Transformer") && getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY && prefs.getBoolean(PreferenceConstants.ACTIONBAR, true)) { keyboardGroup.setEnabled(false); keyboardGroup.setVisibility(View.INVISIBLE); } mKeyboardButton = (ImageView) findViewById(R.id.button_keyboard); mKeyboardButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return; inputManager.showSoftInput(flip, InputMethodManager.SHOW_FORCED); keyboardGroup.setVisibility(View.GONE); } }); final ImageView symButton = (ImageView) findViewById(R.id.button_sym); symButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return; TerminalView terminal = (TerminalView) flip; TerminalKeyListener handler = terminal.bridge.getKeyHandler(); handler.showCharPickerDialog(terminal); keyboardGroup.setVisibility(View.GONE); } }); mInputButton = (ImageView) findViewById(R.id.button_input); mInputButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return; final TerminalView terminal = (TerminalView) flip; Thread promptThread = new Thread(new Runnable() { public void run() { String inj = getCurrentPromptHelper().requestStringPrompt(null, ""); terminal.bridge.injectString(inj); } }); promptThread.setName("Prompt"); promptThread.setDaemon(true); promptThread.start(); keyboardGroup.setVisibility(View.GONE); } }); final ImageView ctrlButton = (ImageView) findViewById(R.id.button_ctrl); ctrlButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return; TerminalView terminal = (TerminalView) flip; TerminalKeyListener handler = terminal.bridge.getKeyHandler(); handler.metaPress(TerminalKeyListener.META_CTRL_ON); terminal.bridge.tryKeyVibrate(); keyboardGroup.setVisibility(View.GONE); } }); final ImageView escButton = (ImageView) findViewById(R.id.button_esc); escButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return; TerminalView terminal = (TerminalView) flip; TerminalKeyListener handler = terminal.bridge.getKeyHandler(); handler.sendEscape(); terminal.bridge.tryKeyVibrate(); keyboardGroup.setVisibility(View.GONE); } }); // detect fling gestures to switch between terminals final GestureDetector detect = new GestureDetector(new ICBSimpleOnGestureListener(this)); flip.setLongClickable(true); flip.setOnTouchListener(new ICBOnTouchListener(this, keyboardGroup, detect)); }
From source file:com.android.contacts.activities.ActionBarAdapter.java
private void updateDisplayOptionsInner() { // All the flags we may change in this method. final int MASK = ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP; // The current flags set to the action bar. (only the ones that we may change here) final int current = mActionBar.getDisplayOptions() & MASK; final boolean isSearchOrSelectionMode = mSearchMode || mSelectionMode; // Build the new flags... int newFlags = 0; if (mShowHomeIcon && !isSearchOrSelectionMode) { newFlags |= ActionBar.DISPLAY_SHOW_HOME; }//from w w w . j a v a 2 s.c o m if (mSearchMode && !mSelectionMode) { // The search container is placed inside the toolbar. So we need to disable the // Toolbar's content inset in order to allow the search container to be the width of // the window. mToolbar.setContentInsetsRelative(0, mToolbar.getContentInsetEnd()); } if (!isSearchOrSelectionMode) { newFlags |= ActionBar.DISPLAY_SHOW_TITLE; mToolbar.setContentInsetsRelative(mMaxToolbarContentInsetStart, mToolbar.getContentInsetEnd()); } if (mSelectionMode) { // Minimize the horizontal width of the Toolbar since the selection container is placed // behind the toolbar and its left hand side needs to be clickable. FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mToolbar.getLayoutParams(); params.width = LayoutParams.WRAP_CONTENT; params.gravity = Gravity.END; mToolbar.setLayoutParams(params); } else { FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mToolbar.getLayoutParams(); params.width = LayoutParams.MATCH_PARENT; params.gravity = Gravity.END; mToolbar.setLayoutParams(params); } if (current != newFlags) { // Pass the mask here to preserve other flags that we're not interested here. mActionBar.setDisplayOptions(newFlags, MASK); } }
From source file:android.support.v7.widget.ToolbarWidgetWrapper.java
@Override public void setDisplayOptions(int newOpts) { final int oldOpts = mDisplayOpts; final int changed = oldOpts ^ newOpts; mDisplayOpts = newOpts;/* w w w .jav a 2 s . c om*/ if (changed != 0) { if ((changed & ActionBar.DISPLAY_HOME_AS_UP) != 0) { if ((newOpts & ActionBar.DISPLAY_HOME_AS_UP) != 0) { updateHomeAccessibility(); } updateNavigationIcon(); } if ((changed & AFFECTS_LOGO_MASK) != 0) { updateToolbarLogo(); } if ((changed & ActionBar.DISPLAY_SHOW_TITLE) != 0) { if ((newOpts & ActionBar.DISPLAY_SHOW_TITLE) != 0) { mToolbar.setTitle(mTitle); mToolbar.setSubtitle(mSubtitle); } else { mToolbar.setTitle(null); mToolbar.setSubtitle(null); } } if ((changed & ActionBar.DISPLAY_SHOW_CUSTOM) != 0 && mCustomView != null) { if ((newOpts & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) { mToolbar.addView(mCustomView); } else { mToolbar.removeView(mCustomView); } } } }
From source file:com.nagravision.mediaplayer.FullscreenActivity.java
/** * *//*from w ww . j ava 2 s.c o m*/ @SuppressLint("InlinedApi") @Override protected void onCreate(Bundle inBundle) { Log.v(LOG_TAG, "FullscreenActivity::onCreate - Enter\n"); super.onCreate(inBundle); getApplication().registerActivityLifecycleCallbacks(this); if (Build.VERSION.SDK_INT < 16) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_fullscreen); mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); mMoviesList = (ListView) findViewById(R.id.start_drawer); mUrlsAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_activated_1, MOVIES_ARR); mMoviesList.setAdapter(mUrlsAdapter); mVideoHolder = (VideoView) findViewById(R.id.fullscreen_content); View decorView = getWindow().getDecorView(); // Hide the status bar. int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN; if (Build.VERSION.SDK_INT >= 19) { uiOptions |= View.SYSTEM_UI_FLAG_IMMERSIVE; } decorView.setSystemUiVisibility(uiOptions); // Remember that you should never show the action bar if the // status bar is hidden, so hide that too if necessary. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); actionBar.hide(); mNotifBuilder = new Notification.Builder(this); mNotifMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mExplicitIntent = new Intent(Intent.ACTION_VIEW); mExplicitIntent.setClass(this, this.getClass()); mDefaultIntent = PendingIntent.getActivity(this, REQUEST_DISPLAY, mExplicitIntent, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_DEBUG_LOG_RESOLUTION); mInfosActionIntent = new Intent(); mInfosActionIntent.setAction("com.nagravision.mediaplayer.VIDEO_INFOS"); mInfosActionIntent.addCategory(Intent.CATEGORY_DEFAULT); mInfosActionIntent.addCategory(Intent.CATEGORY_INFO); mInfosIntent = PendingIntent.getActivity(this, REQUEST_INFOS, mInfosActionIntent, Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_DEBUG_LOG_RESOLUTION); if (Build.VERSION.SDK_INT >= 19) { mVideoHolder.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE); } else { mVideoHolder.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN); } OnItemClickListener mMessageClickedHandler = new OnItemClickListener() { public void onItemClick(@SuppressWarnings("rawtypes") AdapterView parent, View v, int position, long id) { Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnItemClickListener::onItemClick - Enter\n"); ClickItem(position, 0); } }; mMoviesList.setOnItemClickListener(mMessageClickedHandler); getWindow().setFormat(PixelFormat.TRANSLUCENT); mControlsView = new MediaController(this, true); mControlsView.setPrevNextListeners(new View.OnClickListener() { /* * Next listener */ @Override public void onClick(View view) { Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnClickListener::onClick(next) - Enter\n"); mVideoHolder.stopPlayback(); int position = 0; if (mLastPosition > 0) position = mLastPosition + 1; if (position >= MOVIES_URLS.length) position = 0; ClickItem(position, 0); String toaststr = getResources().getString(R.string.next_movie_toast_string) + MOVIES_ARR[position]; Toast.makeText(FullscreenActivity.this, toaststr, Toast.LENGTH_LONG).show(); } }, new View.OnClickListener() { /* * Prev listener */ @Override public void onClick(View view) { Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnClickListener::onClick(prev) - Enter\n"); mVideoHolder.stopPlayback(); int position = 0; if (mLastPosition > 0) position = mLastPosition - 1; if (position < 0) position = MOVIES_URLS.length - 1; ClickItem(position, 0); String toaststr = getResources().getString(R.string.prev_movie_toast_string) + MOVIES_ARR[position]; Toast.makeText(FullscreenActivity.this, toaststr, Toast.LENGTH_LONG).show(); } }); mVideoHolder.setMediaController(mControlsView); // Set up an instance of SystemUiHider to control the system UI for // this activity. mSystemUiHider = SystemUiHider.getInstance(this, mVideoHolder, HIDER_FLAGS); mSystemUiHider.setup(); mSystemUiHider.setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() { // Cached values. int mControlsHeight; int mShortAnimTime; @Override @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) public void onVisibilityChange(boolean visible) { Log.v(LOG_TAG, "FullscreenActivity.OnVisibilityChangeListener::onVisibilityChange - Enter\n"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { if (mControlsHeight == 0) mControlsHeight = mControlsView.getHeight(); if (mShortAnimTime == 0) mShortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); mControlsView.animate().translationY(visible ? 0 : mControlsHeight).setDuration(mShortAnimTime); } else mControlsView.setVisibility(visible ? View.VISIBLE : View.GONE); if (visible && AUTO_HIDE) delayedHide(AUTO_HIDE_DELAY_MILLIS); } }); // Set up the user interaction to manually show or hide the system UI. mVideoHolder.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (TOGGLE_ON_CLICK) { mSystemUiHider.toggle(); } else { mSystemUiHider.show(); } } }); mDrawer.openDrawer(mMoviesList); }
From source file:com.bookkos.bircle.CaptureActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); _context = getApplicationContext();//www .j a v a 2 s. c o m _activity = this; currentTime = new Time("Asia/Tokyo"); // exceptionHandler = new ExceptionHandler(_context); // Thread.setDefaultUncaughtExceptionHandler(exceptionHandler); // sharedPreference???, user_id?group_id?registration_id?? getUserData(); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // ?? WindowManager window_manager = getWindowManager(); Display display = window_manager.getDefaultDisplay(); Point point = new Point(); display.getSize(point); displayWidth = point.x; displayHeight = point.y; displayInch = getInch(); // ??4??????? textSize = 17 * (displayInch / 4); actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_USE_LOGO); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); String title_text = ""; subGroupText = ""; groupText = groupName; if (displayInch < 4.7) { title_text = "<small><small><small>??: </small></small></small>"; resizeTitleSizeTooSmall(); } else if (displayInch >= 4.7 && displayInch < 5.5) { title_text = "<small><small>??: </small></small>"; resizeTitleSizeSmall(); } else if (displayInch >= 5.5 && displayInch < 6.5) { title_text = "<small>??: </small>"; resizeTitleSizeMiddle(); } else if (displayInch >= 6.5 && displayInch < 8) { title_text = "<small>??: </small>"; resizeTitleSizeLarge(); } else { title_text = "??: "; } String modify_group_text = title_text + "<font color=#FF0000>" + groupName + "</font>"; actionBar.setTitle(Html.fromHtml(modify_group_text)); Resources resources = _context.getResources(); int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); titleBarHeight = resources.getDimensionPixelSize(resourceId); setContentView(R.layout.capture); returnBorrowHelpView = (ImageView) findViewById(R.id.return_borrow_help_view); returnBorrowHelpView.setImageResource(R.drawable.return_borrow_help); returnBorrowHelpView.setTranslationY(displayHeight / 5 + titleBarHeight); returnBorrowHelpView.setLayoutParams(new FrameLayout.LayoutParams(displayWidth, displayHeight / 5 + titleBarHeight, Gravity.BOTTOM | Gravity.CENTER)); registHelpView = (ImageView) findViewById(R.id.regist_help_view); registHelpView.setImageResource(R.drawable.regist_help); registHelpView.setTranslationY(displayHeight / 5 + titleBarHeight); registHelpView.setLayoutParams(new FrameLayout.LayoutParams(displayWidth, displayHeight / 5 + titleBarHeight, Gravity.BOTTOM | Gravity.CENTER)); registHelpView.setVisibility(View.GONE); leftDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); leftDrawer = (ListView) findViewById(R.id.left_drawer); textView = (TextView) findViewById(R.id.textView); modeText = (TextView) findViewById(R.id.mode_text); modeText.setTextColor(Color.rgb(56, 234, 123)); modeText.setTextSize(textSize); modeText.setTypeface(Typeface.SERIF.MONOSPACE, Typeface.BOLD); strokeColor = Color.rgb(56, 234, 123); borrowReturnButton = (Button) findViewById(R.id.borrowReturnButton); registButton = (Button) findViewById(R.id.registButton); returnHistoryButton = (Button) findViewById(R.id.return_history_button); helpViewButton = (Button) findViewById(R.id.help_view_button); registSelectShelfRelativeLayout = (RelativeLayout) findViewById(R.id.regist_select_shelf_relative_layout); textViewLinearLayout = (LinearLayout) findViewById(R.id.text_view_linear_layout); buttonLinearLayout = (LinearLayout) findViewById(R.id.button_linear_layout); listViewLinearLayout = (LinearLayout) findViewById(R.id.list_view_linear_layout); decisionButton = (Button) findViewById(R.id.decision_button); cancelButton = (Button) findViewById(R.id.cancel_button); shelfListView = (ListView) findViewById(R.id.shelf_list_view); tempTextView = (TextView) findViewById(R.id.temp_text_view); // bookListViewAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1); bookListViewAdapter = new BookListViewAdapter(_context, R.layout.book_list_row, this); bookRegistRelativeLayout = (RelativeLayout) findViewById(R.id.book_regist_relative_layout); bookRegistLinearLayout = (LinearLayout) findViewById(R.id.book_regist_linear_layout); bookRegistListViewLinearLayout = (LinearLayout) findViewById(R.id.book_regist_list_view_linear_layout); bookRegistListView = (ListView) findViewById(R.id.book_regist_list_view); bookRegistTextView = (TextView) findViewById(R.id.book_regist_text_view); bookRegistCancelButton = (Button) findViewById(R.id.book_regist_cancel_button); registFlag = 0; int borrowReturnButton_width = displayWidth / 5 * 2; int borrowReturnButton_height = displayHeight / 10; int borrowReturnButton_x = ((displayWidth / 2) - borrowReturnButton_width) / 2; int borrowReturnButton_y = displayHeight / 2 + titleBarHeight; borrowReturnButton.setTranslationX(borrowReturnButton_x); borrowReturnButton.setTranslationY(borrowReturnButton_y); borrowReturnButton .setLayoutParams(new FrameLayout.LayoutParams(borrowReturnButton_width, borrowReturnButton_height)); borrowReturnButton.setBackgroundColor(Color.rgb(56, 234, 123)); borrowReturnButton.setText("??\n"); borrowReturnButton.setTextSize(textSize * 7 / 10); borrowReturnButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { arrayList.clear(); registFlag = 0; borrowReturnButton.setText("??\n"); borrowReturnButton.setEnabled(false); borrowReturnButton.setTextColor(Color.WHITE); borrowReturnButton.setBackgroundColor(Color.rgb(56, 234, 123)); registButton.setText("?\n??"); registButton.setEnabled(true); registButton.setTextColor(Color.GRAY); registButton.setBackgroundColor(Color.argb(170, 21, 38, 45)); modeText.setText("??"); modeText.setTextColor(Color.rgb(56, 234, 123)); returnBorrowHelpView.setVisibility(View.VISIBLE); registHelpView.setVisibility(View.GONE); strokeColor = Color.rgb(56, 234, 123); } }); int registButton_width = displayWidth / 5 * 2; int registButton_height = displayHeight / 10; int registButton_x = (displayWidth / 2) + ((displayWidth / 2) - registButton_width) / 2; int registButton_y = displayHeight / 2 + titleBarHeight; registButton.setTranslationX(registButton_x); registButton.setTranslationY(registButton_y); registButton.setLayoutParams(new FrameLayout.LayoutParams(registButton_width, registButton_height)); registButton.setBackgroundColor(Color.argb(170, 21, 38, 45)); registButton.setTextColor(Color.GRAY); registButton.setTextSize(textSize * 7 / 10); registButton.setText("?\n??"); registButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { arrayList.clear(); registFlag = 1; borrowReturnButton.setText("??\n??"); borrowReturnButton.setEnabled(true); borrowReturnButton.setTextColor(Color.GRAY); borrowReturnButton.setBackgroundColor(Color.argb(170, 9, 54, 16)); registButton.setText("?\n"); registButton.setEnabled(false); registButton.setTextColor(Color.WHITE); registButton.setBackgroundColor(Color.rgb(62, 162, 229)); modeText.setText("?"); modeText.setTextColor(Color.rgb(62, 162, 229)); returnBorrowHelpView.setVisibility(View.GONE); registHelpView.setVisibility(View.VISIBLE); strokeColor = Color.rgb(62, 162, 229); } }); returnHistoryButton.setText("????"); returnHistoryButton.setTextSize(textSize * 7 / 10); returnHistoryButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { leftDrawerLayout.openDrawer(Gravity.RIGHT); // animateTranslationY(bookRegistRelativeLayout, displayHeight, displayHeight - displayHeight / 4 - titleBarHeight); } }); getReturnHistory(); getCurrentTime(); setHelpView(); setScanUnregisterBookView(); setBookRegistView(); arrayList = new ArrayList<String>(); tempRegistIsbn = ""; initBookRegistUrl = book_register_url + "?user_id=" + userId + "&group_id=" + groupId; initLendRegistUrl = lend_register_url + "?user_id=" + userId + "&group_id=" + groupId; initTemporaryLendRegistUrl = temporary_lend_register_url + "?user_id=" + userId + "&group_id=" + groupId; initCatalogRegistUrl = catalog_register_url + "?group_id=" + groupId + "&book_code="; initManuallyCatalogRegistUrl = manually_catalog_register_url + "?group_id=" + groupId + "&book_code="; getStatusUrl = get_status_url + "?group_id=" + groupId + "&user_id=" + userId; hasSurface = false; inactivityTimer = new InactivityTimer(this); bircleBeepManager = new BircleBeepManager(this); ambientLightManager = new AmbientLightManager(this); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); toastText = ""; }