FIx 1month detail crash

This commit is contained in:
Tanguy Herbron 2018-03-28 00:27:51 +02:00
parent c9e7f8f21d
commit dc0dedca73
7 changed files with 36 additions and 27 deletions

View File

@ -243,7 +243,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
}); });
break; break;
case "1M": case "1M":
currency.updateHistoryDays(this, new Currency.CurrencyCallBack() { currency.updateHistoryHours(this, new Currency.CurrencyCallBack() {
@Override @Override
public void onSuccess(Currency currency) { public void onSuccess(Currency currency) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@ -398,6 +398,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
{ {
case 1: case 1:
dataChartList = currency.getHistoryHours(); dataChartList = currency.getHistoryHours();
Log.d("coinfolio", "1 month");
offset = 124; offset = 124;
pointFormat = MONTH; pointFormat = MONTH;
break; break;

View File

@ -140,7 +140,8 @@ public class HomeActivity extends AppCompatActivity {
//Setup main interface //Setup main interface
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
//this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_currency_summary); setContentView(R.layout.activity_currency_summary);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
@ -185,8 +186,6 @@ public class HomeActivity extends AppCompatActivity {
ImageButton detailsButton = findViewById(R.id.switch_button); ImageButton detailsButton = findViewById(R.id.switch_button);
ImageButton settingsButton = findViewById(R.id.settings_button); ImageButton settingsButton = findViewById(R.id.settings_button);
toolbarLayout.setExpandedTitleGravity(Gravity.CENTER);
toolbarLayout.setCollapsedTitleGravity(Gravity.CENTER);
toolbarLayout.setForegroundGravity(Gravity.CENTER); toolbarLayout.setForegroundGravity(Gravity.CENTER);
toolbarLayout.setTitle("US$0.00"); toolbarLayout.setTitle("US$0.00");

View File

@ -154,13 +154,12 @@ public class HomeLayoutGenerator {
if(currency.getHistoryMinutes() != null) if(currency.getHistoryMinutes() != null)
{ {
view.findViewById(R.id.LineChartView).setVisibility(View.VISIBLE); view.findViewById(R.id.LineChartView).setVisibility(View.VISIBLE);
((LineChart) view.findViewById(R.id.LineChartView)).invalidate(); view.findViewById(R.id.LineChartView).invalidate();
view.findViewById(R.id.errorTextView).setVisibility(View.GONE); view.findViewById(R.id.errorTextView).setVisibility(View.GONE);
} }
else else
{ {
view.findViewById(R.id.LineChartView).setVisibility(View.GONE); view.findViewById(R.id.LineChartView).setVisibility(View.GONE);
view.findViewById(R.id.errorTextView).setVisibility(View.VISIBLE); view.findViewById(R.id.errorTextView).setVisibility(View.VISIBLE);
} }

View File

@ -29,7 +29,10 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
app:contentScrim="@drawable/gradient_background" app:contentScrim="@drawable/gradient_background"
app:layout_scrollFlags="scroll|exitUntilCollapsed" app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar"> app:toolbarId="@+id/toolbar"
app:collapsedTitleGravity="center"
app:expandedTitleGravity="center"
app:titleEnabled="true">
<TextView <TextView
android:id="@+id/toolbarSubtitle" android:id="@+id/toolbarSubtitle"
@ -38,7 +41,7 @@
android:layout_gravity="center|bottom" android:layout_gravity="center|bottom"
android:layout_marginBottom="35dp" android:layout_marginBottom="35dp"
android:gravity="center" android:gravity="center"
android:textSize="20dp" android:textSize="20sp"
app:layout_collapseMode="parallax"/> app:layout_collapseMode="parallax"/>
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
@ -46,16 +49,15 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay"> app:popupTheme="@style/AppTheme.PopupOverlay"
android:layout_marginStart="-30dp">
</android.support.v7.widget.Toolbar> </android.support.v7.widget.Toolbar>
<LinearLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
android:orientation="horizontal"
android:gravity="left"
android:layout_margin="10dp"> android:layout_margin="10dp">
<ImageButton <ImageButton
@ -63,26 +65,18 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/quick_button" android:text="@string/quick_button"
android:visibility="visible"/> android:visibility="visible"
android:layout_gravity="start"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="pin"
android:orientation="horizontal"
android:gravity="right"
android:layout_margin="10dp">
<ImageButton <ImageButton
android:id="@+id/settings_button" android:id="@+id/settings_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/action_settings" android:text="@string/action_settings"
android:visibility="visible"/> android:visibility="visible"
android:layout_gravity="end"/>
</LinearLayout> </FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>

View File

@ -82,7 +82,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="gone" android:visibility="gone"
android:orientation="vertical"> android:orientation="vertical"
android:gravity="center_vertical">
<TextView <TextView
android:id="@+id/marketCapTextView" android:id="@+id/marketCapTextView"

View File

@ -153,5 +153,6 @@
<string name="market_cap_textview">Total Market Capitalization :\nUS$%1$s</string> <string name="market_cap_textview">Total Market Capitalization :\nUS$%1$s</string>
<string name="volume_market_cap_textview">24h volume :\nUS$%1$s</string> <string name="volume_market_cap_textview">24h volume :\nUS$%1$s</string>
<string name="title_activity_scrolling">ScrollingActivity</string>
</resources> </resources>

View File

@ -1,18 +1,25 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="swirl_ridgeColor">@color/separationLine</item> <item name="swirl_ridgeColor">@color/separationLine</item>
<item name="swirl_errorColor">@color/decrease</item> <item name="swirl_errorColor">@color/decrease</item>
<!--<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:statusBarColor">@color/transparent</item>-->
</style> </style>
<style name="AppTheme.NoActionBar"> <style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
<!--<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:actionBarStyle">@style/ThemeActionBar</item>
<item name="android:windowActionBarOverlay">true</item>-->
</style> </style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
@ -24,4 +31,11 @@
<item name="android:windowExitAnimation">@anim/zoom_in</item> <item name="android:windowExitAnimation">@anim/zoom_in</item>
</style> </style>
<style name="ThemeActionBar" parent="Widget.AppCompat.Light.ActionBar.Solid">
<item name="android:background"> @null </item>
<item name="background">@null</item>
<item name="android:displayOptions"> showHome|useLogo</item>
<item name="displayOptions">showHome|useLogo</item>
</style>
</resources> </resources>