com.wangjie.rapidfloatingactionbutton.RapidFloatingActionButton Java Examples

The following examples show how to use com.wangjie.rapidfloatingactionbutton.RapidFloatingActionButton. 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: RapidFloatingActionButtonGroup.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    if(w > 0 && h > 0){
        reset();
        int count = this.getChildCount();
        for (int i = 0; i < count; i++) {
            View child = this.getChildAt(i);
            if (!(child instanceof RapidFloatingActionButton)) {
                continue;
            }
            addRFABToMemory((RapidFloatingActionButton) child);
        }
        if (count > 0) {
            setSection(0, 0);
        }
        // 通知初始化完毕
        if (null != onRapidFloatingButtonGroupListener) {
            onRapidFloatingButtonGroupListener.onRFABGPrepared(this);
        }
    }
}
 
Example #2
Source File: MainActivity.java    From samples-android with Apache License 2.0 6 votes vote down vote up
private void initFabBtn() {
    RapidFloatingActionButton fab = findViewById(R.id.fab);
    RapidFloatingActionLayout fabLayout = findViewById(R.id.fab_layout);

    RapidFloatingActionContentLabelList rfaContent = new RapidFloatingActionContentLabelList(this);
    rfaContent.setOnRapidFloatingActionContentLabelListListener(this);
    List<RFACLabelItem> items = new ArrayList<>();
    items.add(new RFACLabelItem<Integer>()
            .setLabel(getString(R.string.scan_qr_code))
    );
    items.add(new RFACLabelItem<Integer>()
            .setLabel(getString(R.string.input_manually))
    );

    rfaContent.setItems(items);
    fabHelper = new RapidFloatingActionHelper(
            this,
            fabLayout,
            fab,
            rfaContent
    ).build();
}
 
Example #3
Source File: RapidFloatingActionButtonGroup.java    From RapidFloatingActionButton with Apache License 2.0 6 votes vote down vote up
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    if(w > 0 && h > 0){
        reset();
        int count = this.getChildCount();
        for (int i = 0; i < count; i++) {
            View child = this.getChildAt(i);
            if (!(child instanceof RapidFloatingActionButton)) {
                continue;
            }
            addRFABToMemory((RapidFloatingActionButton) child);
        }
        if (count > 0) {
            setSection(0, 0);
        }
        // 通知初始化完毕
        if (null != onRapidFloatingButtonGroupListener) {
            onRapidFloatingButtonGroupListener.onRFABGPrepared(this);
        }
    }
}
 
Example #4
Source File: RapidFloatingActionButtonGroup.java    From RapidFloatingActionButton with Apache License 2.0 5 votes vote down vote up
private void addRFABToMemory(@NonNull RapidFloatingActionButton rfab) {
    allRfabs.add(rfab);
    String identificationCode = rfab.getIdentificationCode();
    if (RapidFloatingActionButton.IDENTIFICATION_CODE_NONE.equals(identificationCode)) {
        throw new RuntimeException("RFAB[" + rfab + "]'s IDENTIFICATION CODE can not be IDENTIFICATION_CODE_NONE if you used RapidFloatingActionButtonGroup");
    }
    if (allRfabsByIdentificationCode.containsKey(identificationCode)) {
        throw new RuntimeException("RFAB[" + rfab + "] Duplicate IDENTIFICATION CODE");
    }
    allRfabsByIdentificationCode.put(identificationCode, rfab);
}
 
Example #5
Source File: RapidFloatingActionButtonGroup.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void addRFABToMemory(@NonNull RapidFloatingActionButton rfab) {
    allRfabs.add(rfab);
    String identificationCode = rfab.getIdentificationCode();
    if (RapidFloatingActionButton.IDENTIFICATION_CODE_NONE.equals(identificationCode)) {
        throw new RuntimeException("RFAB[" + rfab + "]'s IDENTIFICATION CODE can not be IDENTIFICATION_CODE_NONE if you used RapidFloatingActionButtonGroup");
    }
    if (allRfabsByIdentificationCode.containsKey(identificationCode)) {
        throw new RuntimeException("RFAB[" + rfab + "] Duplicate IDENTIFICATION CODE");
    }
    allRfabsByIdentificationCode.put(identificationCode, rfab);
}
 
Example #6
Source File: SeparateRFABSampleActivity.java    From RapidFloatingActionButton with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.separate_rfab_sample);
    rfab = (RapidFloatingActionButton) findViewById(R.id.separate_rfab_sample_rfab);
    rfab.setOnRapidFloatingButtonSeparateListener(this);
}
 
Example #7
Source File: CardListSampleActivity.java    From RapidFloatingActionButton with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.card_list_sample);
    rfaLayout = (RapidFloatingActionLayout) findViewById(R.id.card_list_sample_rfal);
    rfaButton = (RapidFloatingActionButton) findViewById(R.id.card_list_sample_rfab);

    RapidFloatingActionContentCardListView rfaContent = new RapidFloatingActionContentCardListView(this);
    rfaContent.setOnRapidFloatingActionContentCardListViewListener(this);

    List<CardItem> cardItems = new ArrayList<>();
    cardItems.add(new CardItem().setName("wangjie").setResId(R.mipmap.head_test_a));
    cardItems.add(new CardItem().setName("tiantian").setResId(R.mipmap.head_test_b));
    cardItems.add(new CardItem().setName("wangjiegulu").setResId(R.mipmap.head_test_c));
    cardItems.add(new CardItem().setName("咕噜不爱猫").setResId(R.mipmap.head_test_d));
    rfaContent.setList(cardItems);


    rfaLayout.setIsContentAboveLayout(false);
    rfaLayout.setDisableContentDefaultAnimation(true);

    rfabHelper = new RapidFloatingActionHelper(
            this,
            rfaLayout,
            rfaButton,
            rfaContent
    ).build();


}
 
Example #8
Source File: FragmentB.java    From RapidFloatingActionButton with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitialRFAB(RapidFloatingActionButton rfab) {
    this.rfaButton = rfab;
    if (null == rfaButton) {
        return;
    }
    rfaButton.setOnRapidFloatingButtonSeparateListener(this);
}
 
Example #9
Source File: FragmentA.java    From RapidFloatingActionButton with Apache License 2.0 4 votes vote down vote up
@Override
public void onInitialRFAB(RapidFloatingActionButton rfab) {
    this.rfaButton = rfab;
    initRFAB();
}
 
Example #10
Source File: RapidFloatingActionButtonGroup.java    From RapidFloatingActionButton with Apache License 2.0 4 votes vote down vote up
public void addRFABs(RapidFloatingActionButton... rfabs) {
    for (RapidFloatingActionButton rfab : rfabs) {
        addRFABToMemory(rfab);
        this.addView(rfab);
    }
}
 
Example #11
Source File: BaseFragment.java    From RapidFloatingActionButton with Apache License 2.0 4 votes vote down vote up
public void onInitialRFAB(RapidFloatingActionButton rfab) {
}
 
Example #12
Source File: FragmentC.java    From RapidFloatingActionButton with Apache License 2.0 4 votes vote down vote up
@Override
public void onInitialRFAB(RapidFloatingActionButton rfab) {
    this.rfaButton = rfab;
    initRFAB();
}
 
Example #13
Source File: LabelListSampleActivity.java    From RapidFloatingActionButton with Apache License 2.0 4 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.label_list_sample);
        rfaLayout = (RapidFloatingActionLayout) findViewById(R.id.label_list_sample_rfal);
        rfaButton = (RapidFloatingActionButton) findViewById(R.id.label_list_sample_rfab);
        /*
        // 可通过代码设置属性
        rfaLayout.setFrameColor(Color.RED);
        rfaLayout.setFrameAlpha(0.4f);

        rfaButton.setNormalColor(0xff37474f);
        rfaButton.setPressedColor(0xff263238);
        rfaButton.getRfabProperties().setShadowDx(ABTextUtil.dip2px(this, 3));
        rfaButton.getRfabProperties().setShadowDy(ABTextUtil.dip2px(this, 3));
        rfaButton.getRfabProperties().setShadowRadius(ABTextUtil.dip2px(this, 5));
        rfaButton.getRfabProperties().setShadowColor(0xffcccccc);
        rfaButton.getRfabProperties().setStandardSize(RFABSize.MINI);
        rfaButton.build();
        */

        RapidFloatingActionContentLabelList rfaContent = new RapidFloatingActionContentLabelList(this);
        rfaContent.setOnRapidFloatingActionContentLabelListListener(this);
        List<RFACLabelItem> items = new ArrayList<>();
        items.add(new RFACLabelItem<Integer>()
                        .setLabel("Github: wangjiegulu")
                        .setResId(R.mipmap.ico_test_d)
                        .setIconNormalColor(0xffd84315)
                        .setIconPressedColor(0xffbf360c)
                        .setWrapper(0)
        );
        items.add(new RFACLabelItem<Integer>()
                        .setLabel("[email protected]")
//                        .setResId(R.mipmap.ico_test_c)
                        .setDrawable(getResources().getDrawable(R.mipmap.ico_test_c))
                        .setIconNormalColor(0xff4e342e)
                        .setIconPressedColor(0xff3e2723)
                        .setLabelColor(Color.WHITE)
                        .setLabelSizeSp(14)
                        .setLabelBackgroundDrawable(RFABShape.generateCornerShapeDrawable(0xaa000000, RFABTextUtil.dip2px(this, 4)))
                        .setWrapper(1)
        );
        items.add(new RFACLabelItem<Integer>()
                        .setLabel("WangJie")
                        .setResId(R.mipmap.ico_test_b)
                        .setIconNormalColor(0xff056f00)
                        .setIconPressedColor(0xff0d5302)
                        .setLabelColor(0xff056f00)
                        .setWrapper(2)
        );
        items.add(new RFACLabelItem<Integer>()
                        .setLabel("Compose")
                        .setResId(R.mipmap.ico_test_a)
                        .setIconNormalColor(0xff283593)
                        .setIconPressedColor(0xff1a237e)
                        .setLabelColor(0xff283593)
                        .setWrapper(3)
        );
        rfaContent
                .setItems(items)
                .setIconShadowRadius(RFABTextUtil.dip2px(this, 5))
                .setIconShadowColor(0xff888888)
                .setIconShadowDy(RFABTextUtil.dip2px(this, 5))
        ;

        rfabHelper = new RapidFloatingActionHelper(
                this,
                rfaLayout,
                rfaButton,
                rfaContent
        ).build();

    }
 
Example #14
Source File: RapidFloatingActionButtonGroup.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void addRFABs(RapidFloatingActionButton... rfabs) {
    for (RapidFloatingActionButton rfab : rfabs) {
        addRFABToMemory(rfab);
        this.addView(rfab);
    }
}
 
Example #15
Source File: OnRapidFloatingActionListener.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * 获取当前的RFAB对象
 *
 * @return
 */
RapidFloatingActionButton obtainRFAButton();
 
Example #16
Source File: OnRapidFloatingActionListener.java    From RapidFloatingActionButton with Apache License 2.0 2 votes vote down vote up
/**
 * 获取当前的RFAB对象
 *
 * @return
 */
RapidFloatingActionButton obtainRFAButton();
 
Example #17
Source File: RapidFloatingActionButtonGroup.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * 根据identificationCode获取
 *
 * @param identificationCode
 * @return
 */
public RapidFloatingActionButton getRFABByIdentificationCode(String identificationCode) {
    return allRfabsByIdentificationCode.get(identificationCode);
}
 
Example #18
Source File: RapidFloatingActionButtonGroup.java    From RapidFloatingActionButton with Apache License 2.0 2 votes vote down vote up
/**
 * 根据identificationCode获取
 *
 * @param identificationCode
 * @return
 */
public RapidFloatingActionButton getRFABByIdentificationCode(String identificationCode) {
    return allRfabsByIdentificationCode.get(identificationCode);
}