Skip to content

Commit

Permalink
better intro
Browse files Browse the repository at this point in the history
  • Loading branch information
brodeurlv committed Sep 19, 2018
1 parent aa8181d commit c8962f7
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 64 deletions.
5 changes: 2 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.easyfitness"
android:versionCode="19"
android:versionName="0.15.1">
<!-- Current versionCode on Google Play : 18 -->
android:versionCode="20"
android:versionName="0.15.2">

<uses-sdk
android:minSdkVersion="16"
Expand Down
55 changes: 1 addition & 54 deletions app/src/main/java/com/easyfitness/intro/MainIntroActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setButtonBackFunction(skipEnabled ? BUTTON_BACK_FUNCTION_SKIP : BUTTON_BACK_FUNCTION_BACK);
setButtonNextFunction( finishEnabled ? BUTTON_NEXT_FUNCTION_NEXT_FINISH : BUTTON_NEXT_FUNCTION_NEXT);
setButtonNextFunction(finishEnabled ? BUTTON_NEXT_FUNCTION_NEXT_FINISH : BUTTON_NEXT_FUNCTION_NEXT);
setButtonBackVisible(showBack);
setButtonNextVisible(showNext);
setButtonCtaVisible(getStartedEnabled);
Expand Down Expand Up @@ -115,58 +115,5 @@ protected void onCreate(Bundle savedInstanceState) {
.build();
addSlide(profileSlide);
}

//Feel free to add a navigation policy to define when users can go forward/backward
/*
setNavigationPolicy(new NavigationPolicy() {
@Override
public boolean canGoForward(int position) {
return true;
}
@Override
public boolean canGoBackward(int position) {
return true;
}
});
*/
/*
addOnNavigationBlockedListener(new OnNavigationBlockedListener() {
@Override
public void onNavigationBlocked(int position, int direction) {
View contentView = findViewById(android.R.id.content);
if (contentView != null) {
Slide slide = getSlide(position);
if (slide == permissionsSlide) {
Snackbar.make(contentView, R.string.label_grant_permissions, Snackbar.LENGTH_LONG)
.show();
} else if (slide == loginSlide) {
Snackbar.make(contentView, R.string.label_fill_out_form, Snackbar.LENGTH_LONG).show();
}
}
}
});
*/
//Feel free to add and remove page change listeners
/*
addOnPageChangeListener(new ViewPager.OnPageChangeListener(){
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
*/
}

}
30 changes: 27 additions & 3 deletions app/src/main/java/com/easyfitness/intro/NewProfileFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.easyfitness.MainActivity;
import com.easyfitness.R;
import com.easyfitness.utils.DateConverter;
import com.heinrichreimersoftware.materialintro.app.OnNavigationBlockedListener;
import com.heinrichreimersoftware.materialintro.app.SlideFragment;
import com.onurkaganaldemir.ktoastlib.KToast;

Expand Down Expand Up @@ -109,10 +110,27 @@ public void onFocusChange(View v, boolean hasFocus) {
/* Initialisation des boutons */
mBtCreate.setOnClickListener(clickCreateButton);

getIntroActivity().addOnNavigationBlockedListener(new OnNavigationBlockedListener() {
@Override
public void onNavigationBlocked(int position, int direction) {
//Slide slide = getIntroActivity().getSlide(position);

if (position == 5) {
mBtCreate.callOnClick();
}
}
});

// Inflate the layout for this fragment
return view;
}

;

private NewProfileFragment getThis() {
return this;
}

private final View.OnClickListener clickCreateButton = new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand All @@ -121,7 +139,7 @@ public void onClick(View v) {

if (mName.getText().toString().isEmpty()) {
//Toast.makeText(getActivity().getBaseContext(), R.string.fillAllFields, Toast.LENGTH_SHORT).show();
KToast.warningToast(getActivity(), getResources().getText(R.string.fillNameField).toString(), Gravity.BOTTOM, KToast.LENGTH_LONG);
KToast.warningToast(getActivity(), getResources().getText(R.string.fillNameField).toString(), Gravity.BOTTOM, KToast.LENGTH_SHORT);
} else {
int size = 0;
try {
Expand All @@ -144,7 +162,6 @@ public void onClick(View v) {
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sDialog) {

nextSlide();
}
})
Expand All @@ -153,7 +170,6 @@ public void onClick(SweetAlertDialog sDialog) {
} else {
KToast.errorToast(getActivity(), "An error occurred in profile creation", Gravity.BOTTOM, KToast.LENGTH_LONG);
}

}
}
};
Expand All @@ -167,5 +183,13 @@ public void onDestroy() {
public boolean canGoForward() {
return mProfilCreated;
}

public MainIntroActivity getIntroActivity() {
if (getActivity() instanceof MainIntroActivity) {
return (MainIntroActivity) getActivity();
} else {
throw new IllegalStateException("SlideFragment's must be attached to MainIntroActivity.");
}
}
}

9 changes: 6 additions & 3 deletions app/src/main/res/layout/introfragment_newprofile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
~ SOFTWARE.
-->

<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -36,6 +38,7 @@
android:padding="@dimen/mi_baseline"
android:weightSum="1">


<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -95,5 +98,5 @@
android:text="@string/create" />

</LinearLayout>

</ScrollView>
</layout>
4 changes: 3 additions & 1 deletion app/src/main/res/values/about.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<string name="app_version" translatable="false">0.15.1</string>
<string name="app_version" translatable="false">0.15.2</string>
<string name="database_version_label" translatable="false">Database version: </string>
<string name="author_label" translatable="false">Author: </string>
<string name="author" translatable="false">Charles Combes</string>
Expand All @@ -10,6 +10,8 @@
<string name="email_url" translatable="false">[email protected]</string>
<string name="revision_history_label" translatable="false">Revision History: </string>
<string name="revision_history" translatable="false">\n
V0.15.2 : 19/09/2018 \n
\t - Enhancement : Better intro for profile creation\n
V0.15.1 : 13/09/2018 \n
\t - Bug : Fixed float issue for profile size\n
\t - Bug : Fixed wrong image rotation\n
Expand Down

0 comments on commit c8962f7

Please sign in to comment.