Transaction deletion list

This commit is contained in:
Tanguy Herbron 2018-01-31 00:50:12 +01:00
parent 15ead28734
commit f3e24d2a34
5 changed files with 74 additions and 32 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 26 compileSdkVersion 26
defaultConfig { defaultConfig {
applicationId "com.nauk.coinfoliobeta" applicationId "com.nauk.coinfolio"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 26 targetSdkVersion 26
versionCode 1 versionCode 1

View File

@ -340,6 +340,21 @@ public class HomeActivity extends AppCompatActivity {
{ {
loadingDialog.dismiss(); loadingDialog.dismiss();
} }
runOnUiThread(new Runnable() {
@Override
public void run() {
toolbarLayout.setTitle("US$0.00");
toolbarSubtitle.setText("US$0.00");
toolbarSubtitle.setTextColor(-1275068417);
}
});
//toolbarSubtitle.setText("US$0.00");
Log.d(this.getResources().getString(R.string.debug), "Colors : " + toolbarSubtitle.getTextColors());
} }
} }

View File

@ -109,33 +109,45 @@ public class CurrencyDataRetriver {
{ {
List<CurrencyDataChart> dataChart = new ArrayList<>(); List<CurrencyDataChart> dataChart = new ArrayList<>();
response = response.substring(response.indexOf("Data\":[{") + 7, response.lastIndexOf("}],\"TimeTo")); Log.d("coinfolio", "Result : " + response);
String[] tab = response.split(Pattern.quote("},{"));
for(int i = 0; i < tab.length; i++) if(response.length() > 200)
{ {
response = response.substring(response.indexOf("Data\":[{") + 7, response.lastIndexOf("}],\"TimeTo"));
if(i == 0) String[] tab = response.split(Pattern.quote("},{"));
for(int i = 0; i < tab.length; i++)
{ {
tab[i] = tab[i] + "}";
if(i == 0)
{
tab[i] = tab[i] + "}";
}
else
{
tab[i] = "{" + tab[i] + "}";
}
try {
JSONObject jsonObject = new JSONObject(tab[i]);
long timestamp = Long.parseLong(jsonObject.getString("time"));
double close = Double.parseDouble(jsonObject.getString("close"));
double high = Double.parseDouble(jsonObject.getString("high"));
double low = Double.parseDouble(jsonObject.getString("low"));
double open = Double.parseDouble(jsonObject.getString("open"));
dataChart.add(new CurrencyDataChart(timestamp, close, high, low, open));
} catch (JSONException e) {
Log.d(context.getResources().getString(R.string.debug_volley), "API Request error: " + e + " index: " + i);
}
} }
else }
else
{
for(int i = 1; i <= 1440; i++)
{ {
tab[i] = "{" + tab[i] + "}"; dataChart.add(new CurrencyDataChart(i, 1, 1, 1, 1));
}
try {
JSONObject jsonObject = new JSONObject(tab[i]);
long timestamp = Long.parseLong(jsonObject.getString("time"));
double close = Double.parseDouble(jsonObject.getString("close"));
double high = Double.parseDouble(jsonObject.getString("high"));
double low = Double.parseDouble(jsonObject.getString("low"));
double open = Double.parseDouble(jsonObject.getString("open"));
dataChart.add(new CurrencyDataChart(timestamp, close, high, low, open));
} catch (JSONException e) {
Log.d(context.getResources().getString(R.string.debug_volley), "API Request error: " + e + " index: " + i);
} }
} }

View File

@ -15,6 +15,7 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.db.chart.model.LineSet; import com.db.chart.model.LineSet;
import com.db.chart.model.Point;
import com.db.chart.renderer.AxisRenderer; import com.db.chart.renderer.AxisRenderer;
import com.db.chart.view.LineChartView; import com.db.chart.view.LineChartView;
import com.nauk.coinfolio.Activities.CurrencyDetailsActivity; import com.nauk.coinfolio.Activities.CurrencyDetailsActivity;
@ -28,6 +29,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import static java.lang.Math.abs; import static java.lang.Math.abs;
import static java.lang.Math.floorDiv;
/** /**
* Created by Tiji on 05/01/2018. * Created by Tiji on 05/01/2018.
@ -259,6 +261,12 @@ public class HomeLayoutGenerator {
} }
} }
if(valMax == valMin)
{
valMin = 0;
valMax *= 2;
}
chartView.setAxisBorderValues((float) valMin, (float) valMax); chartView.setAxisBorderValues((float) valMin, (float) valMax);
chartView.setYLabels(AxisRenderer.LabelPosition.NONE); chartView.setYLabels(AxisRenderer.LabelPosition.NONE);
chartView.setYAxis(false); chartView.setYAxis(false);

View File

@ -9,18 +9,25 @@
<ViewFlipper <ViewFlipper
android:id="@+id/vfCurrencyDetails" android:id="@+id/vfCurrencyDetails"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:layout_marginBottom="56dp">
<ScrollView <ScrollView
android:id="@+id/svCharts" android:id="@+id/svCharts"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:gravity="center"
android:text="Charts"/> <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Charts"/>
</LinearLayout>
</ScrollView> </ScrollView>
@ -37,8 +44,8 @@
</ScrollView> </ScrollView>
<RelativeLayout <ScrollView
android:id="@+id/rlTransactions" android:id="@+id/svTransactions"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -50,7 +57,7 @@
</LinearLayout> </LinearLayout>
</RelativeLayout> </ScrollView>
<!--<ScrollView <!--<ScrollView
android:id="@+id/svTransactions" android:id="@+id/svTransactions"