Java Code Examples for com.melnykov.fab.FloatingActionButton#setOnClickListener()
The following examples show how to use
com.melnykov.fab.FloatingActionButton#setOnClickListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From CameraColorPicker with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mToolbar = (Toolbar) findViewById(R.id.activity_main_toolbar); mToolbar.setTitle(R.string.app_name); setSupportActionBar(mToolbar); mCurrentPageId = PAGE_ID_COLOR_ITEM_LIST; mColorItemListPage = new ColorItemListPage(this); mColorItemListPage.setListener(this); mPaletteListPage = new PaletteListPage(this); mPaletteListPage.setListener(this); mFab = (FloatingActionButton) findViewById(R.id.activity_main_fab); mFab.setOnClickListener(this); final MyPagerAdapter adapter = new MyPagerAdapter(); mTabs = (PagerSlidingTabStrip) findViewById(R.id.activity_main_tabs); mViewPager = (ViewPager) findViewById(R.id.activity_main_view_pager); mViewPager.setAdapter(adapter); mTabs.setViewPager(mViewPager); mTabs.setOnPageChangeListener(this); mMainActivityFlavor = new MainActivityFlavor(this); }
Example 2
Source File: WidgetPickerActivity.java From AcDisplay with GNU General Public License v2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { if (mConfig.isWallpaperShown()) setTheme(R.style.MaterialTheme_WidgetPicker_Wallpaper); super.onCreate(savedInstanceState); setContentView(R.layout.activity_widget_picker); mEmptyView = findViewById(R.id.empty); mFab = (FloatingActionButton) findViewById(R.id.fab); mFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startAppWidgetDiscover(); } }); mAppWidgetManager = AppWidgetManager.getInstance(this); mHostContainer = (ViewGroup) findViewById(R.id.appwidget_container); mAppWidgetHost = new MyAppWidgetHost(this, HostWidget.HOST_ID); initSwitchBar(); initSeekBars(); }
Example 3
Source File: FabToolbar.java From fab-toolbar with MIT License | 5 votes |
private void init() { screenWidth = getResources().getDisplayMetrics().widthPixels; inflate(getContext(), R.layout.fab_toolbar, this); button = (FloatingActionButton) findViewById(R.id.button); button.setOnClickListener(new ButtonClickListener()); container = ((LinearLayout) findViewById(R.id.container)); }
Example 4
Source File: FPListView.java From FancyPlaces with GNU General Public License v3.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fancy_places_list_view, container, false); // add places to list fancyPlacesList = (ListView) v.findViewById(R.id.fp_list_view); FloatingActionButton fab = (FloatingActionButton) v.findViewById(R.id.fp_list_fab); fab.attachToListView(fancyPlacesList); // set on click listener fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fancyPlaceSelectedCallback.onFancyPlaceSelected(0, OnFancyPlaceSelectedListener.INTENT_CREATE_NEW); } }); // set adapter fancyPlacesList.setAdapter(parent.fancyPlaceArrayAdapter); // add on mode change listener onListModeChangeListeners.add(parent.fancyPlaceArrayAdapter); changeListMode(IOnListModeChangeListener.MODE_NORMAL); return v; }
Example 5
Source File: FPOsmDroidView.java From FancyPlaces with GNU General Public License v3.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fancy_places_osmview, container, false); mMapView = (OsmMapViewScrollWorkaround) v.findViewById(R.id.fp_map_view); mMapView.setTileSource(TileSourceFactory.MAPQUESTOSM); mMapView.setMultiTouchControls(true); mMapView.setTilesScaledToDpi(true); mMapView.setWorkaroundEnabled(true); mapHandler = new OsmMapHandler(mMapView, fancyPlaceSelectedCallback); mapHandler.setAdapter(parent.fancyPlaceArrayAdapter); locationHandler = ((FancyPlacesApplication) parent.getApplicationContext()).getLocationHandler(); locationHandler.addOnLocationUpdatedListener(this); locationHandler.updateLocation(false); // add fab callback FloatingActionButton fab = (FloatingActionButton) v.findViewById(R.id.fp_map_fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fancyPlaceSelectedCallback.onFancyPlaceSelected(0, OnFancyPlaceSelectedListener.INTENT_CREATE_NEW); } }); return v; }
Example 6
Source File: AbstractBrowserFragment.java From SimpleExplorer with GNU General Public License v3.0 | 5 votes |
protected void initFab(View rootView) { FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fabbutton); fab.attachToListView(mListView); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showMenu(view); } }); }
Example 7
Source File: SongsFragment.java From Muzesto with GNU General Public License v3.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //requestPermissions(); View rootView = inflater.inflate( R.layout.fragment_recyclerview, container, false); recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab); FastScroller fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller); fastScroller.setRecyclerView(recyclerView); audioVisualization = (AudioVisualization) rootView.findViewById(R.id.visualizer_view); backdrop = (ImageView) rootView.findViewById(R.id.white_backdrop); fab.attachToRecyclerView(recyclerView); fab.setColorNormal(getResources().getColor(R.color.colorAccent)); fab.setColorPressed(getResources().getColor(R.color.widget_pause)); fab.setColorRipple(getResources().getColor(R.color.window_background)); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { MusicPlayer.shuffleAll(getActivity()); } }, 80); } }); new loadSongs().execute(""); ((BaseActivity) getActivity()).setMusicStateListenerListener(this); // if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED // && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.MODIFY_AUDIO_SETTINGS) == PackageManager.PERMISSION_GRANTED) { // // requestPermissions(); // // } // // requestPermissions(); SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); Boolean stateWave = sharedPrefs.getBoolean(getString(R.string.pref_switch_wave_key), true); if(stateWave) backdrop.setVisibility(View.GONE); else backdrop.setVisibility(View.VISIBLE); return rootView; }
Example 8
Source File: ContactsFragment.java From OPFPush with Apache License 2.0 | 4 votes |
private void initFAB(@NonNull final View view) { final FloatingActionButton addContactFab = (FloatingActionButton) view.findViewById(R.id.add_contact_fab); addContactFab.attachToListView(contactsListView); addContactFab.setOnClickListener(onFabClickListener()); }
Example 9
Source File: BaseActivity.java From Dashboard with MIT License | 2 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(getLayoutResource()); toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { setSupportActionBar(toolbar); YoYo.with(Techniques.RotateIn) .duration(600) .playOn(findViewById(R.id.imageView4)); YoYo.with(Techniques.FadeIn) .duration(1800) .playOn(findViewById(R.id.imageView3)); YoYo.with(Techniques.Shake) .delay(800) .interpolate(new AccelerateDecelerateInterpolator()) .duration(2100) .playOn(findViewById(R.id.imageView3)); } ScrollView scrollView = (ScrollView) findViewById(R.id.scroll); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.attachToScrollView((com.melnykov.fab.ObservableScrollView) scrollView); fab.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //For example: Start Wallpaper Home Activity Intent intent = new Intent(v.getContext(), com.antonioleiva.materialeverywhere.HomeActivity.class); startActivity(intent); } }); }
Example 10
Source File: BaseActivity.java From Dashboard with MIT License | 2 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(getLayoutResource()); toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { setSupportActionBar(toolbar); YoYo.with(Techniques.RotateIn) .duration(600) .playOn(findViewById(R.id.imageView4)); YoYo.with(Techniques.FadeIn) .duration(1800) .playOn(findViewById(R.id.imageView3)); YoYo.with(Techniques.Shake) .delay(800) .interpolate(new AccelerateDecelerateInterpolator()) .duration(2100) .playOn(findViewById(R.id.imageView3)); } ScrollView scrollView = (ScrollView) findViewById(R.id.scroll); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.attachToScrollView((com.melnykov.fab.ObservableScrollView) scrollView); fab.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //For example: Start Wallpaper Home Activity Intent intent = new Intent(v.getContext(), com.antonioleiva.materialeverywhere.HomeActivity.class); startActivity(intent); } }); }