Code cleanup | Selection activty smoother

This commit is contained in:
Tanguy Herbron 2018-04-13 00:31:56 +02:00
parent cf8ec6c565
commit 334c867ea2
18 changed files with 485 additions and 303 deletions

View File

@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"app-release.apk","properties":{"packageId":"com.nauk.coinfolio","split":"","minSdkVersion":"21"}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"app-release.apk","properties":{"packageId":"com.nauk.coinfolio","split":"","minSdkVersion":"23"}}]

View File

@ -16,6 +16,7 @@ import android.support.v4.app.NavUtils;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
@ -43,6 +44,7 @@ import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.nauk.coinfolio.DataManagers.CurrencyData.Currency;
import com.nauk.coinfolio.DataManagers.CurrencyData.CurrencyDataChart;
import com.nauk.coinfolio.DataManagers.CurrencyData.CurrencyDetailsList;
import com.nauk.coinfolio.DataManagers.CurrencyData.Transaction;
import com.nauk.coinfolio.DataManagers.DatabaseManager;
import com.nauk.coinfolio.DataManagers.ExchangeManager.BinanceManager;
@ -83,6 +85,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
private BarChart barChart;
private PreferencesManager preferencesManager;
private BinanceManager binanceManager;
private CurrencyDetailsList currencyDetailsList;
private boolean displayLineChart;
@ -140,6 +143,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
databaseManager = new DatabaseManager(this);
preferencesManager = new PreferencesManager(this);
currencyDetailsList = new CurrencyDetailsList(this);
displayLineChart = true;
@ -183,6 +187,8 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
drawTransactionList();
updateInfoTab();
initializeButtons();
initializeLineChart(lineChart);
initializeCandleStickChart(candleStickChart);
@ -196,6 +202,13 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
TradeUpdater updater = new TradeUpdater();
updater.execute();
Log.d("coinfolio", "Details loaded for " + currency.getId());
}
private void updateInfoTab()
{
((TextView) findViewById(R.id.txtViewTotalSupply)).setText("");
}
private void setupActionBar()

View File

@ -5,29 +5,34 @@ import android.os.AsyncTask;
import android.os.Bundle;
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.Menu;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.Transformation;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SearchView;
import com.nauk.coinfolio.DataManagers.BalanceManager;
import com.nauk.coinfolio.DataManagers.CurrencyData.Currency;
import com.nauk.coinfolio.DataManagers.CurrencyData.CurrencyDetailsList;
import com.nauk.coinfolio.LayoutManagers.CurrencyListAdapter;
import com.nauk.coinfolio.R;
import java.util.ArrayList;
import java.util.List;
public class CurrencySelectionActivity extends AppCompatActivity implements SearchView.OnQueryTextListener{
private String[] currencySymbols;
private String[] currencyNames;
private CurrencyListAdapter adapter;
private ListView listView;
private android.widget.Filter filter;
private Intent comingIntent;
private CurrencyDetailsList currencyDetailsList;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -38,12 +43,14 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
setContentView(R.layout.activity_add_currency);
comingIntent = getIntent();
currencyDetailsList = new CurrencyDetailsList(this);
setTitle("Select a coin");
ListLoader listLoader = new ListLoader();
listLoader.execute();
Log.d("coinfolio", "Started");
}
private void setupSearchView()
@ -58,18 +65,14 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
private void setupAdapter()
{
String[] currencyFullName = new String[currencyNames.length];
for(int i = 0; i < currencyFullName.length; i++)
{
currencyFullName[i] = currencyNames[i] + " " + currencySymbols[i];
}
List<String> currencyNames = currencyDetailsList.getCurrenciesName();
List<String> currencySymbols = currencyDetailsList.getCurrenciesSymbol();
ArrayList<Currency> currencyArrayList = new ArrayList<>();
for(int i = 0; i < currencyNames.length; i++)
for(int i = 0; i < currencyNames.size(); i++)
{
currencyArrayList.add(new Currency(currencyNames[i], currencySymbols[i]));
currencyArrayList.add(new Currency(currencyNames.get(i), currencySymbols.get(i)));
}
adapter = new CurrencyListAdapter(this, currencyArrayList);
@ -97,27 +100,32 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
filter = adapter.getFilter();
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
/*final AutoCompleteTextView searchAutoComplete = findViewById(R.id.search_bar);
private static void expand(final View v) {
v.measure(CardView.LayoutParams.MATCH_PARENT, CardView.LayoutParams.WRAP_CONTENT);
final int targetHeight = v.getMeasuredHeight();
searchAutoComplete.setOnItemClickListener(new AdapterView.OnItemClickListener() {
// 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
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Currency selectedCurrency = (Currency) adapterView.getItemAtPosition(i);
Intent intent = new Intent(CurrencySelectionActivity.this, RecordTransactionActivity.class);
intent.putExtra("coin", selectedCurrency.getName());
intent.putExtra("symbol", selectedCurrency.getSymbol());
startActivity(intent);
finish();
protected void applyTransformation(float interpolatedTime, Transformation t) {
v.getLayoutParams().height = interpolatedTime == 1
? CardView.LayoutParams.WRAP_CONTENT
: (int)(targetHeight * interpolatedTime);
v.requestLayout();
}
});
searchAutoComplete.setAdapter(adapter);
searchAutoComplete.setThreshold(0);*/
@Override
public boolean willChangeBounds() {
return true;
}
};
return true;
// 1dp/ms
a.setDuration((int)(targetHeight / v.getContext().getResources().getDisplayMetrics().density));
v.startAnimation(a);
}
@Override
@ -161,17 +169,22 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
Looper.prepare();
}
currencySymbols = comingIntent.getStringArrayExtra("currencyListSymbols");
currencyNames = comingIntent.getStringArrayExtra("currencyListNames");
setupAdapter();
setupList();
runOnUiThread(new Runnable() {
currencyDetailsList.update(new BalanceManager.IconCallBack() {
@Override
public void run() {
setupSearchView();
public void onSuccess() {
setupAdapter();
setupList();
runOnUiThread(new Runnable() {
@Override
public void run() {
setupSearchView();
expand(findViewById(R.id.listContainerLayout));
findViewById(R.id.currencyListProgressBar).setVisibility(View.GONE);
}
});
}
});
@ -181,8 +194,7 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
@Override
protected void onPostExecute(Void result)
{
findViewById(R.id.coinsPreview).setVisibility(View.VISIBLE);
findViewById(R.id.currencyListProgressBar).setVisibility(View.GONE);
}
}
}

View File

@ -232,14 +232,6 @@ public class HomeActivity extends AppCompatActivity {
public void onClick(View view) {
Intent addIntent = new Intent(HomeActivity.this, CurrencySelectionActivity.class);
String[] symbolList = new String[balanceManager.getCurrenciesSymbol().size()];
symbolList = balanceManager.getCurrenciesSymbol().toArray(symbolList);
String[] nameList = new String[balanceManager.getCurrenciesName().size()];
nameList = balanceManager.getCurrenciesName().toArray(nameList);
addIntent.putExtra("currencyListSymbols", symbolList);
addIntent.putExtra("currencyListNames", nameList);
startActivity(addIntent);
}
});
@ -324,8 +316,14 @@ public class HomeActivity extends AppCompatActivity {
private void switchMainView()
{
Log.d("coinfolio", "Should");
((AppBarLayout) findViewById(R.id.app_bar)).setExpanded(true, true);
findViewById(R.id.swiperefresh).setNestedScrollingEnabled(true);
findViewById(R.id.toolbar_layout).setFocusable(true);
((AppBarLayout) findViewById(R.id.app_bar)).setExpanded(true, true);
((AppBarLayout) findViewById(R.id.app_bar)).setActivated(true);
findViewById(R.id.app_bar).setClickable(true);
findViewById(R.id.nestedScrollViewLayout).setNestedScrollingEnabled(true);
findViewById(R.id.app_bar).setEnabled(true);
@ -339,8 +337,14 @@ public class HomeActivity extends AppCompatActivity {
private void switchSecondaryViews(int itemIndex)
{
Log.d("coinfolio", "Should not");
((AppBarLayout) findViewById(R.id.app_bar)).setExpanded(false, true);
findViewById(R.id.swiperefresh).setNestedScrollingEnabled(false);
findViewById(R.id.toolbar_layout).setFocusable(false);
((AppBarLayout) findViewById(R.id.app_bar)).setExpanded(false, true);
((AppBarLayout) findViewById(R.id.app_bar)).setActivated(false);
findViewById(R.id.app_bar).setClickable(false);
findViewById(R.id.nestedScrollViewLayout).setNestedScrollingEnabled(false);
findViewById(R.id.app_bar).setEnabled(false);

View File

@ -26,7 +26,6 @@ public class RecordTransactionActivity extends AppCompatActivity {
private String coin;
private String symbol;
private TextView symbolTxtView;
private EditText amountTxtView;
private TextView purchasedDate;
private Button validateButton;

View File

@ -10,6 +10,7 @@ import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.nauk.coinfolio.DataManagers.CurrencyData.Currency;
import com.nauk.coinfolio.DataManagers.CurrencyData.CurrencyDetailsList;
import com.nauk.coinfolio.DataManagers.ExchangeManager.BinanceManager;
import com.nauk.coinfolio.DataManagers.ExchangeManager.HitBtcManager;
import com.nauk.coinfolio.R;
@ -46,6 +47,7 @@ public class BalanceManager {
private LinkedHashMap<String, String> coinInfosHashmap;
private PreferencesManager preferenceManager;
private DatabaseManager databaseManager;
private CurrencyDetailsList currencyDetailsList;
private int balanceCounter;
@ -65,33 +67,17 @@ public class BalanceManager {
databaseManager = new DatabaseManager(context);
hitBtcManagers = new ArrayList<>();
binanceManagers = new ArrayList<>();
currencyDetailsList = new CurrencyDetailsList(context);
balanceCounter = 0;
}
public List<String> getCurrenciesName()
{
List<String> currenciesName = new ArrayList<>();
for (String symbol : coinInfosHashmap.keySet())
{
try {
JSONObject jsonObject = new JSONObject(coinInfosHashmap.get(symbol));
currenciesName.add(jsonObject.getString("CoinName"));
} catch (JSONException e) {
e.printStackTrace();
}
}
return currenciesName;
}
public List<String> getBiggestCurrencies()
{
List<String> currenciesDetails = new ArrayList<>();
int index = 0;
Iterator<String> coinIterator = coinInfosHashmap.keySet().iterator();
Iterator<String> coinIterator = currencyDetailsList.getCoinInfosHashmap().keySet().iterator();
while(index < 11)
{
@ -103,28 +89,6 @@ public class BalanceManager {
return currenciesDetails;
}
public List<String> getOrders()
{
List<String> currenciesOrder = new ArrayList<>();
for(String symbol : coinInfosHashmap.keySet())
{
try {
JSONObject jsonObject = new JSONObject(coinInfosHashmap.get(symbol));
currenciesOrder.add(jsonObject.getString("SortOrder"));
} catch (JSONException e) {
e.printStackTrace();
}
}
return currenciesOrder;
}
public List<String> getCurrenciesSymbol()
{
return new ArrayList<>(coinInfosHashmap.keySet());
}
public void updateExchangeKeys()
{
String publicKey = preferenceManager.getHitBTCPublicKey();
@ -289,7 +253,8 @@ public class BalanceManager {
public void updateDetails(final IconCallBack callBack)
{
StringRequest strRequest = new StringRequest(Request.Method.GET, detailUrl,
currencyDetailsList.update(callBack);
/*StringRequest strRequest = new StringRequest(Request.Method.GET, detailUrl,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
@ -305,7 +270,7 @@ public class BalanceManager {
}
});
requestQueue.add(strRequest);
requestQueue.add(strRequest);*/
}
public String getIconUrl(String symbol)
@ -313,7 +278,7 @@ public class BalanceManager {
String url;
try {
JSONObject jsonObject = new JSONObject(coinInfosHashmap.get(symbol));
JSONObject jsonObject = new JSONObject(currencyDetailsList.getCoinInfosHashmap().get(symbol));
url = "https://www.cryptocompare.com" + jsonObject.getString("ImageUrl") + "?width=50";
} catch (NullPointerException e) {
Log.d(context.getResources().getString(R.string.debug), symbol + " has no icon URL");
@ -331,7 +296,7 @@ public class BalanceManager {
String currencyName = null;
try {
JSONObject jsonObject = new JSONObject(coinInfosHashmap.get(symbol));
JSONObject jsonObject = new JSONObject(currencyDetailsList.getCoinInfosHashmap().get(symbol));
currencyName = jsonObject.getString("CoinName");
} catch (JSONException e) {
e.printStackTrace();
@ -345,7 +310,7 @@ public class BalanceManager {
int id = 0;
try {
JSONObject jsonObject = new JSONObject(coinInfosHashmap.get(symbol));
JSONObject jsonObject = new JSONObject(currencyDetailsList.getCoinInfosHashmap().get(symbol));
id = jsonObject.getInt("Id");
} catch (JSONException e) {
e.printStackTrace();
@ -354,32 +319,6 @@ public class BalanceManager {
return id;
}
private void processDetailResult(String response, final IconCallBack callBack)
{
response = response.substring(response.indexOf("\"Data\"") + 7, response.lastIndexOf("},\"Type\":100}"));
String[] tab = response.split(Pattern.quote("},"));
coinInfosHashmap = new LinkedHashMap<>();
for(int i = 0; i < tab.length; i++)
{
tab[i] = tab[i].substring(tab[i].indexOf("\":{")+2, tab[i].length()) + "}";
try {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
JSONObject jsonObject = new JSONObject(tab[i]);
coinInfosHashmap.put(jsonObject.getString("Symbol"), tab[i]);
} catch (JSONException e) {
Log.d(context.getResources().getString(R.string.debug), "ImageUrl not found.");
}
}
sortDetails();
callBack.onSuccess();
}
private void sortDetails()
{
LinkedHashMap<String, String> sortedHashmap = new LinkedHashMap<>();

View File

@ -28,21 +28,12 @@ public class Currency implements Parcelable {
private CurrencyDataRetriever dataRetriver;
private Bitmap icon;
private int chartColor;
public Currency(Currency currency)
{
this.id = currency.id;
this.name = currency.name;
this.symbol = currency.symbol;
this.value = currency.value;
this.balance = currency.balance;
this.dayFluctuationPercentage = currency.getDayFluctuationPercentage();
this.dayFluctuation = currency.getDayFluctuation();
this.historyMinutes = currency.historyMinutes;
this.dataRetriver = currency.getDataRetriver();
this.icon = currency.icon;
this.chartColor = currency.chartColor;
}
private int circulatingSupply;
private int totalSupply;
private double marketCapitalization;
private List<String> socialMediaLinks;
private String algorithm;
//private String proofType
public Currency(String symbol, double balance)
{
@ -63,6 +54,8 @@ public class Currency implements Parcelable {
this.symbol = symbol;
}
//public Currency(int id, String symbol, String name, String algorithm, String proofType, )
public void getTimestampPrice(android.content.Context context, final PriceCallBack callBack, long timestamp)
{
dataRetriver = new CurrencyDataRetriever(context);
@ -137,6 +130,12 @@ public class Currency implements Parcelable {
}, CurrencyDataRetriever.DAYS);
}
public void updateDetails(android.content.Context context, final CurrencyCallBack callBack)
{
dataRetriver = new CurrencyDataRetriever(context);
}
public void setId(int id)
{
this.id = id;

View File

@ -182,6 +182,32 @@ public class CurrencyDataRetriever {
}
}
/*public void updateCryptocompareDetails(int id, final Currency.CurrencyCallBack callBack)
{
String requestUrl = getRequestUrl(timeUnit, symbolCurrencyFrom, symbolCyrrencyTo);
StringRequest stringRequest = new StringRequest(Request.Method.GET, requestUrl,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
callBack.onSuccess();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
callBack.onSuccess();
}
});
requestQueue.add(stringRequest);
}*/
public void updateCoinMarketCapDetails()
{
}
public interface DataChartCallBack {
void onSuccess(List<CurrencyDataChart> dataChart);
void onSuccess(String price);

View File

@ -0,0 +1,149 @@
package com.nauk.coinfolio.DataManagers.CurrencyData;
import android.os.StrictMode;
import android.util.Log;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.nauk.coinfolio.Activities.HomeActivity;
import com.nauk.coinfolio.DataManagers.BalanceManager;
import com.nauk.coinfolio.R;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.regex.Pattern;
/**
* Created by Tiji on 11/04/2018.
*/
public class CurrencyDetailsList {
final private static String DETAILURL = "https://www.cryptocompare.com/api/data/coinlist/";
private RequestQueue requestQueue;
private LinkedHashMap<String, String> coinInfosHashmap;
private android.content.Context context;
public CurrencyDetailsList(android.content.Context context)
{
this.context = context;
requestQueue = Volley.newRequestQueue(context);
}
public void update(final BalanceManager.IconCallBack callBack)
{
StringRequest strRequest = new StringRequest(Request.Method.GET, DETAILURL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
if (response.length() > 0) {
processDetailResult(response, callBack);
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
requestQueue.add(strRequest);
}
private void processDetailResult(String response, final BalanceManager.IconCallBack callBack)
{
response = response.substring(response.indexOf("\"Data\"") + 7, response.lastIndexOf("},\"Type\":100}"));
String[] tab = response.split(Pattern.quote("},"));
coinInfosHashmap = new LinkedHashMap<>();
for(int i = 0; i < tab.length; i++)
{
tab[i] = tab[i].substring(tab[i].indexOf("\":{")+2, tab[i].length()) + "}";
try {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
JSONObject jsonObject = new JSONObject(tab[i]);
coinInfosHashmap.put(jsonObject.getString("Symbol"), tab[i]);
} catch (JSONException e) {
Log.d(context.getResources().getString(R.string.debug), "ImageUrl not found.");
}
}
sortDetails();
callBack.onSuccess();
}
private void sortDetails()
{
LinkedHashMap<String, String> sortedHashmap = new LinkedHashMap<>();
List<String> listInfos = new ArrayList<>(coinInfosHashmap.values());
List<String> listSymbols = new ArrayList<>(coinInfosHashmap.keySet());
for(int i = 0; i < coinInfosHashmap.keySet().size(); i++)
{
try {
JSONObject jsonObject = new JSONObject(listInfos.get(i));
int index = jsonObject.getInt("SortOrder");
listInfos.add(index, listInfos.get(i));
listSymbols.add(index, listSymbols.get(i));
} catch (JSONException e) {
e.printStackTrace();
}
}
for(int i = 0; i < listInfos.size(); i++)
{
sortedHashmap.put(listSymbols.get(i), listInfos.get(i));
}
coinInfosHashmap = sortedHashmap;
}
public LinkedHashMap<String, String> getCoinInfosHashmap() {
return coinInfosHashmap;
}
public List<String> getCurrenciesName()
{
List<String> currenciesName = new ArrayList<>();
for (String symbol : coinInfosHashmap.keySet())
{
try {
JSONObject jsonObject = new JSONObject(coinInfosHashmap.get(symbol));
currenciesName.add(jsonObject.getString("CoinName"));
} catch (JSONException e) {
e.printStackTrace();
}
}
return currenciesName;
}
public Currency getCurrencyDetailsFromSymbol(String symbol)
{
//Currency currency = new Currency();
return null;
}
public List<String> getCurrenciesSymbol()
{
return new ArrayList<>(coinInfosHashmap.keySet());
}
}

View File

@ -77,8 +77,6 @@ public class BinanceManager {
BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance(publicKey, privateKey);
BinanceApiRestClient client = factory.newRestClient();
Log.d("coinfolio", symbol + pairSymbol);
if(!symbol.equals(pairSymbol))
{
try {
@ -102,16 +100,6 @@ public class BinanceManager {
return presentTrades;
}
public void setPublicKey(String publicKey)
{
this.publicKey = publicKey;
}
public void setPrivateKey(String privateKey)
{
this.privateKey = privateKey;
}
public List<Currency> getBalance()
{
return balance;

View File

@ -110,16 +110,6 @@ public class HitBtcManager {
}
}
public void setPublicKey(String publicKey)
{
this.publicKey = publicKey;
}
private void setPrivateKey(String privateKey)
{
this.privateKey = privateKey;
}
public List<Currency> getBalance()
{
return balance;

View File

@ -24,7 +24,6 @@ public class MarketCapManager {
private static final String topCurrenciesUrl = "https://api.coinmarketcap.com/v1/ticker/?limit=9";
private static final String marketCapUrl = "https://api.coinmarketcap.com/v1/global/";
private android.content.Context context;
private RequestQueue requestQueue;
private String topRequestResult[];
private long marketCap;
@ -32,8 +31,6 @@ public class MarketCapManager {
public MarketCapManager(android.content.Context context)
{
this.context = context;
requestQueue = Volley.newRequestQueue(context);
}

View File

@ -14,23 +14,14 @@ public class PreferencesManager {
private SharedPreferences settingPreferences;
private SharedPreferences currencyList;
private SharedPreferences preferencesList;
android.content.Context context;
public PreferencesManager(android.content.Context context)
{
this.context = context;
settingPreferences = PreferenceManager.getDefaultSharedPreferences(context);
currencyList = context.getSharedPreferences(currencyListFile, 0);
preferencesList = context.getSharedPreferences(preferencesFile, 0);
}
public void addCurrency(String symbol, double balance)
{
SharedPreferences.Editor editor = currencyList.edit();
editor.putString(symbol, String.valueOf(balance));
editor.apply();
}
public void setDetailOption(boolean isExtended)
{
SharedPreferences.Editor editor = preferencesList.edit();

View File

@ -80,7 +80,7 @@ public class HomeLayoutGenerator {
return view;
}
public static void expand(final View v) {
private static void expand(final View v) {
v.measure(CardView.LayoutParams.MATCH_PARENT, CardView.LayoutParams.WRAP_CONTENT);
final int targetHeight = v.getMeasuredHeight();
@ -108,7 +108,7 @@ public class HomeLayoutGenerator {
v.startAnimation(a);
}
public static void collapse(final View v) {
private static void collapse(final View v) {
final int initialHeight = v.getMeasuredHeight();
Animation a = new Animation()

View File

@ -19,11 +19,18 @@
android:layout_gravity="center|top"
android:background="@color/listBackground"/>
<ListView
android:id="@+id/coinsPreview"
<LinearLayout
android:id="@+id/listContainerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"/>
android:layout_height="match_parent"
android:visibility="gone">
<ListView
android:id="@+id/coinsPreview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
<LinearLayout
android:id="@+id/currencyListProgressBar"

View File

@ -184,157 +184,148 @@
<LinearLayout
android:id="@+id/llCharts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.16">
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Beginning price"
android:layout_weight="0.75"/>
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:id="@+id/txtViewPriceStart"
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Beginning price"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewPriceStart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_weight="0.25"/>
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Current price"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewPriceNow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Delta"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewPercentage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:background="@color/separationColor"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.16">
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Current price"
android:layout_weight="0.75"/>
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:id="@+id/txtViewPriceNow"
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Total volume"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/totalVolume"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_weight="0.25"/>
android:orientation="vertical"
android:layout_weight="0.16">
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Highest price"
android:layout_weight="0.5"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:background="@color/separationColor"/>
<TextView
android:id="@+id/highestPrice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.16">
</LinearLayout>
<TextView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Delta"
android:layout_weight="0.75"/>
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:id="@+id/txtViewPercentage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_weight="0.25"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Lowest price"
android:layout_weight="0.5"
android:textStyle="bold"/>
</LinearLayout>
<TextView
android:id="@+id/lowestPrice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:background="@color/separationColor"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Total volume"
android:layout_weight="0.75"/>
<TextView
android:id="@+id/totalVolume"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_weight="0.25" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:background="@color/separationColor"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Highest price"
android:layout_weight="0.75" />
<TextView
android:id="@+id/highestPrice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_weight="0.25" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:background="@color/separationColor"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Lowest price"
android:layout_weight="0.75"/>
<TextView
android:id="@+id/lowestPrice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_weight="0.25" />
</LinearLayout>
</LinearLayout>
@ -346,15 +337,88 @@
<LinearLayout
android:id="@+id/infosLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<ProgressBar
android:id="@+id/progressBar"
android:id="@+id/currencyPortfolioDominance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleLarge"
android:layout_gravity="center"
android:background="@drawable/circular_progress_bar" />
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:visibility="invisible"
android:background="@color/colorAccent"
android:padding="@dimen/mdtp_ampm_left_padding"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.5">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Total supply"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewTotalSupply"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.5">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Circulating supply"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewCirculatingSupply"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Market capitalizaion"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewMarketCapitalization"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -61,7 +61,8 @@
android:layout_height="wrap_content"
android:text="@string/quick_button"
android:visibility="visible"
android:layout_gravity="start"/>
android:layout_gravity="start"
android:contentDescription="Switch view"/>
<ImageButton
android:id="@+id/settings_button"
@ -69,7 +70,8 @@
android:layout_height="wrap_content"
android:text="@string/action_settings"
android:visibility="visible"
android:layout_gravity="end"/>
android:layout_gravity="end"
android:contentDescription="Settings"/>
</FrameLayout>

View File

@ -19,4 +19,6 @@
<dimen name="separationLineSize">1dp</dimen>
<dimen name="cardview_elevation">8dp</dimen>
<dimen name="toolbar_height">56dp</dimen>
<dimen name="toolbar_height_expand">70dp</dimen>
</resources>