Merge pull request #7 from TanguyHerbron/master

Update unstable to correct some bugs hot fixed
This commit is contained in:
Tanguy Herbron 2018-07-31 13:14:30 +02:00 committed by GitHub
commit 38723b7dca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 212 additions and 62 deletions

Binary file not shown.

2
.idea/gradle.xml generated
View File

@ -5,7 +5,7 @@
<GradleProjectSettings> <GradleProjectSettings>
<option name="distributionType" value="LOCAL" /> <option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-4.4" /> <option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-4.9" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

View File

@ -583,6 +583,7 @@ public class Charts extends Fragment {
dataSet.setHighlightEnabled(true); dataSet.setHighlightEnabled(true);
dataSet.setDrawHorizontalHighlightIndicator(false); dataSet.setDrawHorizontalHighlightIndicator(false);
dataSet.setHighLightColor(currency.getChartColor()); dataSet.setHighLightColor(currency.getChartColor());
dataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
return new LineData(dataSet); return new LineData(dataSet);
} }

View File

@ -264,6 +264,8 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
File cacheDir = new File(getContext().getCacheDir().getAbsolutePath()); File cacheDir = new File(getContext().getCacheDir().getAbsolutePath());
File[] cacheFiles = cacheDir.listFiles(); File[] cacheFiles = cacheDir.listFiles();
if(cacheFiles.length > 4)
{
for(int i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
{ {
File cachedIcon = null; File cachedIcon = null;
@ -294,6 +296,13 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
animator.setRepeatCount(ValueAnimator.INFINITE); animator.setRepeatCount(ValueAnimator.INFINITE);
animator.start(); animator.start();
} }
}
else
{
TextView appNameTextView = splashLayout.findViewById(R.id.appNameTextView);
appNameTextView.setVisibility(View.VISIBLE);
animatedLayout.setVisibility(View.GONE);
}
loadingDialog.setContentView(splashLayout); loadingDialog.setContentView(splashLayout);
loadingDialog.show(); loadingDialog.show();

View File

@ -3,7 +3,9 @@ package com.herbron.moodl.Activities.HomeActivityFragments;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.os.Bundle; import android.os.Bundle;
@ -62,6 +64,7 @@ public class Watchlist extends Fragment {
private boolean detailsUpdated; private boolean detailsUpdated;
private boolean editModeEnabled; private boolean editModeEnabled;
private DatabaseManager databaseManager; private DatabaseManager databaseManager;
private ImageButton editButton;
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
@ -141,16 +144,15 @@ public class Watchlist extends Fragment {
updater.execute(); updater.execute();
} }
private void setupEditButton() private void disableEdition()
{ {
ImageButton editButton = view.findViewById(R.id.edit_button); editButton.setBackground(MoodlBox.getDrawable(R.drawable.check_to_edit, getContext()));
editButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(editModeEnabled) if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{ {
((ImageView) view.findViewById(R.id.edit_button)).setBackground(MoodlBox.getDrawable(R.drawable.ic_mode_edit_white_24dp, getContext())); AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) editButton.getBackground();
animatedVectorDrawable.start();
}
editModeEnabled = false; editModeEnabled = false;
@ -166,9 +168,16 @@ public class Watchlist extends Fragment {
} }
} }
} }
else
private void enableEdition()
{ {
((ImageView) view.findViewById(R.id.edit_button)).setBackground(MoodlBox.getDrawable(R.drawable.ic_check_white_24dp, getContext())); editButton.setBackground(MoodlBox.getDrawable(R.drawable.edit_to_check, getContext()));
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{
AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) editButton.getBackground();
animatedVectorDrawable.start();
}
editModeEnabled = true; editModeEnabled = true;
@ -184,6 +193,22 @@ public class Watchlist extends Fragment {
} }
} }
} }
private void setupEditButton()
{
editButton = view.findViewById(R.id.edit_button);
editButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(editModeEnabled)
{
disableEdition();
}
else
{
enableEdition();
}
} }
}); });
} }
@ -194,6 +219,11 @@ public class Watchlist extends Fragment {
addWatchlistButton.setOnClickListener(new View.OnClickListener() { addWatchlistButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(editModeEnabled)
{
disableEdition();
}
Intent selectionIntent = new Intent(getActivity(), CurrencySelectionActivity.class); Intent selectionIntent = new Intent(getActivity(), CurrencySelectionActivity.class);
selectionIntent.putExtra("isWatchList", true); selectionIntent.putExtra("isWatchList", true);
startActivity(selectionIntent); startActivity(selectionIntent);

View File

@ -17,6 +17,7 @@ import android.preference.EditTextPreference;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.preference.SwitchPreference; import android.preference.SwitchPreference;
@ -415,6 +416,33 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
bindPreferenceSummaryToValue(findPreference("default_currency")); bindPreferenceSummaryToValue(findPreference("default_currency"));
bindPreferenceSummaryToValue(findPreference("minimum_value_displayed")); bindPreferenceSummaryToValue(findPreference("minimum_value_displayed"));
PreferenceCategory developperCategory = (PreferenceCategory) findPreference("developper_category");
if(!BuildConfig.DEBUG)
{
getPreferenceScreen().removePreference(developperCategory);
}
else
{
developperCategory.getPreference(0).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
File cacheDir = getContext().getCacheDir();
File[] cachedFiles = cacheDir.listFiles();
for(int i = 0; i < cachedFiles.length; i++)
{
if(cachedFiles[i].isFile())
{
cachedFiles[i].delete();
}
}
return false;
}
});
}
findPreference("export").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { findPreference("export").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {

View File

@ -351,6 +351,7 @@ public class CurrencyCardview extends CardView {
dataSet.setDrawCircles(false); dataSet.setDrawCircles(false);
dataSet.setDrawValues(false); dataSet.setDrawValues(false);
dataSet.setHighlightEnabled(false); dataSet.setHighlightEnabled(false);
dataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
return new LineData(dataSet); return new LineData(dataSet);
} }

View File

@ -1,6 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <ripple xmlns:android="http://schemas.android.com/apk/res/android"
<item> android:color="@color/separationColor">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/separationColor" />
<corners android:radius="2dp" />
</shape>
</item>
<item android:id="@android:id/background">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<solid android:color="@color/transparent"/> <solid android:color="@color/transparent"/>
<corners android:radius="2dp"/> <corners android:radius="2dp"/>
@ -11,4 +20,4 @@
android:dashWidth="9dp"/> android:dashWidth="9dp"/>
</shape> </shape>
</item> </item>
</selector> </ripple>

View File

@ -0,0 +1,27 @@
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="vector"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:name="check"
android:pathData="M 9 16.17 L 4.83 12 L 3.41 13.41 L 9 19 L 21 7 L 19.59 5.59 Z"
android:fillColor="#FFFFFFFF"/>
</vector>
</aapt:attr>
<target android:name="check">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="pathData"
android:duration="200"
android:valueFrom="M 3.41 13.41 L 6.205 16.205 L 9 19 L 21 7 L 19.59 5.59 L 9 16.17 L 4.83 12 L 3.41 13.41 M 18.216 5.784 L 18.216 5.784 L 18.216 5.784 L 18.216 5.784 L 18.216 5.784 C 18.216 5.784 18.216 5.784 18.216 5.784 L 18.216 5.784 C 18.216 5.784 18.216 5.784 18.216 5.784"
android:valueTo="M 3 17.25 L 3 21 L 6.75 21 L 17.81 9.94 L 14.06 6.19 L 8.53 11.72 L 3 17.25 L 3 17.25 M 20.71 7.04 L 20.71 7.04 L 18.88 8.87 L 15.13 5.12 L 16.96 3.29 C 17.35 2.9 17.98 2.9 18.37 3.29 L 20.71 5.63 C 21.1 6.02 21.1 6.65 20.71 7.04"
android:valueType="pathType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr>
</target>
</animated-vector>

View File

@ -0,0 +1,28 @@
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="vector"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:name="edit"
android:pathData="M 3 17.25 L 3 21 L 6.75 21 L 17.81 9.94 L 14.06 6.19 L 3 17.25 Z M 20.71 7.04 C 21.1 6.65 21.1 6.02 20.71 5.63 L 18.37 3.29 C 17.98 2.9 17.35 2.9 16.96 3.29 L 15.13 5.12 L 18.88 8.87 L 20.71 7.04 Z"
android:fillColor="#FFFFFFFF"/>
</vector>
</aapt:attr>
<target android:name="edit">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="pathData"
android:duration="200"
android:valueFrom="M 3 17.25 L 3 17.25 L 3 21 L 6.75 21 L 17.81 9.94 L 14.06 6.19 L 3 17.25 M 20.71 5.63 L 18.37 3.29 C 17.98 2.9 17.35 2.9 16.96 3.29 L 15.13 5.12 L 18.88 8.87 L 20.71 7.04 L 20.71 7.04 C 21.1 6.65 21.1 6.02 20.71 5.63"
android:valueTo="M 9 16.17 L 4.83 12 L 3.41 13.41 L 9 19 L 21 7 L 19.59 5.59 L 9 16.17 M 18.216 5.784 L 18.216 5.784 C 18.216 5.784 18.216 5.784 18.216 5.784 L 18.216 5.784 L 18.216 5.784 L 18.216 5.784 L 18.216 5.784 C 18.216 5.784 18.216 5.784 18.216 5.784"
android:valueType="pathType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr>
</target>
</animated-vector>

View File

@ -4,6 +4,14 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="@color/colorPrimaryDark"> android:background="@color/colorPrimaryDark">
<TextView
android:id="@+id/appNameTextView"
android:text="@string/app_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_gravity="center"/>
<LinearLayout <LinearLayout
android:id="@+id/animatedViewsLayout" android:id="@+id/animatedViewsLayout"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -27,7 +27,7 @@
<PreferenceCategory <PreferenceCategory
android:title="@string/pref_title_category_data_backup"> android:title="@string/pref_title_category_data_backup">
<PreferenceScreen android:title="@string/pref_title_export" <Preference android:title="@string/pref_title_export"
android:key="export"/> android:key="export"/>
<Preference android:title="@string/pref_title_import" <Preference android:title="@string/pref_title_import"
@ -57,4 +57,13 @@
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory
android:title="Developper"
android:key="developper_category">
<Preference android:title="Wipe cache"
android:key="wipe_cache"/>
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>