Permalink
Browse files

Working on new app style

  • Loading branch information...
avalax committed Sep 3, 2017
1 parent 2521c24 commit b51d887cdbf411d42d082400edefb98fa8ae384c
@@ -0,0 +1,37 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="459.000000pt" height="442.000000pt" viewBox="0 0 459.000000 442.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.15, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,442.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M1114 3971 c-54 -39 -71 -60 -89 -110 -13 -38 -15 -234 -15 -1641 0
-1774 -5 -1648 67 -1722 62 -64 93 -70 316 -66 l195 3 44 30 c50 36 84 82 98
136 7 24 9 584 8 1641 l-3 1603 -28 48 c-16 26 -47 61 -69 77 l-41 30 -222 0
-222 0 -39 -29z"/>
<path d="M2938 3967 c-24 -18 -54 -53 -68 -77 l-25 -45 -3 -1595 c-2 -1185 0
-1609 8 -1649 10 -43 22 -63 60 -102 29 -29 63 -52 86 -58 22 -6 120 -11 219
-11 202 0 232 8 292 71 67 71 63 -45 63 1719 0 1407 -2 1603 -15 1641 -18 50
-35 71 -89 110 l-39 29 -223 0 -222 0 -44 -33z"/>
<path d="M383 3569 c-37 -11 -90 -61 -105 -98 -6 -17 -9 -472 -10 -1253 0
-1372 -5 -1274 71 -1323 61 -40 114 -47 318 -43 200 4 223 9 281 62 55 49 52
-21 52 1300 0 843 -3 1233 -11 1253 -15 40 -48 73 -94 94 -35 16 -66 18 -255
18 -118 0 -229 -5 -247 -10z"/>
<path d="M3715 3573 c-31 -8 -94 -62 -111 -94 -13 -25 -14 -187 -14 -1260 0
-1362 -5 -1259 67 -1318 50 -42 106 -51 302 -51 202 0 248 11 306 70 l40 41 5
612 c3 337 3 902 0 1257 l-5 645 -23 31 c-50 66 -63 69 -317 71 -126 1 -239
-1 -250 -4z"/>
<path d="M1756 2494 c-3 -26 -6 -165 -6 -309 0 -241 1 -263 18 -278 17 -15 68
-17 524 -17 484 0 506 1 522 19 16 17 17 46 14 313 -2 161 -7 299 -11 306 -6
9 -124 12 -531 12 l-523 0 -7 -46z"/>
<path d="M67 2422 c-15 -16 -17 -45 -17 -204 0 -219 0 -218 98 -218 54 0 63 3
81 26 19 25 21 40 21 196 0 166 0 169 -25 193 -20 21 -34 25 -83 25 -44 0 -63
-5 -75 -18z"/>
<path d="M4355 2415 c-25 -24 -25 -27 -25 -193 0 -156 2 -171 21 -196 18 -23
27 -26 83 -26 96 0 96 0 96 222 0 218 0 218 -94 218 -47 0 -61 -4 -81 -25z"/>
</g>
</svg>
View
@@ -87,13 +87,19 @@ android {
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
implementation 'com.android.support:support-v4:26.0.2'
//implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:design:26.0.2'
implementation 'com.google.zxing:android-integration:3.3.0'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.google.dagger:dagger:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
androidTestAnnotationProcessor 'com.google.dagger:dagger-compiler:2.11'
testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'org.mockito:mockito-all:1.10.19'
@@ -103,17 +109,17 @@ dependencies {
exclude module: 'commons-logging'
exclude module: 'httpclient'
}
androidTestImplementation 'com.android.support:support-annotations:26.0.1'
androidTestImplementation 'com.android.support:support-annotations:26.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation('com.android.support.test.espresso:espresso-contrib:3.0.1') {
exclude module: 'support-v4'
exclude module: 'recyclerview-v7'
exclude module: 'appcompat-v7'
exclude module: 'design'
}
androidTestUtil 'com.android.support.test:orchestrator:1.0.1'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.android.support:support-v4:26.0.1'
implementation 'com.google.zxing:android-integration:3.3.0'
implementation 'com.google.dagger:dagger:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
androidTestAnnotationProcessor 'com.google.dagger:dagger-compiler:2.11'
}
versioneye {
@@ -4,6 +4,7 @@
import android.support.test.filters.LargeTest;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -19,11 +20,13 @@
import static android.support.test.espresso.matcher.ViewMatchers.isEnabled;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.CoreMatchers.not;
import static de.avalax.fitbuddy.runner.BottomNavigationMatcher.bottomNavItemIsChecked;
import static de.avalax.fitbuddy.runner.BottomNavigationMatcher.bottomNavItemIsNotChecked;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MainActivityTest {
public class FitbuddyAcceptanceTest {
private int actionBarTitleId() {
Resources resources = activityRule.getActivity().getResources();
return resources.getIdentifier("action_bar_title", "id", "android");
@@ -34,6 +37,16 @@ private int actionBarTitleId() {
MainActivity.class);
@Test
public void initialStart_shouldShowStartFragmentOnly() throws Exception {
activityRule.launchActivity();
onView(withId(R.id.navigation_start_item)).check(matches(bottomNavItemIsChecked()));
onView(withId(R.id.navigation_workout_item)).check(matches(bottomNavItemIsNotChecked()));
onView(withId(R.id.navigation_statistics_item)).check(matches(bottomNavItemIsNotChecked()));
}
@Test
@Ignore
public void switchedToWorkout_shouldShowWorkoutActivity() throws Exception {
BasicWorkout workout = new BasicWorkout();
Exercise exercise = workout.getExercises().createExercise();
@@ -43,18 +56,9 @@ public void switchedToWorkout_shouldShowWorkoutActivity() throws Exception {
activityRule.launchActivity();
onView(withId(R.id.continue_workout_button)).check(matches(isEnabled()));
onView(withId(R.id.continue_workout_button)).perform(click());
onView(withId(R.id.navigation_start_item)).check(matches(isEnabled()));
onView(withId(R.id.navigation_start_item)).perform(click());
onView(withId(actionBarTitleId())).check(matches(withText("first_exercise")));
}
@Test
public void noWorkoutCreated_shouldShowMainActivity() throws Exception {
activityRule.getWorkoutSession().switchWorkout(null);
activityRule.launchActivity();
onView(withId(R.id.continue_workout_button)).check(matches(not(isEnabled())));
}
}
@@ -0,0 +1,40 @@
package de.avalax.fitbuddy.runner;
import android.annotation.SuppressLint;
import android.support.design.internal.BottomNavigationItemView;
import android.support.test.espresso.matcher.BoundedMatcher;
import android.view.View;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
public class BottomNavigationMatcher {
public static Matcher<View> bottomNavItemIsChecked() {
return withBottomNavItemCheckedStatus(true);
}
public static Matcher<View> bottomNavItemIsNotChecked() {
return withBottomNavItemCheckedStatus(false);
}
private static Matcher<View> withBottomNavItemCheckedStatus(final boolean isChecked) {
return new BoundedMatcher<View, BottomNavigationItemView>(BottomNavigationItemView.class) {
boolean triedMatching;
@Override
public void describeTo(Description description) {
if (triedMatching) {
description.appendText("with BottomNavigationItem check status: " + String.valueOf(isChecked));
description.appendText("But was: " + String.valueOf(!isChecked));
}
}
@SuppressLint("RestrictedApi")
@Override
protected boolean matchesSafely(BottomNavigationItemView item) {
triedMatching = true;
return item.getItemData().isChecked() == isChecked;
}
};
}
}
@@ -6,6 +6,7 @@
import javax.inject.Inject;
import de.avalax.fitbuddy.application.workout.WorkoutSession;
import de.avalax.fitbuddy.domain.model.workout.WorkoutRepository;
import de.avalax.fitbuddy.presentation.MainActivity;
import static de.avalax.fitbuddy.runner.TestFitbuddyApplication.TestComponent;
@@ -15,6 +16,9 @@
@Inject
WorkoutSession workoutSession;
@Inject
WorkoutRepository workoutRepository;
public FitbuddyActivityTestRule(Class<MainActivity> activityClass) {
super(activityClass);
}
@@ -30,6 +34,10 @@ public WorkoutSession getWorkoutSession() {
return workoutSession;
}
public void setWorkoutRepository(WorkoutRepository workoutRepository) {
this.workoutRepository = workoutRepository;
}
public MainActivity launchActivity() {
return super.launchActivity(new Intent());
}
@@ -22,7 +22,16 @@
<data android:scheme="http" android:host="fitbuddy.de" />
</intent-filter>
</activity>
<activity android:name=".presentation.MainActivity" />
<activity android:name=".presentation.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="fitbuddy.de" />
</intent-filter>
</activity>
<activity android:name=".presentation.edit.workout.EditWorkoutActivity"/>
<activity android:name=".presentation.edit.exercise.EditExerciseActivity"/>
<activity android:name=".presentation.summary.FinishedWorkoutActivity"/>
@@ -1,23 +1,28 @@
package de.avalax.fitbuddy.presentation;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import de.avalax.fitbuddy.R;
import de.avalax.fitbuddy.presentation.workout.WorkoutActivity;
public class MainActivity extends FragmentActivity {
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
}
public void continueWorkout(View view) {
Intent intent = new Intent(this, WorkoutActivity.class);
startActivity(intent);
// Menu icons are inflated just as they were with actionbar
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
}
@@ -27,8 +27,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
}
private void init(View view) {
View continueWorkoutButton = view.findViewById(R.id.continue_workout_button);
continueWorkoutButton.setEnabled(workoutSession.hasWorkout());
}
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
</vector>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM20,12l-2.5,-1.5L15,12L15,4h5v8z"/>
</vector>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M11,17h2v-1h1c0.55,0 1,-0.45 1,-1v-3c0,-0.55 -0.45,-1 -1,-1h-3v-1h4L15,8h-2L13,7h-2v1h-1c-0.55,0 -1,0.45 -1,1v3c0,0.55 0.45,1 1,1h3v1L9,14v2h2v1zM20,4L4,4c-1.11,0 -1.99,0.89 -1.99,2L2,18c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,6c0,-1.11 -0.89,-2 -2,-2zM20,18L4,18L4,6h16v12z"/>
</vector>
@@ -0,0 +1,17 @@
<vector android:height="24dp" android:viewportHeight="442.0"
android:viewportWidth="459.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF"
android:pathData="M111.4,44.9c-5.4,3.9 -7.1,6 -8.9,11 -1.3,3.8 -1.5,23.4 -1.5,164.1 0,177.4 -0.5,164.8 6.7,172.2 6.2,6.4 9.3,7 31.6,6.6l19.5,-0.3 4.4,-3c5,-3.6 8.4,-8.2 9.8,-13.6 0.7,-2.4 0.9,-58.4 0.8,-164.1l-0.3,-160.3 -2.8,-4.8c-1.6,-2.6 -4.7,-6.1 -6.9,-7.7l-4.1,-3 -22.2,0 -22.2,0 -3.9,2.9z" android:strokeColor="#00000000"/>
<path android:fillColor="#FFFFFF"
android:pathData="M293.8,45.3c-2.4,1.8 -5.4,5.3 -6.8,7.7l-2.5,4.5 -0.3,159.5c-0.2,118.5 0,160.9 0.8,164.9 1,4.3 2.2,6.3 6,10.2 2.9,2.9 6.3,5.2 8.6,5.8 2.2,0.6 12,1.1 21.9,1.1 20.2,0 23.2,-0.8 29.2,-7.1 6.7,-7.1 6.3,4.5 6.3,-171.9 0,-140.7 -0.2,-160.3 -1.5,-164.1 -1.8,-5 -3.5,-7.1 -8.9,-11l-3.9,-2.9 -22.3,0 -22.2,0 -4.4,3.3z" android:strokeColor="#00000000"/>
<path android:fillColor="#FFFFFF"
android:pathData="M38.3,85.1c-3.7,1.1 -9,6.1 -10.5,9.8 -0.6,1.7 -0.9,47.2 -1,125.3 0,137.2 -0.5,127.4 7.1,132.3 6.1,4 11.4,4.7 31.8,4.3 20,-0.4 22.3,-0.9 28.1,-6.2 5.5,-4.9 5.2,2.1 5.2,-130 0,-84.3 -0.3,-123.3 -1.1,-125.3 -1.5,-4 -4.8,-7.3 -9.4,-9.4 -3.5,-1.6 -6.6,-1.8 -25.5,-1.8 -11.8,0 -22.9,0.5 -24.7,1z" android:strokeColor="#00000000"/>
<path android:fillColor="#FFFFFF"
android:pathData="M371.5,84.7c-3.1,0.8 -9.4,6.2 -11.1,9.4 -1.3,2.5 -1.4,18.7 -1.4,126 0,136.2 -0.5,125.9 6.7,131.8 5,4.2 10.6,5.1 30.2,5.1 20.2,0 24.8,-1.1 30.6,-7l4,-4.1 0.5,-61.2c0.3,-33.7 0.3,-90.2 0,-125.7l-0.5,-64.5 -2.3,-3.1c-5,-6.6 -6.3,-6.9 -31.7,-7.1 -12.6,-0.1 -23.9,0.1 -25,0.4z" android:strokeColor="#00000000"/>
<path android:fillColor="#FFFFFF"
android:pathData="M175.6,192.6c-0.3,2.6 -0.6,16.5 -0.6,30.9 0,24.1 0.1,26.3 1.8,27.8 1.7,1.5 6.8,1.7 52.4,1.7 48.4,0 50.6,-0.1 52.2,-1.9 1.6,-1.7 1.7,-4.6 1.4,-31.3 -0.2,-16.1 -0.7,-29.9 -1.1,-30.6 -0.6,-0.9 -12.4,-1.2 -53.1,-1.2l-52.3,0 -0.7,4.6z" android:strokeColor="#00000000"/>
<path android:fillColor="#FFFFFF"
android:pathData="M6.7,199.8c-1.5,1.6 -1.7,4.5 -1.7,20.4 0,21.9 0,21.8 9.8,21.8 5.4,0 6.3,-0.3 8.1,-2.6 1.9,-2.5 2.1,-4 2.1,-19.6 0,-16.6 0,-16.9 -2.5,-19.3 -2,-2.1 -3.4,-2.5 -8.3,-2.5 -4.4,0 -6.3,0.5 -7.5,1.8z" android:strokeColor="#00000000"/>
<path android:fillColor="#FFFFFF"
android:pathData="M435.5,200.5c-2.5,2.4 -2.5,2.7 -2.5,19.3 0,15.6 0.2,17.1 2.1,19.6 1.8,2.3 2.7,2.6 8.3,2.6 9.6,0 9.6,0 9.6,-22.2 0,-21.8 0,-21.8 -9.4,-21.8 -4.7,0 -6.1,0.4 -8.1,2.5z" android:strokeColor="#00000000"/>
</vector>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_enabled="true"
android:color="@color/primary_background" />
<item
android:state_enabled="false"
android:color="@color/secondary_background" />
</selector>
@@ -1,14 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_container"
android:orientation="vertical"
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".presentation.MainActivity">
android:layout_height="match_parent">
<fragment
android:id="@+id/toolbar_fragment"
android:name="de.avalax.fitbuddy.presentation.welcome_screen.WelcomeScreenFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/primary_background"
app:layout_collapseMode="pin"
app:titleTextColor="@color/main_text" />
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/main_text"
app:itemBackground="@color/main_text"
app:itemIconTint="@drawable/navigation_colors"
app:itemTextColor="@drawable/navigation_colors"
app:menu="@menu/navigation_menu" />
</android.support.design.widget.CoordinatorLayout>
Oops, something went wrong.

0 comments on commit b51d887

Please sign in to comment.