List of usage examples for android.support.v4.view WindowCompat FEATURE_ACTION_BAR
int FEATURE_ACTION_BAR
To view the source code for android.support.v4.view WindowCompat FEATURE_ACTION_BAR.
Click Source Link
From source file:org.mariotaku.twidere.activity.support.BrowserActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); super.onCreate(savedInstanceState); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); }/* www . ja va 2s . c o m*/ mUri = getIntent().getData(); if (mUri == null) { Toast.makeText(this, R.string.error_occurred, Toast.LENGTH_SHORT).show(); finish(); return; } final FragmentTransaction ft = getFragmentManager().beginTransaction(); final Fragment fragment = Fragment.instantiate(this, BaseWebViewFragment.class.getName()); final Bundle bundle = new Bundle(); bundle.putString(EXTRA_URI, mUri.toString()); fragment.setArguments(bundle); ft.replace(android.R.id.content, fragment); ft.commit(); }
From source file:com.example.android.supportv7.app.ActionBarMechanics.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // The Action Bar is a window feature. The feature must be requested // before setting a content view. Normally this is set automatically // by your Activity's theme in your manifest. The provided system // theme Theme.WithActionBar enables this for you. Use it as you would // use Theme.NoTitleBar. You can add an Action Bar to your own themes // by adding the element <item name="android:windowActionBar">true</item> // to your style definition. supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); }
From source file:ivl.android.moneybalance.CalculationEditorActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); setContentView(R.layout.calculation_editor); setTitle(R.string.new_calculation); titleField = (EditText) findViewById(R.id.calculation_title); currencyField = (Spinner) findViewById(R.id.calculation_currency); personList = (LinearLayout) findViewById(R.id.person_list); CurrencySpinnerAdapter adapter = new CurrencySpinnerAdapter(this); int selected = adapter.findItem(getDefaultCurrency()); currencyField.setAdapter(adapter);/*www .j a v a 2 s . com*/ currencyField.setSelection(selected); if (savedInstanceState != null) { List<String> personNames = savedInstanceState.getStringArrayList("personNames"); if (personNames != null) { for (String personName : personNames) { PersonView view = addPersonRow(); view.nameField.setText(personName); } } } createOrDeletePersonRows(); }
From source file:android.support.v7.app.ActionBarActivityDelegateICS.java
@Override public void onCreate(Bundle savedInstanceState) { // Set framework uiOptions from the support metadata value if (UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.equals(getUiOptionsFromMetadata())) { mActivity.getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW, ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); }/*from ww w . j a va2s . c o m*/ super.onCreate(savedInstanceState); if (mHasActionBar) { // If action bar is requested by inheriting from the appcompat theme, // the system will not know about that. So explicitly request for an action bar. mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); } if (mOverlayActionBar) { mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY); } /* * This goofy move needs some explanation. * * The verifier on older platform versions has some interesting side effects if * a class defines a method that takes a parameter of a type that doesn't exist. * In this case, that type is android.view.ActionMode. Therefore, ActionBarActivity * cannot override the onActionModeStarted/Finished methods without causing nastiness * when it is loaded on older platform versions. * * Since these methods are actually part of the window callback and not intrinsic to * Activity itself, we can install a little shim with the window instead that knows * about the ActionMode class. Note that this means that any new methods added to * Window.Callback in the future won't get proxied without updating the support lib, * but we shouldn't be adding new methods to public interfaces that way anyway...right? ;) */ final Window w = mActivity.getWindow(); w.setCallback(createWindowCallbackWrapper(w.getCallback())); }
From source file:ivl.android.moneybalance.ExpenseEditorActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); setContentView(R.layout.expense_editor); titleView = (AutoCompleteTextView) findViewById(R.id.expense_title); amountView = (EditText) findViewById(R.id.expense_amount); currencySpinner = (Spinner) findViewById(R.id.expense_currency); payerView = (TextView) findViewById(R.id.expense_payer); dateView = (TextView) findViewById(R.id.expense_date); customSplitCheckBox = (CheckBox) findViewById(R.id.custom_split); customSplitTable = (TableLayout) findViewById(R.id.expense_split_table); Intent intent = getIntent();/*from w ww . j av a 2 s .c o m*/ long calculationId = intent.getLongExtra(PARAM_CALCULATION_ID, -1); long expenseId = intent.getLongExtra(PARAM_EXPENSE_ID, -1); calculation = calculationDataSource.get(calculationId); persons = calculation.getPersons(); expenseDataSource = new ExpenseDataSource(dbHelper, calculation); mode = (expenseId >= 0 ? Mode.EDIT_EXPENSE : Mode.NEW_EXPENSE); if (mode == Mode.EDIT_EXPENSE) { setTitle(R.string.edit_expense); expense = expenseDataSource.get(expenseId); titleView.setText(expense.getTitle()); } else { setTitle(R.string.new_expense); expense = new Expense(calculation); long personId = intent.getLongExtra(PARAM_PERSON_ID, -1); expense.setPerson(calculation.getPersonById(personId)); long millis = intent.getLongExtra(PARAM_DATE, -1); if (millis > 0) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(millis); expense.setDate(cal); } } List<java.util.Currency> currencies = new ArrayList<>(); for (Currency currency : calculation.getCurrencies()) currencies.add(java.util.Currency.getInstance(currency.getCurrencyCode())); CurrencySpinnerAdapter adapter = new CurrencySpinnerAdapter(this, currencies); adapter.setSymbolOnly(true); Currency currency = expense.getCurrency(); currencyHelper = currency.getCurrencyHelper(); currencySpinner.setAdapter(adapter); currencySpinner.setSelection(adapter.findItem(currency.getCurrencyCode())); currencySpinner.setEnabled(currencies.size() > 1); currencySpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { updateCurrency(); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); if (mode == Mode.EDIT_EXPENSE) { String formatted = currencyHelper.format(expense.getAmount(), false); amountView.setText(formatted); } Set<String> expenseTitles = new HashSet<>(); for (Expense expense : calculation.getExpenses()) expenseTitles.add(expense.getTitle()); ArrayAdapter<String> expenseTitlesAdapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, expenseTitles.toArray(new String[expenseTitles.size()])); titleView.setAdapter(expenseTitlesAdapter); titleView.setThreshold(1); createCustomSplitRows(); updateCustomSplit(); updatePayer(); updateDate(); customSplitCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { customSplitTable.setVisibility(isChecked ? View.VISIBLE : View.GONE); } }); amountView.addTextChangedListener(updateCustomSplitTextWatcher); payerView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pickPayer(); } }); dateView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pickDate(); } }); }
From source file:org.mariotaku.twidere.activity.support.BaseDialogWhenLargeActivity.java
private void setupWindow() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS); }/*from w ww . ja v a 2 s . c o m*/ supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY); supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_MODE_OVERLAY); }
From source file:ivl.android.moneybalance.CalculationListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); setContentView(R.layout.calculation_list); listView = (ListView) findViewById(R.id.calculation_list); adapter = new CalculationAdapter(this); listView.setAdapter(adapter);// w ww . j a v a2 s. co m listView.setOnItemClickListener(this); registerForContextMenu(listView); setContentView(listView); refresh(); }
From source file:android.support.v7.app.ActionBarActivityDelegateBase.java
@Override public boolean supportRequestWindowFeature(int featureId) { switch (featureId) { case WindowCompat.FEATURE_ACTION_BAR: mHasActionBar = true;// w ww . jav a2s. c om return true; case WindowCompat.FEATURE_ACTION_BAR_OVERLAY: mOverlayActionBar = true; return true; case Window.FEATURE_PROGRESS: mFeatureProgress = true; return true; case Window.FEATURE_INDETERMINATE_PROGRESS: mFeatureIndeterminateProgress = true; return true; default: return mActivity.requestWindowFeature(featureId); } }
From source file:ivl.android.moneybalance.ExpenseListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); setContentView(R.layout.expense_list); Intent intent = getIntent();/* w w w.j av a2 s . co m*/ calculationId = intent.getLongExtra(PARAM_CALCULATION_ID, -1); ExpandableListView listView = (ExpandableListView) findViewById(R.id.expense_list); adapter = new ExpenseAdapter(this); listView.setAdapter(adapter); listView.setOnChildClickListener(this); registerForContextMenu(listView); setContentView(listView); refresh(); }