Skip to content

Commit

Permalink
Merge branch 'release/v0.2.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
pluscubed committed Mar 30, 2015
2 parents fb0bc06 + d08a715 commit dc4fb43
Show file tree
Hide file tree
Showing 47 changed files with 850 additions and 588 deletions.
21 changes: 11 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ task syncTask(type: Sync) {
preBuild.dependsOn('syncTask')

android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.pluscubed.plustimer"
minSdkVersion 14
targetSdkVersion 21
versionCode 21
versionName '0.2.3'
targetSdkVersion 22
versionCode 22
versionName '0.2.4'
}

if (project.hasProperty("RELEASE_STORE_FILE")) {
Expand All @@ -47,13 +47,14 @@ android {
}

buildTypes {
//noinspection GroovyMissingReturnStatement
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
if (project.hasProperty("RELEASE_STORE_FILE")) {
signingConfig signingConfigs.release
} else {
signingConfig signingConfigs.debug
}
}
debug {
Expand All @@ -80,12 +81,12 @@ android {

dependencies {
compile 'com.jjoe64:graphview:3.+'
compile 'com.android.support:appcompat-v7:21.+'
compile 'com.android.support:support-v13:21.+'
compile 'com.android.support:recyclerview-v7:21.+'
compile 'com.android.support:appcompat-v7:22.+'
compile 'com.android.support:support-v13:22.+'
compile 'com.android.support:recyclerview-v7:22.+'
compile 'com.github.cubing:tnoodle-android:0.+@aar'
compile 'com.caverock:androidsvg:1.2.1'
compile 'com.android.support:support-annotations:21.+'
compile 'com.android.support:support-annotations:22.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.+'
compile 'com.afollestad:material-dialogs:0.+'
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/.gitignore

This file was deleted.

19 changes: 11 additions & 8 deletions app/src/main/java/com/pluscubed/plustimer/model/PuzzleType.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,17 @@ public Session deserialize(JsonElement json, Type typeOfT,
throws JsonParseException {

Gson gson = new GsonBuilder()
.registerTypeAdapter(ScrambleAndSvg.class, new JsonDeserializer<ScrambleAndSvg>() {
@Override
public ScrambleAndSvg deserialize(JsonElement json, Type typeOfT,
JsonDeserializationContext context)
throws JsonParseException {
return new ScrambleAndSvg(json.getAsJsonPrimitive().getAsString(), null);
}
}).create();
.registerTypeAdapter(ScrambleAndSvg.class, new
JsonDeserializer<ScrambleAndSvg>() {
@Override
public ScrambleAndSvg deserialize(JsonElement json,
Type typeOfT,
JsonDeserializationContext context)
throws JsonParseException {
return new ScrambleAndSvg(json.getAsJsonPrimitive
().getAsString(), null);
}
}).create();

Session s = gson.fromJson(json, typeOfT);
for (final Solve solve : s.getSolves()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.pluscubed.plustimer.ui;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Fragment;
import android.app.FragmentManager;
import android.graphics.Color;
Expand All @@ -19,6 +21,7 @@
import android.view.animation.DecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.Spinner;

Expand All @@ -28,6 +31,7 @@
import com.pluscubed.plustimer.model.PuzzleType;
import com.pluscubed.plustimer.ui.widget.LockingViewPager;
import com.pluscubed.plustimer.ui.widget.SlidingTabLayout;
import com.pluscubed.plustimer.utils.PrefUtils;

import io.fabric.sdk.android.Fabric;

Expand All @@ -50,6 +54,7 @@ public class CurrentSessionActivity extends DrawerActivity implements
private boolean mInvalidateActionBarOnDrawerClosed;
private SlidingTabLayout mSlidingTabLayout;
private LockingViewPager mViewPager;
private int mContentFrameLayoutHeight;

private static String makeFragmentName(int viewId, int index) {
return "android:switcher:" + viewId + ":" + index;
Expand All @@ -59,70 +64,78 @@ public Toolbar getActionBarToolbar() {
return super.getActionBarToolbar();
}

@Override
public FrameLayout getContentFrameLayout() {
return (FrameLayout) findViewById(R.id
.activity_current_session_framelayout);
}

@Override
public void playToolbarExitAnimation() {
final LinearLayout toolbar = (LinearLayout) findViewById(R.id.activity_current_session_headerbar);
findViewById(R.id.activity_current_session_toolbarshadow).setVisibility(View.GONE);
ObjectAnimator exit = ObjectAnimator.ofFloat(toolbar, View.Y,
final LinearLayout toolbar = (LinearLayout) findViewById(R.id
.activity_current_session_headerbar);
final FrameLayout layout = (FrameLayout) findViewById(R.id
.activity_current_session_framelayout);
mContentFrameLayoutHeight = layout.getHeight();

ObjectAnimator exit = ObjectAnimator.ofFloat(toolbar, View.TRANSLATION_Y,
-toolbar.getHeight());
exit.setDuration(300);
exit.setInterpolator(new AccelerateInterpolator());
AnimatorSet scrambleAnimatorSet = new AnimatorSet();
scrambleAnimatorSet.play(exit);
scrambleAnimatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {

}

@Override
public void onAnimationEnd(Animator animation) {
if (toolbar.getY() == -toolbar.getHeight()) {
toolbar.setVisibility(View.GONE);
}
}

exit.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationCancel(Animator animation) {

}

@Override
public void onAnimationRepeat(Animator animation) {

public void onAnimationUpdate(ValueAnimator animation) {
LinearLayout.LayoutParams params =
(LinearLayout.LayoutParams) layout.getLayoutParams();
params.height =
mContentFrameLayoutHeight - (int) (float) animation.getAnimatedValue();
params.weight = 0;
layout.setLayoutParams(params);
layout.setTranslationY((int) (float) animation.getAnimatedValue());
}
});

AnimatorSet scrambleAnimatorSet = new AnimatorSet();
scrambleAnimatorSet.play(exit);
scrambleAnimatorSet.start();
}

@Override
public void playToolbarEnterAnimation() {
final LinearLayout toolbar = (LinearLayout) findViewById(R.id.activity_current_session_headerbar);
ObjectAnimator exit = ObjectAnimator.ofFloat(toolbar, View.Y, 0f);
final LinearLayout toolbar = (LinearLayout) findViewById(R.id
.activity_current_session_headerbar);
final FrameLayout layout = (FrameLayout) findViewById(R.id
.activity_current_session_framelayout);

ObjectAnimator exit = ObjectAnimator.ofFloat(toolbar, View.TRANSLATION_Y, 0f);
exit.setDuration(300);
exit.setInterpolator(new DecelerateInterpolator());
AnimatorSet scrambleAnimatorSet = new AnimatorSet();
scrambleAnimatorSet.play(exit);
toolbar.setVisibility(View.VISIBLE);
scrambleAnimatorSet.addListener(new Animator.AnimatorListener() {
exit.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationStart(Animator animation) {

public void onAnimationUpdate(ValueAnimator animation) {
LinearLayout.LayoutParams params =
(LinearLayout.LayoutParams) layout.getLayoutParams();
params.height =
mContentFrameLayoutHeight - (int) (float) animation.getAnimatedValue();
params.weight = 0;
layout.setLayoutParams(params);
layout.setTranslationY((int) (float) animation.getAnimatedValue());
}
});

AnimatorSet scrambleAnimatorSet = new AnimatorSet();
scrambleAnimatorSet.play(exit);
toolbar.setVisibility(View.VISIBLE);
scrambleAnimatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
findViewById(R.id.activity_current_session_toolbarshadow).setVisibility(View.VISIBLE);
}

@Override
public void onAnimationCancel(Animator animation) {

}

@Override
public void onAnimationRepeat(Animator animation) {

if (toolbar.getTranslationY() == 0) {
LinearLayout.LayoutParams params =
(LinearLayout.LayoutParams) layout.getLayoutParams();
params.height = 0;
params.weight = 1;
layout.setLayoutParams(params);
}
}
});
scrambleAnimatorSet.start();
Expand All @@ -131,7 +144,8 @@ public void onAnimationRepeat(Animator animation) {
@Override
public void lockDrawerAndViewPager(boolean lock) {
mSlidingTabLayout.setClickEnabled(!lock);
mViewPager.setPagingEnabled(!lock);
if (!PrefUtils.isLockSwipingEnabled(this))
mViewPager.setPagingEnabled(!lock);
lockDrawer(lock);
}

Expand Down Expand Up @@ -207,7 +221,6 @@ public void onPageScrollStateChanged(int state) {
if (state == ViewPager.SCROLL_STATE_DRAGGING || state ==
ViewPager.SCROLL_STATE_SETTLING) {
getCurrentSessionTimerFragment().stopHoldTimer();
getCurrentSessionTimerFragment().playEnterAnimations();
getSolveListFragment().finishActionMode();
}
}
Expand All @@ -225,6 +238,7 @@ protected void onResume() {
// TODO: Only update Spinner, not invalidate whole action bar
// When puzzle types are enabled/disabled, update Spinner
queueInvalidateOptionsMenu();
mViewPager.setPagingEnabled(!PrefUtils.isLockSwipingEnabled(this));
}

private CurrentSessionTimerFragment getCurrentSessionTimerFragment() {
Expand Down Expand Up @@ -267,7 +281,6 @@ protected void onNavDrawerClosed() {
protected void onNavDrawerSlide(float offset) {
getSolveListFragment().finishActionMode();
getCurrentSessionTimerFragment().stopHoldTimer();
getCurrentSessionTimerFragment().playEnterAnimations();
}

@Override
Expand All @@ -284,7 +297,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
}
getMenuInflater().inflate(R.menu.menu_current_session, menu);

Spinner menuPuzzleSpinner = (Spinner) MenuItemCompat.getActionView
final Spinner menuPuzzleSpinner = (Spinner) MenuItemCompat.getActionView
(menu.findItem(R.id
.menu_activity_current_session_puzzletype_spinner));
ArrayAdapter<PuzzleType> puzzleTypeSpinnerAdapter = new
Expand All @@ -298,11 +311,12 @@ public boolean onCreateOptionsMenu(Menu menu) {
@Override
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id) {
PuzzleType.getCurrent().getSession(PuzzleType.CURRENT_SESSION)
.unregisterAllObservers();
PuzzleType.setCurrent((PuzzleType) parent.getItemAtPosition
(position), CurrentSessionActivity.this);

PuzzleType newPuzzleType = (PuzzleType) parent.getItemAtPosition(position);
if (newPuzzleType != PuzzleType.getCurrent()) {
PuzzleType.getCurrent().getSession(PuzzleType.CURRENT_SESSION)
.unregisterAllObservers();
PuzzleType.setCurrent(newPuzzleType, CurrentSessionActivity.this);
}
}

@Override
Expand Down
Loading

0 comments on commit dc4fb43

Please sign in to comment.