Update version name
Fix SDK 19 crashs
This commit is contained in:
parent
2339a98f64
commit
b935cfa89f
@ -3,11 +3,11 @@ apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
defaultConfig {
|
||||
applicationId "com.nauk.moodl"
|
||||
applicationId "com.herbron.moodl"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 27
|
||||
versionCode 2
|
||||
versionName "0.0.2"
|
||||
versionName "0.0.3"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
|
@ -10,6 +10,7 @@ import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.support.annotation.NonNull;
|
||||
@ -115,7 +116,10 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
||||
|
||||
if(viewPager.getCurrentItem() == 0)
|
||||
{
|
||||
finishAfterTransition();
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
{
|
||||
finishAfterTransition();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ import android.os.Looper;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
@ -72,7 +73,7 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
|
||||
|
||||
ArrayList<Currency> currencyArrayList = new ArrayList<>();
|
||||
|
||||
for(int i = currencyNames.size() - 1; i > 0; i--)
|
||||
for(int i = 0; i < currencyNames.size(); i++)
|
||||
{
|
||||
currencyArrayList.add(new Currency(currencyNames.get(i), currencySymbols.get(i)));
|
||||
}
|
||||
@ -151,8 +152,10 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
|
||||
if (TextUtils.isEmpty(text)) {
|
||||
listView.clearTextFilter();
|
||||
} else {
|
||||
Log.d("moodl", "Set filter : " + text);
|
||||
listView.setFilterText(text);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.nauk.moodl.Activities.DetailsActivityFragments;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
@ -171,7 +172,11 @@ public class Home extends Fragment {
|
||||
private void buttonEvent(View v)
|
||||
{
|
||||
v.setEnabled(false);
|
||||
v.setElevation(MoodlBox.convertDpToPx(8, getResources()));
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
{
|
||||
v.setElevation(MoodlBox.convertDpToPx(8, getResources()));
|
||||
}
|
||||
|
||||
LinearLayout buttonLayout = (LinearLayout) v.getParent();
|
||||
|
||||
@ -182,7 +187,11 @@ public class Home extends Fragment {
|
||||
if(button != v)
|
||||
{
|
||||
button.setEnabled(true);
|
||||
button.setElevation(MoodlBox.convertDpToPx(2, getResources()));
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
{
|
||||
button.setElevation(MoodlBox.convertDpToPx(2, getResources()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -638,17 +647,17 @@ public class Home extends Fragment {
|
||||
, (float) dataChartList.get(i).getClose()));
|
||||
}
|
||||
|
||||
dataSet = new CandleDataSet(values, "History");
|
||||
dataSet = new CandleDataSet(values, "");
|
||||
dataSet.setDrawIcons(false);
|
||||
dataSet.setDrawValues(false);
|
||||
dataSet.setDecreasingColor(getContext().getColor(R.color.decreaseCandle));
|
||||
dataSet.setDecreasingColor(MoodlBox.getColor(R.color.decreaseCandle, getContext()));
|
||||
dataSet.setShowCandleBar(true);
|
||||
dataSet.setShadowColorSameAsCandle(true);
|
||||
dataSet.setDecreasingPaintStyle(Paint.Style.FILL);
|
||||
dataSet.setIncreasingColor(getContext().getColor(R.color.increaseCandle));
|
||||
dataSet.setIncreasingColor(MoodlBox.getColor(R.color.increaseCandle, getContext()));
|
||||
dataSet.setIncreasingPaintStyle(Paint.Style.STROKE);
|
||||
dataSet.setNeutralColor(getContext().getColor(R.color.increaseCandle));
|
||||
dataSet.setHighLightColor(getContext().getColor(R.color.colorAccent));
|
||||
dataSet.setNeutralColor(MoodlBox.getColor(R.color.increaseCandle, getContext()));
|
||||
dataSet.setHighLightColor(MoodlBox.getColor(R.color.colorAccent, getContext()));
|
||||
dataSet.setDrawHorizontalHighlightIndicator(false);
|
||||
|
||||
return new CandleData(dataSet);
|
||||
|
@ -8,6 +8,7 @@ import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.CardView;
|
||||
@ -58,7 +59,7 @@ public class CurrencyCardview extends CardView {
|
||||
|
||||
((LineChart) findViewById(R.id.LineChartView)).setNoDataTextColor(currency.getChartColor());
|
||||
|
||||
setupCardView(context);
|
||||
setupCardView();
|
||||
|
||||
setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -118,8 +119,17 @@ public class CurrencyCardview extends CardView {
|
||||
Intent intent = new Intent(activity, CurrencyDetailsActivity.class);
|
||||
intent.putExtra("currency", currency);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
ActivityOptions activityOptions = ActivityOptions.makeSceneTransitionAnimation(activity, findViewById(R.id.LineChartView), "chart");
|
||||
activity.startActivity(intent, activityOptions.toBundle());
|
||||
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
{
|
||||
ActivityOptions activityOptions = ActivityOptions.makeSceneTransitionAnimation(activity, findViewById(R.id.LineChartView), "chart");
|
||||
activity.startActivity(intent, activityOptions.toBundle());
|
||||
}
|
||||
else
|
||||
{
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -134,7 +144,7 @@ public class CurrencyCardview extends CardView {
|
||||
|
||||
((LineChart) findViewById(R.id.LineChartView)).setNoDataTextColor(currency.getChartColor());
|
||||
|
||||
setupCardView(context);
|
||||
setupCardView();
|
||||
|
||||
setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -184,6 +194,7 @@ public class CurrencyCardview extends CardView {
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(context.getApplicationContext(), CurrencyDetailsActivity.class);
|
||||
intent.putExtra(getContext().getString(R.string.currency), currency);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.getApplicationContext().startActivity(intent);
|
||||
}
|
||||
});
|
||||
@ -191,7 +202,7 @@ public class CurrencyCardview extends CardView {
|
||||
updateColor(currency);
|
||||
}
|
||||
|
||||
private void setupCardView(Context context)
|
||||
private void setupCardView()
|
||||
{
|
||||
ViewGroup.MarginLayoutParams layoutParams = new ViewGroup.MarginLayoutParams(ViewGroup.MarginLayoutParams.MATCH_PARENT, ViewGroup.MarginLayoutParams.WRAP_CONTENT);
|
||||
layoutParams.setMargins((int) MoodlBox.convertDpToPx(10, getResources()), 0, (int) MoodlBox.convertDpToPx(10, getResources()), (int) MoodlBox.convertDpToPx(10, getResources()));
|
||||
@ -202,7 +213,8 @@ public class CurrencyCardview extends CardView {
|
||||
|
||||
setClickable(false);
|
||||
setFocusable(false);
|
||||
setCardBackgroundColor(context.getColor(R.color.white));
|
||||
|
||||
setCardBackgroundColor(MoodlBox.getColor(R.id.withText, getContext()));
|
||||
}
|
||||
|
||||
private void setupLineChart(final Currency currency)
|
||||
|
@ -2,6 +2,7 @@ package com.nauk.moodl.LayoutManagers;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -66,7 +67,7 @@ public class CurrencyListAdapter extends ArrayAdapter<Currency> {
|
||||
return myFilter;
|
||||
}
|
||||
|
||||
Filter myFilter = new Filter() {
|
||||
private Filter myFilter = new Filter() {
|
||||
@Override
|
||||
public CharSequence convertResultToString(Object resultValue) {
|
||||
Currency currency = (Currency) resultValue;
|
||||
@ -103,6 +104,9 @@ public class CurrencyListAdapter extends ArrayAdapter<Currency> {
|
||||
@Override
|
||||
protected void publishResults(CharSequence constraint, FilterResults results) {
|
||||
ArrayList<Currency> c = (ArrayList<Currency>) results.values;
|
||||
|
||||
Log.d("moodl", "Q " + constraint);
|
||||
|
||||
if (results != null && results.count > 0) {
|
||||
clear();
|
||||
for (Currency currency : c) {
|
||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Build;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -242,6 +243,22 @@ public class MoodlBox {
|
||||
callBack.onSuccess(result);
|
||||
}
|
||||
|
||||
public static int getColor(int id, Context context)
|
||||
{
|
||||
int color;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
{
|
||||
color = context.getColor(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
color = context.getResources().getColor(id);
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
public static String getIconUrl(String symbol, CurrencyDetailsList currencyDetailsList)
|
||||
{
|
||||
return getIconUrl(symbol, 50, currencyDetailsList);
|
||||
|
Loading…
x
Reference in New Issue
Block a user