This commit is contained in:
Tanguy Herbron 2018-02-12 08:17:10 +01:00
parent 1e945ec071
commit 7bd7d360d6
3 changed files with 18 additions and 15 deletions

View File

@ -11,6 +11,7 @@ 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.design.widget.CollapsingToolbarLayout; import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
@ -78,13 +79,16 @@ public class HomeActivity extends AppCompatActivity {
@Override @Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) { public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.navigation_home: case R.id.navigation_something:
//viewFlipper.setDisplayedChild(1);
((FloatingActionButton) findViewById(R.id.floatingAddButton)).hide();
return true; return true;
case R.id.navigation_view_list: case R.id.navigation_view_list:
((FloatingActionButton) findViewById(R.id.floatingAddButton)).show();
//viewFlipper.setDisplayedChild(1); //viewFlipper.setDisplayedChild(1);
return true; return true;
case R.id.navigation_market_cap: case R.id.navigation_market_cap:
((FloatingActionButton) findViewById(R.id.floatingAddButton)).hide();
//viewFlipper.setDisplayedChild(2); //viewFlipper.setDisplayedChild(2);
return true; return true;
} }
@ -152,6 +156,8 @@ public class HomeActivity extends AppCompatActivity {
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation_home); BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation_home);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
navigation.setSelectedItemId(R.id.navigation_view_list); navigation.setSelectedItemId(R.id.navigation_view_list);
navigation.setFitsSystemWindows(true);
navigation.setItemBackgroundResource(R.color.colorAccent);
//Events setup //Events setup
detailsButton.setOnClickListener(new View.OnClickListener() { detailsButton.setOnClickListener(new View.OnClickListener() {
@ -338,14 +344,14 @@ public class HomeActivity extends AppCompatActivity {
{ {
iconCounter++; iconCounter++;
Log.d("coinfolio", "Icon ++"); Log.d("coinfolio", "Icon ++ " + iconCounter);
if(balanceManager.getTotalBalance() != null) if(balanceManager.getTotalBalance() != null)
{ {
if(iconCounter == balanceManager.getTotalBalance().size() - 1) if(iconCounter == balanceManager.getTotalBalance().size())
{ {
Log.d("coinfolio", "1"); Log.d("coinfolio", "1");
if(coinCounter == balanceManager.getTotalBalance().size() - 1 && detailsChecker) if(coinCounter == balanceManager.getTotalBalance().size())
{ {
Log.d("coinfolio", "Loading heavy"); Log.d("coinfolio", "Loading heavy");
@ -425,8 +431,10 @@ public class HomeActivity extends AppCompatActivity {
if(balanceManager.getTotalBalance() != null) if(balanceManager.getTotalBalance() != null)
{ {
if(coinCounter == balanceManager.getTotalBalance().size()-1) if(coinCounter == balanceManager.getTotalBalance().size())
{ {
Log.d("coinfolio", "Going through");
for (int i = 0; i < balanceManager.getTotalBalance().size(); i++) for (int i = 0; i < balanceManager.getTotalBalance().size(); i++)
{ {
final Currency localCurrency = balanceManager.getTotalBalance().get(i); final Currency localCurrency = balanceManager.getTotalBalance().get(i);

View File

@ -103,8 +103,11 @@
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:id="@+id/floatingAddButton"
android:layout_width="64dp" android:layout_width="64dp"
android:layout_height="64dp" android:layout_height="64dp"
android:elevation="0dp"
app:borderWidth="0dp"
android:background="@color/cardview_light_background" android:background="@color/cardview_light_background"
android:src="@drawable/ic_add_white_24dp" android:src="@drawable/ic_add_white_24dp"
android:layout_gravity="bottom|center_horizontal" android:layout_gravity="bottom|center_horizontal"

View File

@ -2,11 +2,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:icon="@drawable/ic_pie_chart_black_24dp" android:id="@+id/navigation_something"
android:title="@string/title_market_cap" />
<item
android:id="@+id/navigation_home"
android:icon="@drawable/ic_show_chart_black_24dp" android:icon="@drawable/ic_show_chart_black_24dp"
android:title="@string/title_charts" /> android:title="@string/title_charts" />
@ -20,8 +16,4 @@
android:icon="@drawable/ic_pie_chart_black_24dp" android:icon="@drawable/ic_pie_chart_black_24dp"
android:title="@string/title_market_cap" /> android:title="@string/title_market_cap" />
<item
android:icon="@drawable/ic_pie_chart_black_24dp"
android:title="@string/title_market_cap" />
</menu> </menu>