com.github.clans.fab.FloatingActionButton Java Examples

The following examples show how to use com.github.clans.fab.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: MainActivity.java    From MagicalCamera with Apache License 2.0 7 votes vote down vote up
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));
}
 
Example #2
Source File: MainActivity.java    From AndroidApp with Mozilla Public License 2.0 6 votes vote down vote up
/**********************************Setup UI elements and their functionality***********************************/
private void viewSetup() {
    fabPoiDetailsAfterRoute = findViewById(R.id.fabPoiDetailsAfterRoute);
    floatingActionButton = findViewById(R.id.mainFab);
    floatingActionButton.setClosedOnTouchOutside(true);

    navigation = 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 = findViewById(R.id.fabClearMap);
    FloatingActionButton fabLocation = findViewById(R.id.fabLocation);
    FloatingActionButton fabAdd = findViewById(R.id.fabAdd);
    FloatingActionButton fabSearch = findViewById(R.id.fabSearch);
    fabClearMap.setOnClickListener(clickListenerFAB);
    fabLocation.setOnClickListener(clickListenerFAB);
    fabAdd.setOnClickListener(clickListenerFAB);
    fabSearch.setOnClickListener(clickListenerFAB);
    fabPoiDetailsAfterRoute.setOnClickListener(clickListenerFAB);
}
 
Example #3
Source File: FragmentSample.java    From MagicalCamera with Apache License 2.0 6 votes vote down vote up
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));
}
 
Example #4
Source File: DeviceActivity.java    From AndroidSDK with MIT License 6 votes vote down vote up
private void initViews() {
    mDeviceItem = (DeviceItem) getIntent().getSerializableExtra(EXTRA_DEVICE_ITEM);

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setTitle(mDeviceItem.getTitle());
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeAsUpIndicator(android.support.v7.appcompat.R.drawable.abc_ic_ab_back_material);

    mRecyclerView = (RecyclerView) findViewById(R.id.recyler_view);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
    mFabAddDataStream = (FloatingActionButton) findViewById(R.id.fab_add_ds);

    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mAdapter = new DSListAdapter();
    mRecyclerView.setAdapter(mAdapter);
    mSwipeRefreshLayout.setColorSchemeColors(0xFFDA4336);
    mSwipeRefreshLayout.setOnRefreshListener(this);
    getDataStreams();
    mSwipeRefreshLayout.setRefreshing(true);

    mFabAddDataStream.setOnClickListener(this);
}
 
Example #5
Source File: Activity_Result_Combination.java    From MortgageCalculator with Apache License 2.0 5 votes vote down vote up
public void initViews(){
    viewPager = (ViewPager)findViewById(R.id.Result_Combination_Viewpager);
    typeOneText = (TextView)findViewById(R.id.Result_Combination_TypeOne_TextView);
    typeTwoText = (TextView)findViewById(R.id.Result_Combination_TypeTwo_TextView);
    cursorImageView = (ImageView)findViewById(R.id.Result_Combination_Cursor_ImageView);

    shareMenu = (FloatingActionMenu)findViewById(R.id.combination_menu);
    share2friendButton = (FloatingActionButton)findViewById(R.id.combination_menu_item1);
    share2timelineButton = (FloatingActionButton)findViewById(R.id.combination_menu_item2);
    adButton = (FloatingActionButton)findViewById(R.id.combination_menu_item3);
}
 
Example #6
Source File: NewsActivity.java    From SimpleNews with Apache License 2.0 5 votes vote down vote up
private void initNewsTypeIcon() {
    newsTypeButton = (FloatingActionMenu) findViewById(R.id.floating_action_menu);
    subactionButton1 = (FloatingActionButton) findViewById(R.id.menu_item_1);
    subactionButton2 = (FloatingActionButton) findViewById(R.id.menu_item_2);

    subactionButton1.setOnClickListener(new OnSubActionButtonClickListener());
    subactionButton2.setOnClickListener(new OnSubActionButtonClickListener());

    actionButtonIds = new int[]{R.drawable.ic_home, R.drawable.ic_fav, R.drawable.ic_seen};
    updateNewsIcon();
}
 
Example #7
Source File: NewsActivity.java    From SimpleNews with Apache License 2.0 5 votes vote down vote up
private void setColor(FloatingActionButton button, int primaryColor, int secondaryColor) {
    if (button != null) {
        button.setColorNormal(primaryColor);
        button.setColorPressed(secondaryColor);
        button.setColorRipple(secondaryColor);
    }
}
 
Example #8
Source File: ProgressFragment.java    From FloatingActionButton with Apache License 2.0 5 votes vote down vote up
private void increaseProgress(final FloatingActionButton fab, int i) {
if (i <= mMaxProgress) {
    fab.setProgress(i, false);
    final int progress = ++i;
    mUiHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            increaseProgress(fab, progress);
        }
    }, 30);
} else {
    mUiHandler.postDelayed(new Runnable() {
 
Example #9
Source File: DeviceListFragment.java    From AndroidSDK with MIT License 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View contentView = inflater.inflate(R.layout.fragment_device_list, container, false);
    mRecyclerView = (RecyclerView) contentView.findViewById(R.id.recyler_view);
    mSwipeRefreshLayout = (SwipeRefreshLayout) contentView.findViewById(R.id.swipe_refresh_layout);
    mFabAddDevice = (FloatingActionButton) contentView.findViewById(R.id.fab_add_device);

    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mAdapter = new DeviceListAdapter();
    mAdapter.setOnLoadMoreListener(mLoadMoreListener, mRecyclerView);
    mRecyclerView.addOnItemTouchListener(new OnItemClickListener() {
        @Override
        public void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position) {
            DeviceActivity.actionDevice(getContext(), mDeviceItems.get(position));
        }
    });
    mRecyclerView.setAdapter(mAdapter);
    mSwipeRefreshLayout.setColorSchemeColors(0xFFDA4336);
    mSwipeRefreshLayout.setOnRefreshListener(this);
    getDevices(false);
    mSwipeRefreshLayout.setRefreshing(true);

    mFabAddDevice.setOnClickListener(this);
    LocalBroadcastManager.getInstance(getContext()).registerReceiver(mUpdateApiKeyReceiver, new IntentFilter(IntentActions.ACTION_UPDATE_APIKEY));
    LocalBroadcastManager.getInstance(getContext()).registerReceiver(mUpdateDeviceListReceiver, new IntentFilter(IntentActions.ACTION_UPDATE_DEVICE_LIST));
    return contentView;
}
 
Example #10
Source File: HomeFragment.java    From CoordinatorLayoutExample with Apache License 2.0 5 votes vote down vote up
@Override
protected void initView(View view) {
    mRecyclerView = (RecyclerView) mView.findViewById(R.id.recyclerView);
    mMenu = (FloatingActionMenu) mView.findViewById(R.id.menu);
    mMenuItemCollect = (FloatingActionButton) mView.findViewById(R.id.menu_item_collect);
    mMenuItemComment = (FloatingActionButton) mView.findViewById(R.id.menu_item_comment);
    mMenuItemStar = (FloatingActionButton) mView.findViewById(R.id.menu_item_star);
    mMenu.setVisibility(View.GONE);

}
 
Example #11
Source File: MessageFragment.java    From foodie-app with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = (View) inflater.inflate(
            R.layout.fragment_message, container, false);
    //设置Item增加、移除动画
    worksListView= (RecyclerView) view.findViewById(R.id.recyclerview);
    worksListView.setItemAnimator(new DefaultItemAnimator());
    sr = (SwipeRefreshLayout) view.findViewById(R.id.sr);
    fab = (FloatingActionButton) view.findViewById(R.id.fab);
    progressBar = (ProgressBar) view.findViewById(R.id.progress_bar);
    return view;
}
 
Example #12
Source File: MainService.java    From More-For-GO with GNU General Public License v3.0 5 votes vote down vote up
private void updateFab() {
    floatingActionMenuLP.gravity = Integer.parseInt(prefs.getString(Prefs.fab_position, "51"));
    Set<String> selections = prefs.getStringSet("buttons");
    ArrayList<Integer> ids = new ArrayList<>();
    if (selections != null) {
        for (String key : selections) {
            if (key.equals("pidgey_calc"))
                ids.add(R.id.pidgey_calc);

            if (key.equals("pogotoolkit"))
                ids.add(R.id.pogotoolkit);

            if (key.equals("pokevision"))
                ids.add(R.id.pokevision);

            if (key.equals("pokedex"))
                ids.add(R.id.pokedex);

            if (key.equals("the_silph_road"))
                ids.add(R.id.silph_road);
        }
        int[] buttons = {R.id.pidgey_calc, R.id.pogotoolkit, R.id.pokevision, R.id.pokedex, R.id.silph_road};
        for (int button : buttons) {
            if (!ids.contains(button)) {
                if (fab.findViewById(button) != null)
                    fab.removeMenuButton((FloatingActionButton) fab.findViewById(button));
            }
        }
    }
}
 
Example #13
Source File: ProfileManagerActivity.java    From ShadowsocksRR with Apache License 2.0 5 votes vote down vote up
@SuppressLint("RestrictedApi")
public void initFab() {
    menu = (FloatingActionMenu) findViewById(R.id.menu);
    menu.setClosedOnTouchOutside(true);
    AppCompatDrawableManager dm = AppCompatDrawableManager.get();
    FloatingActionButton manualAddFAB = (FloatingActionButton) findViewById(R.id.fab_manual_add);
    manualAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_content_create));
    manualAddFAB.setOnClickListener(this);
    final FloatingActionButton qrcodeAddFAB = (FloatingActionButton) findViewById(R.id.fab_qrcode_add);
    qrcodeAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_image_camera_alt));
    qrcodeAddFAB.setOnClickListener(this);
    FloatingActionButton nfcAddFAB = (FloatingActionButton) findViewById(R.id.fab_nfc_add);
    nfcAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_device_nfc));
    nfcAddFAB.setOnClickListener(this);
    FloatingActionButton importAddFAB = (FloatingActionButton) findViewById(R.id.fab_import_add);
    importAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_content_paste));
    importAddFAB.setOnClickListener(this);
    FloatingActionButton ssrsubAddFAB = (FloatingActionButton) findViewById(R.id.fab_ssr_sub);
    ssrsubAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_rss));
    ssrsubAddFAB.setOnClickListener(this);
    menu.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() {
        @Override
        public void onMenuToggle(boolean opened) {
            if (opened) {
                int visible = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA) ? View.VISIBLE : View.GONE;
                qrcodeAddFAB.setVisibility(visible);
            }
        }
    });
}
 
Example #14
Source File: Activity_Result.java    From MortgageCalculator with Apache License 2.0 5 votes vote down vote up
public void initViews(){
    viewPager = (ViewPager)findViewById(R.id.viewpager);
    typeOneText = (TextView)findViewById(R.id.typeOneTextView);
    typeTwoText = (TextView)findViewById(R.id.typeTwoTextView);
    cursorImageView = (ImageView)findViewById(R.id.ResultCursorImageView);

    shareMenu = (FloatingActionMenu)findViewById(R.id.menu);
    share2friendButton = (FloatingActionButton)findViewById(R.id.menu_item1);
    share2timelineButton = (FloatingActionButton)findViewById(R.id.menu_item2);
    adButton = (FloatingActionButton)findViewById(R.id.menu_item3);
}
 
Example #15
Source File: Activity_Result_Combination.java    From MortgageCalculator with Apache License 2.0 5 votes vote down vote up
public void initViews(){
    viewPager = (ViewPager)findViewById(R.id.Result_Combination_Viewpager);
    typeOneText = (TextView)findViewById(R.id.Result_Combination_TypeOne_TextView);
    typeTwoText = (TextView)findViewById(R.id.Result_Combination_TypeTwo_TextView);
    cursorImageView = (ImageView)findViewById(R.id.Result_Combination_Cursor_ImageView);

    shareMenu = (FloatingActionMenu)findViewById(R.id.combination_menu);
    share2friendButton = (FloatingActionButton)findViewById(R.id.combination_menu_item1);
    share2timelineButton = (FloatingActionButton)findViewById(R.id.combination_menu_item2);
}
 
Example #16
Source File: Activity_Result.java    From MortgageCalculator with Apache License 2.0 5 votes vote down vote up
public void initViews(){
    viewPager = (ViewPager)findViewById(R.id.viewpager);
    typeOneText = (TextView)findViewById(R.id.typeOneTextView);
    typeTwoText = (TextView)findViewById(R.id.typeTwoTextView);
    cursorImageView = (ImageView)findViewById(R.id.ResultCursorImageView);

    shareMenu = (FloatingActionMenu)findViewById(R.id.menu);
    share2friendButton = (FloatingActionButton)findViewById(R.id.menu_item1);
    share2timelineButton = (FloatingActionButton)findViewById(R.id.menu_item2);
}
 
Example #17
Source File: MainActivity.java    From QuickNote with Apache License 2.0 5 votes vote down vote up
private void initFabMenu() {
    mFabMenu = findViewById(R.id.floating_action_menu);
    FloatingActionButton fabBtnCamera = findViewById(R.id.fab_menu_item_camera);
    FloatingActionButton fabBtnAttachment = findViewById(R.id.fab_menu_item_attachment);
    FloatingActionButton fabBtnRecord = findViewById(R.id.fab_menu_item_record);
    FloatingActionButton fabBtnFreehand = findViewById(R.id.fab_menu_item_freehand);
    FloatingActionButton fabBtnText = findViewById(R.id.fab_menu_item_text);
    fabBtnCamera.setOnClickListener(this);
    fabBtnAttachment.setOnClickListener(this);
    fabBtnRecord.setOnClickListener(this);
    fabBtnFreehand.setOnClickListener(this);
    fabBtnText.setOnClickListener(this);
}
 
Example #18
Source File: ProfileManagerActivity.java    From Maying with Apache License 2.0 5 votes vote down vote up
@SuppressLint("RestrictedApi")
public void initFab() {
    menu = findViewById(R.id.menu);
    menu.setClosedOnTouchOutside(true);
    AppCompatDrawableManager dm = AppCompatDrawableManager.get();
    FloatingActionButton manualAddFAB = findViewById(R.id.fab_manual_add);
    manualAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_content_create));
    manualAddFAB.setOnClickListener(this);
    final FloatingActionButton qrcodeAddFAB = findViewById(R.id.fab_qrcode_add);
    qrcodeAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_image_camera_alt));
    qrcodeAddFAB.setOnClickListener(this);
    FloatingActionButton nfcAddFAB = findViewById(R.id.fab_nfc_add);
    nfcAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_device_nfc));
    nfcAddFAB.setOnClickListener(this);
    FloatingActionButton importAddFAB = findViewById(R.id.fab_import_add);
    importAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_content_paste));
    importAddFAB.setOnClickListener(this);
    FloatingActionButton ssrsubAddFAB = findViewById(R.id.fab_ssr_sub);
    ssrsubAddFAB.setImageDrawable(dm.getDrawable(this, R.drawable.ic_rss));
    ssrsubAddFAB.setOnClickListener(this);
    menu.setOnMenuToggleListener(opened -> {
        if (opened) {
            int visible = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA) ? View.VISIBLE : View.GONE;
            qrcodeAddFAB.setVisibility(visible);
        }
    });
}
 
Example #19
Source File: ResourceUtil.java    From TLint with Apache License 2.0 4 votes vote down vote up
public static void setFabBtnColor(Activity activity, FloatingActionButton fab) {
    // 更新FAB的颜色
    fab.setColorNormal(getThemeColor(activity));
    fab.setColorPressed(getThemeColor(activity));
    fab.setColorRipple(getThemeColor(activity));
}
 
Example #20
Source File: HomeFragment.java    From FloatingActionButton with Apache License 2.0 4 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mListView = (ListView) view.findViewById(R.id.list);
    mFab = (FloatingActionButton) view.findViewById(R.id.fab);
}
 
Example #21
Source File: MenusFragment.java    From FloatingActionButton with Apache License 2.0 4 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    menuRed = (FloatingActionMenu) view.findViewById(R.id.menu_red);
    menuYellow = (FloatingActionMenu) view.findViewById(R.id.menu_yellow);
    menuGreen = (FloatingActionMenu) view.findViewById(R.id.menu_green);
    menuBlue = (FloatingActionMenu) view.findViewById(R.id.menu_blue);
    menuDown = (FloatingActionMenu) view.findViewById(R.id.menu_down);
    menuLabelsRight = (FloatingActionMenu) view.findViewById(R.id.menu_labels_right);

    fab1 = (FloatingActionButton) view.findViewById(R.id.fab1);
    fab2 = (FloatingActionButton) view.findViewById(R.id.fab2);
    fab3 = (FloatingActionButton) view.findViewById(R.id.fab3);

    final FloatingActionButton programFab1 = new FloatingActionButton(getActivity());
    programFab1.setButtonSize(FloatingActionButton.SIZE_MINI);
    programFab1.setLabelText(getString(R.string.lorem_ipsum));
    programFab1.setImageResource(R.drawable.ic_edit);
    menuRed.addMenuButton(programFab1);
    programFab1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            programFab1.setLabelColors(ContextCompat.getColor(getActivity(), R.color.grey),
                    ContextCompat.getColor(getActivity(), R.color.light_grey),
                    ContextCompat.getColor(getActivity(), R.color.white_transparent));
            programFab1.setLabelTextColor(ContextCompat.getColor(getActivity(), R.color.black));
        }
    });

    ContextThemeWrapper context = new ContextThemeWrapper(getActivity(), R.style.MenuButtonsStyle);
    FloatingActionButton programFab2 = new FloatingActionButton(context);
    programFab2.setLabelText("Programmatically added button");
    programFab2.setImageResource(R.drawable.ic_edit);
    menuYellow.addMenuButton(programFab2);

    fab1.setEnabled(false);
    menuRed.setClosedOnTouchOutside(true);
    menuBlue.setIconAnimated(false);

    menuDown.hideMenuButton(false);
    menuRed.hideMenuButton(false);
    menuYellow.hideMenuButton(false);
    menuGreen.hideMenuButton(false);
    menuBlue.hideMenuButton(false);
    menuLabelsRight.hideMenuButton(false);

    fabEdit = (FloatingActionButton) view.findViewById(R.id.fab_edit);
    fabEdit.setShowAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.scale_up));
    fabEdit.setHideAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.scale_down));
}
 
Example #22
Source File: FragmentMediaItemDetails.java    From uPods-android with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_media_details, container, false);
    lnInternetError = (LinearLayout) view.findViewById(R.id.lnInternetError);
    rlDetailedContent = (RelativeLayout) view.findViewById(R.id.rlDetailedContent);
    viewStatusBar = view.findViewById(R.id.viewStatusBar);
    tvDetailedDescription = (TextView) view.findViewById(R.id.tvDetailedDescription);
    tvDetailedHeader = (TextView) view.findViewById(R.id.tvDetailedHeader);
    tvDetailedSubHeader = (TextView) view.findViewById(R.id.tvDetailedSubHeader);
    tvDetailedDesHeader = (TextView) view.findViewById(R.id.tvDetailedDesHeader);
    tvBottomHeader = (TextView) view.findViewById(R.id.tvDetailedBottomHeader);
    viewDetailedHeader = view.findViewById(R.id.viewDetailedHeader);
    btnSubscribe = (Button) view.findViewById(R.id.btnSubscribe);
    btnMediaMore = (ImageButton) view.findViewById(R.id.btnMediaMore);
    imgDetailedTopCover = (ImageView) view.findViewById(R.id.imgDetailedCover);
    imgBluredCover = (ImageView) view.findViewById(R.id.imgBluredCover);
    fbDetailsPlay = (FloatingActionButton) view.findViewById(R.id.fbDetailsPlay);
    svDetails = (DetailsScrollView) view.findViewById(R.id.svDetails);
    rvTracks = (RecyclerView) view.findViewById(R.id.rvTracks);
    pbTracks = (ProgressBar) view.findViewById(R.id.pbTracks);
    moveDeltaY = 0;

    if (playableItem != null) {
        initImagesColors();
        tvDetailedHeader.setText(playableItem.getName());
        tvDetailedSubHeader.setText(playableItem.getSubHeader());
        tvBottomHeader.setText(playableItem.getBottomHeader());
        btnSubscribe.setText(playableItem.isSubscribed ? getString(R.string.unsubscribe) : getString(R.string.subscribe));
        initSubscribeBtn();

        if (playableItem.hasTracks()) {
            initTrackable();
        } else {
            initNotTrackable();
        }
    }

    rlDetailedContent.setOnTouchListener(this);
    view.setOnClickListener(frgamentCloseClickListener);
    initFragmentScrollConstants();

    return view;
}
 
Example #23
Source File: MainActivity.java    From OmniList with GNU Affero General Public License v3.0 4 votes vote down vote up
private void initFloatButtons() {
    getBinding().menu.setMenuButtonColorNormal(accentColor());
    getBinding().menu.setMenuButtonColorPressed(accentColor());
    getBinding().menu.setOnMenuButtonLongClickListener(v -> {
        FabSortActivity.start(this, REQUEST_FAB_SORT);
        return false;
    });
    getBinding().menu.setOnMenuToggleListener(opened -> getBinding().rlMenuContainer.setVisibility(opened ? View.VISIBLE : View.GONE));
    getBinding().rlMenuContainer.setOnClickListener(view -> getBinding().menu.close(true));
    getBinding().rlMenuContainer.setBackgroundResource(isDarkTheme() ? R.color.dark_menu_container_background_color : R.color.light_menu_container_background_color);

    floatingActionButtons = new FloatingActionButton[]{getBinding().fab1, getBinding().fab2, getBinding().fab3, getBinding().fab4, getBinding().fab5};

    for (int i = 0; i< floatingActionButtons.length; i++) {
        floatingActionButtons[i].setColorNormal(accentColor());
        floatingActionButtons[i].setColorPressed(accentColor());
        int finalI = i;
        floatingActionButtons[i].setOnClickListener(view -> resolveFabClick(finalI));
    }

    onScrollListener = new CustomRecyclerScrollViewListener() {
        @Override
        public void show() {
            getBinding().menu.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
        }

        @Override
        public void hide() {
            RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) getBinding().menu.getLayoutParams();
            int fabMargin = lp.bottomMargin;
            getBinding().menu.animate().translationY(getBinding().menu.getHeight() + fabMargin).setInterpolator(new AccelerateInterpolator(2.0f)).start();
        }

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            if (newState == SCROLL_STATE_IDLE){
                LogUtils.d("onScrollStateChanged: SCROLL_STATE_IDLE");
            }
        }
    };
}