diff --git a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivity.java b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivity.java index 228c6c9..a4ceee6 100644 --- a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivity.java +++ b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivity.java @@ -72,7 +72,6 @@ import java.util.Locale; public class HomeActivity extends AppCompatActivity { - private CollapsingToolbarLayout toolbarLayout; private BottomNavigationView bottomNavigationView; private ViewPager viewPager; @@ -115,7 +114,6 @@ public class HomeActivity extends AppCompatActivity { //getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); setContentView(R.layout.activity_currency_summary); - setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); viewPager = findViewById(R.id.viewPager); final PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager(), 3); @@ -125,7 +123,7 @@ public class HomeActivity extends AppCompatActivity { viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - bottomNavigationView.getMenu().getItem(position).setChecked(true); + //bottomNavigationView.getMenu().getItem(position).setChecked(true); if(position % 2 == 0) { @@ -147,24 +145,10 @@ public class HomeActivity extends AppCompatActivity { //Objects initialization //Layouts setup - toolbarLayout = findViewById(R.id.toolbar_layout); bottomNavigationView = findViewById(R.id.navigationSummary); bottomNavigationView.setOnNavigationItemSelectedListener(onNavigationItemSelectedListener); bottomNavigationView.setSelectedItemId(R.id.navigation_currencies_list); - toolbarLayout.setForegroundGravity(Gravity.CENTER); - - ImageButton settingsButton = findViewById(R.id.settings_button); - - settingsButton.setBackground(this.getResources().getDrawable(R.drawable.ic_settings_black_24dp)); - settingsButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Intent settingIntent = new Intent(HomeActivity.this, SettingsActivity.class); - startActivity(settingIntent); - //overridePendingTransition(R.anim.activity_enter, R.anim.activity_exit); - } - }); } @Override diff --git a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/MarketCapitalization.java b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/MarketCapitalization.java index cdc44f6..386b2f2 100644 --- a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/MarketCapitalization.java +++ b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/MarketCapitalization.java @@ -1,6 +1,7 @@ package com.nauk.coinfolio.Activities.HomeActivityFragments; import android.annotation.SuppressLint; +import android.content.Intent; import android.graphics.Color; import android.support.design.widget.AppBarLayout; import android.support.v4.app.Fragment; @@ -14,6 +15,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; +import android.widget.ImageButton; import android.widget.TextView; import com.github.mikephil.charting.charts.PieChart; @@ -21,6 +23,7 @@ import com.github.mikephil.charting.data.PieData; import com.github.mikephil.charting.data.PieDataSet; import com.github.mikephil.charting.data.PieEntry; import com.github.mikephil.charting.formatter.PercentFormatter; +import com.nauk.coinfolio.Activities.SettingsActivity; import com.nauk.coinfolio.DataManagers.MarketCapManager; import com.nauk.coinfolio.R; @@ -70,6 +73,16 @@ public class MarketCapitalization extends Fragment { lastTimestamp = 0; + ImageButton settingsButton = view.findViewById(R.id.settings_button); + + settingsButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent settingIntent = new Intent(getActivity(), SettingsActivity.class); + startActivity(settingIntent); + } + }); + updateMarketCap(); return view; @@ -205,13 +218,11 @@ public class MarketCapitalization extends Fragment { { case MotionEvent.ACTION_DOWN: refreshLayout.setEnabled(false); - getActivity().findViewById(R.id.viewPager).setEnabled(false); break; case MotionEvent.ACTION_MOVE: break; default: refreshLayout.setEnabled(true); - getActivity().findViewById(R.id.viewPager).setEnabled(true); break; } return false; diff --git a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Summary.java b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Summary.java index a51f335..71a91db 100644 --- a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Summary.java +++ b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Summary.java @@ -27,6 +27,7 @@ import android.widget.TextView; import com.nauk.coinfolio.Activities.CurrencySelectionActivity; import com.nauk.coinfolio.Activities.HomeActivity; +import com.nauk.coinfolio.Activities.SettingsActivity; import com.nauk.coinfolio.DataManagers.BalanceManager; import com.nauk.coinfolio.DataManagers.CurrencyData.Currency; import com.nauk.coinfolio.DataManagers.PreferencesManager; @@ -75,8 +76,7 @@ public class Summary extends Fragment { balanceManager = new BalanceManager(getActivity()); layoutGenerator = new HomeLayoutGenerator(getActivity()); refreshLayout = view.findViewById(R.id.swiperefreshsummary); - toolbarSubtitle = getActivity().findViewById(R.id.toolbarSubtitle); - toolbarLayout = getActivity().findViewById(R.id.toolbar_layout); + toolbarSubtitle = view.findViewById(R.id.toolbarSubtitle); totalValue = 0; totalFluctuation = 0; @@ -113,9 +113,21 @@ public class Summary extends Fragment { ); handler.postDelayed(updateRunnable, 10000); + toolbarLayout = view.findViewById(R.id.toolbar_layout); + toolbarLayout.setForegroundGravity(Gravity.CENTER); Button addCurrencyButton = view.findViewById(R.id.buttonAddTransaction); + ImageButton settingsButton = view.findViewById(R.id.settings_button); + + settingsButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent settingIntent = new Intent(getActivity(), SettingsActivity.class); + startActivity(settingIntent); + } + }); + addCurrencyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -125,7 +137,7 @@ public class Summary extends Fragment { } }); - ImageButton detailsButton = getActivity().findViewById(R.id.switch_button); + ImageButton detailsButton = view.findViewById(R.id.switch_button); detailsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Watchlist.java b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Watchlist.java index 7f66a78..dff61bb 100644 --- a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Watchlist.java +++ b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Watchlist.java @@ -23,6 +23,7 @@ import android.view.ViewParent; import android.view.animation.Animation; import android.view.animation.Transformation; import android.widget.Button; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -34,6 +35,7 @@ import com.github.mikephil.charting.data.LineDataSet; import com.nauk.coinfolio.Activities.CurrencyDetailsActivity; import com.nauk.coinfolio.Activities.CurrencySelectionActivity; import com.nauk.coinfolio.Activities.HomeActivity; +import com.nauk.coinfolio.Activities.SettingsActivity; import com.nauk.coinfolio.DataManagers.BalanceManager; import com.nauk.coinfolio.DataManagers.CurrencyData.Currency; import com.nauk.coinfolio.DataManagers.CurrencyData.CurrencyDataChart; @@ -100,6 +102,16 @@ public class Watchlist extends Fragment { } }); + ImageButton settingsButton = view.findViewById(R.id.settings_button); + + settingsButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent settingIntent = new Intent(getActivity(), SettingsActivity.class); + startActivity(settingIntent); + } + }); + return view; } diff --git a/app/src/main/res/drawable/gradient_background_reverse.xml b/app/src/main/res/drawable/gradient_background_reverse.xml new file mode 100644 index 0000000..bb27ef1 --- /dev/null +++ b/app/src/main/res/drawable/gradient_background_reverse.xml @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_currency_summary.xml b/app/src/main/res/layout/activity_currency_summary.xml index e049ade..e4c5bc3 100644 --- a/app/src/main/res/layout/activity_currency_summary.xml +++ b/app/src/main/res/layout/activity_currency_summary.xml @@ -1,82 +1,11 @@ - - - - - - - - - - - - - - - - - - - - - - - + tools:context="com.nauk.coinfolio.Activities.HomeActivity" + android:fitsSystemWindows="true"> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_marketcap_homeactivity.xml b/app/src/main/res/layout/fragment_marketcap_homeactivity.xml index c3b6ed9..b94da03 100644 --- a/app/src/main/res/layout/fragment_marketcap_homeactivity.xml +++ b/app/src/main/res/layout/fragment_marketcap_homeactivity.xml @@ -1,61 +1,101 @@ - - + + + + + + + + + + + + + + + + + android:layout_marginTop="?attr/actionBarSize" + app:layout_behavior="@string/appbar_scrolling_view_behavior" + android:background="@color/summary_background"> - - - + android:orientation="vertical" + xmlns:android="http://schemas.android.com/apk/res/android"> - + style="?android:attr/progressBarStyleLarge" + android:layout_gravity="center" + android:background="@drawable/circular_progress_bar" /> - + android:layout_height="match_parent" + android:visibility="gone" + android:orientation="vertical"> - + + + + + + + - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_summary_homeactivity.xml b/app/src/main/res/layout/fragment_summary_homeactivity.xml index 675d65d..1221530 100644 --- a/app/src/main/res/layout/fragment_summary_homeactivity.xml +++ b/app/src/main/res/layout/fragment_summary_homeactivity.xml @@ -1,49 +1,127 @@ - + android:fitsSystemWindows="true" + tools:context="com.nauk.coinfolio.Activities.HomeActivity"> - + + + + + + + + + + + + + + + + + + + + + - + + - + android:layout_height="match_parent" + tools:context="com.nauk.coinfolio.Activities.HomeActivity"> + android:orientation="vertical" + android:layout_marginTop="10dp"> -