public void startOpenAnimation(boolean finished) { TranslateTransition transition = new TranslateTransition(); transition.setNode(this); transition.setDuration(Duration.millis(500)); if (finished) { transition.setToX(0); transition.setOnFinished( ev -> { drawerOpen = false; actionBar.setDrawerOpen(false); oldX = 0; startX = 0; }); } else { transition.setToX(getPrefWidth()); transition.setOnFinished( ev -> { drawerOpen = true; actionBar.setDrawerOpen(true); oldX = 0; startX = 0; }); } transition.play(); animationFinished = false; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_customize); Bundle bundle = getIntent().getExtras(); if (bundle != null) { type = bundle.getString("Type"); } bundle = getIntent().getBundleExtra("user_details"); if (bundle != null) { if (type.equals("Name")) { this.givenValue = bundle.getString("user_name"); } else { this.givenValue = bundle.getString("user_phone"); ((EditText) findViewById(R.id.customize_old)).setInputType(InputType.TYPE_CLASS_PHONE); ((EditText) findViewById(R.id.customize_new)).setInputType(InputType.TYPE_CLASS_PHONE); } } ((TextView) findViewById(R.id.customize_title)) .setText(getString(R.string.customize_title) + " " + type); ((EditText) findViewById(R.id.customize_old)) .setHint(getString(R.string.customize_old) + " " + type); ((EditText) findViewById(R.id.customize_new)) .setHint(getString(R.string.customize_new) + " " + type); ((Button) findViewById(R.id.customize_btn)) .setText(getString(R.string.customize_btn) + " " + type); ActionBar mainActionBar = getSupportActionBar(); mainActionBar.setDisplayHomeAsUpEnabled(true); }
public void setActionBarDescription(int paramInt) { ActionBar localActionBar = AppCompatDelegateImplBase.this.getSupportActionBar(); if (localActionBar != null) { localActionBar.setHomeActionContentDescription(paramInt); } }
public void setActionBarUpIndicator(Drawable paramDrawable, int paramInt) { ActionBar localActionBar = AppCompatDelegateImplBase.this.getSupportActionBar(); if (localActionBar != null) { localActionBar.setHomeAsUpIndicator(paramDrawable); localActionBar.setHomeActionContentDescription(paramInt); } }
protected void setActionBarState() { final ActionBar bar = activity.getActionBar(); if (null != bar && !uiFullscreen) { bar.show(); } else if (null != bar && uiFullscreen) { bar.hide(); } }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayShowTitleEnabled(false); initCartoDB(); initTabs(); initLocation(); }
public final boolean onMenuItemSelected(int paramInt, MenuItem paramMenuItem) { if (super.onMenuItemSelected(paramInt, paramMenuItem)) { return true; } ActionBar localActionBar = a(); if ((paramMenuItem.getItemId() == 16908332) && (localActionBar != null) && ((0x4 & localActionBar.a()) != 0)) { return b(); } return false; }
private void initTabs() { listingListener = new TabListener<ListingListFragment>(this, "listinglist", ListingListFragment.class); ActionBar.Tab tab = actionBar.newTab().setText("Listings").setTabListener(listingListener); actionBar.addTab(tab); tab = actionBar .newTab() .setText("Requests") .setTabListener( new TabListener<RequestListFragment>( this, "requestlist", RequestListFragment.class)); actionBar.addTab(tab); myListingFrag = (ListingListFragment) listingListener.getFragment(); myListingFrag.setClient(myClient); }
public DrawerLayout() { super(); sceneProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue != null) { if (!getScene() .getStylesheets() .contains(getClass().getResource("application.css").toExternalForm())) getScene() .getStylesheets() .add(getClass().getResource("application.css").toExternalForm()); newValue .widthProperty() .addListener( (ob, o, n) -> { if (getPrefWidth() == -1) { setPrefWidth(n.doubleValue() * 0.4); setLayoutX(-getPrefWidth()); } }); newValue .heightProperty() .addListener( (ob, o, n) -> { setPrefHeight(n.doubleValue() - 50); }); setLayoutY(50); } }); translateXProperty() .addListener( (observable, oldValue, newValue) -> { actionBar.setAnimationProgress(-newValue.doubleValue() / getWidth()); }); getStyleClass().add("material-drawer"); addEventHandler( MouseEvent.MOUSE_DRAGGED, e -> { if (oldX == 0) startX = e.getX(); if (oldX != 0 && (e.getX() - oldX) < 0) { if (e.getSceneX() < getWidth() / 2) { animationFinished = true; } setTranslateX(getTranslateX() - 4); } oldX = e.getX(); }); addEventHandler( MouseEvent.MOUSE_RELEASED, e -> { e.consume(); if (startX != 0) { startOpenAnimation(animationFinished); } }); }
public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU && !checkTransitionAnimation() && !startedTracking && currentActionBar != null) { currentActionBar.onMenuButtonPressed(); } return super.onKeyUp(keyCode, event); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener( new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar.addTab( actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } youTubeService = new YouTubeService(); }
public void onBackPressed() { if (startedTracking || checkTransitionAnimation() || fragmentsStack.isEmpty()) { return; } if (currentActionBar != null && currentActionBar.isSearchFieldVisible) { currentActionBar.closeSearchField(); return; } BaseFragment lastFragment = fragmentsStack.get(fragmentsStack.size() - 1); if (lastFragment.onBackPressed()) { if (!fragmentsStack.isEmpty()) { closeLastFragment(true); } } }
/** @see Activity#onPanelClosed(int, Menu) */ public void onPanelClosed(int featureId, Menu menu) { if (featureId == Window.FEATURE_ACTION_BAR) { mActionBar.dispatchMenuVisibilityChanged(false); } }
public void onActionModeStarted(Object mode) { if (currentActionBar != null) { currentActionBar.setVisibility(GONE); } inActionMode = true; }
public void onActionModeFinished(Object mode) { if (currentActionBar != null) { currentActionBar.setVisibility(VISIBLE); } inActionMode = false; }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { try { mSharedPreferences = Prefs.getSharedPreferences(this); } catch (NullPointerException e) { if (BuildConfig.DEBUG) { Log.w("[" + TAG + "]", "mSharedPreferences == NullPointerException :" + e.getMessage()); } } mSharedPreferences.registerOnSharedPreferenceChangeListener(this); if (Prefs.getThemeType(this) == false) { mThemeId = R.style.AppTheme_Light; setTheme(mThemeId); } else { mThemeId = R.style.AppTheme_Dark; setTheme(mThemeId); } // Eula.showDisclaimer( this ); Eula.showEula(this, getApplicationContext()); mActionBar = getActionBar(); if (mActionBar != null) { mActionBar.setDisplayHomeAsUpEnabled(false); mActionBar.setDisplayShowHomeEnabled(true); mActionBar.setDisplayShowTitleEnabled(true); } else { if (BuildConfig.DEBUG) { Log.w("[" + TAG + "]", "mActionBar == null"); } } Bundle extras = getIntent().getExtras(); if (extras != null) { this.setTitle(extras.getString("dir") + " :: " + getString(R.string.app_name)); } else { this.setTitle(" :: " + getString(R.string.app_name)); } super.onCreate(savedInstanceState); setContentView(R.layout.main); tvDisplay = (TextView) findViewById(R.id.tvDisplay); bRename = (Button) findViewById(R.id.bRename); bSettings = (Button) findViewById(R.id.bSettings); bHelp = (Button) findViewById(R.id.bHelp); bExit = (Button) findViewById(R.id.bExit); bRename.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { Intent openAndroidFileBrowser = new Intent("com.scto.filerenamer.ANDROIDFILEBROWSER"); openAndroidFileBrowser.putExtra("what", "renamer"); openAndroidFileBrowser.putExtra("theme", mThemeId); startActivity(openAndroidFileBrowser); } }); bSettings.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { Intent openPreferencesActivity = new Intent("com.scto.filerenamer.PREFERENCESACTIVITY"); startActivity(openPreferencesActivity); } }); bHelp.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { FragmentManager fm = getSupportFragmentManager(); HelpDialog helpDialog = new HelpDialog(); helpDialog.show(fm, "dlg_help"); } }); bExit.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { FragmentManager fm = getSupportFragmentManager(); ExitDialog exitDialog = new ExitDialog(); exitDialog.show(fm, "dlg_exit"); } }); /* ChangeLog cl = new ChangeLog( this ); if( cl.firstRun() ) { cl.getLogDialog().show(); } */ init(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); state = savedInstanceState; data = getIntent().getExtras(); // Mark as read SMILMessageProxy sm = SMILActivity.inbox.get(data.getInt("index")); AsyncFetchSMILMessage async = new AsyncFetchSMILMessage(this); sm = async.editMessage(sm); sm.setRead(true); async.updateMessage(sm); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.message_view); SharedPreferences myPrefs = this.getSharedPreferences("username", MODE_WORLD_READABLE); autoPlay = myPrefs.getBoolean("autoPlay", true); alertAutoPlay = new AlertDialog.Builder(this).create(); alertAutoPlay.setTitle("Did you know?"); alertAutoPlay.setMessage( "If you turn your phone into landscape mode the message will automatically play. Turn your phone back up to return to the message screen."); alertAutoPlay.setButton( "Let me try!", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); alertAutoPlay.setButton2( "Not for me! (disable feature)", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { SharedPreferences.Editor myPrefEdit = ViewMessageActivity.this .getSharedPreferences("username", MODE_WORLD_READABLE) .edit(); myPrefEdit.putBoolean("autoPlay", false); myPrefEdit.commit(); ViewMessageActivity.autoPlay = false; playMessage(true); return; } }); _actionBar = (ActionBar) findViewById(R.id.actionBar); _actionBar.setTitle("Message Details"); _actionBar.setHomeListener( new OnClickListener() { public void onClick(View v) { ViewMessageActivity.this.finish(); } }); workingDir += "/" + data.getString("title"); items = new ScrollItemManager(findViewById(R.id.scrollHolder)); items.addItem(getApplicationContext(), true); items.setTitle(data.getString("title")); items.setIcon(R.drawable.ic_home); items.setListener(this, 1); TextView item1Text1 = new TextView(this); item1Text1.setText( "From: " + data.getString("Sender") + " on " + data.getString("date")); item1Text1.setTextColor(Color.BLACK); items.addToLinear(item1Text1); items.addItem(getApplicationContext(), true); TextView item2Text1 = new TextView(this); item2Text1.setText("Subject:"); item2Text1.setTextColor(Color.BLACK); TextView item2Text2 = new TextView(this); item2Text2.setText(data.getString("message")); item2Text2.setTextColor(Color.BLACK); items.addToLinear(item2Text1); items.addLine(getApplicationContext()); items.addToLinear(item2Text2); items.addItem(getApplicationContext()); items.setTitle("Play Message"); items.setListener(this, 1); items.addItem(getApplicationContext()); items.setTitle("Reply"); // items.setListener(this, 1); items.addItem(getApplicationContext()); items.setTitle("Forward"); items.setListener(this, 2); items.addItem(getApplicationContext()); items.setTitle("Reset Preference"); items.setListener(this, 3); }
/** Called when the dialog is starting. */ protected void onStart() { if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(true); }
/** Called to tell you that you're stopping. */ protected void onStop() { if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(false); }
public boolean isNavigationVisible() { ActionBar localActionBar = AppCompatDelegateImplBase.this.getSupportActionBar(); return (localActionBar != null) && ((localActionBar.getDisplayOptions() & 0x4) != 0); }
/** @see Activity#onMenuOpened(int, Menu) */ public boolean onMenuOpened(int featureId, Menu menu) { if (featureId == Window.FEATURE_ACTION_BAR) { mActionBar.dispatchMenuVisibilityChanged(true); } return true; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); final String ID = intent.getStringExtra("ID"); final String name = intent.getStringExtra("Name"); final ActionBar actionBar = getSupportActionBar(); setContentView(R.layout.individual_colour_change_layout); SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); ColH = settings.getInt("houCol" + ID, getResources().getColor(R.color.clokH)); ColM = settings.getInt("minCol" + ID, getResources().getColor(R.color.clokM)); ColS = settings.getInt("secCol" + ID, getResources().getColor(R.color.clokS)); String currentTitle = name + ": " + getString(R.string.chsColour); if (actionBar != null) { actionBar.setTitle(currentTitle); actionBar.setDisplayUseLogoEnabled(false); } draw(); Button reset = (Button) findViewById(R.id.reset); reset.setOnClickListener( v -> { Editor editor = settings.edit(); ColH = IndividualColourChange.this.getResources().getColor(R.color.clokH); ColM = IndividualColourChange.this.getResources().getColor(R.color.clokM); ColS = IndividualColourChange.this.getResources().getColor(R.color.clokS); editor.putInt("houCol" + ID, ColH); editor.putInt("minCol" + ID, ColM); editor.putInt("secCol" + ID, ColS); editor.apply(); IndividualColourChange.this.draw(); }); ImageView colPickH = (ImageView) findViewById(R.id.colorHou); colPickH.setClickable(true); colPickH.setOnClickListener( v -> { ColorSelectorDialog dlg = new ColorSelectorDialog( context, color -> { ColH = color; Editor editor = settings.edit(); editor.putInt("houCol" + ID, ColH); editor.apply(); draw(); }, ColH); dlg.setTitle(IndividualColourChange.this.getString(R.string.hHandCol)); dlg.show(); }); ImageView colPickM = (ImageView) findViewById(R.id.colorMin); colPickM.setClickable(true); colPickM.setOnClickListener( v -> { ColorSelectorDialog dlg = new ColorSelectorDialog( context, color -> { ColM = color; Editor editor = settings.edit(); editor.putInt("minCol" + ID, ColM); editor.apply(); draw(); }, ColM); dlg.setTitle(IndividualColourChange.this.getString(R.string.mHandCol)); dlg.show(); }); ImageView colPickS = (ImageView) findViewById(R.id.colorSec); colPickS.setClickable(true); colPickS.setOnClickListener( v -> { ColorSelectorDialog dlg = new ColorSelectorDialog( context, color -> { ColS = color; Editor editor = settings.edit(); editor.putInt("minCol" + ID, ColS); editor.apply(); draw(); }, ColS); dlg.setTitle(IndividualColourChange.this.getString(R.string.sHandCol)); dlg.show(); }); }
public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) { if (mActionBar != null) { return mActionBar.startActionMode(callback); } return null; }