Fix SDK 19 crash

This commit is contained in:
Tanguy Herbron 2018-08-15 04:23:54 +02:00
parent 85dd10a177
commit 91418b73fa
6 changed files with 442 additions and 11 deletions

View File

@ -233,15 +233,23 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
.setText(PlaceholderManager.getPercentageString(numberConformer(currency.getDayFluctuationPercentage()), getContext()));
Drawable arrowDrawable = ((ImageView) findViewById(R.id.detailsArrow)).getDrawable();
if(arrowDrawable != null)
{
arrowDrawable.mutate();
arrowDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
arrowDrawable.invalidateSelf();
}
Drawable progressDrawable = ((ProgressBar) findViewById(R.id.progressBarLinechartWatchlist)).getIndeterminateDrawable();
if(progressDrawable != null)
{
progressDrawable.mutate();
progressDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
progressDrawable.invalidateSelf();
}
}
private void updateCardViewInfos(Currency currency, float totalValue, boolean isBalanceHidden)
{

View File

@ -204,7 +204,7 @@ public class DatabaseManager extends SQLiteOpenHelper{
result.moveToFirst();
return result.getInt(result.getColumnIndex(KEY_WATCHLIST_ID));
return result.getInt(0);
}
public void deleteExchangeAccountFromId(int id)

View File

@ -0,0 +1,203 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLinear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="false"
android:orientation="vertical"
android:tag="mainLinear">
<ProgressBar
android:id="@+id/currencyPortfolioDominance"
android:layout_width="match_parent"
android:layout_height="2dp"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:visibility="invisible"/>
<LinearLayout
android:id="@+id/currencyInfoLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/topLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/currencyIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="1dp" />
<TextView
android:id="@+id/currencyNameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="start"
android:textColor="@color/mainTextViewColor"
android:textSize="@dimen/cardViewTitle" />
<TextView
android:id="@+id/currencySymbolTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:gravity="left"
android:textColor="@color/secondaryTextViewColor"
android:textSize="@dimen/cardViewCaption" />
<TextView
android:id="@+id/currencyValueTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:textColor="@color/secondaryTextViewColor"
android:textSize="@dimen/cardViewTitle" />
</LinearLayout>
<LinearLayout
android:id="@+id/bottomLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/percentageOwnedTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start"
android:textColor="@color/secondaryTextViewColor"
android:textSize="@dimen/cardViewTitle"
android:visibility="gone"/>
<LinearLayout
android:id="@+id/currencyOwnedInfoLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/currencyOwnedTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start"
android:textColor="@color/mainTextViewColor"
android:textSize="@dimen/cardViewTitle" />
<TextView
android:id="@+id/currencyValueOwnedTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:gravity="start"
android:textColor="@color/secondaryTextViewColor"
android:textSize="@dimen/cardViewCaption" />
</LinearLayout>
<LinearLayout
android:id="@+id/secondaryLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal">
<TextView
android:id="@+id/currencyFluctuationPercentageTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/cardViewTitle" />
<TextView
android:id="@+id/currencyFluctuationTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/cardViewCaption" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/collapsableLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:orientation="vertical">
<LinearLayout
android:id="@+id/separationLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/day_history"
android:textSize="@dimen/cardViewCaption" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@color/separationColor" />
</LinearLayout>
<FrameLayout
android:id="@+id/frameLayoutChart"
android:layout_width="match_parent"
android:layout_height="@dimen/cardViewChartSize"
android:clickable="true"
android:focusable="true">
<ProgressBar
android:id="@+id/progressBarLinechartSummary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:visibility="visible"/>
<FrameLayout
android:id="@+id/linearLayoutSubCharts"
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"
android:transitionName="chart"/>
<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>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLinear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="false"
android:orientation="vertical"
android:tag="mainLinear">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:id="@+id/dragCardWatchlist"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center"
android:layout_gravity="start"
android:visibility="gone"
android:layout_weight="0.08"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_drag_handle_24dp"
android:clickable="false"
android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/currencyInfoLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical"
android:layout_weight="0.92">
<LinearLayout
android:id="@+id/topLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<ImageView
android:id="@+id/currencyIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="1dp" />
<TextView
android:id="@+id/currencyNameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="start"
android:textColor="@color/mainTextViewColor"
android:textSize="@dimen/cardViewTitle" />
<TextView
android:id="@+id/currencySymbolTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:layout_marginLeft="2dp"
android:gravity="left"
android:textColor="@color/secondaryTextViewColor"
android:textSize="@dimen/cardViewCaption" />
</LinearLayout>
<LinearLayout
android:id="@+id/bottomLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/currencyValueTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:textColor="@color/secondaryTextViewColor"
android:textSize="@dimen/cardViewTitle"
android:layout_weight="0.5"/>
<LinearLayout
android:id="@+id/secondaryLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal"
android:layout_weight="0.5">
<TextView
android:id="@+id/currencyFluctuationPercentageTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/cardViewTitle" />
<TextView
android:id="@+id/currencyFluctuationTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/cardViewCaption" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/deleteCardWatchlist"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@color/decreaseCandle"
android:gravity="center"
android:layout_gravity="end"
android:visibility="gone"
android:layout_weight="0.08"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_delete_white_24dp"
android:clickable="false"
android:focusable="false"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/collapsableLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:orientation="vertical">
<LinearLayout
android:id="@+id/separationLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/day_history"
android:textSize="@dimen/cardViewCaption" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@color/separationColor" />
</LinearLayout>
<FrameLayout
android:id="@+id/frameLayoutChart"
android:layout_width="match_parent"
android:layout_height="@dimen/cardViewChartSize"
android:clickable="true"
android:focusable="true"
android:visibility="visible">
<ProgressBar
android:id="@+id/progressBarLinechartWatchlist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:visibility="visible"/>
<FrameLayout
android:id="@+id/linearLayoutSubCharts"
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>
</LinearLayout>
</LinearLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mainLinear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -191,7 +192,8 @@
android:id="@+id/detailsArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_keyboard_arrow_right_grey_48dp"
app:srcCompat="@drawable/ic_keyboard_arrow_right_grey_48dp"
android:background="@color/transparent"
android:layout_gravity="center_vertical|end"/>
</FrameLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mainLinear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -26,7 +27,8 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_drag_handle_24dp"
app:srcCompat="@drawable/ic_drag_handle_24dp"
android:background="@color/transparent"
android:clickable="false"
android:focusable="false"/>
@ -129,7 +131,8 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_delete_white_24dp"
app:srcCompat="@drawable/ic_delete_white_24dp"
android:background="@color/transparent"
android:clickable="false"
android:focusable="false"/>
@ -202,7 +205,8 @@
android:id="@+id/detailsArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_keyboard_arrow_right_grey_48dp"
app:srcCompat="@drawable/ic_keyboard_arrow_right_grey_48dp"
android:background="@color/transparent"
android:layout_gravity="center_vertical|end"/>
</FrameLayout>