Skip to content

Commit

Permalink
new version
Browse files Browse the repository at this point in the history
  • Loading branch information
senpl committed Sep 3, 2020
1 parent 001d5ad commit b204936
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 80 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.fitworkoutfast"
minSdkVersion 21
targetSdkVersion 29
versionCode 50
versionName "0.22.04"
versionCode 51
versionName "0.23.01"
vectorDrawables.useSupportLibrary = true
}

Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/com/easyfitness/programs/ProgramRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class ProgramRunner : Fragment(R.layout.tab_program_runner) {
KToast.warningToast(requireActivity(), resources.getText(R.string.missinginfo).toString(), Gravity.BOTTOM, KToast.LENGTH_SHORT)
return@OnClickListener
}
var tmpPoids = poidsEdit.text.toString().replace(",".toRegex(), ".").toFloat() /* Weight conversion */
val tmpPoids = poidsEdit.text.toString().replace(",".toRegex(), ".").toFloat() /* Weight conversion */
val unitPoids = UnitConverter.UNIT_KG // Kg
strengthRecordsDao.addBodyBuildingRecord(date,
exerciseEdit.text.toString(),
Expand All @@ -374,7 +374,7 @@ class ProgramRunner : Fragment(R.layout.tab_program_runner) {
return@OnClickListener
}
/* Weight conversion */
var tmpPoids = poidsEdit.text.toString().replace(",".toRegex(), ".").toFloat()
val tmpPoids = poidsEdit.text.toString().replace(",".toRegex(), ".").toFloat()
val unitPoids = UnitConverter.UNIT_KG // Kg
try {
restTime = restTimeEdit.text.toString().toInt()
Expand Down Expand Up @@ -659,10 +659,11 @@ class ProgramRunner : Fragment(R.layout.tab_program_runner) {
}
TYPE_STATIC -> {
imageExerciseThumb.setImageResource(R.drawable.ic_static)
staticFillBackgroundProgress.setDuration((exercise.seconds * progressScaleFix).toLong())
val staticPrepareTime=5
staticFillBackgroundProgress.setDuration(((exercise.seconds+staticPrepareTime) * progressScaleFix).toLong())
staticTimer = Rx2Timer.builder()
.initialDelay(0)
.take(exercise.seconds)
.take(exercise.seconds+staticPrepareTime)
.onEmit { count ->
staticFillBackgroundProgress.setProgress(count.toInt() * progressScaleFix)
countDownStatic.text = getString(R.string.count_string, count)
Expand Down
13 changes: 9 additions & 4 deletions app/src/main/java/com/fitworkoutfast/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
Expand Down Expand Up @@ -120,7 +121,6 @@ public class MainActivity extends AppCompatActivity {
private String mCurrentMachine = "";
private boolean mIntro014Launched = false;
private boolean mMigrationBD15done = false;
public boolean swapped = false;

private PopupMenu.OnMenuItemClickListener onMenuItemClick = item -> {
switch (item.getItemId()) {
Expand Down Expand Up @@ -222,6 +222,10 @@ public void onCreate(Bundle savedInstanceState) {
if (success) {
folder = new File(Environment.getExternalStorageDirectory() + "/FastnFitness/crashreport");
success = folder.mkdir();
if(!success){
Toast.makeText(getBaseContext(),"Folder creation failed",Toast.LENGTH_LONG).show();
}

}

if (folder.exists()) {
Expand Down Expand Up @@ -269,7 +273,7 @@ public void onCreate(Bundle savedInstanceState) {
if (savedInstanceState == null) {
if (mpFontesPagerFrag == null)
mpFontesPagerFrag = FontesPagerFragment.newInstance(FONTESPAGER, 6);
if (mpFontesPagerFrag == null)
if (mpFontesOldPagerFrag == null)
mpFontesOldPagerFrag = FontesOldPagerFragment.newInstance(FONTESPAGER+"OLD", 6);
if (mpWeightFrag == null) mpWeightFrag = WeightFragment.newInstance(WEIGHT, 5);
if (mpProfileFrag == null) mpProfileFrag = ProfileFragment.newInstance(PROFILE, 10);
Expand Down Expand Up @@ -638,6 +642,7 @@ public boolean CreateNewProfil() {

// Set an EditText view to get user input
final EditText input = new EditText(this);
input.setText(R.string.anonymous);
newProfilBuilder.setView(input);

newProfilBuilder.setPositiveButton(getActivity().getResources().getText(R.string.global_ok), (dialog, whichButton) -> {
Expand Down Expand Up @@ -699,7 +704,7 @@ public boolean renameProfil() {
}

private void setDrawerTitle(String pProfilName) {
mDrawerAdapter.getItem(0).setTitle(pProfilName);
Objects.requireNonNull(mDrawerAdapter.getItem(0)).setTitle(pProfilName);
mDrawerAdapter.notifyDataSetChanged();
mDrawerLayout.invalidate();
}
Expand Down Expand Up @@ -992,7 +997,7 @@ public void onBackPressed() {
String tag = backEntry.getName();
Fragment fragment = getSupportFragmentManager().findFragmentByTag(tag);
super.onBackPressed();
getActivity().getSupportActionBar().show();
Objects.requireNonNull(getActivity().getSupportActionBar()).show();
} else { // Si on est la racine, avec il faut cliquer deux fois
if (mBackPressed + TIME_INTERVAL > System.currentTimeMillis()) {
super.onBackPressed();
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/programrunner_pager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<RelativeLayout 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">
android:layout_height="match_parent"
android:keepScreenOn="true">

<com.ogaclejapan.smarttablayout.SmartTabLayout
android:id="@+id/noviewpagertab"
Expand Down
58 changes: 10 additions & 48 deletions app/src/main/res/layout/tab_program_runner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
android:name="tab_program_runner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
android:fillViewport="true"
android:keepScreenOn="true">

<LinearLayout
android:id="@+id/layoutProgramRunner"
Expand Down Expand Up @@ -191,6 +192,7 @@
android:inputType="numberDecimal|numberSigned"
android:minEms="3"
tools:text="10"
tools:labelFor="@id/weightCardView"
android:label="@string/weightLabel"
android:autofillHints="false" />

Expand Down Expand Up @@ -371,7 +373,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"> >
android:orientation="vertical">
<TextView
android:id="@+id/restTimeLabel"
android:layout_width="wrap_content"
Expand All @@ -386,7 +388,8 @@
android:gravity="center"
android:inputType="number"
android:singleLine="true"
android:text="60" />
android:text="60"
/>
</LinearLayout>
</androidx.cardview.widget.CardView>

Expand Down Expand Up @@ -510,49 +513,6 @@
android:layout_height="wrap_content"
android:orientation="vertical"
>

<!-- <LinearLayout-->
<!-- android:id="@+id/restTimeLayout"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal">-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="center_vertical"-->
<!-- android:layout_marginStart="8dp"-->
<!-- android:layout_weight="100"-->
<!-- android:text="@string/activate_rest_time" />-->

<!-- <CheckBox-->
<!-- android:id="@+id/restTimeCheck"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="center_vertical"-->
<!-- android:checked="true"-->
<!-- android:text="" />-->

<!-- <TextView-->
<!-- android:id="@+id/restTimeLabel"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="center_vertical"-->
<!-- android:layout_marginStart="8dp"-->
<!-- android:layout_weight="100"-->
<!-- android:text="@string/rest_time" />-->

<!-- <EditText-->
<!-- android:id="@+id/restTimeEdit"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginEnd="8dp"-->
<!-- android:ems="4"-->
<!-- android:inputType="number"-->
<!-- android:singleLine="true"-->
<!-- android:text="60" />-->
<!-- </LinearLayout>-->

</LinearLayout>
</RelativeLayout>

Expand Down Expand Up @@ -613,7 +573,8 @@
android:text="@string/DoneLabel"
app:layout_constraintEnd_toStartOf="@+id/nextExerciseArrow"
app:layout_constraintStart_toEndOf="@+id/failButton"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
android:contentDescription="@string/DoneLabel" />

<ImageButton
android:id="@+id/nextExerciseArrow"
Expand Down Expand Up @@ -658,7 +619,8 @@
android:src="@drawable/reset_yellow_400_24dp"
android:layout_marginStart="@dimen/progress_circle_radius"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:contentDescription="@string/reset" />
</com.devzone.fillprogresslayout.FillProgressLayout>
<!-- app:fpl_backgroundColor="@color/red_btn_bg_color"
app:fpl_progressDuration="150"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,5 @@
<string name="Lbs">Lbs</string>
<string name="single_exercise_and_results">Results</string>
<string name="static_prepare_seconds">Static exercise prepare time always 5 sec.</string>
<string name="anonymous">Default</string>
</resources>
48 changes: 27 additions & 21 deletions app/src/main/res/xml/settings2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,6 @@

</PreferenceCategory>

<PreferenceCategory android:title="@string/sound_settings">
<CheckBoxPreference
android:defaultValue="true"
android:key="playRestSound"
android:summary="@string/playRestSoundDescription"
android:title="@string/playRestSound" />


<Preference android:key="dialog_rest_sound"
android:title="@string/chooseRestSound"/>

<CheckBoxPreference
android:defaultValue="true"
android:key="playStaticExerciseFinishSound"
android:summary="@string/playStaticExerciseFinishSoundDescription"
android:title="@string/playStaticExerciseFinishSound" />

<Preference android:key="dialog_static_sound"
android:title="@string/chooseRestSound"/>
</PreferenceCategory>

<PreferenceCategory android:title="@string/programs_settings">
<CheckBoxPreference
android:defaultValue="true"
Expand All @@ -68,5 +47,32 @@
android:key="swipeGesturesSwitch"
android:summary="@string/swipeGesturesDescription"
android:title="@string/swipeGesturesSwitch" />

<EditTextPreference
android:defaultValue="5"
android:key="staticPreperSecs"
android:title="@string/static_prepare_seconds"
/>
</PreferenceCategory>

<PreferenceCategory android:title="@string/sound_settings">
<CheckBoxPreference
android:defaultValue="true"
android:key="playRestSound"
android:summary="@string/playRestSoundDescription"
android:title="@string/playRestSound" />


<Preference android:key="dialog_rest_sound"
android:title="@string/chooseRestSound"/>

<CheckBoxPreference
android:defaultValue="true"
android:key="playStaticExerciseFinishSound"
android:summary="@string/playStaticExerciseFinishSoundDescription"
android:title="@string/playStaticExerciseFinishSound" />

<Preference android:key="dialog_static_sound"
android:title="@string/chooseRestSound"/>
</PreferenceCategory>
</PreferenceScreen>

0 comments on commit b204936

Please sign in to comment.