Skip to content

Commit

Permalink
Merge branch 'release/v0.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
pluscubed committed Feb 7, 2015
2 parents 13cd64b + 776f643 commit 8da31ba
Show file tree
Hide file tree
Showing 37 changed files with 1,060 additions and 725 deletions.
9 changes: 3 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.pluscubed.plustimer"
minSdkVersion 14
targetSdkVersion 21
versionCode 19
versionName '0.2.1'
versionCode 20
versionName '0.2.2'
}

if (project.hasProperty("RELEASE_STORE_FILE")) {
Expand Down Expand Up @@ -75,10 +76,6 @@ android {
ext.enableCrashlytics = false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}

dependencies {
Expand Down
11 changes: 5 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="com.pluscubed.plustimer"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.pluscubed.plustimer">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
Expand All @@ -13,7 +12,7 @@
android:supportsRtl="true"
android:theme="@style/Theme.PlusTimer"
tools:replace="android:theme, android:icon">
<activity
<activity
android:name="com.pluscubed.plustimer.ui.CurrentSessionActivity"
android:label="@string/app_name"
android:theme="@style/Theme.PlusTimer.WithNavDrawer">
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/java/com/pluscubed/plustimer/model/PuzzleType.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ public synchronized static void initialize(Context context) {
PrefUtils.saveVersionCode(context);
}

public String getHistoryFileName() {
return historyFileName;
}

public String getCurrentSessionFileName() {
return currentSessionFileName;
}

public HistorySessions getHistorySessions() {
return mHistorySessions;
}
Expand Down Expand Up @@ -265,7 +273,7 @@ public void resetCurrentSession() {
mCurrentSession.reset();
}

public boolean isEnabled() {
boolean isEnabled() {
return mEnabled;
}

Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/pluscubed/plustimer/model/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public void reset() {
notifyReset();
}

public void notifySolveAdded() {
void notifySolveAdded() {
for (Observer s : mObservers) {
s.onSolveAdded();
}
}

public void notifySolveDeleted(int index) {
void notifySolveDeleted(int index) {
for (Observer s : mObservers) {
s.onSolveRemoved(index);
}
Expand All @@ -70,7 +70,7 @@ public void notifySolveChanged(int index) {
}
}

public void notifyReset() {
void notifyReset() {
for (Observer s : mObservers) {
s.onReset();
}
Expand Down Expand Up @@ -146,8 +146,8 @@ public String getStringCurrentAverageOf(int number,
* @param millisecondsEnabled whether to display milliseconds
* @return the best average of some number of solves
*/
public String getStringBestAverageOf(int number,
boolean millisecondsEnabled) {
String getStringBestAverageOf(int number,
boolean millisecondsEnabled) {
long bestAverage = getBestAverageOf(number);
if (bestAverage == GET_AVERAGE_INVALID_NOT_ENOUGH) {
return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import com.pluscubed.plustimer.BuildConfig;
import com.pluscubed.plustimer.R;
import com.pluscubed.plustimer.utils.Utils;
import com.pluscubed.plustimer.utils.ErrorUtils;

/**
* About Page
Expand Down Expand Up @@ -126,7 +126,7 @@ public void onClick(View v) {
send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Utils.sendHistoryDataEmail(getActivity());
ErrorUtils.sendFileDataEmail(getActivity());

}
});
Expand Down

This file was deleted.

146 changes: 100 additions & 46 deletions app/src/main/java/com/pluscubed/plustimer/ui/CurrentSessionActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.pluscubed.plustimer.ui;

import android.app.DialogFragment;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Fragment;
import android.app.FragmentManager;
import android.graphics.Color;
Expand All @@ -13,28 +15,28 @@
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.Spinner;

import com.crashlytics.android.Crashlytics;
import com.pluscubed.plustimer.BuildConfig;
import com.pluscubed.plustimer.R;
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.Utils;

import io.fabric.sdk.android.Fabric;

/**
* Current Session Activity
*/
public class CurrentSessionActivity extends DrawerActivity implements
CreateDialogCallback,
CurrentSessionTimerFragment.ActivityCallback {

public static final String DIALOG_SOLVE_TAG = "SOLVE_DIALOG";

private static final String STATE_MENU_ITEMS_ENABLE_BOOLEAN =
"menu_items_enable_boolean";

Expand All @@ -46,16 +48,93 @@ public class CurrentSessionActivity extends DrawerActivity implements
private int mSelectedPage;

private boolean mInvalidateActionBarOnDrawerClosed;
private SlidingTabLayout mSlidingTabLayout;
private LockingViewPager mViewPager;

public static String makeFragmentName(int viewId, int index) {
private static String makeFragmentName(int viewId, int index) {
return "android:switcher:" + viewId + ":" + index;
}

@Override
public Toolbar getActionBarToolbar() {
return super.getActionBarToolbar();
}

@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,
-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);
}
}

@Override
public void onAnimationCancel(Animator animation) {

}

@Override
public void onAnimationRepeat(Animator animation) {

}
});
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);
exit.setDuration(300);
exit.setInterpolator(new DecelerateInterpolator());
AnimatorSet scrambleAnimatorSet = new AnimatorSet();
scrambleAnimatorSet.play(exit);
toolbar.setVisibility(View.VISIBLE);
scrambleAnimatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {

}

@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) {

}
});
scrambleAnimatorSet.start();
}

@Override
public void lockDrawerAndViewPager(boolean lock) {
mSlidingTabLayout.setClickEnabled(!lock);
mViewPager.setPagingEnabled(!lock);
lockDrawer(lock);
}

@Override
public CurrentSessionTimerRetainedFragment getTimerRetainedFragment() {
return (CurrentSessionTimerRetainedFragment)
Expand All @@ -73,12 +152,12 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_current_session);

PuzzleType.initialize(this);

if (BuildConfig.USE_CRASHLYTICS) {
Fabric.with(this, new Crashlytics());
}

PuzzleType.initialize(this);

if (savedInstanceState != null) {
mScrambleImageActionEnable = savedInstanceState.getBoolean
(STATE_MENU_ITEMS_ENABLE_BOOLEAN);
Expand All @@ -94,24 +173,24 @@ protected void onCreate(Bundle savedInstanceState) {
}

//Set up ViewPager with CurrentSessionAdapter
ViewPager viewPager = (ViewPager) findViewById(R.id
mViewPager = (LockingViewPager) findViewById(R.id
.activity_current_session_viewpager);
viewPager.setAdapter(new CurrentSessionPagerAdapter
mViewPager.setAdapter(new CurrentSessionPagerAdapter
(getFragmentManager(),
getResources().getStringArray(R.array
.current_session_page_titles)));

//Set up SlidingTabLayout
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R
mSlidingTabLayout = (SlidingTabLayout) findViewById(R
.id.activity_current_session_slidingtablayout);
int[] attrs = {R.attr.colorAccent};
slidingTabLayout.setSelectedIndicatorColors(obtainStyledAttributes
mSlidingTabLayout.setSelectedIndicatorColors(obtainStyledAttributes
(attrs).getColor(0, Color.BLACK));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setCustomTabView(R.layout.sliding_tab_textview,
mSlidingTabLayout.setDistributeEvenly(true);
mSlidingTabLayout.setCustomTabView(R.layout.sliding_tab_textview,
android.R.id.text1);
slidingTabLayout.setViewPager(viewPager);
slidingTabLayout.setOnPageChangeListener(new ViewPager
mSlidingTabLayout.setViewPager(mViewPager);
mSlidingTabLayout.setOnPageChangeListener(new ViewPager
.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset,
Expand All @@ -128,11 +207,12 @@ public void onPageScrollStateChanged(int state) {
if (state == ViewPager.SCROLL_STATE_DRAGGING || state ==
ViewPager.SCROLL_STATE_SETTLING) {
getCurrentSessionTimerFragment().stopHoldTimer();
getCurrentSessionTimerFragment().playEnterAnimations();
getSolveListFragment().finishActionMode();
}
}
});
viewPager.setCurrentItem(0);
mViewPager.setCurrentItem(0);

getSupportActionBar().setElevation(0);

Expand All @@ -159,7 +239,7 @@ private SolveListFragment getSolveListFragment() {
.activity_current_session_viewpager, 1));
}

public void queueInvalidateOptionsMenu() {
void queueInvalidateOptionsMenu() {
if (!isNavDrawerOpen()) {
invalidateOptionsMenu();
} else {
Expand Down Expand Up @@ -187,6 +267,7 @@ protected void onNavDrawerClosed() {
protected void onNavDrawerSlide(float offset) {
getSolveListFragment().finishActionMode();
getCurrentSessionTimerFragment().stopHoldTimer();
getCurrentSessionTimerFragment().playEnterAnimations();
}

@Override
Expand Down Expand Up @@ -255,33 +336,6 @@ public void onNothingSelected(AdapterView<?> parent) {
return super.onCreateOptionsMenu(menu);
}

@Override
public void createSolveDisplayDialog(String displayName, int sessionIndex,
int solveIndex) {
DialogFragment dialog = (DialogFragment) getFragmentManager()
.findFragmentByTag(DIALOG_SOLVE_TAG);
if (!Utils.assertSolveExists(this, solveIndex, PuzzleType.CURRENT_SESSION)) {
return;
}
if (dialog == null) {
SolveDialogFragment d = SolveDialogFragment.newInstanceDisplay
(PuzzleType.getCurrent().name(),
PuzzleType.CURRENT_SESSION, solveIndex);
d.show(getFragmentManager(), DIALOG_SOLVE_TAG);
}
}

@Override
public void createSolveAddDialog(String displayName, int sessionIndex) {
DialogFragment dialog = (DialogFragment) getFragmentManager()
.findFragmentByTag(DIALOG_SOLVE_TAG);
if (dialog == null) {
SolveDialogFragment d = SolveDialogFragment.newInstanceAdd
(PuzzleType.getCurrent().name(), PuzzleType.CURRENT_SESSION);
d.show(getFragmentManager(), DIALOG_SOLVE_TAG);
}
}

public class CurrentSessionPagerAdapter extends FragmentPagerAdapter {

private final String[] mPageTitles;
Expand Down
Loading

0 comments on commit 8da31ba

Please sign in to comment.