本文整理汇总了Java中com.rey.material.widget.FloatingActionButton类的典型用法代码示例。如果您正苦于以下问题:Java FloatingActionButton类的具体用法?Java FloatingActionButton怎么用?Java FloatingActionButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FloatingActionButton类属于com.rey.material.widget包,在下文中一共展示了FloatingActionButton类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.rey.material.widget.FloatingActionButton; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_feed, container, false);
mToolbar = getActivity().findViewById(R.id.toolbar);
mAdapter = new FeedPagerAdapter(getChildFragmentManager());
ViewPager pager = (ViewPager) root.findViewById(R.id.feed_pager);
pager.setAdapter(mAdapter);
pager.addOnPageChangeListener(this);
pager.setOffscreenPageLimit(3);
mTabStrip = (TabPageIndicator) root.findViewById(R.id.feed_tabs);
mTabStrip.setOnPageChangeListener(this);
mTabStrip.setViewPager(pager);
mFab = (FloatingActionButton) root.findViewById(R.id.fab);
mFab.setOnClickListener(this);
return root;
}
示例2: onCreateView
import com.rey.material.widget.FloatingActionButton; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_create_event, container, false);
mFromDateButton = (Button) root.findViewById(R.id.from_date_button);
mToDateButton = (Button) root.findViewById(R.id.to_date_button);
mFromTimeButton = (Button) root.findViewById(R.id.from_time_button);
mToTimeButton = (Button) root.findViewById(R.id.to_time_button);
mFABUpload = (FloatingActionButton) root.findViewById(R.id.fab_upload);
mCoverImage = (ImageView) root.findViewById(R.id.create_event_cover);
mFABUpload.setOnClickListener(this);
mCoverImage.setOnClickListener(this);
setupButtonListener(mFromDateButton, true);
setupButtonListener(mToDateButton, true);
setupButtonListener(mFromTimeButton, false);
setupButtonListener(mToTimeButton, false);
return root;
}
示例3: setIconColorOnClickListeners
import com.rey.material.widget.FloatingActionButton; //导入依赖的package包/类
private void setIconColorOnClickListeners(final MaterialDialog md) {
String colors[] = getResources().getStringArray(R.array.icon_colors_array_pro);
for (int i = 0; i < colors.length; i++) {
int id = getResources().getIdentifier("icon_button_bt_float" + Integer.toString(i), "id", getPackageName());
final FloatingActionButton fab = (FloatingActionButton) md.findViewById(id);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
iconColor = v.getTag().toString();
setImageButtonsBasedOffIconSelection();
md.dismiss();
}
});
}
}
示例4: onCreate
import com.rey.material.widget.FloatingActionButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu_edit);
_menuDto = (MenuDto) getIntent().getSerializableExtra(MenuService.MenuIntent);
_receiverController = new ReceiverController(this);
final TextView dateTextView = findViewById(R.id.menuDateTextView);
final AutoCompleteTextView menuTitleTypeTextView = findViewById(R.id.menu_edit_title_textview);
final AutoCompleteTextView menuDescriptionTypeTextView = findViewById(R.id.menu_edit_description_textview);
_saveButton = findViewById(R.id.save_menu_edit_button);
menuTitleTypeTextView.setAdapter(new ArrayAdapter<>(MenuEditActivity.this, android.R.layout.simple_dropdown_item_1line, MenuService.getInstance().GetMenuTitleList()));
menuTitleTypeTextView.addTextChangedListener(_textWatcher);
menuDescriptionTypeTextView.setAdapter(new ArrayAdapter<>(MenuEditActivity.this, android.R.layout.simple_dropdown_item_1line, MenuService.getInstance().GetMenuDescriptionList()));
menuDescriptionTypeTextView.addTextChangedListener(_textWatcher);
if (_menuDto != null) {
dateTextView.setText(_menuDto.GetDateString());
menuTitleTypeTextView.setText(_menuDto.GetTitle());
menuDescriptionTypeTextView.setText(_menuDto.GetDescription());
} else {
displayErrorSnackBar("Cannot work with data! Is corrupt! Please try again!");
}
FloatingActionButton randomMenuButton = findViewById(R.id.menuRandomEntry_Button);
randomMenuButton.setOnClickListener(view -> {
SerializableList<ListedMenu> listedMenuList = ListedMenuService.getInstance().GetDataList();
Random randomMenuId = new Random();
int menuId = randomMenuId.nextInt(listedMenuList.getSize());
ListedMenu menu = listedMenuList.getValue(menuId);
menuTitleTypeTextView.setText(menu.GetTitle());
menuDescriptionTypeTextView.setText(menu.GetDescription());
});
_saveButton.setEnabled(false);
_saveButton.setOnClickListener(view -> {
menuTitleTypeTextView.setError(null);
menuDescriptionTypeTextView.setError(null);
boolean cancel = false;
View focusView = null;
if (!_propertyChanged) {
menuTitleTypeTextView.setError(createErrorText(getString(R.string.error_nothing_changed)));
focusView = menuTitleTypeTextView;
cancel = true;
}
String title = menuTitleTypeTextView.getText().toString();
if (TextUtils.isEmpty(title)) {
menuTitleTypeTextView.setError(createErrorText(getString(R.string.error_field_required)));
focusView = menuTitleTypeTextView;
cancel = true;
}
String description = menuDescriptionTypeTextView.getText().toString();
if (TextUtils.isEmpty(description)) {
menuDescriptionTypeTextView.setError(createErrorText(getString(R.string.error_field_required)));
focusView = menuDescriptionTypeTextView;
cancel = true;
}
if (cancel) {
focusView.requestFocus();
} else {
MenuService.getInstance().UpdateMenu(new LucaMenu(_menuDto.GetId(), title, description, _menuDto.GetWeekday(), _menuDto.GetDate(), false, ILucaClass.LucaServerDbAction.Update));
_saveButton.setEnabled(false);
}
});
}
示例5: onCreate
import com.rey.material.widget.FloatingActionButton; //导入依赖的package包/类
@Override
public void onCreate() {
FloatingActionButton floatingActionButtonMenu = ((Activity) _context).findViewById(R.id.floating_action_button_menu);
FloatingActionButton floatingActionButtonShopping = ((Activity) _context).findViewById(R.id.floating_action_button_shopping);
FloatingActionButton floatingActionButtonWirelessSocket = ((Activity) _context).findViewById(R.id.floating_action_button_socket);
FloatingActionButton floatingActionButtonWirelessSwitch = ((Activity) _context).findViewById(R.id.floating_action_button_switch);
FloatingActionButton floatingActionButtonReload = ((Activity) _context).findViewById(R.id.floating_action_button_reload);
floatingActionButtonMenu.setOnClickListener(view -> {
if (_menu != null) {
ArrayList<String> menuTitleList = new ArrayList<>();
for (int index = 0; index < _menu.getSize(); index++) {
menuTitleList.add(_menu.getValue(index).GetSingleLineString());
}
_dialogController.DisplayListViewDialog("Menu", menuTitleList);
} else {
Logger.getInstance().Error(TAG, "_menu is null!");
Toasty.warning(_context, "Menu is null!!", Toast.LENGTH_LONG).show();
}
});
floatingActionButtonShopping.setOnClickListener(view -> {
if (_shoppingList != null) {
ArrayList<String> shoppingListTitleList = new ArrayList<>();
for (int index = 0; index < _shoppingList.getSize(); index++) {
shoppingListTitleList.add(String.format(Locale.getDefault(), "%dx %s", _shoppingList.getValue(index).GetQuantity(), _shoppingList.getValue(index).GetName()));
}
_dialogController.DisplayListViewDialog("Shopping List", shoppingListTitleList);
} else {
Logger.getInstance().Error(TAG, "_shoppingList is null!");
Toasty.warning(_context, "ShoppingList is null!!", Toast.LENGTH_LONG).show();
}
});
floatingActionButtonWirelessSocket.setOnClickListener(view -> {
if (_wirelessSocketList != null) {
_dialogController.DisplaySocketListViewDialog(_wirelessSocketList);
} else {
Logger.getInstance().Error(TAG, "_wirelessSocketList is null!");
Toasty.warning(_context, "WirelessSocketList is null!!", Toast.LENGTH_LONG).show();
}
});
floatingActionButtonWirelessSwitch.setOnClickListener(view -> {
if (_wirelessSocketList != null) {
_dialogController.DisplaySwitchListViewDialog(_wirelessSwitchList);
} else {
Logger.getInstance().Error(TAG, "_wirelessSwitchList is null!");
Toasty.warning(_context, "WirelessSwitchList is null!!", Toast.LENGTH_LONG).show();
}
});
floatingActionButtonReload.setOnClickListener(view -> _broadcastController.SendSimpleBroadcast(Broadcasts.RELOAD_ALL));
}