Graphical adjustment
- Update every progress bar color - Smoother quick chart loading
This commit is contained in:
parent
ee318266e9
commit
97dc6df33a
@ -185,6 +185,11 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
Drawable progressBarDrawable = ((ProgressBar) findViewById(R.id.progressBarChart)).getIndeterminateDrawable();
|
||||
progressBarDrawable.mutate();
|
||||
progressBarDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
|
||||
progressBarDrawable.invalidateSelf();
|
||||
|
||||
setupActionBar();
|
||||
|
||||
drawTransactionList();
|
||||
|
@ -26,6 +26,7 @@ import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
||||
@ -292,13 +293,29 @@ public class Watchlist extends Fragment {
|
||||
.setText(PlaceholderManager.getSymbolString(currency.getSymbol(), getActivity()));
|
||||
((ImageView) card.findViewById(R.id.currencyIcon)).setImageBitmap(currency.getIcon());
|
||||
|
||||
((LineChart) card.findViewById(R.id.LineChartView)).setNoDataTextColor(currency.getChartColor());
|
||||
|
||||
Drawable arrowDrawable = ((ImageView) card.findViewById(R.id.detailsArrow)).getDrawable();
|
||||
arrowDrawable.mutate();
|
||||
arrowDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
|
||||
arrowDrawable.invalidateSelf();
|
||||
|
||||
Drawable progressDrawable = ((ProgressBar) card.findViewById(R.id.progressBarLinechartWatchlist)).getIndeterminateDrawable();
|
||||
progressDrawable.mutate();
|
||||
progressDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
|
||||
progressDrawable.invalidateSelf();
|
||||
|
||||
updateColor(card, currency);
|
||||
|
||||
card.findViewById(R.id.LineChartView).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(getActivity(), CurrencyDetailsActivity.class);
|
||||
intent.putExtra("currency", currency);
|
||||
getActivity().getApplicationContext().startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
card.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
card.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -309,37 +326,39 @@ public class Watchlist extends Fragment {
|
||||
}
|
||||
else
|
||||
{
|
||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.progressBarLinechartWatchlist).setVisibility(View.VISIBLE);
|
||||
extendView(view);
|
||||
|
||||
if (currency.getHistoryMinutes() == null) {
|
||||
currency.updateHistoryMinutes(getActivity(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
|
||||
@Override
|
||||
public void onSuccess(Currency currency) {
|
||||
extendView(view);
|
||||
setupLineChart(view, currency);
|
||||
if(currency.getHistoryMinutes() != null)
|
||||
{
|
||||
setupLineChart(view, currency);
|
||||
view.findViewById(R.id.progressBarLinechartWatchlist).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
view.findViewById(R.id.progressBarLinechartWatchlist).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.linearLayoutSubLayout).findViewById(R.id.detailsArrow).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
extendView(view);
|
||||
view.findViewById(R.id.progressBarLinechartWatchlist).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
card.findViewById(R.id.LineChartView).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(getActivity(), CurrencyDetailsActivity.class);
|
||||
intent.putExtra("currency", currency);
|
||||
getActivity().getApplicationContext().startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
if(currency.getHistoryMinutes() != null)
|
||||
{
|
||||
setupLineChart(card, currency);
|
||||
}
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
@ -400,11 +419,13 @@ public class Watchlist extends Fragment {
|
||||
lineChart.getXAxis().setEnabled(false);
|
||||
lineChart.setViewPortOffsets(0, 0, 0, 0);
|
||||
lineChart.setData(generateData(currency));
|
||||
|
||||
lineChart.invalidate();
|
||||
}
|
||||
|
||||
private void updateColor(View card, Currency currency)
|
||||
{
|
||||
if(currency.getDayFluctuation() > 0)
|
||||
if(currency.getDayFluctuation() >= 0)
|
||||
{
|
||||
((TextView) card.findViewById(R.id.currencyFluctuationPercentageTextView)).setTextColor(getResources().getColor(R.color.increase));
|
||||
((TextView) card.findViewById(R.id.currencyFluctuationTextView)).setTextColor(getResources().getColor(R.color.increase));
|
||||
|
@ -53,6 +53,8 @@ public class HomeLayoutGenerator {
|
||||
{
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.cardview_currency, null, true);
|
||||
|
||||
((LineChart) view.findViewById(R.id.LineChartView)).setNoDataTextColor(currency.getChartColor());
|
||||
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
@ -61,18 +63,34 @@ public class HomeLayoutGenerator {
|
||||
if (view.findViewById(R.id.collapsableLayout).getVisibility() == View.VISIBLE) {
|
||||
collapseView(view);
|
||||
} else {
|
||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.progressBarLinechartSummary).setVisibility(View.VISIBLE);
|
||||
extendView(view);
|
||||
|
||||
if (currency.getHistoryMinutes() == null) {
|
||||
currency.updateHistoryMinutes(context, preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
|
||||
@Override
|
||||
public void onSuccess(Currency currency) {
|
||||
ChartLoader chartLoader = new ChartLoader(view, currency);
|
||||
chartLoader.execute();
|
||||
if(currency.getHistoryMinutes() != null)
|
||||
{
|
||||
setupLineChart(view, currency);
|
||||
view.findViewById(R.id.progressBarLinechartSummary).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
view.findViewById(R.id.progressBarLinechartSummary).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.linearLayoutSubLayout).findViewById(R.id.detailsArrow).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
extendView(view);
|
||||
view.findViewById(R.id.progressBarLinechartSummary).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.linearLayoutSubLayout).setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,7 +112,7 @@ public class HomeLayoutGenerator {
|
||||
return view;
|
||||
}
|
||||
|
||||
private class ChartLoader extends AsyncTask<Void, Integer, Void>
|
||||
/*private class ChartLoader extends AsyncTask<Void, Integer, Void>
|
||||
{
|
||||
private View view;
|
||||
private Currency currency;
|
||||
@ -126,7 +144,7 @@ public class HomeLayoutGenerator {
|
||||
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();
|
||||
@ -230,6 +248,11 @@ public class HomeLayoutGenerator {
|
||||
arrowDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
|
||||
arrowDrawable.invalidateSelf();
|
||||
|
||||
Drawable progressDrawable = ((ProgressBar) view.findViewById(R.id.progressBarLinechartSummary)).getIndeterminateDrawable();
|
||||
progressDrawable.mutate();
|
||||
progressDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
|
||||
progressDrawable.invalidateSelf();
|
||||
|
||||
Drawable progressBarDrawable = ((ProgressBar) view.findViewById(R.id.currencyPortfolioDominance)).getProgressDrawable();
|
||||
progressBarDrawable.mutate();
|
||||
progressBarDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
|
||||
@ -265,7 +288,7 @@ public class HomeLayoutGenerator {
|
||||
|
||||
private void updateColor(View view, Currency currency)
|
||||
{
|
||||
if(currency.getDayFluctuationPercentage() > 0)
|
||||
if(currency.getDayFluctuationPercentage() >= 0)
|
||||
{
|
||||
((TextView) view.findViewById(R.id.currencyFluctuationPercentageTextView))
|
||||
.setTextColor(context.getResources().getColor(R.color.increase));
|
||||
|
@ -50,6 +50,7 @@
|
||||
android:gravity="center">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBarChart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
|
@ -182,23 +182,35 @@
|
||||
android:focusable="true">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressLineChart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<com.github.mikephil.charting.charts.LineChart
|
||||
android:id="@+id/LineChartView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:visibility="visible"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/detailsArrow"
|
||||
android:id="@+id/progressBarLinechartSummary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_keyboard_arrow_right_grey_48dp"
|
||||
android:layout_gravity="center_vertical|end"/>
|
||||
android:layout_gravity="center"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:visibility="visible"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/linearLayoutSubLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.github.mikephil.charting.charts.LineChart
|
||||
android:id="@+id/LineChartView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/detailsArrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_keyboard_arrow_right_grey_48dp"
|
||||
android:layout_gravity="center_vertical|end"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
@ -139,19 +139,39 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/cardViewChartSize"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
android:focusable="true"
|
||||
android:visibility="visible">
|
||||
|
||||
<com.github.mikephil.charting.charts.LineChart
|
||||
android:id="@+id/LineChartView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/detailsArrow"
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBarLinechartWatchlist"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_keyboard_arrow_right_grey_48dp"
|
||||
android:layout_gravity="center_vertical|end"/>
|
||||
android:layout_gravity="center"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:visibility="visible"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/linearLayoutSubLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.github.mikephil.charting.charts.LineChart
|
||||
android:id="@+id/LineChartView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/detailsArrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_keyboard_arrow_right_grey_48dp"
|
||||
android:layout_gravity="center_vertical|end"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user