Update Details activity chart layout construction system

This commit is contained in:
Tanguy Herbron 2018-04-16 16:30:54 +02:00
parent 4001e8d094
commit ff98837235
5 changed files with 39 additions and 84 deletions

View File

@ -65,20 +65,14 @@ import java.util.Locale;
//Use WilliamChart for charts https://github.com/diogobernardino/WilliamChart
//Auto refresh with predefined intervals
//Adding manually currencies (date, purchased price)
//Multiple portfolio (exchanges & custom)
//Add currency details (market cap, 1h, 3h, 1d, 3d, 1w, 1m, 3m, 1y)
//Add roadmap to buy a coin
//Add reddit link ?
//
public class HomeActivity extends AppCompatActivity {
private PreferencesManager preferencesManager;
private CollapsingToolbarLayout toolbarLayout;
private ViewFlipper viewFlipper;
private HomeLayoutGenerator layoutGenerator;
private BottomNavigationView bottomNavigationView;
private ViewPager viewPager;
@ -151,11 +145,9 @@ public class HomeActivity extends AppCompatActivity {
});
//Objects initialization
preferencesManager = new PreferencesManager(this);
//Layouts setup
toolbarLayout = findViewById(R.id.toolbar_layout);
viewFlipper = findViewById(R.id.viewFlipperSummary);
bottomNavigationView = findViewById(R.id.navigationSummary);
bottomNavigationView.setOnNavigationItemSelectedListener(onNavigationItemSelectedListener);
@ -175,75 +167,12 @@ public class HomeActivity extends AppCompatActivity {
});
}
private void switchMainView()
{
Log.d("coinfolio", "Should");
((AppBarLayout) findViewById(R.id.app_bar)).setExpanded(true, true);
findViewById(R.id.swiperefresh).setNestedScrollingEnabled(true);
findViewById(R.id.toolbar_layout).setFocusable(true);
((AppBarLayout) findViewById(R.id.app_bar)).setExpanded(true, true);
((AppBarLayout) findViewById(R.id.app_bar)).setActivated(true);
findViewById(R.id.app_bar).setClickable(true);
findViewById(R.id.nestedScrollViewLayout).setNestedScrollingEnabled(true);
findViewById(R.id.app_bar).setEnabled(true);
findViewById(R.id.toolbar_layout).setNestedScrollingEnabled(true);
findViewById(R.id.coordinatorLayout).setNestedScrollingEnabled(true);
findViewById(R.id.switch_button).setVisibility(View.VISIBLE);
viewFlipper.setDisplayedChild(1);
}
private void switchSecondaryViews(int itemIndex)
{
Log.d("coinfolio", "Should not");
((AppBarLayout) findViewById(R.id.app_bar)).setExpanded(false, true);
findViewById(R.id.swiperefresh).setNestedScrollingEnabled(false);
findViewById(R.id.toolbar_layout).setFocusable(false);
((AppBarLayout) findViewById(R.id.app_bar)).setExpanded(false, true);
((AppBarLayout) findViewById(R.id.app_bar)).setActivated(false);
findViewById(R.id.app_bar).setClickable(false);
findViewById(R.id.nestedScrollViewLayout).setNestedScrollingEnabled(false);
findViewById(R.id.app_bar).setEnabled(false);
findViewById(R.id.toolbar_layout).setNestedScrollingEnabled(false);
findViewById(R.id.coordinatorLayout).setNestedScrollingEnabled(false);
findViewById(R.id.switch_button).setVisibility(View.GONE);
viewFlipper.setDisplayedChild(itemIndex);
}
@Override
protected void onResume() {
super.onResume();
}
private void addTestWatchlistCardview()
{
View view = LayoutInflater.from(this).inflate(R.layout.cardview_watchlist, null);
((TextView) view.findViewById(R.id.currencyFluctuationPercentageTextView)).setText("3%");
((TextView) view.findViewById(R.id.currencyFluctuationTextView)).setText("$3");
((TextView) view.findViewById(R.id.currencyNameTextView)).setText("TanguyCoin");
((TextView) view.findViewById(R.id.currencySymbolTextView)).setText("TGC");
((TextView) view.findViewById(R.id.currencyValueTextView)).setText("$100");
view.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("coinfolio", "Clicked !");
}
});
((LinearLayout) findViewById(R.id.linearLayoutWatchlist)).addView(view);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.

View File

@ -106,6 +106,7 @@ public class Currency implements Parcelable {
if(dataChart != null)
{
Log.d("coinfolio", "Success for : " + symbol);
setValue(dataChart.get(dataChart.size() - 1).getClose());
updateDayFluctuation();
}

View File

@ -1,7 +1,5 @@
package com.nauk.coinfolio;
import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
@ -46,4 +44,4 @@ public class PagerAdapter extends FragmentStatePagerAdapter {
public int getCount() {
return numOfTabs;
}
}
}

View File

@ -44,7 +44,8 @@
<LinearLayout
android:id="@+id/progressLayoutChart"
android:layout_width="match_parent"
android:layout_height="305dp"
android:layout_height="match_parent"
android:layout_weight="0.4"
android:visibility="gone"
android:gravity="center">
@ -57,21 +58,23 @@
</LinearLayout>
<com.github.mikephil.charting.charts.LineChart
android:id="@+id/chartPriceView"
android:layout_width="match_parent"
android:layout_height="250dp"/>
android:layout_height="match_parent"
android:layout_weight="0.5"/>
<com.github.mikephil.charting.charts.CandleStickChart
android:id="@+id/chartCandleStickView"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:visibility="gone"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.85"
android:orientation="horizontal">
<TextView
@ -106,13 +109,15 @@
<com.github.mikephil.charting.charts.BarChart
android:id="@+id/chartVolumeView"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="match_parent"
android:layout_weight="0.8"
android:layout_marginTop="5dp" />
<LinearLayout
android:id="@+id/layoutChartButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.82"
android:orientation="horizontal">
<Button
@ -120,6 +125,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:text="@string/button1h"/>
<Button
@ -127,6 +133,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:text="@string/button3h"/>
<Button
@ -135,6 +142,7 @@
android:layout_height="wrap_content"
android:layout_weight="11.1"
android:enabled="false"
android:autoSizeTextType="uniform"
android:text="@string/button1d"/>
<Button
@ -142,6 +150,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:text="@string/button3d"/>
<Button
@ -149,6 +158,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:text="@string/button1w"/>
<Button
@ -156,6 +166,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:text="@string/button1m"/>
<Button
@ -170,6 +181,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:text="@string/button6m"/>
<Button
@ -177,6 +189,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:text="@string/button1y"/>
</LinearLayout>
@ -184,8 +197,10 @@
<LinearLayout
android:id="@+id/llCharts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_height="match_parent"
android:layout_weight="0.7"
android:orientation="horizontal"
android:paddingStart="4dp">
<LinearLayout
android:layout_width="match_parent"
@ -202,6 +217,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="Beginning price"
android:layout_weight="0.5"
android:textStyle="bold"/>
@ -210,6 +226,7 @@
android:id="@+id/txtViewPriceStart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5"/>
</LinearLayout>
@ -223,6 +240,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="Current price"
android:layout_weight="0.5"
android:textStyle="bold"/>
@ -231,6 +249,7 @@
android:id="@+id/txtViewPriceNow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5"/>
</LinearLayout>
@ -244,6 +263,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="Delta"
android:layout_weight="0.5"
android:textStyle="bold"/>
@ -252,6 +272,7 @@
android:id="@+id/txtViewPercentage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5"/>
</LinearLayout>
@ -273,6 +294,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="Total volume"
android:layout_weight="0.5"
android:textStyle="bold"/>
@ -281,6 +303,7 @@
android:id="@+id/totalVolume"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5" />
</LinearLayout>
@ -294,6 +317,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="Highest price"
android:layout_weight="0.5"
android:textStyle="bold" />
@ -302,6 +326,7 @@
android:id="@+id/highestPrice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5" />
</LinearLayout>
@ -315,6 +340,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="Lowest price"
android:layout_weight="0.5"
android:textStyle="bold"/>
@ -323,6 +349,7 @@
android:id="@+id/lowestPrice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5" />
</LinearLayout>

View File

@ -123,7 +123,7 @@
<string name="title_watchlist">Watchlist</string>
<string name="title_infos">Infos</string>
<string name="title_transactions">Transactions</string>
<string name="title_home">Home</string>
<string name="title_home">Holdings</string>
<string name="title_market_cap">Market Capitalization</string>
<!--Chart buttons texts-->