本文整理匯總了Java中com.getbase.floatingactionbutton.FloatingActionsMenu類的典型用法代碼示例。如果您正苦於以下問題:Java FloatingActionsMenu類的具體用法?Java FloatingActionsMenu怎麽用?Java FloatingActionsMenu使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FloatingActionsMenu類屬於com.getbase.floatingactionbutton包,在下文中一共展示了FloatingActionsMenu類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setFabButtons
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
/**
* Resets the FAB labels and replaces them with the current gateway information
*/
private void setFabButtons() {
resetFabButtons();
setFabTitle(addZone);
setFabTitle(addButton);
setFabTitle(addCommand);
fabMenu.setOnFloatingActionsMenuUpdateListener(new FloatingActionsMenu.OnFloatingActionsMenuUpdateListener() {
@Override
public void onMenuCollapsed() {
dim.setVisibility(View.GONE);
}
@Override
public void onMenuExpanded() {
dim.setVisibility(View.VISIBLE);
}
});
dim.setOnTouchListener(getDimListener());
getHelp.setOnClickListener(getHelpListener());
}
示例2: onScrollUp
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
@Override
public void onScrollUp() {
new Handler().post(new Runnable() {
@Override
public void run() {
if (floatActionButton instanceof FloatingActionsMenu) {
if (((FloatingActionsMenu) floatActionButton).isExpanded()) {
((FloatingActionsMenu) floatActionButton).collapse();
}
}
}
});
hide();
if (mScrollDirectionListener != null) {
mScrollDirectionListener.onScrollUp();
}
}
示例3: onNestedScroll
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionsMenu child, View target,
int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
// 向上滾動進入, 向下滾動隱藏
if (dyConsumed > 20 && !this.isAnimationOut && child.getVisibility() == View.VISIBLE) {
// 如果是展開的就先收回去
if (child.isExpanded()) {
child.collapse();
}
// animateOut()和animateIn()都是私有方法, 需要重新實現
animateOut(child);
} else if (dyConsumed < -20 && child.getVisibility() != View.VISIBLE) {
animatæeIn(child);
}
}
示例4: init
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
private void init(Context context, AttributeSet attributeSet) {
mButtonSpacing = (int) (getResources().getDimension(R.dimen.fab_actions_spacing) - getResources().getDimension(R.dimen.fab_shadow_radius) - getResources().getDimension(R.dimen.fab_shadow_offset));
mLabelsMargin = getResources().getDimensionPixelSize(R.dimen.fab_labels_margin);
mLabelsVerticalOffset = getResources().getDimensionPixelSize(R.dimen.fab_shadow_offset);
mTouchDelegateGroup = new TouchDelegateGroup(this);
setTouchDelegate(mTouchDelegateGroup);
TypedArray attr = context.obtainStyledAttributes(attributeSet, R.styleable.FloatingActionsMenu, 0, 0);
mAddButtonPlusColor = attr.getColor(R.styleable.FloatingActionsMenu_fab_addButtonPlusIconColor, getColor(android.R.color.white));
mAddButtonColorNormal = attr.getColor(R.styleable.FloatingActionsMenu_fab_addButtonColorNormal, getColor(android.R.color.holo_blue_dark));
mAddButtonColorPressed = attr.getColor(R.styleable.FloatingActionsMenu_fab_addButtonColorPressed, getColor(android.R.color.holo_blue_light));
mAddButtonSize = attr.getInt(R.styleable.FloatingActionsMenu_fab_addButtonSize, FloatingActionButton.SIZE_NORMAL);
mAddButtonStrokeVisible = attr.getBoolean(R.styleable.FloatingActionsMenu_fab_addButtonStrokeVisible, true);
mExpandDirection = attr.getInt(R.styleable.FloatingActionsMenu_fab_expandDirection, EXPAND_UP);
mLabelsStyle = attr.getResourceId(R.styleable.FloatingActionsMenu_fab_labelStyle, 0);
mLabelsPosition = attr.getInt(R.styleable.FloatingActionsMenu_fab_labelsPosition, LABELS_ON_LEFT_SIDE);
attr.recycle();
if (mLabelsStyle != 0 && expandsHorizontally()) {
throw new IllegalStateException("Action labels in horizontal expand orientation is not supported.");
}
createAddButton(context);
}
示例5: initDrawer
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
public void initDrawer() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
fabMenu = (FloatingActionsMenu) findViewById(R.id.multiple_actions_down);
fabPrimary = (FloatingActionButton) findViewById(R.id.bt_rings_from_contacts);
fabSecondary = (FloatingActionButton) findViewById(R.id.bt_rings_from_qrcode);
fabPrimary.setIconDrawable(getResources().getDrawable(R.drawable.ic_contact_mail_white_36dp));
fabSecondary.setIconDrawable(getResources().getDrawable(R.drawable.ic_qrcode_scan_white_36dp));
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
示例6: onPostExecute
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
@Override
protected void onPostExecute(Integer myResultObject) {
int mResult = myResultObject.intValue();
mMultipleActions = (FloatingActionsMenu) getView().findViewById(R.id.multipleActions);
mActionLock = (FloatingActionButton) getView().findViewById(R.id.actionLock);
mActionUnlock = (FloatingActionButton) getView().findViewById(R.id.actionUnlock);
if (mResult == BootLoader.BL_UNLOCKED) {
prepareUnlockSet();
mActionLock.setVisibility(View.VISIBLE);
mActionUnlock.setVisibility(View.GONE);
} else if (mResult == BootLoader.BL_LOCKED) {
prepareLockSet();
mMultipleActions.setAlpha(1);
mActionLock.setVisibility(View.GONE);
mActionUnlock.setVisibility(View.VISIBLE);
} else if (mResult == BootLoader.BL_UNSUPPORTED_DEVICE) {
prepareUnsupportedSet();
mActionLock.setVisibility(View.GONE);
mActionUnlock.setVisibility(View.GONE);
} else {
prepareErrorSet();
mMultipleActions.setVisibility(View.GONE);
}
}
示例7: onCreateView
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_server, container, false);
// Set the adapter
mListView = (AbsListView) view.findViewById(android.R.id.list);
mAdapter = new ServerFragmentAdapter(getActivity());
refresh();
mListView.setAdapter(mAdapter);
// Set OnItemClickListener so we can be notified on item clicks
mListView.setOnItemLongClickListener(this);
FloatingActionsMenu addServerMenu = (FloatingActionsMenu) view.findViewById(R.id.add_server_menu);
mListener.onViewCreated(view, addServerMenu);
return view;
}
示例8: onNestedScroll
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionsMenu child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
//向上滾動進入,向下滾動隱藏
if (dyConsumed>0&&!this.mIsAnimatingOut && child.getVisibility()==View.VISIBLE){
//如果是展開的話就先收回去
if (child.isExpanded()){
child.collapse();
}
//animateOut()和animateIn()都是私有方法,需要重新實現
animateOut(child);
} else if (dyConsumed<0 && child.getVisibility()!=View.VISIBLE){
animateIn(child);
}
}
示例9: afterInitSetup
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
private void afterInitSetup(boolean isRoot){
setContentView(R.layout.activity_filemanager_tabs);
if(!isRoot){
rootUnavailableOp();
}else{
mStoragePaths.add("/");
mStoragePaths.add(Environment.getExternalStorageDirectory().getAbsolutePath() + "/");
mStorageTitles.add("root");
mStorageTitles.add("home");
}
SharedData.STARTED_IN_SELECTION_MODE=false;
SharedData.DO_NOT_RESET_ICON=false;
SharedPreferences prefs=getSharedPreferences("done",Context.MODE_PRIVATE);
SharedData.KEYS_GENERATED=prefs.getBoolean("keys_gen",false);
if(!isServiceStarted){
startService(new Intent(CryptoFM.getContext(),CleanupService.class));
isServiceStarted=true;
}
//see the external dirs
mTotalStorage = mStoragePaths.size();
if(SharedData.DB_PASSWORD==null ){
if (getIntent().getExtras()!=null) {
SharedData.DB_PASSWORD = getIntent().getExtras().getString("dbpass");
SharedData.USERNAME = getIntent().getExtras().getString("username", "default");
}
}
SharedData.LINEAR_LAYOUTMANAGER =getPreferences(Context.MODE_PRIVATE).getBoolean("layout",true);
setToolbar();
mFloatingActionsMenu=(FloatingActionsMenu)findViewById(R.id.fab_add_folder);
mFloatingActionsMenu.setOnFloatingActionsMenuUpdateListener(this);
setButtonClickListeners();
}
示例10: initView
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
void initView() {
mMapView = (MapView) findViewById(R.id.map);
mLocbtn = (AppCompatImageButton) findViewById(R.id.locbtn);
mActionLocate = (FloatingActionButton) findViewById(R.id.action_locate);
mActionSettings = (FloatingActionButton) findViewById(R.id.action_settings);
mActionReminder = (FloatingActionButton) findViewById(R.id.action_reminder);
mFloatingActionsMenu = (FloatingActionsMenu) findViewById(R.id.floating_actions_menu);
mInfoTextView = (TextView) findViewById(R.id.info_text_view);
mActionLocate.setOnClickListener(this);
mActionSettings.setOnClickListener(this);
mActionReminder.setOnClickListener(this);
mLocbtn.setOnClickListener(this);
}
示例11: onCreate
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Find the layout information
rootLayout = (CoordinatorLayout) findViewById(R.id.root_layout);
recycler = (RecyclerView) findViewById(R.id.recycler_view);
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
toolbar = (Toolbar) findViewById(R.id.toolbar);
spinner = (Spinner) findViewById(R.id.toolbar_spinner);
dim = findViewById(R.id.dim);
fabMenu = (FloatingActionsMenu) findViewById(R.id.fab_menu);
getHelp = (FloatingActionButton) findViewById(R.id.get_help);
addZone = (FloatingActionButton) findViewById(R.id.add_zone);
addButton = (FloatingActionButton) findViewById(R.id.add_button);
addCommand = (FloatingActionButton) findViewById(R.id.add_command);
// set up the app bar with a spinner, toolbar, and no title
setSpinnerAdapter();
setSupportActionBar(toolbar);
setTitle("");
// put the labels on the floating action buttons.
setFabButtons();
swipeRefreshLayout.setOnRefreshListener(getRefreshListener(this));
swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent, R.color.colorPrimary);
}
示例12:
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
private void animatæeIn(FloatingActionsMenu child) {
child.setVisibility(View.VISIBLE);
ViewCompat.animate(child).translationY(0)
.setInterpolator(INTERPOLATOR)
.withLayer()
.setListener(null)
.start();
}
示例13: onInterceptTouchEvent
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
@Override
public boolean onInterceptTouchEvent(CoordinatorLayout parent, ViewGroup child, MotionEvent ev) {
FloatingActionsMenu menu = getFloatingActionsMenu(child);
if (!(visible && menu.isExpanded())) {
return false;
}
final int x = (int) ev.getX();
final int y = (int) ev.getY();
Rect rect = new Rect();
child.getHitRect(rect);
if (rect.contains(x, y)) {
if (ev.getAction() == MotionEvent.ACTION_UP) {
//點擊非"加"按鈕就折疊菜單
menu.getChildAt(menu.getChildCount() - 1).getHitRect(rect);
if (!rect.contains(x - (int) child.getX(), y - (int) child.getY())) {
menu.collapse();
}
}
return false;
} else {
menu.collapse();
return true;
}
}
示例14: onNestedScroll
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout,
ViewGroup child, View target,
int dxConsumed, int dyConsumed,
int dxUnconsumed, int dyUnconsumed) {
FloatingActionsMenu menu = getFloatingActionsMenu(child);
if (dyConsumed > 0 && !isAnimatingOut && menu.getVisibility() == VISIBLE){
animateOut(menu);
} else if (dyConsumed < 0 && menu.getVisibility() != VISIBLE){
animateIn(menu);
}
}
示例15: onRestart
import com.getbase.floatingactionbutton.FloatingActionsMenu; //導入依賴的package包/類
@Override
public void onRestart() {
super.onRestart();
final FloatingActionsMenu fabMenu = (FloatingActionsMenu) findViewById(R.id.multiple_actions);
if (fabMenu.isExpanded())
fabMenu.collapse();
}