Several fixes/adjustments
- LineCharts are now smooth - The splashscreens works 'properly' even when there is no cached icons - Edit mode is disabled when adding a coin in the watchlist - Add option to clear cache in the settings menu when in debug mode
This commit is contained in:
parent
533aea5bb6
commit
6fe8831c69
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
2
.idea/gradle.xml
generated
2
.idea/gradle.xml
generated
@ -5,7 +5,7 @@
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="LOCAL" />
|
||||
<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">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
@ -583,6 +583,7 @@ public class Charts extends Fragment {
|
||||
dataSet.setHighlightEnabled(true);
|
||||
dataSet.setDrawHorizontalHighlightIndicator(false);
|
||||
dataSet.setHighLightColor(currency.getChartColor());
|
||||
dataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
|
||||
|
||||
return new LineData(dataSet);
|
||||
}
|
||||
|
@ -261,35 +261,44 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
|
||||
File cacheDir = new File(getContext().getCacheDir().getAbsolutePath());
|
||||
File[] cacheFiles = cacheDir.listFiles();
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
if(cacheFiles.length > 4)
|
||||
{
|
||||
File cachedIcon = null;
|
||||
|
||||
while(cachedIcon == null || cachedIcon.isDirectory())
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
cachedIcon = cacheFiles[random.nextInt(cacheFiles.length)];
|
||||
File cachedIcon = null;
|
||||
|
||||
while(cachedIcon == null || cachedIcon.isDirectory())
|
||||
{
|
||||
cachedIcon = cacheFiles[random.nextInt(cacheFiles.length)];
|
||||
}
|
||||
|
||||
Bitmap icon = BitmapFactory.decodeFile(cachedIcon.getAbsolutePath());
|
||||
|
||||
Bitmap result = Bitmap.createBitmap(150, 150, icon.getConfig());
|
||||
|
||||
Paint paint = new Paint();
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(ContextCompat.getColor(getContext(), R.color.white));
|
||||
|
||||
Canvas canvas = new Canvas(result);
|
||||
canvas.drawCircle(result.getHeight()/2, result.getWidth()/2, 75, paint);
|
||||
canvas.drawBitmap(Bitmap.createScaledBitmap(icon, 100, 100, false), result.getHeight()/2 - 50, result.getWidth()/2 - 50, null);
|
||||
|
||||
((ImageView) animatedLayout.getChildAt(i)).setImageBitmap(result);
|
||||
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(animatedLayout.getChildAt(i), "translationY", 0, -100, 0);
|
||||
animator.setInterpolator(new EasingInterpolator(Ease.CIRC_IN_OUT));
|
||||
animator.setStartDelay(i*200);
|
||||
animator.setDuration(1500);
|
||||
animator.setRepeatCount(ValueAnimator.INFINITE);
|
||||
animator.start();
|
||||
}
|
||||
|
||||
Bitmap icon = BitmapFactory.decodeFile(cachedIcon.getAbsolutePath());
|
||||
|
||||
Bitmap result = Bitmap.createBitmap(150, 150, icon.getConfig());
|
||||
|
||||
Paint paint = new Paint();
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(ContextCompat.getColor(getContext(), R.color.white));
|
||||
|
||||
Canvas canvas = new Canvas(result);
|
||||
canvas.drawCircle(result.getHeight()/2, result.getWidth()/2, 75, paint);
|
||||
canvas.drawBitmap(Bitmap.createScaledBitmap(icon, 100, 100, false), result.getHeight()/2 - 50, result.getWidth()/2 - 50, null);
|
||||
|
||||
((ImageView) animatedLayout.getChildAt(i)).setImageBitmap(result);
|
||||
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(animatedLayout.getChildAt(i), "translationY", 0, -100, 0);
|
||||
animator.setInterpolator(new EasingInterpolator(Ease.CIRC_IN_OUT));
|
||||
animator.setStartDelay(i*200);
|
||||
animator.setDuration(1500);
|
||||
animator.setRepeatCount(ValueAnimator.INFINITE);
|
||||
animator.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
TextView appNameTextView = splashLayout.findViewById(R.id.appNameTextView);
|
||||
appNameTextView.setVisibility(View.VISIBLE);
|
||||
animatedLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
loadingDialog.setContentView(splashLayout);
|
||||
|
@ -64,6 +64,7 @@ public class Watchlist extends Fragment {
|
||||
private boolean detailsUpdated;
|
||||
private boolean editModeEnabled;
|
||||
private DatabaseManager databaseManager;
|
||||
private ImageButton editButton;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
@ -143,60 +144,70 @@ public class Watchlist extends Fragment {
|
||||
updater.execute();
|
||||
}
|
||||
|
||||
private void disableEdition()
|
||||
{
|
||||
editButton.setBackground(MoodlBox.getDrawable(R.drawable.check_to_edit, getContext()));
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
{
|
||||
AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) editButton.getBackground();
|
||||
animatedVectorDrawable.start();
|
||||
}
|
||||
|
||||
editModeEnabled = false;
|
||||
|
||||
for(int i = 0; i < dragLinearLayout.getChildCount(); i++)
|
||||
{
|
||||
View watchlistElement = dragLinearLayout.getChildAt(i);
|
||||
|
||||
if(watchlistElement instanceof CurrencyCardview)
|
||||
{
|
||||
watchlistElement.setClickable(true);
|
||||
collapseW(watchlistElement.findViewById(R.id.deleteCardWatchlist));
|
||||
collapseW(watchlistElement.findViewById(R.id.dragCardWatchlist));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void enableEdition()
|
||||
{
|
||||
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;
|
||||
|
||||
for(int i = 0; i < dragLinearLayout.getChildCount(); i++)
|
||||
{
|
||||
View watchlistElement = dragLinearLayout.getChildAt(i);
|
||||
|
||||
if(watchlistElement instanceof CurrencyCardview)
|
||||
{
|
||||
watchlistElement.setClickable(false);
|
||||
expandW(watchlistElement.findViewById(R.id.deleteCardWatchlist));
|
||||
expandW(watchlistElement.findViewById(R.id.dragCardWatchlist));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupEditButton()
|
||||
{
|
||||
final ImageButton editButton = view.findViewById(R.id.edit_button);
|
||||
editButton = view.findViewById(R.id.edit_button);
|
||||
editButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
if(editModeEnabled)
|
||||
{
|
||||
editButton.setBackground(MoodlBox.getDrawable(R.drawable.check_to_edit, getContext()));
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
{
|
||||
AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) editButton.getBackground();
|
||||
animatedVectorDrawable.start();
|
||||
}
|
||||
|
||||
editModeEnabled = false;
|
||||
|
||||
for(int i = 0; i < dragLinearLayout.getChildCount(); i++)
|
||||
{
|
||||
View watchlistElement = dragLinearLayout.getChildAt(i);
|
||||
|
||||
if(watchlistElement instanceof CurrencyCardview)
|
||||
{
|
||||
watchlistElement.setClickable(true);
|
||||
collapseW(watchlistElement.findViewById(R.id.deleteCardWatchlist));
|
||||
collapseW(watchlistElement.findViewById(R.id.dragCardWatchlist));
|
||||
}
|
||||
}
|
||||
disableEdition();
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
|
||||
for(int i = 0; i < dragLinearLayout.getChildCount(); i++)
|
||||
{
|
||||
View watchlistElement = dragLinearLayout.getChildAt(i);
|
||||
|
||||
if(watchlistElement instanceof CurrencyCardview)
|
||||
{
|
||||
watchlistElement.setClickable(false);
|
||||
expandW(watchlistElement.findViewById(R.id.deleteCardWatchlist));
|
||||
expandW(watchlistElement.findViewById(R.id.dragCardWatchlist));
|
||||
}
|
||||
}
|
||||
enableEdition();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -208,6 +219,11 @@ public class Watchlist extends Fragment {
|
||||
addWatchlistButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(editModeEnabled)
|
||||
{
|
||||
disableEdition();
|
||||
}
|
||||
|
||||
Intent selectionIntent = new Intent(getActivity(), CurrencySelectionActivity.class);
|
||||
selectionIntent.putExtra("isWatchList", true);
|
||||
startActivity(selectionIntent);
|
||||
|
@ -17,6 +17,7 @@ import android.preference.EditTextPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.preference.SwitchPreference;
|
||||
@ -414,6 +415,33 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
bindPreferenceSummaryToValue(findPreference("default_currency"));
|
||||
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() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
|
@ -351,6 +351,7 @@ public class CurrencyCardview extends CardView {
|
||||
dataSet.setDrawCircles(false);
|
||||
dataSet.setDrawValues(false);
|
||||
dataSet.setHighlightEnabled(false);
|
||||
dataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
|
||||
|
||||
return new LineData(dataSet);
|
||||
}
|
||||
|
@ -4,6 +4,14 @@
|
||||
android:layout_width="match_parent"
|
||||
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
|
||||
android:id="@+id/animatedViewsLayout"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -27,7 +27,7 @@
|
||||
<PreferenceCategory
|
||||
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"/>
|
||||
|
||||
<Preference android:title="@string/pref_title_import"
|
||||
@ -57,4 +57,13 @@
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="Developper"
|
||||
android:key="developper_category">
|
||||
|
||||
<Preference android:title="Wipe cache"
|
||||
android:key="wipe_cache"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user