Update Details activity chart layout construction system
This commit is contained in:
parent
4001e8d094
commit
ff98837235
@ -65,20 +65,14 @@ import java.util.Locale;
|
|||||||
//Use WilliamChart for charts https://github.com/diogobernardino/WilliamChart
|
//Use WilliamChart for charts https://github.com/diogobernardino/WilliamChart
|
||||||
|
|
||||||
//Auto refresh with predefined intervals
|
//Auto refresh with predefined intervals
|
||||||
//Adding manually currencies (date, purchased price)
|
|
||||||
//Multiple portfolio (exchanges & custom)
|
//Multiple portfolio (exchanges & custom)
|
||||||
//Add currency details (market cap, 1h, 3h, 1d, 3d, 1w, 1m, 3m, 1y)
|
|
||||||
//Add roadmap to buy a coin
|
//Add roadmap to buy a coin
|
||||||
//Add reddit link ?
|
//Add reddit link ?
|
||||||
//
|
//
|
||||||
|
|
||||||
public class HomeActivity extends AppCompatActivity {
|
public class HomeActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private PreferencesManager preferencesManager;
|
|
||||||
|
|
||||||
private CollapsingToolbarLayout toolbarLayout;
|
private CollapsingToolbarLayout toolbarLayout;
|
||||||
private ViewFlipper viewFlipper;
|
|
||||||
private HomeLayoutGenerator layoutGenerator;
|
|
||||||
private BottomNavigationView bottomNavigationView;
|
private BottomNavigationView bottomNavigationView;
|
||||||
|
|
||||||
private ViewPager viewPager;
|
private ViewPager viewPager;
|
||||||
@ -151,11 +145,9 @@ public class HomeActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Objects initialization
|
//Objects initialization
|
||||||
preferencesManager = new PreferencesManager(this);
|
|
||||||
|
|
||||||
//Layouts setup
|
//Layouts setup
|
||||||
toolbarLayout = findViewById(R.id.toolbar_layout);
|
toolbarLayout = findViewById(R.id.toolbar_layout);
|
||||||
viewFlipper = findViewById(R.id.viewFlipperSummary);
|
|
||||||
|
|
||||||
bottomNavigationView = findViewById(R.id.navigationSummary);
|
bottomNavigationView = findViewById(R.id.navigationSummary);
|
||||||
bottomNavigationView.setOnNavigationItemSelectedListener(onNavigationItemSelectedListener);
|
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
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.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
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
|
@ -106,6 +106,7 @@ public class Currency implements Parcelable {
|
|||||||
|
|
||||||
if(dataChart != null)
|
if(dataChart != null)
|
||||||
{
|
{
|
||||||
|
Log.d("coinfolio", "Success for : " + symbol);
|
||||||
setValue(dataChart.get(dataChart.size() - 1).getClose());
|
setValue(dataChart.get(dataChart.size() - 1).getClose());
|
||||||
updateDayFluctuation();
|
updateDayFluctuation();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.nauk.coinfolio;
|
package com.nauk.coinfolio;
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||||
@ -46,4 +44,4 @@ public class PagerAdapter extends FragmentStatePagerAdapter {
|
|||||||
public int getCount() {
|
public int getCount() {
|
||||||
return numOfTabs;
|
return numOfTabs;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -44,7 +44,8 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/progressLayoutChart"
|
android:id="@+id/progressLayoutChart"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="305dp"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="0.4"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:gravity="center">
|
android:gravity="center">
|
||||||
|
|
||||||
@ -57,21 +58,23 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<com.github.mikephil.charting.charts.LineChart
|
<com.github.mikephil.charting.charts.LineChart
|
||||||
android:id="@+id/chartPriceView"
|
android:id="@+id/chartPriceView"
|
||||||
android:layout_width="match_parent"
|
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
|
<com.github.mikephil.charting.charts.CandleStickChart
|
||||||
android:id="@+id/chartCandleStickView"
|
android:id="@+id/chartCandleStickView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="250dp"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="0.5"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="0.85"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -106,13 +109,15 @@
|
|||||||
<com.github.mikephil.charting.charts.BarChart
|
<com.github.mikephil.charting.charts.BarChart
|
||||||
android:id="@+id/chartVolumeView"
|
android:id="@+id/chartVolumeView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="0.8"
|
||||||
android:layout_marginTop="5dp" />
|
android:layout_marginTop="5dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/layoutChartButtons"
|
android:id="@+id/layoutChartButtons"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="0.82"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@ -120,6 +125,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="11.1"
|
android:layout_weight="11.1"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="@string/button1h"/>
|
android:text="@string/button1h"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@ -127,6 +133,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="11.1"
|
android:layout_weight="11.1"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="@string/button3h"/>
|
android:text="@string/button3h"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@ -135,6 +142,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="11.1"
|
android:layout_weight="11.1"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="@string/button1d"/>
|
android:text="@string/button1d"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@ -142,6 +150,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="11.1"
|
android:layout_weight="11.1"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="@string/button3d"/>
|
android:text="@string/button3d"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@ -149,6 +158,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="11.1"
|
android:layout_weight="11.1"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="@string/button1w"/>
|
android:text="@string/button1w"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@ -156,6 +166,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="11.1"
|
android:layout_weight="11.1"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="@string/button1m"/>
|
android:text="@string/button1m"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@ -170,6 +181,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="11.1"
|
android:layout_weight="11.1"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="@string/button6m"/>
|
android:text="@string/button6m"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@ -177,6 +189,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="11.1"
|
android:layout_weight="11.1"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="@string/button1y"/>
|
android:text="@string/button1y"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -184,8 +197,10 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/llCharts"
|
android:id="@+id/llCharts"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal">
|
android:layout_weight="0.7"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="4dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -202,6 +217,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="Beginning price"
|
android:text="Beginning price"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
@ -210,6 +226,7 @@
|
|||||||
android:id="@+id/txtViewPriceStart"
|
android:id="@+id/txtViewPriceStart"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:layout_weight="0.5"/>
|
android:layout_weight="0.5"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -223,6 +240,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="Current price"
|
android:text="Current price"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
@ -231,6 +249,7 @@
|
|||||||
android:id="@+id/txtViewPriceNow"
|
android:id="@+id/txtViewPriceNow"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:layout_weight="0.5"/>
|
android:layout_weight="0.5"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -244,6 +263,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="Delta"
|
android:text="Delta"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
@ -252,6 +272,7 @@
|
|||||||
android:id="@+id/txtViewPercentage"
|
android:id="@+id/txtViewPercentage"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:layout_weight="0.5"/>
|
android:layout_weight="0.5"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -273,6 +294,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="Total volume"
|
android:text="Total volume"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
@ -281,6 +303,7 @@
|
|||||||
android:id="@+id/totalVolume"
|
android:id="@+id/totalVolume"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:layout_weight="0.5" />
|
android:layout_weight="0.5" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -294,6 +317,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="Highest price"
|
android:text="Highest price"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
@ -302,6 +326,7 @@
|
|||||||
android:id="@+id/highestPrice"
|
android:id="@+id/highestPrice"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:layout_weight="0.5" />
|
android:layout_weight="0.5" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -315,6 +340,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:text="Lowest price"
|
android:text="Lowest price"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
@ -323,6 +349,7 @@
|
|||||||
android:id="@+id/lowestPrice"
|
android:id="@+id/lowestPrice"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
android:layout_weight="0.5" />
|
android:layout_weight="0.5" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -123,7 +123,7 @@
|
|||||||
<string name="title_watchlist">Watchlist</string>
|
<string name="title_watchlist">Watchlist</string>
|
||||||
<string name="title_infos">Infos</string>
|
<string name="title_infos">Infos</string>
|
||||||
<string name="title_transactions">Transactions</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>
|
<string name="title_market_cap">Market Capitalization</string>
|
||||||
|
|
||||||
<!--Chart buttons texts-->
|
<!--Chart buttons texts-->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user