本文整理汇总了Java中com.github.clans.fab.FloatingActionButton类的典型用法代码示例。如果您正苦于以下问题:Java FloatingActionButton类的具体用法?Java FloatingActionButton怎么用?Java FloatingActionButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FloatingActionButton类属于com.github.clans.fab包,在下文中一共展示了FloatingActionButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: viewSetup
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
/**********************************Setup UI elements and their functionality***********************************/
private void viewSetup() {
fabPoiDetailsAfterRoute = (android.support.design.widget.FloatingActionButton) findViewById(R.id.fabPoiDetailsAfterRoute);
floatingActionButton = (FloatingActionMenu) findViewById(R.id.mainFab);
floatingActionButton.setClosedOnTouchOutside(true);
navigation = (BottomNavigationViewEx) findViewById(R.id.navigation);
//setup bottom navigation
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
navigation.setSelectedItemId(R.id.navigation_categories);
navigation.enableAnimation(false);
navigation.enableShiftingMode(false);
navigation.enableItemShiftingMode(false);
FloatingActionButton fabClearMap = (FloatingActionButton) findViewById(R.id.fabClearMap);
FloatingActionButton fabLocation = (FloatingActionButton) findViewById(R.id.fabLocation);
FloatingActionButton fabAdd = (FloatingActionButton) findViewById(R.id.fabAdd);
FloatingActionButton fabSearch = (FloatingActionButton) findViewById(R.id.fabSearch);
fabClearMap.setOnClickListener(clickListenerFAB);
fabLocation.setOnClickListener(clickListenerFAB);
fabAdd.setOnClickListener(clickListenerFAB);
fabSearch.setOnClickListener(clickListenerFAB);
fabPoiDetailsAfterRoute.setOnClickListener(clickListenerFAB);
}
示例2: initView
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
private void initView() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext, R.color.color_Actionbar)));
}
mCoordinatorLayout = findViewById(R.id.coordinator);
RecyclerView recyclerView = findViewById(R.id.recycle_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new LocationAdapter(this, new ArrayList<Location>());
@SuppressWarnings("unchecked") SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter, recyclerView);
recyclerView.setAdapter(animatorAdapter);
ItemTouchHelper.Callback callback = new ItemTouchHelperCallBackNoMove(mAdapter);
ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
touchHelper.attachToRecyclerView(recyclerView);
mView_FABMenu = findViewById(R.id.fab_menu_1);
FloatingActionButton addLocation = findViewById(R.id.fab_action_1);
addLocation.setVisibility(View.VISIBLE);
addLocation.setLabelText(mContext.getResources().getString(R.string.add_location));
addLocation.setOnClickListener(this);
}
示例3: onNestedScroll
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FrameLayout fabContainer, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, fabContainer, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
if (fabContainer.getChildAt(0) instanceof FloatingActionMenu) {
FloatingActionMenu fabMenu = (FloatingActionMenu) fabContainer.getChildAt(0);
if (dyConsumed > 0) {
fabMenu.hideMenuButton(true);
}
else if (dyConsumed < 0) {
fabMenu.showMenuButton(true);
}
}
else if (fabContainer.getChildAt(0) instanceof FloatingActionButton) {
FloatingActionButton fab = (FloatingActionButton) fabContainer.getChildAt(0);
if (dyConsumed > 0) {
fab.hide(true);
}
else if (dyConsumed < 0) {
fab.show(true);
}
}
}
示例4: setUIComponents
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
private void setUIComponents() {
imageView = (ImageView) findViewById(R.id.imageView);
btntakephoto = (ImageButton) findViewById(R.id.btntakephoto);
btnselectedphoto = (ImageButton) findViewById(R.id.btnselectedphoto);
btnGoTo = (Button) findViewById(R.id.btnGoTo);
texttitle = (TextView) findViewById(R.id.texttitle);
saveImage = (ImageButton) findViewById(R.id.saveImage);
floatingBtnRotate = (FloatingActionButton) findViewById(R.id.floatingBtnRotate);
floatingBtnFacialRecognition = (FloatingActionButton) findViewById(R.id.floatingBtnFacialRecognition);
floatingBtnPhotoInformation = (FloatingActionButton) findViewById(R.id.floatingBtnPhotoInformation);
floatingBtnSeeString64 = (FloatingActionButton) findViewById(R.id.floatingBtnSeeString64);
frame = (FrameLayout) findViewById(R.id.frame);
principalLayout = findViewById(R.id.principalLayout);
floatingBtnMenu = (FloatingActionMenu) findViewById(R.id.floatingBtnMenu);
progressLoadingIndicator = (LinearLayout) findViewById(R.id.progressLoadingIndicator);
floatingBtnMenu.setVisibility(View.GONE);
saveImage.setVisibility(View.GONE);
btnGoTo.setText(getString(R.string.go_to_fragment));
texttitle.setText(getString(R.string.title_activity));
}
示例5: setUIComponents
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
private void setUIComponents(View rootView) {
imageView = (ImageView) rootView.findViewById(R.id.imageView);
btntakephoto = (ImageButton) rootView.findViewById(R.id.btntakephoto);
btnselectedphoto = (ImageButton) rootView.findViewById(R.id.btnselectedphoto);
btnGoTo = (Button) rootView.findViewById(R.id.btnGoTo);
texttitle = (TextView) rootView.findViewById(R.id.texttitle);
saveImage = (ImageButton) rootView.findViewById(R.id.saveImage);
floatingBtnRotate = (FloatingActionButton) rootView.findViewById(R.id.floatingBtnRotate);
floatingBtnFacialRecognition = (FloatingActionButton) rootView.findViewById(R.id.floatingBtnFacialRecognition);
floatingBtnPhotoInformation = (FloatingActionButton) rootView.findViewById(R.id.floatingBtnPhotoInformation);
floatingBtnSeeString64 = (FloatingActionButton) rootView.findViewById(R.id.floatingBtnSeeString64);
frame = (FrameLayout) rootView.findViewById(R.id.frame);
principalLayout = rootView.findViewById(R.id.principalLayout);
floatingBtnMenu = (FloatingActionMenu) rootView.findViewById(R.id.floatingBtnMenu);
floatingBtnMenu.setVisibility(View.GONE);
saveImage.setVisibility(View.GONE);
btnGoTo.setText(getString(R.string.go_to_activity));
texttitle.setText(getString(R.string.title_fragment));
}
示例6: LoadingDialog
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
/**
* Default constructor
* @param context - Application context.
*/
public LoadingDialog(Context context){
this.context = context;
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this.context);
LayoutInflater inflater = LayoutInflater.from(this.context);
dialogView = inflater.inflate(R.layout.ui_loading_dialog, null);
this.title = (TextView) dialogView.findViewById(R.id.dialog_title);
this.title.setText("");
this.message= (TextView) dialogView.findViewById(R.id.dialog_message);
this.message.setText("");
this.message.setMovementMethod(new ScrollingMovementMethod());
this.progressView = (SmoothProgressBar) dialogView.findViewById(R.id.progress_bar);
this.postiveButton = (FloatingActionButton) dialogView.findViewById(R.id.pos);
this.postiveButton.hide(false);
this.postiveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
dialogBuilder.setView(dialogView);
dialog = dialogBuilder.create();
this.dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
if (allowAnimation)
dialog.getWindow().getAttributes().windowAnimations = R.style.customDialogAnimation;
}
示例7: CustomViewDialog
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
public CustomViewDialog(Context context){
this.context = context;
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this.context);
LayoutInflater inflater = LayoutInflater.from(this.context);
dialogView = inflater.inflate(R.layout.ui_custom_view_dialog, null);
title = (TextView) dialogView.findViewById(R.id.dialog_title);
customViewLayout = (LinearLayout) dialogView.findViewById(R.id.customView);
postiveButton = (FloatingActionButton) dialogView.findViewById(R.id.pos);
negativeButton = (FloatingActionButton) dialogView.findViewById(R.id.neg);
dialogView.findViewById(R.id.background).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
dialogBuilder.setView(dialogView);
dialog = dialogBuilder.create();
}
示例8: InfoDialog
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
public InfoDialog(Context context){
this.context = context;
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this.context);
LayoutInflater inflater = LayoutInflater.from(this.context);
dialogView = inflater.inflate(R.layout.ui_simple_dialog, null);
this.title = (TextView) dialogView.findViewById(R.id.dialog_title);
this.title.setText("");
this.message= (TextView) dialogView.findViewById(R.id.dialog_message);
this.message.setMovementMethod(new ScrollingMovementMethod());
this.icon = (CircleImageView) dialogView.findViewById(R.id.dialog_imageView);
this.postiveButton = (FloatingActionButton) dialogView.findViewById(R.id.pos);
this.negativeButton = (FloatingActionButton) dialogView.findViewById(R.id.neg);
this.naturalButton = (FloatingActionButton) dialogView.findViewById(R.id.natural);
dialogView.findViewById(R.id.background).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
dialogBuilder.setView(dialogView);
dialog = dialogBuilder.create();
this.dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
if (allowAnimation)
dialog.getWindow().getAttributes().windowAnimations = R.style.customDialogAnimation;
}
示例9: onCreate
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initView();
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); }
mFloatingActionMenu = (FloatingActionMenu)findViewById(R.id.menu);
mLoadingFab = (FloatingActionButton)findViewById(R.id.fab_loading);
mEmptyFab = (FloatingActionButton)findViewById(R.id.fab_empty);
mErrorFab = (FloatingActionButton)findViewById(R.id.fab_error);
mNoNetworkFab = (FloatingActionButton)findViewById(R.id.fab_no_network);
mContentFab = (FloatingActionButton)findViewById(R.id.fab_content);
mLoadingFab.setOnClickListener(this);
mEmptyFab.setOnClickListener(this);
mErrorFab.setOnClickListener(this);
mNoNetworkFab.setOnClickListener(this);
mContentFab.setOnClickListener(this);
mMultipleStatusView.setOnRetryClickListener(mRetryClickListener);
}
示例10: onCreate
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_another_fab);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final TextView contentView = (TextView)findViewById(R.id.content_view);
FloatingActionButton fab = (FloatingActionButton)findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Snackbar.make(contentView, R.string.another_fab_snackbar, Snackbar.LENGTH_SHORT).show();
}
});
}
示例11: hide
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
private void hide(View view) {
if (view instanceof FloatingActionButton) {
((FloatingActionButton)view).hide(true);
} else if (view instanceof FloatingActionMenu) {
((FloatingActionMenu)view).hideMenu(true);
} else {
view.setVisibility(View.GONE);
}
}
示例12: show
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
private void show(View view) {
if (view instanceof FloatingActionButton) {
((FloatingActionButton)view).show(true);
} else if (view instanceof FloatingActionMenu) {
((FloatingActionMenu)view).showMenu(true);
} else {
view.setVisibility(View.VISIBLE);
}
}
示例13: initView
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
private void initView() {
getViewByID();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, R.color.color_Actionbar)));
actionBar.setDisplayHomeAsUpEnabled(true);
setTitle(getTitleString());
}
RecyclerView recyclerView = findViewById(R.id.recycle_view);
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter, recyclerView);
recyclerView.setAdapter(animatorAdapter);
ItemTouchHelper.Callback callback = new ItemTouchHelperCallBackNoMove(mAdapter);
ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
touchHelper.attachToRecyclerView(recyclerView);
fab_menu = findViewById(R.id.fab_menu_1);
FloatingActionButton add_subject = findViewById(R.id.fab_action_1);
add_subject.setVisibility(View.VISIBLE);
add_subject.setOnClickListener(this);
add_subject.setLabelText(mResources.getString(R.string.add_subject));
//listener
et_name.addTextChangedListener(this);
et_home_phone.addTextChangedListener(this);
et_work_phone.addTextChangedListener(this);
et_name.setOnFocusChangeListener(this);
setInfo();
}
示例14: initView
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
private void initView() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext, R.color.color_Actionbar)));
}
mCoordinatorLayout = findViewById(R.id.coordinator);
RecyclerView recyclerView = findViewById(R.id.recycle_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new TeacherAdapter(this, new ArrayList<Teacher>());
@SuppressWarnings("unchecked") SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter, recyclerView);
recyclerView.setAdapter(animatorAdapter);
ItemTouchHelper.Callback callback = new ItemTouchHelperCallBackNoMove(mAdapter);
ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
touchHelper.attachToRecyclerView(recyclerView);
mView_FABMenu = findViewById(R.id.fab_menu_1);
FloatingActionButton addTeacher = findViewById(R.id.fab_action_1);
addTeacher.setVisibility(View.VISIBLE);
addTeacher.setLabelText(mContext.getResources().getString(R.string.add_teacher));
addTeacher.setOnClickListener(this);
CoordinatorLayout.LayoutParams params =
(CoordinatorLayout.LayoutParams) mView_FABMenu.getLayoutParams();
params.setBehavior(new FloatingActionMenuBehavior());
mView_FABMenu.requestLayout();
}
示例15: initView
import com.github.clans.fab.FloatingActionButton; //导入依赖的package包/类
private void initView() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext, R.color.color_Actionbar)));
}
mView_Coordinator = findViewById(R.id.coordinator);
mView_SubjectName = findViewById(R.id.week_lesson_detail_subject_name);
mView_SubjectArrow = findViewById(R.id.arrow);
mView_Weekday = findViewById(R.id.week_lesson_detail_weekday);
mView_Repeat = findViewById(R.id.week_lesson_detail_repeat);
mView_Day = findViewById(R.id.week_lesson_detail_day);
mView_FABMenu = findViewById(R.id.fab_menu_1);
FloatingActionButton addDayLesson = findViewById(R.id.fab_action_1);
FloatingActionButton editWeekLesson = findViewById(R.id.fab_action_2);
addDayLesson.setVisibility(View.VISIBLE);
editWeekLesson.setVisibility(View.VISIBLE);
addDayLesson.setLabelText(mResources.getString(R.string.add_day_lesson));
editWeekLesson.setLabelText(mResources.getString(R.string.edit_week_lesson));
editWeekLesson.setImageResource(R.drawable.ic_edit_white_24dp);
RecyclerView mView_RecyclerView = findViewById(R.id.recycle_view);
mView_RecyclerView.setNestedScrollingEnabled(false);
mView_RecyclerView.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new DayLessonAdapter(mContext, new ArrayList<DayLesson>(), mColorText, mColorBackground);
@SuppressWarnings("unchecked") SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter, mView_RecyclerView);
mView_RecyclerView.setAdapter(animatorAdapter);
ItemTouchHelper.Callback callback = new ItemTouchHelperCallBackNoMove(mAdapter);
ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
touchHelper.attachToRecyclerView(mView_RecyclerView);
registerForContextMenu(mView_SubjectArrow);
mView_SubjectArrow.setOnClickListener(this);
mView_SubjectName.setOnClickListener(this);
addDayLesson.setOnClickListener(this);
editWeekLesson.setOnClickListener(this);
setUpInfo();
}