本文整理汇总了Java中com.melnykov.fab.FloatingActionButton.setOnClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java FloatingActionButton.setOnClickListener方法的具体用法?Java FloatingActionButton.setOnClickListener怎么用?Java FloatingActionButton.setOnClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.melnykov.fab.FloatingActionButton
的用法示例。
在下文中一共展示了FloatingActionButton.setOnClickListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpFAB
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
/**
* Setup utility for the FAB
*
* @param context
* @param icon the icon to apply
* @param button the FAB button
* @param mFABlistener the listener to apply
*/
public static void setUpFAB(Activity context, int icon, FloatingActionButton button, View.OnClickListener mFABlistener) {
button.setVisibility(View.VISIBLE);
button.setType(FloatingActionButton.TYPE_NORMAL);
if (ThemeUtils.getAppTheme3(context) < 6) {
button.setColorNormal(context.getResources().getColor(
ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context)));
button.setColorPressed(context.getResources().getColor(
ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context)));
} else {
button.setColorNormal(ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context));
button.setColorPressed(ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context));
}
button.setImageDrawable(context.getResources().getDrawable(icon));
button.setOnClickListener(mFABlistener);
}
示例2: onViewCreated
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.inject(this, view);
mSwipeRefresh.setOnRefreshListener(this);
mSwipeRefresh.setColorSchemeResources(getFragmentActivity().isEasyRedmine() ? R.color.er_primary : R.color.r_primary);
if (!mLastFilter.equals(Storage.getFilter()) || mAdapter == null) {
setFilteredAdapter(!mLastFilter.equals(Storage.getFilter()));
}
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
fab.attachToListView(getListView());
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NewTaskActivity.start(getFragmentActivity());
}
});
}
示例3: addHelperFab
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
public void addHelperFab(Context context ,HelperFab.Location location,final HelperFab fab) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
final FloatingActionButton newFab = (FloatingActionButton)inflater.inflate(R.layout.fab_layout_normal,null);
newFab.setBackgroundColor(fab.getBackgroundColor());
newFab.setColorNormal(fab.getBackgroundColor());
newFab.setColorPressed(fab.getFabSelectedColor());
newFab.setColorRipple(fab.getFabRippleColor());
newFab.setImageDrawable(fab.getDrawable());
newFab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
fab.onClick();
}
});
if(location == HelperFab.Location.RIGHT) {
helperFabRight = newFab;
}
else if(location == HelperFab.Location.LEFT) {
helperFabLeft = newFab;
}
}
示例4: onCreateView
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment and hold the reference
//in mRootView
mRootView = inflater.inflate(R.layout.fragment_note_list, container, false);
//Get a programmatic reference to the Floating Action Button
mFab = (FloatingActionButton)mRootView.findViewById(R.id.fab);
//attach an onClick listener to the Floating Action Button
mFab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getActivity(), NoteEditorActivity.class));
}
});
setupList();
return mRootView;
}
示例5: onCreate
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@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);
}
示例6: initFloatingActionButton
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
/**
* Initialize the floating action button to add new grade entries.
*/
private void initFloatingActionButton(View rootView) {
fabAddGradeEntry = (FloatingActionButton) rootView.findViewById(R.id.fab_add_grade_entry);
fabAddGradeEntry.attachToRecyclerView(rvGrades);
fabAddGradeEntry.hide();
fabAddGradeEntry.setVisibility(View.GONE);
fabAddGradeEntry.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
adapter.enableEditMode(false);
fabAddGradeEntry.hide(true);
fabAddGradeEntry.setVisibility(View.GONE);
getActivity().invalidateOptionsMenu();
final Intent intent = new Intent(v.getContext(), GradeDetailedActivity.class);
intent.putExtra(GradeDetailedActivity.EXTRA_GRADE_HASH, "");
intent.putExtra(GradeDetailedActivity.EXTRA_ADD_NEW_GRADE_ENTRY, true);
v.getContext().startActivity(intent);
}
});
}
示例7: onCreate
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@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();
}
示例8: onBindViewHolder
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(ColorPaletteViewHolder holder, final int position) {
final FloatingActionButton button = holder.getButton();
button.setColorNormal(mNormalColorList[position]);
button.setColorPressed(mPressedColorList[position]);
button.setColorRipple(mRippleColorList[position]);
setButtonSelectedStatus(button, mSelectedPosition == position);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setButtonSelectedStatus(button, true);
updateButtons(position, mSelectedPosition);
mSelectedPosition = position;
if (mColorSelectedListener != null) {
mColorSelectedListener.onColorSelected(position);
}
}
});
}
示例9: onContentChanged
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onContentChanged() {
super.onContentChanged();
if (!mHasFAB)
return;
View view = getWindow().getDecorView().findViewById(android.R.id.content);
if (view instanceof FrameLayout) {
FrameLayout base = (FrameLayout) view;
if (base.findViewById(R.id.fab) == null) {
FrameLayout layout = (FrameLayout) getLayoutInflater().inflate(R.layout.fab, base);
mFAB = (FloatingActionButton) layout.findViewById(R.id.fab);
layout.removeView(mFAB);
base.addView(mFAB);
mFAB.setColorRipple(UiUtil.darkerColor(mFAB.getColorNormal(), 0.5f));
mFAB.setColorPressed(UiUtil.darkerColor(mFAB.getColorNormal(), 0.3f));
mFAB.setOnClickListener(this);
}
}
}
示例10: onCreateView
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.default_device_view, container, false);
list=(ExpandableListView)view.findViewById(R.id.list);
list.setAdapter(adapter);
list.setOnChildClickListener(this);
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
fab.attachToListView(list);
fab.setOnClickListener(this);
if(conn.isShowAll()){
fab.setImageResource(R.drawable.ic_visibility_black_24dp);
}else{
fab.setImageResource(R.drawable.ic_visibility_off_black_24dp);
}
return view;
}
示例11: onViewCreated
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getLoaderManager().initLoader(LOADER_ID, null, this);
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.contact_list);
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
fab.attachToRecyclerView(recyclerView);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().getSupportFragmentManager().beginTransaction()
.replace(R.id.content_frame, new AllContactsFragment(), SELECT_CONTACTS_TAG)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
.addToBackStack(SELECT_CONTACTS_TRANSACTION).commit();
}
});
}
示例12: onCreate
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStatusBarColor(getResources().getColor(R.color.signal_primary_dark));
final Optional<ExperienceUpgrade> upgrade = getExperienceUpgrade(this);
if (!upgrade.isPresent()) {
onContinue(upgrade);
return;
}
setContentView(R.layout.experience_upgrade_activity);
final ViewPager pager = ViewUtil.findById(this, R.id.pager);
final FloatingActionButton fab = ViewUtil.findById(this, R.id.fab);
pager.setAdapter(new IntroPagerAdapter(getSupportFragmentManager(), upgrade.get().getPages()));
fab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onContinue(upgrade);
}
});
getWindow().setBackgroundDrawable(new ColorDrawable(upgrade.get().getPage(0).backgroundColor));
ServiceUtil.getNotificationManager(this).cancel(NOTIFICATION_ID);
}
示例13: initFab
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
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);
}
});
}
示例14: onCreate
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.down_up_theme);
setContentView(R.layout.activity_library);
myTitle = getString(R.string.app_name);
if (toolbar == null) {
toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
toolbar.setTitle(myTitle);
toolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
mRecyclerView = (RecyclerView) findViewById(
R.id.library_recyclerview);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(layoutManager);
FloatingActionButton libraryFab = (FloatingActionButton) findViewById(R.id.library_fab);
libraryFab.attachToRecyclerView(mRecyclerView);
fetchLibrary();
libraryFab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(), AddBookLibraryActivity.class);
startActivity(i);
}
});
}
示例15: onCreateView
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_signon, container, false);
mUsername = (MaterialEditText) rootView.findViewById(R.id.et_username);
mPassword = (MaterialEditText) rootView.findViewById(R.id.et_password);
Button signup = (Button) rootView.findViewById(R.id.btn_signup);
Button signin = (Button) rootView.findViewById(R.id.btn_signin);
mUsername.setText(Utils.getUserEmail(getActivity()));
FloatingActionButton fb_login = (FloatingActionButton) rootView.findViewById(R.id.btn_facebook);
FloatingActionButton twitter_login = (FloatingActionButton) rootView.findViewById(R.id.btn_twitter);
mTextview = (TextView) rootView.findViewById(R.id.Bookd_text);
typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Lobster-Regular.ttf");
secondTypface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/RobotoCondensed-Regular.ttf");
mTextview.setTypeface(typeface);
mPassword.setTypeface(typeface);
mUsername.setTypeface(typeface);
signin.setTypeface(secondTypface);
signup.setTypeface(secondTypface);
// fb_login.setColorNormal(R.color.button_normal);
// fb_login.setColorPressed(R.color.button_normal_pressed);
// fb_login.setColorRipple(R.color.colorAccent);
// fb_login.setImageResource(R.drawable.ic_action_facebook);
fb_login.setShadow(true);
// twitter_login.setColorNormal(R.color.button_normal);
// twitter_login.setColorPressed(R.color.button_normal_pressed);
// twitter_login.setColorRipple(R.color.colorAccent);
// twitter_login.setImageResource(R.drawable.ic_action_twitter);
twitter_login.setShadow(true);
signup.setOnClickListener(this);
signin.setOnClickListener(this);
fb_login.setOnClickListener(this);
twitter_login.setOnClickListener(this);
return rootView;
}