com.getbase.floatingactionbutton.FloatingActionButton Java Examples

The following examples show how to use com.getbase.floatingactionbutton.FloatingActionButton. 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: FabMenuManager.java    From timecat with Apache License 2.0 6 votes vote down vote up
public FabMenuManager(FloatingActionButton fab, FloatingActionsMenu fabMenu, LeftDrawerManager drawerMgr, MainActivity a) {
    this.fab = fab;
    this.fabMenu = fabMenu;
    this.activity = a;
    this.drawerMgr = drawerMgr;
    this.scheduleActions = getScheduleActions();

    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());

    fabMenu.setOnFloatingActionsMenuUpdateListener(new FloatingActionsMenu.OnFloatingActionsMenuUpdateListener() {
        @Override
        public void onMenuExpanded() {
            if (!prefs.getBoolean("PREFERENCE_SCHEDULE_HELP_SHOWN", false)) {
                activity.launchActivityDelayed(SchedulesHelpActivity.class, 600);
            }
        }

        @Override
        public void onMenuCollapsed() {

        }
    });

}
 
Example #2
Source File: FabMenuManager.java    From timecat with Apache License 2.0 6 votes vote down vote up
private List<FloatingActionButton> getScheduleActions() {
    ArrayList<FloatingActionButton> actions = new ArrayList<>();

    FloatingActionButton actionA = fabMenu.findViewById(R.id.action_a);
    FloatingActionButton actionB = fabMenu.findViewById(R.id.action_b);
    FloatingActionButton actionC = fabMenu.findViewById(R.id.action_c);

    actions.add(actionA);
    actions.add(actionB);
    actions.add(actionC);
    scanQrAction = fabMenu.findViewById(R.id.action_d);
    if (TimeCatApp.isPharmaModeEnabled(activity)) {
        scanQrAction.setVisibility(View.VISIBLE);
        actions.add(scanQrAction);
    } else {
        scanQrAction.setVisibility(View.GONE);
    }
    return actions;
}
 
Example #3
Source File: FloatingActionsMenuBehavior.java    From Aria2App with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
private static FloatingActionButton findInnerMenu(@NonNull FloatingActionsMenu menu) {
    for (int i = 0; i < menu.getChildCount(); i++) {
        View v = menu.getChildAt(i);
        if (v instanceof AddFloatingActionButton)
            return (AddFloatingActionButton) v;
    }

    return null;
}
 
Example #4
Source File: FabMenuManager.java    From timecat with Apache License 2.0 5 votes vote down vote up
public void init() {

        for (FloatingActionButton f : scheduleActions) {
            f.setOnClickListener(this);
        }

        fab.setOnClickListener(this);
        fab.setIconDrawable(new IconicsDrawable(activity).icon(GoogleMaterial.Icon.gmd_plus).paddingDp(5).sizeDp(24).color(Color.parseColor("#263238")));

        onViewPagerItemChange(0);
    }
 
Example #5
Source File: FabMenuManager.java    From timecat with Apache License 2.0 5 votes vote down vote up
public void onUserUpdate(DBUser u) {
    for (FloatingActionButton f : scheduleActions) {
        f.setColorNormal(u.color());
        f.setColorPressed(ScreenUtil.equivalentNoAlpha(u.color(), 0.5f));
    }
    fabMenu.invalidate();
}
 
Example #6
Source File: SelectEntriesActivity.java    From Aegis with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_select_entries);

    ActionBar bar = getSupportActionBar();
    bar.setHomeAsUpIndicator(R.drawable.ic_close);
    bar.setDisplayHomeAsUpEnabled(true);

    _adapter = new ImportEntriesAdapter();
    RecyclerView entriesView = findViewById(R.id.list_entries);
    entriesView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            onScroll(dx, dy);
        }
    });

    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    entriesView.setLayoutManager(layoutManager);
    entriesView.setAdapter(_adapter);
    entriesView.setNestedScrollingEnabled(false);

    Intent intent = getIntent();
    List<ImportEntry> entries = (ArrayList<ImportEntry>) intent.getSerializableExtra("entries");
    List<DatabaseImporterEntryException> errors = (ArrayList<DatabaseImporterEntryException>) intent.getSerializableExtra("errors");

    for (ImportEntry entry : entries) {
        _adapter.addEntry(entry);
    }

    if (errors.size() > 0) {
        showErrorDialog(errors);
    }

    FloatingActionButton fabMenu = findViewById(R.id.fab);
    fabMenu.setOnClickListener(v -> returnSelectedEntries());
    _fabScrollHelper = new FabScrollHelper(fabMenu);
}
 
Example #7
Source File: MainActivity.java    From CollapsingHeader with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mFab = (FloatingActionButton)findViewById(R.id.favorite);
    mToolbar = (Toolbar)findViewById(R.id.toolbar);
    ListView listView = (ListView)findViewById(R.id.listview);

    if (mToolbar != null) {
        mToolbar.setTitle(getString(R.string.title));
        setSupportActionBar(mToolbar);
    }

    // Inflate the header view and attach it to the ListView
    View headerView = LayoutInflater.from(this)
                                    .inflate(R.layout.listview_header, listView, false);
    mContainerHeader = headerView.findViewById(R.id.container);
    listView.addHeaderView(headerView);

    // prepare the fade in/out animator
    fade =  ObjectAnimator.ofFloat(mContainerHeader, "alpha", 0f, 1f);
    fade.setInterpolator(new DecelerateInterpolator());
    fade.setDuration(400);

    listView.setOnScrollListener(this);
    listView.setAdapter(new ArrayAdapter<>(this,
                                    android.R.layout.simple_list_item_1,
                                    DUMMY_DATA));
}
 
Example #8
Source File: UtilsApp.java    From MLManager with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Save the app as hidden
 * @param context Context
 * @param fabHide FAB button to change
 * @param isHidden true if the app is hidden, false otherwise
 */
public static void setAppHidden(Context context, FloatingActionButton fabHide, Boolean isHidden) {
    if (isHidden) {
        fabHide.setTitle(context.getResources().getString(R.string.action_unhide));
        fabHide.setIcon(R.drawable.ic_visibility_white);
    } else {
        fabHide.setTitle(context.getResources().getString(R.string.action_hide));
        fabHide.setIcon(R.drawable.ic_visibility_off_white);
    }
}
 
Example #9
Source File: RecruitDataActivity.java    From Social with Apache License 2.0 4 votes vote down vote up
private void initData(){
    tv_address = (TextView)this.findViewById(R.id.id_recruit_data_activity_tv_address);
    tv_companyname = (TextView)this.findViewById(R.id.id_recruit_data_activity_tv_companyname);
    tv_distance = (TextView)this.findViewById(R.id.id_recruit_data_activity_tv_distance);
    tv_link = (TextView)this.findViewById(R.id.id_recruit_data_activity_tv_link);
    tv_requirement = (TextView)this.findViewById(R.id.id_recruit_data_activity_tv_requirement);

    fab_chat = (FloatingActionButton)this.findViewById(R.id.id_recruit_data_activity_fab_chat);
    //fab_chat.setSize(FloatingActionButton.SIZE_MINI);
    fab_chat.setColorNormalResId(R.color.colorGreen_300);
    fab_chat.setColorPressedResId(R.color.colorGreen700);
    fab_chat.setIcon(R.mipmap.ic_sms_white_24dp);
    fab_chat.setStrokeVisible(false);
    fab_chat.setOnClickListener(this);

    fab_dail = (FloatingActionButton)this.findViewById(R.id.id_recruit_data_activity_fab_dail);
    //fab_chat.setSize(FloatingActionButton.SIZE_MINI);
    fab_dail.setColorNormalResId(R.color.colorGreen_300);
    fab_dail.setColorPressedResId(R.color.colorGreen700);
    fab_dail.setIcon(R.mipmap.ic_call_white_24dp);
    fab_dail.setStrokeVisible(false);
    fab_dail.setOnClickListener(this);

    fab_add_post = (FloatingActionButton)this.findViewById(R.id.id_recruit_data_activity_fab_add_post);
    //fab_chat.setSize(FloatingActionButton.SIZE_MINI);
    fab_add_post.setColorNormalResId(R.color.colorIndigo_300);
    fab_add_post.setColorPressedResId(R.color.colorIndigo_700);
    fab_add_post.setIcon(R.mipmap.ic_add_48);
    fab_add_post.setStrokeVisible(false);
    fab_add_post.setOnClickListener(this);


    fab_modify_recruit = (FloatingActionButton)this.findViewById(R.id.id_recruit_data_activity_fab_modify_recruit);
    //fab_chat.setSize(FloatingActionButton.SIZE_MINI);
    fab_modify_recruit.setColorNormalResId(R.color.colorPrimary);
    fab_modify_recruit.setColorPressedResId(R.color.colorPrimaryDark);
    fab_modify_recruit.setIcon(R.mipmap.ic_mode_edit_white_24dp);
    fab_modify_recruit.setStrokeVisible(false);
    fab_modify_recruit.setOnClickListener(this);

    fab_delete_recruit = (FloatingActionButton)this.findViewById(R.id.id_recruit_data_activity_fab_delete_recruit);
    //fab_chat.setSize(FloatingActionButton.SIZE_MINI);
    fab_delete_recruit.setColorNormalResId(R.color.colorPink_300);
    fab_delete_recruit.setColorPressedResId(R.color.colorPink_700);
    fab_delete_recruit.setIcon(R.mipmap.trashbin_24);
    fab_delete_recruit.setStrokeVisible(false);
    fab_delete_recruit.setOnClickListener(this);


    iv_head = (CircleImageView)this.findViewById(R.id.id_recruit_data_activity_iv_head);
    listView = (ListView)this.findViewById(R.id.id_recruit_data_activity_listview);
    listView.setOnItemClickListener(this);

    flashView = (FlashView)this.findViewById(R.id.id_recruit_data_activity_flash_view);
    imageUrls = new ArrayList<String>();
    flashView.setOnPageClickListener(new FlashViewListener() {
        @Override
        public void onClick(int position) {
           // Toast.makeText(getApplicationContext(), "你的点击的是第"+(position+1)+"张图片!", Toast.LENGTH_LONG).show();

            Intent intent = new Intent(RecruitDataActivity.this, ShowNewsImageActivity.class);
            if(arr_recruit_img.length>=1){

            }else if(arr_recruit_img.length==0){
                arr_recruit_img[0] = WebUtil.HTTP_ADDRESS + recruit.head_path;
            }
            intent.putExtra("listpath", arr_recruit_img);
            intent.putExtra("position", (position));
            RecruitDataActivity.this.startActivity(intent);

        }});

}
 
Example #10
Source File: PostDetailActivity.java    From Social with Apache License 2.0 4 votes vote down vote up
private void ininData(){
    tv_postname = (TextView)this.findViewById(R.id.id_post_detail_activity_tv_postname);
    tv_companyname = (TextView)this.findViewById(R.id.id_post_detail_activity_tv_companyname);
    tv_distance = (TextView)this.findViewById(R.id.id_post_detail_activity_tv_distance);
    tv_salary = (TextView)this.findViewById(R.id.id_post_detail_activity_tv_salary);
    tv_date = (TextView)this.findViewById(R.id.id_post_detail_activity_tv_date);
    tv_description = (TextView)this.findViewById(R.id.id_post_detail_activity_tv_description);
    tv_requirement = (TextView)this.findViewById(R.id.id_post_detail_activity_tv_requirement);
    tv_link = (TextView)this.findViewById(R.id.id_post_detail_activity_tv_link);
    tv_phone = (TextView)this.findViewById(R.id.id_post_detail_activity_tv_phone);
    tv_address = (TextView)this.findViewById(R.id.id_post_detail_activity_tv_address);
    tv_location = (TextView)this.findViewById(R.id.id_post_detail_activity_tv_location);

    fab_chat = (FloatingActionButton)this.findViewById(R.id.id_post_detail_activity_fab_chat);
    //fab_chat.setSize(FloatingActionButton.SIZE_MINI);
    fab_chat.setColorNormalResId(R.color.colorGreen_300);
    fab_chat.setColorPressedResId(R.color.colorGreen700);
    fab_chat.setIcon(R.mipmap.ic_sms_white_24dp);
    fab_chat.setStrokeVisible(false);
    fab_chat.setOnClickListener(this);

    fab_dail = (FloatingActionButton)this.findViewById(R.id.id_post_detail_activity_fab_dail);
    //fab_chat.setSize(FloatingActionButton.SIZE_MINI);
    fab_dail.setColorNormalResId(R.color.colorGreen_300);
    fab_dail.setColorPressedResId(R.color.colorGreen700);
    fab_dail.setIcon(R.mipmap.ic_call_white_24dp);
    fab_dail.setStrokeVisible(false);
    fab_dail.setOnClickListener(this);

    fab_add_post = (FloatingActionButton)this.findViewById(R.id.id_post_detail_activity_fab_add_post);
    //fab_chat.setSize(FloatingActionButton.SIZE_MINI);
    fab_add_post.setColorNormalResId(R.color.colorIndigo_300);
    fab_add_post.setColorPressedResId(R.color.colorIndigo_700);
    fab_add_post.setIcon(R.mipmap.ic_add_48);
    fab_add_post.setStrokeVisible(false);
    fab_add_post.setOnClickListener(this);


    fab_modify_post = (FloatingActionButton)this.findViewById(R.id.id_post_detail_activity_fab_modify_post);
    //fab_chat.setSize(FloatingActionButton.SIZE_MINI);
    fab_modify_post.setColorNormalResId(R.color.colorPrimary);
    fab_modify_post.setColorPressedResId(R.color.colorPrimaryDark);
    fab_modify_post.setIcon(R.mipmap.ic_mode_edit_white_24dp);
    fab_modify_post.setStrokeVisible(false);
    fab_modify_post.setOnClickListener(this);

    fab_delete_post = (FloatingActionButton)this.findViewById(R.id.id_post_detail_activity_fab_delete_post);
    //fab_chat.setSize(FloatingActionButton.SIZE_MINI);
    fab_delete_post.setColorNormalResId(R.color.colorPink_300);
    fab_delete_post.setColorPressedResId(R.color.colorPink_700);
    fab_delete_post.setIcon(R.mipmap.trashbin_24);
    fab_delete_post.setStrokeVisible(false);
    fab_delete_post.setOnClickListener(this);



    flashView = (FlashView)this.findViewById(R.id.id_post_detail_activity_flash_view);
    imageUrls = new ArrayList<String>();

    flashView.setOnPageClickListener(new FlashViewListener() {
        @Override
        public void onClick(int position) {

            Intent intent = new Intent(PostDetailActivity.this, ShowNewsImageActivity.class);
            if(arr_recruit_img.length>=1){

            }else if(arr_recruit_img.length==0){
                //arr_recruit_img[0] = WebUtil.HTTP_ADDRESS + recruit.head_path;
            }
            intent.putExtra("listpath", arr_recruit_img);
            intent.putExtra("position", (position));
            PostDetailActivity.this.startActivity(intent);

        }});

}
 
Example #11
Source File: MainActivity.java    From writeily-pro with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);
    }

    frameLayout = findViewById(R.id.frame);

    fabMenu = (FloatingActionsMenu) findViewById(R.id.fab);
    fabCreateNote = (FloatingActionButton) findViewById(R.id.create_note);
    fabCreateFolder = (FloatingActionButton) findViewById(R.id.create_folder);

    fabCreateNote.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            createNote();
        }
    });

    fabCreateFolder.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            createFolder();
        }
    });

    // Set up the fragments
    notesFragment = new NotesFragment();

    renameBroadcastReceiver = new RenameBroadcastReceiver(notesFragment);
    browseToFolderBroadcastReceiver = new CurrentFolderChangedReceiver(this);

    // Load initial fragment
    FragmentManager fm = getFragmentManager();
    fm.beginTransaction()
            .replace(R.id.frame, notesFragment)
            .commit();

    initFolders();
}