Skip to content

Commit

Permalink
Bugfix 349: update label shadow size
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelaysam authored Jun 19, 2017
1 parent d3feaad commit 39ecb9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 4 additions & 8 deletions library/src/main/java/com/github/clans/fab/Label.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,13 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
}

private int calculateMeasuredWidth() {
if (mRawWidth == 0) {
mRawWidth = getMeasuredWidth();
}
return getMeasuredWidth() + calculateShadowWidth();
mRawWidth = getMeasuredWidth();
return mRawWidth + calculateShadowWidth();
}

private int calculateMeasuredHeight() {
if (mRawHeight == 0) {
mRawHeight = getMeasuredHeight();
}
return getMeasuredHeight() + calculateShadowHeight();
mRawHeight = getMeasuredHeight();
return mRawHeight + calculateShadowHeight();
}

int calculateShadowWidth() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class MenusFragment extends Fragment {
private List<FloatingActionMenu> menus = new ArrayList<>();
private Handler mUiHandler = new Handler();

private boolean mShowLongText = false;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Expand All @@ -65,7 +67,7 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

final FloatingActionButton programFab1 = new FloatingActionButton(getActivity());
programFab1.setButtonSize(FloatingActionButton.SIZE_MINI);
programFab1.setLabelText(getString(R.string.lorem_ipsum));
programFab1.setLabelText(getString(mShowLongText ? R.string.lorem_ipsum : R.string.app_name));
programFab1.setImageResource(R.drawable.ic_edit);
menuRed.addMenuButton(programFab1);
programFab1.setOnClickListener(new View.OnClickListener() {
Expand All @@ -75,6 +77,8 @@ public void onClick(View v) {
ContextCompat.getColor(getActivity(), R.color.light_grey),
ContextCompat.getColor(getActivity(), R.color.white_transparent));
programFab1.setLabelTextColor(ContextCompat.getColor(getActivity(), R.color.black));
programFab1.setLabelText(getString(mShowLongText ? R.string.app_name : R.string.lorem_ipsum));
mShowLongText = !mShowLongText;
}
});

Expand Down

0 comments on commit 39ecb9b

Please sign in to comment.