Fix and improvements
- Clear code - Add Mooblbox for toolbox methods - Add minimum value settings to display a currency (ex : everything above 0.01) - Fix Market capitalization padding - Reduce FPS drop while reloading data - Fix refresh for 1H, 3H and 1D charts in detail activity
This commit is contained in:
parent
18da197cf6
commit
373a944e41
@ -6,14 +6,17 @@ android {
|
|||||||
applicationId "com.nauk.moodl"
|
applicationId "com.nauk.moodl"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 1
|
versionCode 2
|
||||||
versionName "0.0.1"
|
versionName "0.0.2"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
lintOptions {
|
||||||
|
disable 'MissingTranslation'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
package com.nauk.moodl.Activities;
|
package com.nauk.moodl.Activities;
|
||||||
|
|
||||||
import android.app.ProgressDialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.ColorFilter;
|
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.PorterDuffColorFilter;
|
import android.graphics.PorterDuffColorFilter;
|
||||||
@ -17,14 +14,12 @@ import android.os.Bundle;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.BottomNavigationView;
|
import android.support.design.widget.BottomNavigationView;
|
||||||
import android.support.v4.app.NavUtils;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.CardView;
|
import android.support.v7.widget.CardView;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
@ -65,13 +60,11 @@ import com.nauk.moodl.LayoutManagers.TransactionListAdapter;
|
|||||||
import com.nauk.moodl.PlaceholderManager;
|
import com.nauk.moodl.PlaceholderManager;
|
||||||
import com.nauk.moodl.R;
|
import com.nauk.moodl.R;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
|
import static com.nauk.moodl.MoodlBox.numberConformer;
|
||||||
|
import static com.nauk.moodl.MoodlBox.getDateFromTimestamp;
|
||||||
import static java.lang.Math.abs;
|
import static java.lang.Math.abs;
|
||||||
|
|
||||||
/**Create a Parcelable**/
|
/**Create a Parcelable**/
|
||||||
@ -266,8 +259,12 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
.setText(currency.getStartDate());
|
.setText(currency.getStartDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
((TextView) findViewById(R.id.txtViewDescription))
|
if(currency.getDescription() != null)
|
||||||
.setText(Html.fromHtml(currency.getDescription()));
|
{
|
||||||
|
((TextView) findViewById(R.id.txtViewDescription))
|
||||||
|
.setText(Html.fromHtml(currency.getDescription()));
|
||||||
|
}
|
||||||
|
|
||||||
((TextView) findViewById(R.id.txtViewDescription))
|
((TextView) findViewById(R.id.txtViewDescription))
|
||||||
.setMovementMethod(LinkMovementMethod.getInstance());
|
.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
((TextView) findViewById(R.id.txtViewPercentageCoinEmited))
|
((TextView) findViewById(R.id.txtViewPercentageCoinEmited))
|
||||||
@ -412,13 +409,43 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
switch (interval)
|
switch (interval)
|
||||||
{
|
{
|
||||||
case "1h":
|
case "1h":
|
||||||
updateChartTab(HOUR, 1);
|
currency.updateHistoryMinutes(this, preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Currency currency) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateChartTab(CurrencyDetailsActivity.HOUR, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "3h":
|
case "3h":
|
||||||
updateChartTab(HOUR, 3);
|
currency.updateHistoryMinutes(this, preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Currency currency) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateChartTab(CurrencyDetailsActivity.HOUR, 3);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "1d":
|
case "1d":
|
||||||
updateChartTab(DAY, 1);
|
currency.updateHistoryMinutes(this, preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Currency currency) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateChartTab(CurrencyDetailsActivity.DAY, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "3d":
|
case "3d":
|
||||||
currency.updateHistoryHours(this, preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
|
currency.updateHistoryHours(this, preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
|
||||||
@ -664,11 +691,11 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if(dataChartList.size() > 200)
|
if(dataChartList.size() > 200)
|
||||||
{
|
{
|
||||||
date = getDate(dataChartList.get((int) Math.floor(dataChartList.size() / 200) * index).getTimestamp() * 1000);
|
date = getDateFromTimestamp(dataChartList.get((int) Math.floor(dataChartList.size() / 200) * index).getTimestamp() * 1000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
date = getDate(dataChartList.get(index).getTimestamp() * 1000);
|
date = getDateFromTimestamp(dataChartList.get(index).getTimestamp() * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
volumePlaceholder = PlaceholderManager.getVolumeString(numberConformer(barChart.getData().getDataSets().get(0).getEntryForIndex(index).getY()), this);
|
volumePlaceholder = PlaceholderManager.getVolumeString(numberConformer(barChart.getData().getDataSets().get(0).getEntryForIndex(index).getY()), this);
|
||||||
@ -707,18 +734,6 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
findViewById(R.id.timestampHightlight).setVisibility(View.INVISIBLE);
|
findViewById(R.id.timestampHightlight).setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDate(long timeStamp){
|
|
||||||
|
|
||||||
try{
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(" HH:mm dd/MM/yyyy", Locale.getDefault());
|
|
||||||
Date netDate = (new Date(timeStamp));
|
|
||||||
return sdf.format(netDate);
|
|
||||||
}
|
|
||||||
catch(Exception ex){
|
|
||||||
return "xx";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private BarData generateVolumeChartSet()
|
private BarData generateVolumeChartSet()
|
||||||
{
|
{
|
||||||
BarDataSet dataSet;
|
BarDataSet dataSet;
|
||||||
@ -746,41 +761,6 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
return new BarData(dataSet);
|
return new BarData(dataSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String numberConformer(double number)
|
|
||||||
{
|
|
||||||
String str;
|
|
||||||
|
|
||||||
if(abs(number) > 1)
|
|
||||||
{
|
|
||||||
str = String.format( Locale.UK, "%.2f", number).replaceAll("\\.?0*$", "");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
str = String.format( Locale.UK, "%.4f", number).replaceAll("\\.?0*$", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!str.equals("Infinity"))
|
|
||||||
{
|
|
||||||
int counter = 0;
|
|
||||||
int i = str.indexOf(".");
|
|
||||||
if(i <= 0)
|
|
||||||
{
|
|
||||||
i = str.length();
|
|
||||||
}
|
|
||||||
for(i -= 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
counter++;
|
|
||||||
if(counter == 3)
|
|
||||||
{
|
|
||||||
str = str.substring(0, i) + " " + str.substring(i, str.length());
|
|
||||||
counter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CandleData generatePriceCandleStickChartSet()
|
private CandleData generatePriceCandleStickChartSet()
|
||||||
{
|
{
|
||||||
CandleDataSet dataSet;
|
CandleDataSet dataSet;
|
||||||
|
@ -61,12 +61,6 @@ public class HomeActivity extends AppCompatActivity {
|
|||||||
w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||||
w.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
|
w.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
|
||||||
|
|
||||||
//Setup main interface
|
|
||||||
//requestWindowFeature(Window.FEATURE_NO_TITLE);
|
|
||||||
//getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
|
|
||||||
//this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
||||||
//getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_currency_summary);
|
setContentView(R.layout.activity_currency_summary);
|
||||||
|
|
||||||
viewPager = findViewById(R.id.viewPager);
|
viewPager = findViewById(R.id.viewPager);
|
||||||
|
@ -30,6 +30,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static com.nauk.moodl.MoodlBox.numberConformer;
|
||||||
import static java.lang.Math.abs;
|
import static java.lang.Math.abs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,12 +53,27 @@ public class MarketCapitalization extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
preferencesManager = new PreferencesManager(getContext());
|
|
||||||
view = inflater.inflate(R.layout.fragment_marketcap_homeactivity, container, false);
|
view = inflater.inflate(R.layout.fragment_marketcap_homeactivity, container, false);
|
||||||
|
|
||||||
setupDominantCurrenciesColors();
|
setupDominantCurrenciesColors();
|
||||||
|
|
||||||
|
preferencesManager = new PreferencesManager(getContext());
|
||||||
marketCapManager = new MarketCapManager(getContext());
|
marketCapManager = new MarketCapManager(getContext());
|
||||||
|
|
||||||
|
defaultCurrency = preferencesManager.getDefaultCurrency();
|
||||||
|
lastTimestamp = 0;
|
||||||
|
|
||||||
|
setupRefreshLayout();
|
||||||
|
|
||||||
|
setupSettingsButton();
|
||||||
|
|
||||||
|
updateMarketCap(true);
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupRefreshLayout()
|
||||||
|
{
|
||||||
refreshLayout = view.findViewById(R.id.swiperefreshmarketcap);
|
refreshLayout = view.findViewById(R.id.swiperefreshmarketcap);
|
||||||
|
|
||||||
refreshLayout.setOnRefreshListener(
|
refreshLayout.setOnRefreshListener(
|
||||||
@ -69,10 +85,10 @@ public class MarketCapitalization extends Fragment {
|
|||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
defaultCurrency = preferencesManager.getDefaultCurrency();
|
private void setupSettingsButton()
|
||||||
lastTimestamp = 0;
|
{
|
||||||
|
|
||||||
ImageButton settingsButton = view.findViewById(R.id.settings_button);
|
ImageButton settingsButton = view.findViewById(R.id.settings_button);
|
||||||
|
|
||||||
settingsButton.setOnClickListener(new View.OnClickListener() {
|
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -82,10 +98,6 @@ public class MarketCapitalization extends Fragment {
|
|||||||
startActivity(settingIntent);
|
startActivity(settingIntent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
updateMarketCap(true);
|
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -170,6 +182,20 @@ public class MarketCapitalization extends Fragment {
|
|||||||
view.findViewById(R.id.progressBarMarketCap).setVisibility(View.GONE);
|
view.findViewById(R.id.progressBarMarketCap).setVisibility(View.GONE);
|
||||||
view.findViewById(R.id.layoutProgressMarketCap).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.layoutProgressMarketCap).setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
PieData data = new PieData(getMarketDominanceDataSet());
|
||||||
|
data.setValueTextSize(10);
|
||||||
|
data.setValueFormatter(new PercentFormatter());
|
||||||
|
|
||||||
|
setupPieChart(data);
|
||||||
|
|
||||||
|
if(refreshLayout.isRefreshing())
|
||||||
|
{
|
||||||
|
refreshLayout.setRefreshing(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PieDataSet getMarketDominanceDataSet()
|
||||||
|
{
|
||||||
List<PieEntry> entries = new ArrayList<>();
|
List<PieEntry> entries = new ArrayList<>();
|
||||||
|
|
||||||
ArrayList<Integer> colors = new ArrayList<>();
|
ArrayList<Integer> colors = new ArrayList<>();
|
||||||
@ -192,16 +218,7 @@ public class MarketCapitalization extends Fragment {
|
|||||||
set.setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
|
set.setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
|
||||||
set.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
|
set.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
|
||||||
|
|
||||||
PieData data = new PieData(set);
|
return set;
|
||||||
data.setValueTextSize(10);
|
|
||||||
data.setValueFormatter(new PercentFormatter());
|
|
||||||
|
|
||||||
setupPieChart(data);
|
|
||||||
|
|
||||||
if(refreshLayout.isRefreshing())
|
|
||||||
{
|
|
||||||
refreshLayout.setRefreshing(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@ -250,33 +267,6 @@ public class MarketCapitalization extends Fragment {
|
|||||||
pieChart.invalidate();
|
pieChart.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String numberConformer(double number)
|
|
||||||
{
|
|
||||||
String str;
|
|
||||||
|
|
||||||
if(abs(number) > 1)
|
|
||||||
{
|
|
||||||
str = String.format( Locale.UK, "%.2f", number).replaceAll("\\.?0*$", "");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
str = String.format( Locale.UK, "%.4f", number).replaceAll("\\.?0*$", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
int counter = 0;
|
|
||||||
for(int i = str.length() - 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
counter++;
|
|
||||||
if(counter == 3)
|
|
||||||
{
|
|
||||||
str = str.substring(0, i) + " " + str.substring(i, str.length());
|
|
||||||
counter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SpannableString generateCenterSpannableText() {
|
private SpannableString generateCenterSpannableText() {
|
||||||
|
|
||||||
SpannableString spannableString = new SpannableString("Market Capitalization Dominance");
|
SpannableString spannableString = new SpannableString("Market Capitalization Dominance");
|
||||||
|
@ -44,6 +44,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static com.nauk.moodl.MoodlBox.numberConformer;
|
||||||
import static java.lang.Math.abs;
|
import static java.lang.Math.abs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,6 +67,7 @@ public class Summary extends Fragment {
|
|||||||
private Handler handler;
|
private Handler handler;
|
||||||
|
|
||||||
private Runnable updateRunnable;
|
private Runnable updateRunnable;
|
||||||
|
private Runnable layoutRefresherRunnable;
|
||||||
|
|
||||||
private int coinCounter;
|
private int coinCounter;
|
||||||
private int iconCounter;
|
private int iconCounter;
|
||||||
@ -81,22 +83,51 @@ public class Summary extends Fragment {
|
|||||||
{
|
{
|
||||||
View fragmentView = inflater.inflate(R.layout.fragment_summary_homeactivity, container, false);
|
View fragmentView = inflater.inflate(R.layout.fragment_summary_homeactivity, container, false);
|
||||||
|
|
||||||
currencyLayout = fragmentView.findViewById(R.id.currencyListLayout);
|
|
||||||
preferencesManager = new PreferencesManager(getActivity());
|
preferencesManager = new PreferencesManager(getActivity());
|
||||||
balanceManager = new BalanceManager(getActivity());
|
balanceManager = new BalanceManager(getActivity());
|
||||||
layoutGenerator = new HomeLayoutGenerator(getActivity());
|
layoutGenerator = new HomeLayoutGenerator(getActivity());
|
||||||
refreshLayout = fragmentView.findViewById(R.id.swiperefreshsummary);
|
|
||||||
toolbarSubtitle = fragmentView.findViewById(R.id.toolbarSubtitle);
|
|
||||||
currencyTickerList = new CurrencyTickerList(getActivity());
|
currencyTickerList = new CurrencyTickerList(getActivity());
|
||||||
|
|
||||||
totalValue = 0;
|
currencyLayout = fragmentView.findViewById(R.id.currencyListLayout);
|
||||||
totalFluctuation = 0;
|
refreshLayout = fragmentView.findViewById(R.id.swiperefreshsummary);
|
||||||
lastTimestamp = 0;
|
toolbarSubtitle = fragmentView.findViewById(R.id.toolbarSubtitle);
|
||||||
tickersChecker = false;
|
|
||||||
|
resetCounters();
|
||||||
|
|
||||||
defaultCurrency = preferencesManager.getDefaultCurrency();
|
defaultCurrency = preferencesManager.getDefaultCurrency();
|
||||||
|
|
||||||
handler = new Handler();
|
handler = new Handler();
|
||||||
|
|
||||||
|
initiateUpdateRunnable();
|
||||||
|
|
||||||
|
initiateLayoutRefresherRunnable();
|
||||||
|
|
||||||
|
refreshLayout.setOnRefreshListener(
|
||||||
|
new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
updateAll(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
handler.postDelayed(updateRunnable, 10000);
|
||||||
|
toolbarLayout = fragmentView.findViewById(R.id.toolbar_layout);
|
||||||
|
toolbarLayout.setForegroundGravity(Gravity.CENTER);
|
||||||
|
|
||||||
|
setupAddCurrencyButton(fragmentView);
|
||||||
|
|
||||||
|
setupSettingsButton(fragmentView);
|
||||||
|
|
||||||
|
updateAll(true);
|
||||||
|
|
||||||
|
generateSplashScreen();
|
||||||
|
|
||||||
|
return fragmentView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initiateUpdateRunnable()
|
||||||
|
{
|
||||||
updateRunnable = new Runnable() {
|
updateRunnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -115,23 +146,62 @@ public class Summary extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
refreshLayout.setOnRefreshListener(
|
private void initiateLayoutRefresherRunnable()
|
||||||
new SwipeRefreshLayout.OnRefreshListener() {
|
{
|
||||||
@Override
|
layoutRefresherRunnable = new Runnable() {
|
||||||
public void onRefresh() {
|
@Override
|
||||||
updateAll(false);
|
public void run() {
|
||||||
|
final List<View> currencyView = new ArrayList<>();
|
||||||
|
|
||||||
|
if (balanceManager.getTotalBalance() != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < balanceManager.getTotalBalance().size(); i++) {
|
||||||
|
final Currency currency = balanceManager.getTotalBalance().get(i);
|
||||||
|
|
||||||
|
if (!currency.getSymbol().equals("USD") && ((currency.getBalance() * currency.getValue()) > preferencesManager.getMinimumAmount())) {
|
||||||
|
currencyView.add(layoutGenerator.getInfoLayout(currency, totalValue, preferencesManager.isBalanceHidden()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
handler.postDelayed(updateRunnable, 10000);
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
toolbarLayout = fragmentView.findViewById(R.id.toolbar_layout);
|
@Override
|
||||||
toolbarLayout.setForegroundGravity(Gravity.CENTER);
|
public void run() {
|
||||||
|
currencyLayout.removeAllViews();
|
||||||
|
|
||||||
|
for(int i = 0; i < currencyView.size(); i++)
|
||||||
|
{
|
||||||
|
currencyLayout.addView(currencyView.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(loadingDialog.isShowing())
|
||||||
|
{
|
||||||
|
loadingDialog.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupAddCurrencyButton(View fragmentView)
|
||||||
|
{
|
||||||
Button addCurrencyButton = fragmentView.findViewById(R.id.buttonAddTransaction);
|
Button addCurrencyButton = fragmentView.findViewById(R.id.buttonAddTransaction);
|
||||||
|
|
||||||
|
addCurrencyButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent addIntent = new Intent(getActivity(), CurrencySelectionActivity.class);
|
||||||
|
|
||||||
|
startActivity(addIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupSettingsButton(View fragmentView)
|
||||||
|
{
|
||||||
ImageButton settingsButton = fragmentView.findViewById(R.id.settings_button);
|
ImageButton settingsButton = fragmentView.findViewById(R.id.settings_button);
|
||||||
|
|
||||||
settingsButton.setOnClickListener(new View.OnClickListener() {
|
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -142,20 +212,6 @@ public class Summary extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addCurrencyButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Intent addIntent = new Intent(getActivity(), CurrencySelectionActivity.class);
|
|
||||||
|
|
||||||
startActivity(addIntent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
updateAll(true);
|
|
||||||
|
|
||||||
generateSplashScreen();
|
|
||||||
|
|
||||||
return fragmentView;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateSplashScreen()
|
private void generateSplashScreen()
|
||||||
@ -231,14 +287,14 @@ public class Summary extends Fragment {
|
|||||||
|
|
||||||
private void showErrorSnackbar()
|
private void showErrorSnackbar()
|
||||||
{
|
{
|
||||||
/*Snackbar.make(getActivity().findViewById(R.id.viewFlipperSummary), "Error while updating data", Snackbar.LENGTH_LONG)
|
Snackbar.make(getActivity().findViewById(R.id.snackbar_placer), "Error while updating data", Snackbar.LENGTH_LONG)
|
||||||
.setAction("Update", new View.OnClickListener() {
|
.setAction("Update", new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.show();*/
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetCounters()
|
private void resetCounters()
|
||||||
@ -253,42 +309,8 @@ public class Summary extends Fragment {
|
|||||||
|
|
||||||
private void adaptView()
|
private void adaptView()
|
||||||
{
|
{
|
||||||
currencyLayout.removeAllViews();
|
|
||||||
|
|
||||||
final List<View> currencyView = new ArrayList<>();
|
layoutRefresherRunnable.run();
|
||||||
|
|
||||||
Runnable newRunnable = new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (balanceManager.getTotalBalance() != null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < balanceManager.getTotalBalance().size(); i++) {
|
|
||||||
final Currency currency = balanceManager.getTotalBalance().get(i);
|
|
||||||
|
|
||||||
if (!currency.getSymbol().equals("USD") && ((currency.getBalance() * currency.getValue()) > 0.001)) {
|
|
||||||
currencyView.add(layoutGenerator.getInfoLayout(currency, totalValue, preferencesManager.isBalanceHidden()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for(int i = 0; i < currencyView.size(); i++)
|
|
||||||
{
|
|
||||||
currencyLayout.addView(currencyView.get(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(loadingDialog.isShowing())
|
|
||||||
{
|
|
||||||
loadingDialog.dismiss();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
newRunnable.run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void countCoins(boolean isCoin, boolean isDetails, boolean isTickers)
|
private void countCoins(boolean isCoin, boolean isDetails, boolean isTickers)
|
||||||
@ -349,8 +371,6 @@ public class Summary extends Fragment {
|
|||||||
{
|
{
|
||||||
if(iconCounter == balanceManager.getTotalBalance().size() - offset)
|
if(iconCounter == balanceManager.getTotalBalance().size() - offset)
|
||||||
{
|
{
|
||||||
Log.d(getResources().getString(R.string.debug), "Loading heavy");
|
|
||||||
|
|
||||||
UiHeavyLoadCalculator uiHeavyLoadCalculator = new UiHeavyLoadCalculator();
|
UiHeavyLoadCalculator uiHeavyLoadCalculator = new UiHeavyLoadCalculator();
|
||||||
uiHeavyLoadCalculator.execute();
|
uiHeavyLoadCalculator.execute();
|
||||||
}
|
}
|
||||||
@ -372,7 +392,6 @@ public class Summary extends Fragment {
|
|||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
updateTitle();
|
updateTitle();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -384,79 +403,57 @@ public class Summary extends Fragment {
|
|||||||
|
|
||||||
if(preferencesManager.isBalanceHidden())
|
if(preferencesManager.isBalanceHidden())
|
||||||
{
|
{
|
||||||
toolbarLayout.setTitle(PlaceholderManager.getPercentageString(numberConformer(totalFluctuationPercentage), getActivity()));
|
updateHideBalanceTitle(totalFluctuationPercentage);
|
||||||
toolbarSubtitle.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
if(totalFluctuation > 0)
|
|
||||||
{
|
|
||||||
toolbarLayout.setCollapsedTitleTextColor(getResources().getColor(R.color.increase));
|
|
||||||
toolbarLayout.setExpandedTitleColor(getResources().getColor(R.color.increase));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toolbarLayout.setCollapsedTitleTextColor(getResources().getColor(R.color.decrease));
|
|
||||||
toolbarLayout.setExpandedTitleColor(getResources().getColor(R.color.decrease));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
toolbarLayout.setTitle(PlaceholderManager.getValueString(numberConformer(totalValue), getActivity()));
|
updateBalanceDisplayedTitle(totalFluctuationPercentage);
|
||||||
toolbarLayout.setCollapsedTitleTextColor(Color.WHITE);
|
|
||||||
toolbarLayout.setExpandedTitleColor(Color.WHITE);
|
|
||||||
|
|
||||||
toolbarSubtitle.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
if(totalFluctuation > 0)
|
|
||||||
{
|
|
||||||
toolbarSubtitle.setTextColor(getResources().getColor(R.color.increase));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toolbarSubtitle.setTextColor(getResources().getColor(R.color.decrease));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(totalFluctuation == 0)
|
|
||||||
{
|
|
||||||
toolbarSubtitle.setText(PlaceholderManager.getValueString(numberConformer(totalValue), getActivity()));
|
|
||||||
toolbarSubtitle.setTextColor(-1275068417);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toolbarSubtitle.setText(PlaceholderManager.getValuePercentageString(numberConformer(totalFluctuation), numberConformer(totalFluctuationPercentage), getActivity()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String numberConformer(double number)
|
public void updateBalanceDisplayedTitle(float totalFluctuationPercentage)
|
||||||
{
|
{
|
||||||
String str;
|
toolbarLayout.setTitle(PlaceholderManager.getValueString(numberConformer(totalValue), getActivity()));
|
||||||
|
toolbarLayout.setCollapsedTitleTextColor(Color.WHITE);
|
||||||
|
toolbarLayout.setExpandedTitleColor(Color.WHITE);
|
||||||
|
|
||||||
if(abs(number) > 1)
|
toolbarSubtitle.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if(totalFluctuation > 0)
|
||||||
{
|
{
|
||||||
str = String.format( Locale.UK, "%.2f", number).replaceAll("\\.?0*$", "");
|
toolbarSubtitle.setTextColor(getResources().getColor(R.color.increase));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str = String.format( Locale.UK, "%.4f", number).replaceAll("\\.?0*$", "");
|
toolbarSubtitle.setTextColor(getResources().getColor(R.color.decrease));
|
||||||
}
|
}
|
||||||
|
|
||||||
int counter = 0;
|
if(totalFluctuation == 0)
|
||||||
int i = str.indexOf(".");
|
|
||||||
if(i <= 0)
|
|
||||||
{
|
{
|
||||||
i = str.length();
|
toolbarSubtitle.setText(PlaceholderManager.getValueString(numberConformer(totalValue), getActivity()));
|
||||||
|
toolbarSubtitle.setTextColor(-1275068417);
|
||||||
}
|
}
|
||||||
for(i -= 1; i > 0; i--)
|
else
|
||||||
{
|
{
|
||||||
counter++;
|
toolbarSubtitle.setText(PlaceholderManager.getValuePercentageString(numberConformer(totalFluctuation), numberConformer(totalFluctuationPercentage), getActivity()));
|
||||||
if(counter == 3)
|
|
||||||
{
|
|
||||||
str = str.substring(0, i) + " " + str.substring(i, str.length());
|
|
||||||
counter = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return str;
|
private void updateHideBalanceTitle(float totalFluctuationPercentage)
|
||||||
|
{
|
||||||
|
toolbarLayout.setTitle(PlaceholderManager.getPercentageString(numberConformer(totalFluctuationPercentage), getActivity()));
|
||||||
|
toolbarSubtitle.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
if(totalFluctuation > 0)
|
||||||
|
{
|
||||||
|
toolbarLayout.setCollapsedTitleTextColor(getResources().getColor(R.color.increase));
|
||||||
|
toolbarLayout.setExpandedTitleColor(getResources().getColor(R.color.increase));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toolbarLayout.setCollapsedTitleTextColor(getResources().getColor(R.color.decrease));
|
||||||
|
toolbarLayout.setExpandedTitleColor(getResources().getColor(R.color.decrease));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class UiHeavyLoadCalculator extends AsyncTask<Void, Integer, Void>
|
private class UiHeavyLoadCalculator extends AsyncTask<Void, Integer, Void>
|
||||||
@ -493,7 +490,8 @@ public class Summary extends Fragment {
|
|||||||
|
|
||||||
private void loadCurrency(Currency currency)
|
private void loadCurrency(Currency currency)
|
||||||
{
|
{
|
||||||
if(!currency.getSymbol().equals("USD") && (currency.getBalance() * currency.getValue()) > 0.001)
|
Log.d("moodl", "For " + currency.getSymbol() + " " + (currency.getBalance() * currency.getValue()) + " " + preferencesManager.getMinimumAmount());
|
||||||
|
if(!currency.getSymbol().equals("USD") && (currency.getBalance() * currency.getValue()) > preferencesManager.getMinimumAmount())
|
||||||
{
|
{
|
||||||
currency.setName(balanceManager.getCurrencyName(currency.getSymbol()));
|
currency.setName(balanceManager.getCurrencyName(currency.getSymbol()));
|
||||||
currency.setId(balanceManager.getCurrencyId(currency.getSymbol()));
|
currency.setId(balanceManager.getCurrencyId(currency.getSymbol()));
|
||||||
@ -539,8 +537,19 @@ public class Summary extends Fragment {
|
|||||||
protected void onPostExecute(Void result)
|
protected void onPostExecute(Void result)
|
||||||
{
|
{
|
||||||
refreshLayout.setRefreshing(false);
|
refreshLayout.setRefreshing(false);
|
||||||
//refreshCurrencyList();
|
new AsyncTask<Void, Integer, Void>() {
|
||||||
adaptView();
|
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(Void... voids) {
|
||||||
|
if(Looper.myLooper() == null)
|
||||||
|
{
|
||||||
|
Looper.prepare();
|
||||||
|
}
|
||||||
|
|
||||||
|
adaptView();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}.execute();
|
||||||
handler.removeCallbacks(updateRunnable);
|
handler.removeCallbacks(updateRunnable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -625,17 +634,49 @@ public class Summary extends Fragment {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(Void result)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class DataUpdater extends AsyncTask<Void, Integer, Void>
|
private class DataUpdater extends AsyncTask<Void, Integer, Void>
|
||||||
{
|
{
|
||||||
|
private void generateSnackBarError(String error)
|
||||||
|
{
|
||||||
|
View view = getActivity().findViewById(R.id.snackbar_placer);
|
||||||
|
|
||||||
|
switch (error)
|
||||||
|
{
|
||||||
|
case "com.android.volley.AuthFailureError":
|
||||||
|
preferencesManager.disableHitBTC();
|
||||||
|
Snackbar.make(view, "HitBTC synchronization error : Invalid keys", Snackbar.LENGTH_LONG)
|
||||||
|
.show();
|
||||||
|
|
||||||
|
refreshLayout.setRefreshing(false);
|
||||||
|
|
||||||
|
updateAll(true);
|
||||||
|
break;
|
||||||
|
case "API-key format invalid.":
|
||||||
|
preferencesManager.disableBinance();
|
||||||
|
Snackbar.make(view, "Binance synchronization error : Invalid keys", Snackbar.LENGTH_LONG)
|
||||||
|
.show();
|
||||||
|
|
||||||
|
updateAll(true);
|
||||||
|
break;
|
||||||
|
case "com.android.volley.NoConnectionError: java.net.UnknownHostException: Unable to resolve host \"api.hitbtc.com\": No address associated with hostname":
|
||||||
|
Snackbar.make(view, "Can't resolve host", Snackbar.LENGTH_LONG)
|
||||||
|
.show();
|
||||||
|
break;
|
||||||
|
case "com.android.volley.TimeoutError":
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Snackbar.make(view, "Unexpected error", Snackbar.LENGTH_LONG)
|
||||||
|
.show();
|
||||||
|
|
||||||
|
Log.d("moodl", error);
|
||||||
|
|
||||||
|
updateAll(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params)
|
protected Void doInBackground(Void... params)
|
||||||
{
|
{
|
||||||
@ -684,44 +725,12 @@ public class Summary extends Fragment {
|
|||||||
|
|
||||||
public void onError(String error)
|
public void onError(String error)
|
||||||
{
|
{
|
||||||
View view = getActivity().findViewById(R.id.snackbar_placer);
|
generateSnackBarError(error);
|
||||||
|
|
||||||
switch (error)
|
|
||||||
{
|
|
||||||
case "com.android.volley.AuthFailureError":
|
|
||||||
preferencesManager.disableHitBTC();
|
|
||||||
Snackbar.make(view, "HitBTC synchronization error : Invalid keys", Snackbar.LENGTH_LONG)
|
|
||||||
.show();
|
|
||||||
|
|
||||||
refreshLayout.setRefreshing(false);
|
|
||||||
|
|
||||||
updateAll(true);
|
|
||||||
break;
|
|
||||||
case "API-key format invalid.":
|
|
||||||
preferencesManager.disableBinance();
|
|
||||||
Snackbar.make(view, "Binance synchronization error : Invalid keys", Snackbar.LENGTH_LONG)
|
|
||||||
.show();
|
|
||||||
|
|
||||||
updateAll(true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Snackbar.make(view, "Unexpected error", Snackbar.LENGTH_LONG)
|
|
||||||
.show();
|
|
||||||
|
|
||||||
Log.d("moodl", error);
|
|
||||||
|
|
||||||
updateAll(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(Void aVoid) {
|
|
||||||
super.onPostExecute(aVoid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,11 @@ import android.support.v4.app.Fragment;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.graphics.Palette;
|
import android.support.v7.graphics.Palette;
|
||||||
import android.support.v7.widget.CardView;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.Transformation;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@ -55,6 +53,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static com.nauk.moodl.MoodlBox.collapseH;
|
||||||
|
import static com.nauk.moodl.MoodlBox.collapseW;
|
||||||
|
import static com.nauk.moodl.MoodlBox.expandH;
|
||||||
|
import static com.nauk.moodl.MoodlBox.expandW;
|
||||||
|
import static com.nauk.moodl.MoodlBox.getVerticalExpandAnimation;
|
||||||
|
import static com.nauk.moodl.MoodlBox.numberConformer;
|
||||||
import static java.lang.Math.abs;
|
import static java.lang.Math.abs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,25 +114,17 @@ public class Watchlist extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button addWatchlistButton = view.findViewById(R.id.buttonAddWatchlist);
|
setupAddWatchlistButton();
|
||||||
addWatchlistButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Intent selectionIntent = new Intent(getActivity(), CurrencySelectionActivity.class);
|
|
||||||
selectionIntent.putExtra("isWatchList", true);
|
|
||||||
startActivity(selectionIntent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ImageButton settingsButton = view.findViewById(R.id.settings_button);
|
setupSettingsButton();
|
||||||
settingsButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Intent settingIntent = new Intent(getActivity(), SettingsActivity.class);
|
|
||||||
startActivity(settingIntent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
setupEditButton();
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupEditButton()
|
||||||
|
{
|
||||||
ImageButton editButton = view.findViewById(R.id.edit_button);
|
ImageButton editButton = view.findViewById(R.id.edit_button);
|
||||||
editButton.setOnClickListener(new View.OnClickListener() {
|
editButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -147,133 +143,53 @@ public class Watchlist extends Fragment {
|
|||||||
{
|
{
|
||||||
editModeEnabled = true;
|
editModeEnabled = true;
|
||||||
|
|
||||||
|
LinearLayout watchlistLayout = Watchlist.this.view.findViewById(R.id.linearLayoutWatchlist);
|
||||||
|
|
||||||
|
Animation anim = getVerticalExpandAnimation(watchlistLayout.getChildAt(0));
|
||||||
|
|
||||||
for(int i = 0; i < ((LinearLayout) Watchlist.this.view.findViewById(R.id.linearLayoutWatchlist)).getChildCount(); i++)
|
for(int i = 0; i < ((LinearLayout) Watchlist.this.view.findViewById(R.id.linearLayoutWatchlist)).getChildCount(); i++)
|
||||||
{
|
{
|
||||||
((LinearLayout) Watchlist.this.view.findViewById(R.id.linearLayoutWatchlist)).getChildAt(i).setClickable(false);
|
View watchlistElement = watchlistLayout.getChildAt(i);
|
||||||
expandW(((LinearLayout) Watchlist.this.view.findViewById(R.id.linearLayoutWatchlist)).getChildAt(i).findViewById(R.id.deleteCardWatchlist));
|
|
||||||
|
watchlistElement.setClickable(false);
|
||||||
|
expandW(watchlistElement.findViewById(R.id.deleteCardWatchlist), anim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collapseView(View view)
|
private void setupAddWatchlistButton()
|
||||||
{
|
{
|
||||||
collapse(view.findViewById(R.id.collapsableLayout));
|
Button addWatchlistButton = view.findViewById(R.id.buttonAddWatchlist);
|
||||||
|
addWatchlistButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent selectionIntent = new Intent(getActivity(), CurrencySelectionActivity.class);
|
||||||
|
selectionIntent.putExtra("isWatchList", true);
|
||||||
|
startActivity(selectionIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extendView(View view)
|
private void setupSettingsButton()
|
||||||
{
|
{
|
||||||
expand(view.findViewById(R.id.collapsableLayout));
|
ImageButton settingsButton = view.findViewById(R.id.settings_button);
|
||||||
|
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent settingIntent = new Intent(getActivity(), SettingsActivity.class);
|
||||||
|
startActivity(settingIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayChartView()
|
||||||
|
{
|
||||||
|
expandH(view.findViewById(R.id.collapsableLayout));
|
||||||
view.findViewById(R.id.LineChartView).invalidate();
|
view.findViewById(R.id.LineChartView).invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void expand(final View v) {
|
|
||||||
v.measure(CardView.LayoutParams.MATCH_PARENT, CardView.LayoutParams.WRAP_CONTENT);
|
|
||||||
final int targetHeight = v.getMeasuredHeight();
|
|
||||||
|
|
||||||
// Older versions of android (pre API 21) cancel animations for views with a height of 0.
|
|
||||||
v.getLayoutParams().height = 1;
|
|
||||||
v.setVisibility(View.VISIBLE);
|
|
||||||
Animation a = new Animation()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
|
||||||
v.getLayoutParams().height = interpolatedTime == 1
|
|
||||||
? CardView.LayoutParams.WRAP_CONTENT
|
|
||||||
: (int)(targetHeight * interpolatedTime);
|
|
||||||
v.requestLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean willChangeBounds() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 1dp/ms
|
|
||||||
a.setDuration((int)(targetHeight / v.getContext().getResources().getDisplayMetrics().density));
|
|
||||||
v.startAnimation(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void expandW(final View v) {
|
|
||||||
v.measure(CardView.LayoutParams.MATCH_PARENT, CardView.LayoutParams.WRAP_CONTENT);
|
|
||||||
final int targetWidth = v.getMeasuredWidth();
|
|
||||||
|
|
||||||
v.getLayoutParams().width = 1;
|
|
||||||
v.setVisibility(View.VISIBLE);
|
|
||||||
Animation a = new Animation() {
|
|
||||||
@Override
|
|
||||||
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
|
||||||
v.getLayoutParams().width = interpolatedTime == 1
|
|
||||||
? CardView.LayoutParams.WRAP_CONTENT
|
|
||||||
: (int)(targetWidth * interpolatedTime);
|
|
||||||
v.requestLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean willChangeBounds() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
a.setDuration((int)(targetWidth / v.getContext().getResources().getDisplayMetrics().density));
|
|
||||||
v.startAnimation(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void collapse(final View v) {
|
|
||||||
final int initialHeight = v.getMeasuredHeight();
|
|
||||||
|
|
||||||
Animation a = new Animation()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
|
||||||
if(interpolatedTime == 1){
|
|
||||||
v.setVisibility(View.GONE);
|
|
||||||
}else{
|
|
||||||
v.getLayoutParams().height = initialHeight - (int)(initialHeight * interpolatedTime);
|
|
||||||
v.requestLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean willChangeBounds() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 1dp/ms
|
|
||||||
a.setDuration((int)(initialHeight / v.getContext().getResources().getDisplayMetrics().density));
|
|
||||||
v.startAnimation(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void collapseW(final View v) {
|
|
||||||
final int initialWidth = v.getMeasuredWidth();
|
|
||||||
|
|
||||||
Animation a = new Animation() {
|
|
||||||
@Override
|
|
||||||
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
|
||||||
if(interpolatedTime == 1) {
|
|
||||||
v.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
v.getLayoutParams().width = initialWidth - (int)(initialWidth * interpolatedTime);
|
|
||||||
v.requestLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean willChangeBounds() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
a.setDuration((int)(initialWidth / v.getContext().getResources().getDisplayMetrics().density));
|
|
||||||
v.startAnimation(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
@ -408,7 +324,7 @@ public class Watchlist extends Fragment {
|
|||||||
card.findViewById(R.id.deleteCardWatchlist).setOnClickListener(new View.OnClickListener() {
|
card.findViewById(R.id.deleteCardWatchlist).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
collapse(card);
|
collapseH(card);
|
||||||
DatabaseManager databaseManager = new DatabaseManager(getActivity());
|
DatabaseManager databaseManager = new DatabaseManager(getActivity());
|
||||||
databaseManager.deleteCurrencyFromWatchlist(currency.getSymbol());
|
databaseManager.deleteCurrencyFromWatchlist(currency.getSymbol());
|
||||||
}
|
}
|
||||||
@ -431,13 +347,14 @@ public class Watchlist extends Fragment {
|
|||||||
public void onClick(final View view) {
|
public void onClick(final View view) {
|
||||||
if(view.findViewById(R.id.collapsableLayout).getVisibility() == View.VISIBLE)
|
if(view.findViewById(R.id.collapsableLayout).getVisibility() == View.VISIBLE)
|
||||||
{
|
{
|
||||||
collapseView(view);
|
collapseH(view.findViewById(R.id.collapsableLayout));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.GONE);
|
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.GONE);
|
||||||
view.findViewById(R.id.progressBarLinechartWatchlist).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.progressBarLinechartWatchlist).setVisibility(View.VISIBLE);
|
||||||
extendView(view);
|
|
||||||
|
displayChartView();
|
||||||
|
|
||||||
if (currency.getHistoryMinutes() == null) {
|
if (currency.getHistoryMinutes() == null) {
|
||||||
currency.updateHistoryMinutes(getActivity(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
|
currency.updateHistoryMinutes(getActivity(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
|
||||||
@ -460,7 +377,7 @@ public class Watchlist extends Fragment {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
extendView(view);
|
displayChartView();
|
||||||
view.findViewById(R.id.progressBarLinechartWatchlist).setVisibility(View.GONE);
|
view.findViewById(R.id.progressBarLinechartWatchlist).setVisibility(View.GONE);
|
||||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@ -647,36 +564,4 @@ public class Watchlist extends Fragment {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String numberConformer(double number)
|
|
||||||
{
|
|
||||||
String str;
|
|
||||||
|
|
||||||
if(abs(number) > 1)
|
|
||||||
{
|
|
||||||
str = String.format( Locale.UK, "%.2f", number).replaceAll("\\.?0*$", "");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
str = String.format( Locale.UK, "%.4f", number).replaceAll("\\.?0*$", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
int counter = 0;
|
|
||||||
int i = str.indexOf(".");
|
|
||||||
if(i <= 0)
|
|
||||||
{
|
|
||||||
i = str.length();
|
|
||||||
}
|
|
||||||
for(i -= 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
counter++;
|
|
||||||
if(counter == 3)
|
|
||||||
{
|
|
||||||
str = str.substring(0, i) + " " + str.substring(i, str.length());
|
|
||||||
counter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import com.nauk.moodl.R;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class RecordTransactionActivity extends AppCompatActivity {
|
public class RecordTransactionActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@ -97,26 +98,18 @@ public class RecordTransactionActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
|
||||||
sdf = new SimpleDateFormat(" HH:mm dd/MM/yyyy");
|
sdf = new SimpleDateFormat(" HH:mm dd/MM/yyyy", Locale.UK);
|
||||||
|
|
||||||
calendar = Calendar.getInstance();
|
calendar = Calendar.getInstance();
|
||||||
|
|
||||||
databaseManager = new DatabaseManager(this);
|
databaseManager = new DatabaseManager(this);
|
||||||
preferenceManager = new PreferencesManager(this);
|
preferenceManager = new PreferencesManager(this);
|
||||||
|
|
||||||
symbolTxtView = findViewById(R.id.currencySymbol);
|
initializeViewElements();
|
||||||
amountTxtView = findViewById(R.id.currencyAmount);
|
|
||||||
feesTxtView = findViewById(R.id.feesTextView);
|
|
||||||
purchasedDateLayout = findViewById(R.id.input_purchase_date);
|
|
||||||
purchaseDate = findViewById(R.id.purchaseDate);
|
|
||||||
purchasedPriceEditText = findViewById(R.id.purchasePrice);
|
|
||||||
buyButton = findViewById(R.id.buyButton);
|
|
||||||
sellButton = findViewById(R.id.sellButton);
|
|
||||||
transferButton = findViewById(R.id.transfertButton);
|
|
||||||
|
|
||||||
coin = intent.getStringExtra("coin");
|
coin = intent.getStringExtra("coin");
|
||||||
Log.d("moodl", "1" + coin);
|
|
||||||
symbol = intent.getStringExtra("symbol");
|
symbol = intent.getStringExtra("symbol");
|
||||||
|
|
||||||
transactionId = intent.getIntExtra("transactionId", -1);
|
transactionId = intent.getIntExtra("transactionId", -1);
|
||||||
|
|
||||||
if(transactionId != -1)
|
if(transactionId != -1)
|
||||||
@ -158,6 +151,18 @@ public class RecordTransactionActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
initializeButtons();
|
||||||
|
|
||||||
|
currency.getTimestampPrice(this, preferenceManager.getDefaultCurrency(), new Currency.PriceCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String price) {
|
||||||
|
purchasedPriceEditText.setText(price);
|
||||||
|
}
|
||||||
|
}, calendar.getTimeInMillis() / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeButtons()
|
||||||
|
{
|
||||||
buyButton.setOnClickListener(new View.OnClickListener() {
|
buyButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
@ -189,13 +194,19 @@ public class RecordTransactionActivity extends AppCompatActivity {
|
|||||||
// Prepare transfer interface
|
// Prepare transfer interface
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
currency.getTimestampPrice(this, preferenceManager.getDefaultCurrency(), new Currency.PriceCallBack() {
|
private void initializeViewElements()
|
||||||
@Override
|
{
|
||||||
public void onSuccess(String price) {
|
symbolTxtView = findViewById(R.id.currencySymbol);
|
||||||
purchasedPriceEditText.setText(price);
|
amountTxtView = findViewById(R.id.currencyAmount);
|
||||||
}
|
feesTxtView = findViewById(R.id.feesTextView);
|
||||||
}, calendar.getTimeInMillis() / 1000);
|
purchasedDateLayout = findViewById(R.id.input_purchase_date);
|
||||||
|
purchaseDate = findViewById(R.id.purchaseDate);
|
||||||
|
purchasedPriceEditText = findViewById(R.id.purchasePrice);
|
||||||
|
buyButton = findViewById(R.id.buyButton);
|
||||||
|
sellButton = findViewById(R.id.sellButton);
|
||||||
|
transferButton = findViewById(R.id.transfertButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createDatePicker()
|
private void createDatePicker()
|
||||||
|
@ -14,6 +14,7 @@ import android.media.RingtoneManager;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
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;
|
||||||
@ -28,10 +29,12 @@ import android.security.keystore.KeyProperties;
|
|||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.nauk.moodl.BuildConfig;
|
import com.nauk.moodl.BuildConfig;
|
||||||
|
import com.nauk.moodl.DataManagers.PreferencesManager;
|
||||||
import com.nauk.moodl.FingerprintToolkit.FingerprintDialogFragment;
|
import com.nauk.moodl.FingerprintToolkit.FingerprintDialogFragment;
|
||||||
import com.nauk.moodl.FingerprintToolkit.FingerprintHandler;
|
import com.nauk.moodl.FingerprintToolkit.FingerprintHandler;
|
||||||
import com.nauk.moodl.R;
|
import com.nauk.moodl.R;
|
||||||
@ -199,8 +202,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||||||
protected boolean isValidFragment(String fragmentName) {
|
protected boolean isValidFragment(String fragmentName) {
|
||||||
return PreferenceFragment.class.getName().equals(fragmentName)
|
return PreferenceFragment.class.getName().equals(fragmentName)
|
||||||
|| GeneralPreferenceFragment.class.getName().equals(fragmentName)
|
|| GeneralPreferenceFragment.class.getName().equals(fragmentName)
|
||||||
|| DataSyncPreferenceFragment.class.getName().equals(fragmentName)
|
|
||||||
|| NotificationPreferenceFragment.class.getName().equals(fragmentName)
|
|
||||||
|| ExchangePreferenceFragment.class.getName().equals(fragmentName);
|
|| ExchangePreferenceFragment.class.getName().equals(fragmentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,9 +233,14 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
((PreferenceScreen) findPreference("version")).setSummary(BuildConfig.VERSION_NAME);
|
findPreference("version").setSummary(BuildConfig.VERSION_NAME);
|
||||||
|
|
||||||
bindPreferenceSummaryToValue(findPreference("default_currency"));
|
bindPreferenceSummaryToValue(findPreference("default_currency"));
|
||||||
|
bindPreferenceSummaryToValue(findPreference("minimum_value_displayed"));
|
||||||
|
|
||||||
|
EditTextPreference editTextPreference = (EditTextPreference) findPreference("minimum_value_displayed");
|
||||||
|
editTextPreference.setPositiveButtonText("Save");
|
||||||
|
editTextPreference.setNegativeButtonText("Cancel");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -433,64 +439,4 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This fragment shows notification preferences only. It is used when the
|
|
||||||
* activity is showing a two-pane settings UI.
|
|
||||||
*/
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
|
||||||
public static class NotificationPreferenceFragment extends PreferenceFragment {
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
addPreferencesFromResource(R.xml.pref_notification);
|
|
||||||
setHasOptionsMenu(true);
|
|
||||||
|
|
||||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
|
||||||
// to their values. When their values change, their summaries are
|
|
||||||
// updated to reflect the new value, per the Android Design
|
|
||||||
// guidelines.
|
|
||||||
bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
int id = item.getItemId();
|
|
||||||
if (id == android.R.id.home) {
|
|
||||||
startActivity(new Intent(getActivity(), SettingsActivity.class));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This fragment shows data and sync preferences only. It is used when the
|
|
||||||
* activity is showing a two-pane settings UI.
|
|
||||||
*/
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
|
||||||
public static class DataSyncPreferenceFragment extends PreferenceFragment {
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
addPreferencesFromResource(R.xml.pref_data_sync);
|
|
||||||
setHasOptionsMenu(true);
|
|
||||||
|
|
||||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
|
||||||
// to their values. When their values change, their summaries are
|
|
||||||
// updated to reflect the new value, per the Android Design
|
|
||||||
// guidelines.
|
|
||||||
bindPreferenceSummaryToValue(findPreference("sync_frequency"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
int id = item.getItemId();
|
|
||||||
if (id == android.R.id.home) {
|
|
||||||
startActivity(new Intent(getActivity(), SettingsActivity.class));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.nauk.moodl.DataManagers;
|
|||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Guitoune on 09/01/2018.
|
* Created by Guitoune on 09/01/2018.
|
||||||
@ -48,6 +49,23 @@ public class PreferencesManager {
|
|||||||
return settingPreferences.getBoolean("refresh_default_currency", false);
|
return settingPreferences.getBoolean("refresh_default_currency", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getMinimumAmount()
|
||||||
|
{
|
||||||
|
String str = settingPreferences.getString("minimum_value_displayed", "0");
|
||||||
|
float ret;
|
||||||
|
|
||||||
|
if(str.equals(""))
|
||||||
|
{
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = Float.valueOf(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
private void disableRefreshDefaultCurrency()
|
private void disableRefreshDefaultCurrency()
|
||||||
{
|
{
|
||||||
SharedPreferences.Editor editor = settingPreferences.edit();
|
SharedPreferences.Editor editor = settingPreferences.edit();
|
||||||
|
@ -55,10 +55,14 @@ public class FingerprintDialogFragment extends DialogFragment{
|
|||||||
|
|
||||||
public void wrongFingerprint(String errorString)
|
public void wrongFingerprint(String errorString)
|
||||||
{
|
{
|
||||||
((SwirlView) this.getView().findViewById(R.id.swirl)).clearColorFilter();
|
SwirlView swirlView = this.getView().findViewById(R.id.swirl);
|
||||||
((SwirlView) this.getView().findViewById(R.id.swirlBackground)).clearColorFilter();
|
SwirlView swirlBackground = this.getView().findViewById(R.id.swirlBackground);
|
||||||
((SwirlView) this.getView().findViewById(R.id.swirl)).setState(SwirlView.State.ERROR);
|
|
||||||
((SwirlView) this.getView().findViewById(R.id.swirlBackground)).setState(SwirlView.State.ERROR);
|
swirlView.clearColorFilter();
|
||||||
|
swirlView.setState(SwirlView.State.ERROR);
|
||||||
|
|
||||||
|
swirlBackground.clearColorFilter();
|
||||||
|
swirlBackground.setState(SwirlView.State.ERROR);
|
||||||
|
|
||||||
((TextView) this.getView().findViewById(R.id.fingerprint_error)).setText(errorString);
|
((TextView) this.getView().findViewById(R.id.fingerprint_error)).setText(errorString);
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,10 @@ import com.nauk.moodl.R;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import static java.lang.Math.abs;
|
import static com.nauk.moodl.MoodlBox.collapseH;
|
||||||
|
import static com.nauk.moodl.MoodlBox.expandH;
|
||||||
|
import static com.nauk.moodl.MoodlBox.numberConformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Tiji on 05/01/2018.
|
* Created by Tiji on 05/01/2018.
|
||||||
@ -58,11 +59,11 @@ public class HomeLayoutGenerator {
|
|||||||
PreferencesManager preferencesManager = new PreferencesManager(context);
|
PreferencesManager preferencesManager = new PreferencesManager(context);
|
||||||
|
|
||||||
if (view.findViewById(R.id.collapsableLayout).getVisibility() == View.VISIBLE) {
|
if (view.findViewById(R.id.collapsableLayout).getVisibility() == View.VISIBLE) {
|
||||||
collapseView(view);
|
collapseH(view.findViewById(R.id.collapsableLayout));
|
||||||
} else {
|
} else {
|
||||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.GONE);
|
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.GONE);
|
||||||
view.findViewById(R.id.progressBarLinechartSummary).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.progressBarLinechartSummary).setVisibility(View.VISIBLE);
|
||||||
extendView(view);
|
expandH(view.findViewById(R.id.collapsableLayout));
|
||||||
|
|
||||||
if (currency.getHistoryMinutes() == null) {
|
if (currency.getHistoryMinutes() == null) {
|
||||||
currency.updateHistoryMinutes(context, preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
|
currency.updateHistoryMinutes(context, preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
|
||||||
@ -85,7 +86,7 @@ public class HomeLayoutGenerator {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
extendView(view);
|
expandH(view.findViewById(R.id.collapsableLayout));
|
||||||
view.findViewById(R.id.progressBarLinechartSummary).setVisibility(View.GONE);
|
view.findViewById(R.id.progressBarLinechartSummary).setVisibility(View.GONE);
|
||||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@ -272,17 +273,6 @@ public class HomeLayoutGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collapseView(View view)
|
|
||||||
{
|
|
||||||
collapse(view.findViewById(R.id.collapsableLayout));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void extendView(View view)
|
|
||||||
{
|
|
||||||
expand(view.findViewById(R.id.collapsableLayout));
|
|
||||||
//view.findViewById(R.id.LineChartView).invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateColor(View view, Currency currency)
|
private void updateColor(View view, Currency currency)
|
||||||
{
|
{
|
||||||
if(currency.getDayFluctuationPercentage() >= 0)
|
if(currency.getDayFluctuationPercentage() >= 0)
|
||||||
@ -339,31 +329,4 @@ public class HomeLayoutGenerator {
|
|||||||
|
|
||||||
return transColor ;
|
return transColor ;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String numberConformer(double number)
|
|
||||||
{
|
|
||||||
String str;
|
|
||||||
|
|
||||||
if(abs(number) > 1)
|
|
||||||
{
|
|
||||||
str = String.format( Locale.UK, "%.2f", number).replaceAll("\\.?0*$", "");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
str = String.format( Locale.UK, "%.4f", number).replaceAll("\\.?0*$", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
int counter = 0;
|
|
||||||
for(int i = str.indexOf(".") - 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
counter++;
|
|
||||||
if(counter == 3)
|
|
||||||
{
|
|
||||||
str = str.substring(0, i) + " " + str.substring(i, str.length());
|
|
||||||
counter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static com.nauk.moodl.MoodlBox.getDateFromTimestamp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Guitoune on 24/04/2018.
|
* Created by Guitoune on 24/04/2018.
|
||||||
*/
|
*/
|
||||||
@ -49,7 +51,7 @@ public class TradeListAdapter extends ArrayAdapter<Trade> {
|
|||||||
|
|
||||||
amountTxtView.setText(String.valueOf(trade.getQty()));
|
amountTxtView.setText(String.valueOf(trade.getQty()));
|
||||||
purchasedPrice.setText(trade.getPrice());
|
purchasedPrice.setText(trade.getPrice());
|
||||||
dateTxtView.setText(getDate(trade.getTime()));
|
dateTxtView.setText(getDateFromTimestamp(trade.getTime()));
|
||||||
tradePair.setText(trade.getSymbol() + "/" + trade.getPairSymbol());
|
tradePair.setText(trade.getSymbol() + "/" + trade.getPairSymbol());
|
||||||
|
|
||||||
if(trade.isBuyer())
|
if(trade.isBuyer())
|
||||||
@ -63,16 +65,4 @@ public class TradeListAdapter extends ArrayAdapter<Trade> {
|
|||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDate(long timeStamp){
|
|
||||||
|
|
||||||
try{
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(" HH:mm dd/MM/yyyy", Locale.getDefault());
|
|
||||||
Date netDate = (new Date(timeStamp));
|
|
||||||
return sdf.format(netDate);
|
|
||||||
}
|
|
||||||
catch(Exception ex){
|
|
||||||
return "xx";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,30 +5,25 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.animation.Animation;
|
|
||||||
import android.view.animation.Transformation;
|
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.daimajia.swipe.SwipeLayout;
|
import com.daimajia.swipe.SwipeLayout;
|
||||||
import com.nauk.moodl.Activities.CurrencyDetailsActivity;
|
|
||||||
import com.nauk.moodl.Activities.CurrencySelectionActivity;
|
|
||||||
import com.nauk.moodl.Activities.RecordTransactionActivity;
|
import com.nauk.moodl.Activities.RecordTransactionActivity;
|
||||||
import com.nauk.moodl.DataManagers.CurrencyData.Transaction;
|
import com.nauk.moodl.DataManagers.CurrencyData.Transaction;
|
||||||
import com.nauk.moodl.DataManagers.DatabaseManager;
|
import com.nauk.moodl.DataManagers.DatabaseManager;
|
||||||
import com.nauk.moodl.DataManagers.PreferencesManager;
|
import com.nauk.moodl.DataManagers.PreferencesManager;
|
||||||
import com.nauk.moodl.R;
|
import com.nauk.moodl.R;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
|
import static com.nauk.moodl.MoodlBox.collapseH;
|
||||||
|
import static com.nauk.moodl.MoodlBox.getDateFromTimestamp;
|
||||||
|
import static com.nauk.moodl.MoodlBox.numberConformer;
|
||||||
import static java.lang.Math.abs;
|
import static java.lang.Math.abs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,7 +56,7 @@ public class TransactionListAdapter extends ArrayAdapter<Transaction> {
|
|||||||
|
|
||||||
amountTxtView.setText(String.valueOf(transaction.getAmount()));
|
amountTxtView.setText(String.valueOf(transaction.getAmount()));
|
||||||
valueTxtView.setText(numberConformer(transaction.getPurchasedPrice() * transaction.getAmount()));
|
valueTxtView.setText(numberConformer(transaction.getPurchasedPrice() * transaction.getAmount()));
|
||||||
dateTxtView.setText(getDate(transaction.getTimestamp()));
|
dateTxtView.setText(getDateFromTimestamp(transaction.getTimestamp()));
|
||||||
|
|
||||||
LinearLayout deleteLayout = convertView.findViewById(R.id.deleteTransactionLayout);
|
LinearLayout deleteLayout = convertView.findViewById(R.id.deleteTransactionLayout);
|
||||||
deleteLayout.setTag(transaction.getTransactionId());
|
deleteLayout.setTag(transaction.getTransactionId());
|
||||||
@ -73,7 +68,7 @@ public class TransactionListAdapter extends ArrayAdapter<Transaction> {
|
|||||||
DatabaseManager databaseManager = new DatabaseManager(context);
|
DatabaseManager databaseManager = new DatabaseManager(context);
|
||||||
preferencesManager.setMustUpdateSummary(true);
|
preferencesManager.setMustUpdateSummary(true);
|
||||||
databaseManager.deleteTransactionFromId(Integer.parseInt(view.getTag().toString()));
|
databaseManager.deleteTransactionFromId(Integer.parseInt(view.getTag().toString()));
|
||||||
collapse((View) view.getParent().getParent().getParent());
|
collapseH((View) view.getParent().getParent().getParent());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -98,32 +93,6 @@ public class TransactionListAdapter extends ArrayAdapter<Transaction> {
|
|||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void collapse(final View v) {
|
|
||||||
final int initialHeight = v.getMeasuredHeight();
|
|
||||||
|
|
||||||
Animation a = new Animation()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
|
||||||
if(interpolatedTime == 1){
|
|
||||||
v.setVisibility(View.GONE);
|
|
||||||
}else{
|
|
||||||
v.getLayoutParams().height = initialHeight - (int)(initialHeight * interpolatedTime);
|
|
||||||
v.requestLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean willChangeBounds() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 1dp/ms
|
|
||||||
a.setDuration((int)(initialHeight / v.getContext().getResources().getDisplayMetrics().density));
|
|
||||||
v.startAnimation(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupSwipeView(View view)
|
private void setupSwipeView(View view)
|
||||||
{
|
{
|
||||||
SwipeLayout swipeLayout = view.findViewById(R.id.swipeLayout);
|
SwipeLayout swipeLayout = view.findViewById(R.id.swipeLayout);
|
||||||
@ -166,52 +135,4 @@ public class TransactionListAdapter extends ArrayAdapter<Transaction> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String getDate(long timeStamp){
|
|
||||||
|
|
||||||
try{
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(" HH:mm dd/MM/yyyy", Locale.getDefault());
|
|
||||||
Date netDate = (new Date(timeStamp));
|
|
||||||
return sdf.format(netDate);
|
|
||||||
}
|
|
||||||
catch(Exception ex){
|
|
||||||
return "xx";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String numberConformer(double number)
|
|
||||||
{
|
|
||||||
String str;
|
|
||||||
|
|
||||||
if(abs(number) > 1)
|
|
||||||
{
|
|
||||||
str = String.format( Locale.UK, "%.2f", number).replaceAll("\\.?0*$", "");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
str = String.format( Locale.UK, "%.4f", number).replaceAll("\\.?0*$", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!str.equals("Infinity"))
|
|
||||||
{
|
|
||||||
int counter = 0;
|
|
||||||
int i = str.indexOf(".");
|
|
||||||
if(i <= 0)
|
|
||||||
{
|
|
||||||
i = str.length();
|
|
||||||
}
|
|
||||||
for(i -= 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
counter++;
|
|
||||||
if(counter == 3)
|
|
||||||
{
|
|
||||||
str = str.substring(0, i) + " " + str.substring(i, str.length());
|
|
||||||
counter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
191
app/src/main/java/com/nauk/moodl/MoodlBox.java
Normal file
191
app/src/main/java/com/nauk/moodl/MoodlBox.java
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
package com.nauk.moodl;
|
||||||
|
|
||||||
|
import android.support.v7.widget.CardView;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.animation.Animation;
|
||||||
|
import android.view.animation.Transformation;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static java.lang.Math.abs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Guitoune on 30/04/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class MoodlBox {
|
||||||
|
|
||||||
|
public static void expandH(final View v) {
|
||||||
|
v.measure(CardView.LayoutParams.MATCH_PARENT, CardView.LayoutParams.WRAP_CONTENT);
|
||||||
|
int targetHeight = v.getMeasuredHeight();
|
||||||
|
|
||||||
|
// Older versions of android (pre API 21) cancel animations for views with a height of 0.
|
||||||
|
v.getLayoutParams().height = 1;
|
||||||
|
v.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
Animation a = getHorizontalExpandAnimation(v);
|
||||||
|
|
||||||
|
// 1dp/ms
|
||||||
|
a.setDuration((int)(targetHeight / v.getContext().getResources().getDisplayMetrics().density));
|
||||||
|
v.startAnimation(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Animation getHorizontalExpandAnimation(final View v)
|
||||||
|
{
|
||||||
|
final int targetHeight = v.getMeasuredHeight();
|
||||||
|
|
||||||
|
Animation a = new Animation()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
||||||
|
v.getLayoutParams().height = interpolatedTime == 1
|
||||||
|
? CardView.LayoutParams.WRAP_CONTENT
|
||||||
|
: (int)(targetHeight * interpolatedTime);
|
||||||
|
v.requestLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean willChangeBounds() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void expandW(final View v, Animation a)
|
||||||
|
{
|
||||||
|
v.measure(CardView.LayoutParams.MATCH_PARENT, CardView.LayoutParams.WRAP_CONTENT);
|
||||||
|
int targetWidth = v.getMeasuredWidth();
|
||||||
|
|
||||||
|
v.getLayoutParams().width = 1;
|
||||||
|
v.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
a.setDuration((int)(targetWidth / v.getContext().getResources().getDisplayMetrics().density));
|
||||||
|
v.startAnimation(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void expandW(final View v) {
|
||||||
|
expandW(v, getVerticalExpandAnimation(v));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Animation getVerticalExpandAnimation(final View v)
|
||||||
|
{
|
||||||
|
final int targetWidth = v.getMeasuredWidth();
|
||||||
|
|
||||||
|
Animation a = new Animation() {
|
||||||
|
@Override
|
||||||
|
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
||||||
|
v.getLayoutParams().width = interpolatedTime == 1
|
||||||
|
? CardView.LayoutParams.WRAP_CONTENT
|
||||||
|
: (int)(targetWidth * interpolatedTime);
|
||||||
|
v.requestLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean willChangeBounds() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void collapseH(final View v) {
|
||||||
|
final int initialHeight = v.getMeasuredHeight();
|
||||||
|
|
||||||
|
Animation a = new Animation()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
||||||
|
if(interpolatedTime == 1){
|
||||||
|
v.setVisibility(View.GONE);
|
||||||
|
}else{
|
||||||
|
v.getLayoutParams().height = initialHeight - (int)(initialHeight * interpolatedTime);
|
||||||
|
v.requestLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean willChangeBounds() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 1dp/ms
|
||||||
|
a.setDuration((int)(initialHeight / v.getContext().getResources().getDisplayMetrics().density));
|
||||||
|
v.startAnimation(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void collapseW(final View v) {
|
||||||
|
final int initialWidth = v.getMeasuredWidth();
|
||||||
|
|
||||||
|
Animation a = new Animation() {
|
||||||
|
@Override
|
||||||
|
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
||||||
|
if(interpolatedTime == 1) {
|
||||||
|
v.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
v.getLayoutParams().width = initialWidth - (int)(initialWidth * interpolatedTime);
|
||||||
|
v.requestLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean willChangeBounds() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
a.setDuration((int)(initialWidth / v.getContext().getResources().getDisplayMetrics().density));
|
||||||
|
v.startAnimation(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String numberConformer(double number)
|
||||||
|
{
|
||||||
|
String str;
|
||||||
|
|
||||||
|
if(abs(number) > 1)
|
||||||
|
{
|
||||||
|
str = String.format( Locale.UK, "%.2f", number).replaceAll("\\.?0*$", "");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str = String.format( Locale.UK, "%.4f", number).replaceAll("\\.?0*$", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!str.equals("Infinity"))
|
||||||
|
{
|
||||||
|
int counter = 0;
|
||||||
|
int i = str.indexOf(".");
|
||||||
|
if(i <= 0)
|
||||||
|
{
|
||||||
|
i = str.length();
|
||||||
|
}
|
||||||
|
for(i -= 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
if(counter == 3)
|
||||||
|
{
|
||||||
|
str = str.substring(0, i) + " " + str.substring(i, str.length());
|
||||||
|
counter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDateFromTimestamp(long timeStamp){
|
||||||
|
try{
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(" HH:mm dd/MM/yyyy", Locale.getDefault());
|
||||||
|
Date netDate = (new Date(timeStamp));
|
||||||
|
return sdf.format(netDate);
|
||||||
|
}
|
||||||
|
catch(Exception ex){
|
||||||
|
return "xx";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -62,7 +62,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
android:paddingTop="20dp">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progressBarMarketCap"
|
android:id="@+id/progressBarMarketCap"
|
||||||
|
30
app/src/main/res/values-fr/strings.xml
Normal file
30
app/src/main/res/values-fr/strings.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="donation">Donation</string>
|
||||||
|
<string name="quick_button">Changement de vue</string>
|
||||||
|
<string name="title_activity_settings">Réglages</string>
|
||||||
|
<string name="pref_header_general">Général</string>
|
||||||
|
<string name="pref_title_hide_balance">Cacher le solde</string>
|
||||||
|
<string name="pref_title_default_currency">Monnaie par défaut</string>
|
||||||
|
<string name="buyText">Achat</string>
|
||||||
|
<string name="sellText">Vente</string>
|
||||||
|
<string name="transferText">Transfère</string>
|
||||||
|
<string name="transaction_record">Enregistrer</string>
|
||||||
|
<string name="fingerprint_verification">Vérifiez votre emprunte</string>
|
||||||
|
<string name="pref_header_exchange">Réglages des échanges</string>
|
||||||
|
<string name="pref_title_enable_synchronization_hitbtc">Activer la synchronisation</string>
|
||||||
|
<string name="pref_title_hitbtc_publickey">Clé public</string>
|
||||||
|
<string name="pref_title_hitbtc_privatekey">Clé privée</string>
|
||||||
|
<string name="pref_title_enable_synchronization_gdax">Activer la synchronisation</string>
|
||||||
|
<string name="pref_title_gdax_publickey">Clé public</string>
|
||||||
|
<string name="pref_title_gdax_privatekey">Clé privée</string>
|
||||||
|
<string name="activity_add_amount">Montant</string>
|
||||||
|
<string name="activity_purchased_price">Prix d\'achat</string>
|
||||||
|
<string name="activity_purchased_date">Date d\'achat</string>
|
||||||
|
<string name="activity_fees">Frais</string>
|
||||||
|
<string name="title_history">Historique</string>
|
||||||
|
<string name="title_infos">Informations</string>
|
||||||
|
<string name="title_transactions">Transactions</string>
|
||||||
|
<string name="title_home">Possessions</string>
|
||||||
|
<string name="title_market_cap">Capitalisation du marché</string>
|
||||||
|
</resources>
|
@ -1,10 +1,8 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Moodl</string>
|
<string name="app_name" translatable="false">Moodl</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="donation">Donation</string>
|
||||||
<string name="action_edit_mode">Edit mode</string>
|
<string name="debug" translatable="false">Moodl_debug</string>
|
||||||
<string name="donation">Fais un don wallah</string>
|
<string name="debug_volley" translatable="false">Moodl_debugVolley</string>
|
||||||
<string name="debug">Moodl_debug</string>
|
|
||||||
<string name="debug_volley">Moodl_debugVolley</string>
|
|
||||||
<string name="quick_button">Switch view</string>
|
<string name="quick_button">Switch view</string>
|
||||||
<string name="title_activity_settings">Settings</string>
|
<string name="title_activity_settings">Settings</string>
|
||||||
|
|
||||||
@ -15,23 +13,8 @@
|
|||||||
|
|
||||||
<string name="pref_title_hide_balance">Hide balance</string>
|
<string name="pref_title_hide_balance">Hide balance</string>
|
||||||
|
|
||||||
<string name="pref_title_display_name">Display name</string>
|
|
||||||
<string name="pref_default_display_name">John Smith</string>
|
|
||||||
|
|
||||||
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
|
|
||||||
<string-array name="pref_example_list_titles">
|
|
||||||
<item>Always</item>
|
|
||||||
<item>When possible</item>
|
|
||||||
<item>Never</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="pref_example_list_values">
|
|
||||||
<item>1</item>
|
|
||||||
<item>0</item>
|
|
||||||
<item>-1</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<!-- Example settings for Data & Sync -->
|
<!-- Example settings for Data & Sync -->
|
||||||
<string name="pref_header_data_sync">Data & sync</string>
|
<string name="pref_title_minimum_amount_displayed">Minimum amount displayed</string>
|
||||||
|
|
||||||
<string name="pref_title_default_currency">Default currency</string>
|
<string name="pref_title_default_currency">Default currency</string>
|
||||||
<string-array name="pref_default_currencies_titles">
|
<string-array name="pref_default_currencies_titles">
|
||||||
@ -90,19 +73,19 @@
|
|||||||
|
|
||||||
<!--Exchange strings-->
|
<!--Exchange strings-->
|
||||||
<string name="pref_header_exchange">Exchanges settings</string>
|
<string name="pref_header_exchange">Exchanges settings</string>
|
||||||
<string name="pref_fingerprint">Touch ID</string>
|
<string name="pref_fingerprint" translatable="false">Touch ID</string>
|
||||||
|
|
||||||
<!--HitBTC-->
|
<!--HitBTC-->
|
||||||
<string name="pref_title_enable_synchronization_hitbtc">Enable synchronization</string>
|
<string name="pref_title_enable_synchronization_hitbtc">Enable synchronization</string>
|
||||||
<string name="pref_title_hitbtc_publickey">Public key</string>
|
<string name="pref_title_hitbtc_publickey">Public key</string>
|
||||||
<string name="pref_title_hitbtc_privatekey">Private key</string>
|
<string name="pref_title_hitbtc_privatekey">Private key</string>
|
||||||
<string name="pref_title_exchange_hitbtc">HitBTC</string>
|
<string name="pref_title_exchange_hitbtc" translatable="false">HitBTC</string>
|
||||||
|
|
||||||
<!--GDAX-->
|
<!--GDAX-->
|
||||||
<string name="pref_title_enable_synchronization_gdax">Enable synchronization</string>
|
<string name="pref_title_enable_synchronization_gdax">Enable synchronization</string>
|
||||||
<string name="pref_title_gdax_publickey">Public key</string>
|
<string name="pref_title_gdax_publickey">Public key</string>
|
||||||
<string name="pref_title_gdax_privatekey">Private key</string>
|
<string name="pref_title_gdax_privatekey">Private key</string>
|
||||||
<string name="pref_title_exchange_gdax">GDAX</string>
|
<string name="pref_title_exchange_gdax" translatable="false">GDAX</string>
|
||||||
|
|
||||||
<!--Binance-->
|
<!--Binance-->
|
||||||
<string name="pref_title_enable_synchronization_binance">Enable synchronization</string>
|
<string name="pref_title_enable_synchronization_binance">Enable synchronization</string>
|
||||||
@ -129,7 +112,7 @@
|
|||||||
<string name="activity_fees">Fees</string>
|
<string name="activity_fees">Fees</string>
|
||||||
<string name="title_activity_currency_details">CurrencyDetailsActivity</string>
|
<string name="title_activity_currency_details">CurrencyDetailsActivity</string>
|
||||||
<string name="title_history">History charts</string>
|
<string name="title_history">History charts</string>
|
||||||
<string name="title_watchlist">Watchlist</string>
|
<string name="title_watchlist" translatable="false">Watchlist</string>
|
||||||
<string name="title_infos">Infos</string>
|
<string name="title_infos">Infos</string>
|
||||||
<string name="title_transactions">Transactions</string>
|
<string name="title_transactions">Transactions</string>
|
||||||
<string name="title_home">Holdings</string>
|
<string name="title_home">Holdings</string>
|
||||||
@ -203,5 +186,7 @@
|
|||||||
<string name="volume_yen_market_cap_textview">24h volume :\n%1$s¥</string>
|
<string name="volume_yen_market_cap_textview">24h volume :\n%1$s¥</string>
|
||||||
|
|
||||||
<string name="title_activity_scrolling">ScrollingActivity</string>
|
<string name="title_activity_scrolling">ScrollingActivity</string>
|
||||||
|
<string name="action_settings">Settings</string>
|
||||||
|
<string name="action_edit_mode">Edition</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -14,6 +14,15 @@
|
|||||||
android:positiveButtonText="@null"
|
android:positiveButtonText="@null"
|
||||||
android:title="@string/pref_title_default_currency" />
|
android:title="@string/pref_title_default_currency" />
|
||||||
|
|
||||||
|
<EditTextPreference
|
||||||
|
android:defaultValue="0"
|
||||||
|
android:key="minimum_value_displayed"
|
||||||
|
android:negativeButtonText="@null"
|
||||||
|
android:positiveButtonText="@null"
|
||||||
|
android:title="@string/pref_title_minimum_amount_displayed"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
|
android:hint="Let blank for none" />
|
||||||
|
|
||||||
<PreferenceScreen android:title="Version"
|
<PreferenceScreen android:title="Version"
|
||||||
android:key="version"/>
|
android:key="version"/>
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"app-release.apk","properties":{"packageId":"com.nauk.moodl","split":"","minSdkVersion":"23"}}]
|
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":2},"path":"app-release.apk","properties":{"packageId":"com.nauk.moodl","split":"","minSdkVersion":"23"}}]
|
Loading…
Reference in New Issue
Block a user