Skip to content

Commit

Permalink
Merge branch 'release-1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
markormesher committed May 9, 2016
2 parents c66490b + 994c3e2 commit e7822e6
Show file tree
Hide file tree
Showing 7 changed files with 9,276 additions and 40 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
}
Expand All @@ -13,8 +13,8 @@ buildscript {
}

def version = new Properties()
version['code'] = 6
version['name'] = '1.1.0'
version['code'] = 7
version['name'] = '1.1.1'

def secrets = getSecrets()

Expand All @@ -29,7 +29,7 @@ android {
}

compileSdkVersion 23
buildToolsVersion "23.0.2"
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "uk.co.markormesher.android_fab.app"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,43 +175,43 @@ protected int getCount() {

@Override
protected MenuItem getViews(Context context, int position) {
MenuItem mi = new MenuItem();

switch (position) {
case 0:
// example: View and View
ImageView icon0 = new ImageView(context);
icon0.setImageResource(R.mipmap.ic_done);
TextView label0 = new TextView(context);
label0.setText(getString(R.string.speed_dial_label, position));
return new MenuItem() {{
iconView = icon0;
labelView = label0;
}};
mi.iconView = icon0;
mi.labelView = label0;
break;

case 1:
// example: Drawable and String
return new MenuItem() {{
iconDrawable = ContextCompat.getDrawable(context, R.mipmap.ic_swap_horiz);
labelString = getString(R.string.speed_dial_label, position);
}};
mi.iconDrawable = ContextCompat.getDrawable(context, R.mipmap.ic_swap_horiz);
mi.labelString = getString(R.string.speed_dial_label, position);
break;

case 2:
// example: Drawable ID and String
return new MenuItem() {{
iconDrawableId = R.mipmap.ic_swap_vert;
labelString = getString(R.string.speed_dial_label, position);
}};
mi.iconDrawableId = R.mipmap.ic_swap_vert;
mi.labelString = getString(R.string.speed_dial_label, position);
break;

case 3:
// example: Drawable ID and String ID
return new MenuItem() {{
iconDrawableId = R.mipmap.ic_cloud;
labelStringId = R.string.label_optional_close;
}};
mi.iconDrawableId = R.mipmap.ic_cloud;
mi.labelStringId = R.string.label_optional_close;
break;

default:
Log.wtf(C.LOG_TAG, "Okay, something went *really* wrong.");
return new MenuItem();
return mi;
}

return mi;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.tools.build:gradle:1.5.0'
}
}

Expand Down
10 changes: 5 additions & 5 deletions fab/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
}
Expand All @@ -13,8 +13,8 @@ buildscript {
}

def version = new Properties()
version['code'] = 6
version['name'] = '1.1.0'
version['code'] = 7
version['name'] = '1.1.1'

apply plugin: 'me.tatarka.retrolambda'

Expand All @@ -27,7 +27,7 @@ android {
}

compileSdkVersion 23
buildToolsVersion "23.0.2"
buildToolsVersion "23.0.3"

defaultConfig {
minSdkVersion 12
Expand All @@ -43,7 +43,7 @@ repositories {

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-annotations:24.0.0-alpha1'
compile 'com.android.support:support-annotations:23.1.1'
compile 'com.android.support:cardview-v7:23.2.0'

androidTestCompile 'junit:junit:4.12'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ public void rebuildSpeedDialMenu() {

// hide
view.setAlpha(0F);
view.setVisibility(GONE);

// clicks
view.setTag(i);
Expand Down Expand Up @@ -425,22 +426,25 @@ public void onAnimationEnd(Animator animation) {
*
* @param visible {@code true} to indicate that the menu is open
*/
private void setSpeedDialMenuVisible(boolean visible) {
private void setSpeedDialMenuVisible(final boolean visible) {
// busy?
if (busyAnimatingSpeedDialMenu) return;
busyAnimatingSpeedDialMenu = true;

// animate
// animate, setting visibility as well to prevent phantom clicks
int distance = cardView.getHeight();
for (int i = 0, n = speedDialMenuItems.size(); i < n; ++i) {
speedDialMenuItems.get(i).animate()
final View v = speedDialMenuItems.get(i);
if (visible) v.setVisibility(VISIBLE);
v.animate()
.translationY(visible ? ((i + 1) * distance * -1) - (distance / 8) : 0F)
.alpha(visible ? 1F : 0F)
.setDuration(SPEED_DIAL_ANIMATION_DURATION)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
busyAnimatingSpeedDialMenu = false;
if (!visible) v.setVisibility(GONE);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,15 @@ protected boolean rotateFab() {
/**
* Wrapper class for returning the views to use for a speed-dial menu item.
*/
protected static class MenuItem {
public static class MenuItem {

public MenuItem() {
}
public View iconView;
public Drawable iconDrawable;
public int iconDrawableId = -1;

protected View iconView;
protected Drawable iconDrawable;
protected int iconDrawableId = -1;

protected View labelView;
protected String labelString;
protected int labelStringId = -1;
public View labelView;
public String labelString;
public int labelStringId = -1;

}

Expand Down
Loading

0 comments on commit e7822e6

Please sign in to comment.