Merge pull request #6 from TanguyHerbron/master

Update the branch for new code coming
This commit is contained in:
Tanguy Herbron 2018-07-21 21:56:30 +02:00 committed by GitHub
commit 1c670d6e5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 2028 additions and 1147 deletions

46
.idea/assetWizardSettings.xml generated Normal file
View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WizardSettings">
<option name="children">
<map>
<entry key="vectorWizard">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="vectorAssetStep">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="clipartAsset">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="url" value="jar:file:/C:/Program%20Files/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/image/ic_panorama_fish_eye_black_24dp.xml" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="outputName" value="ic_panorama_fish_eye_24dp" />
<entry key="sourceFile" value="C:\Users\Guitoune" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</component>
</project>

Binary file not shown.

2
.idea/gradle.xml generated
View File

@ -5,7 +5,7 @@
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-4.7" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-4.4" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

View File

@ -1,17 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="HardCodedStringLiteral" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreForAssertStatements" value="true" />
<option name="ignoreForExceptionConstructors" value="true" />
<option name="ignoreForSpecifiedExceptionConstructors" value="" />
<option name="ignoreForJUnitAsserts" value="true" />
<option name="ignoreForClassReferences" value="true" />
<option name="ignoreForPropertyKeyReferences" value="true" />
<option name="ignoreForNonAlpha" value="true" />
<option name="ignoreAssignedToConstants" value="false" />
<option name="ignoreToString" value="false" />
<option name="nonNlsCommentPattern" value="NON-NLS" />
</inspection_tool>
</profile>
</component>

12
.idea/misc.xml generated
View File

@ -1,20 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.greenrobot.eventbus.Subscribe" />
</list>
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<list size="5">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>

12
.idea/statistic.xml generated
View File

@ -1,20 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Statistic">
<option name="fileTypes" value="class;svn-base;svn-work;Extra;gif;png;jpg;jpeg;bmp;tga;tiff;ear;war;zip;jar;iml;iws;ipr;bz2;gz;gitignore;gradle;md;pro;properties;" />
<option name="fileTypes" value="class;svn-base;svn-work;Extra;gif;png;jpg;jpeg;bmp;tga;tiff;ear;war;zip;jar;iml;iws;ipr;bz2;gz;ap;apk;bin;dex;flat;gitignore;gson;json;md;pro;store;ttf;txt;ap_;" />
<option name="excludedDirectories">
<list>
<option value="$PROJECT_DIR$/build" />
<option value="$PROJECT_DIR$/.idea" />
<option value="$PROJECT_DIR$/.gradle" />
<option value="$PROJECT_DIR$/export" />
<option value="$PROJECT_DIR$/gource" />
<option value="$PROJECT_DIR$/gradle" />
<option value="$PROJECT_DIR$/libs" />
<option value="$PROJECT_DIR$/.idea" />
<option value="$PROJECT_DIR$/.gradle" />
<option value="$PROJECT_DIR$/app/build" />
<option value="$PROJECT_DIR$/app/release" />
<option value="$PROJECT_DIR$/app/src/androidTest" />
<option value="$PROJECT_DIR$/app/src/test" />
<option value="$PROJECT_DIR$/app/src/androidTest" />
<option value="$PROJECT_DIR$/app/build" />
</list>
</option>
</component>

2
.idea/vcs.xml generated
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -6,16 +6,22 @@ android {
applicationId "com.herbron.moodl"
minSdkVersion 19
targetSdkVersion 27
versionCode 5
versionName "0.0.5"
versionCode 6
versionName "0.0.6"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
dataBinding {
enabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
lintOptions {
disable 'MissingTranslation'
//disable 'MissingTranslation'
}
}
}
@ -32,7 +38,7 @@ dependencies {
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.diogobernardino:williamchart:2.5.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:palette-v7:27.1.1'
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
@ -47,9 +53,13 @@ dependencies {
implementation 'com.mattprecious.swirl:swirl:1.1.0'
implementation 'com.wdullaer:materialdatetimepicker:3.5.2'
implementation 'com.jmedeisis:draglinearlayout:1.1.0'
implementation 'com.applandeo:material-file-picker:1.0.0'
implementation 'com.daasuu:EasingInterpolator:1.0.0'
implementation 'com.android.support:support-vector-drawable:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation files('../libs/binance-api.jar')
implementation files('../libs/commons-codec-1.11.jar');
}

View File

@ -2,11 +2,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.herbron.moodl">
<uses-feature android:name="android.hardware.fingerprint"
android:required="false"/>
<uses-feature
android:name="android.hardware.fingerprint"
android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
@ -16,11 +18,11 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="com.herbron.moodl.Activities.HomeActivity"
android:name=".Activities.HomeActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:launchMode="singleTop">
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -28,30 +30,31 @@
</intent-filter>
</activity>
<activity
android:name="com.herbron.moodl.Activities.SettingsActivity"
android:name=".Activities.SettingsActivity"
android:label="@string/title_activity_settings"
android:screenOrientation="portrait" />
<activity
android:name="com.herbron.moodl.Activities.CurrencySelectionActivity"
android:name=".Activities.CurrencySelectionActivity"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.herbron.moodl.Activities.HomeActivity"/>
android:value="com.herbron.moodl.Activities.HomeActivity" />
</activity>
<activity
android:name="com.herbron.moodl.Activities.RecordTransactionActivity"
android:screenOrientation="portrait">
android:name=".Activities.RecordTransactionActivity"
android:screenOrientation="portrait"
android:theme="@style/RecordTransactionTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.herbron.moodl.Activities.HomeActivity"/>
android:value="com.herbron.moodl.Activities.HomeActivity" />
</activity>
<activity
android:name="com.herbron.moodl.Activities.CurrencyDetailsActivity"
android:name=".Activities.CurrencyDetailsActivity"
android:label="@string/title_activity_currency_details"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.herbron.moodl.Activities.HomeActivity"/>
android:value="com.herbron.moodl.Activities.HomeActivity" />
</activity>
</application>

View File

@ -46,7 +46,7 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
currencyDetailsList = CurrencyDetailsList.getInstance(this);
setTitle("Select a coin");
setTitle(getString(R.string.select_coin));
Intent intent = getIntent();
isWatchList = intent.getBooleanExtra("isWatchList", false);
@ -103,7 +103,7 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
}
else
{
Toast.makeText(getApplicationContext(), "Currency already in watchlist.", Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), getString(R.string.already_watchlisr), Toast.LENGTH_SHORT).show();
}
}
else

View File

@ -7,12 +7,16 @@ import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import com.github.mikephil.charting.charts.BarChart;
@ -47,7 +51,7 @@ import static com.herbron.moodl.MoodlBox.numberConformer;
* Created by Tiji on 13/05/2018.
*/
public class Home extends Fragment {
public class Charts extends Fragment {
private final static int HOUR = 0;
private final static int DAY = 1;
@ -72,7 +76,7 @@ public class Home extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
{
view = inflater.inflate(R.layout.fragment_home_detailsactivity, container, false);
view = inflater.inflate(R.layout.fragment_charts_detailsactivity, container, false);
currency = getActivity().getIntent().getParcelableExtra("currency");
@ -111,15 +115,168 @@ public class Home extends Fragment {
}
});
initializeButtons();
initializeLineChart(lineChart);
initializeCandleStickChart(candleStickChart);
updateChartTab(DAY, 1);
initializeSpinners();
return view;
}
private void initializeSpinners()
{
Spinner spinner = view.findViewById(R.id.timeIntervalSinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(),
R.array.time_interval_string_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setSelection(2);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
updateCharts(i);
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
}
private void updateCharts(int index)
{
view.findViewById(R.id.chartPriceView).setVisibility(View.GONE);
view.findViewById(R.id.chartCandleStickView).setVisibility(View.GONE);
view.findViewById(R.id.chartVolumeView).setVisibility(View.GONE);
view.findViewById(R.id.progressLayoutChart).setVisibility(View.VISIBLE);
switch (index)
{
case 0:
currency.updateHistoryMinutes(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Charts.HOUR, 1);
}
});
}
});
break;
case 1:
currency.updateHistoryMinutes(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Charts.HOUR, 3);
}
});
}
});
break;
case 2:
currency.updateHistoryMinutes(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Charts.DAY, 1);
}
});
}
});
break;
case 3:
currency.updateHistoryHours(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Charts.DAY, 3);
}
});
}
});
break;
case 4:
currency.updateHistoryHours(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Charts.WEEK, 11);
}
});
}
});
break;
case 5:
currency.updateHistoryHours(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Charts.MONTH, 1);
}
});
}
});
break;
case 6:
currency.updateHistoryDays(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Charts.MONTH, 3);
}
});
}
});
break;
case 7:
currency.updateHistoryDays(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Charts.MONTH, 6);
}
});
}
});
break;
case 8:
currency.updateHistoryDays(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Charts.YEAR, 1);
}
});
}
});
break;
}
}
private void initializeCandleStickChart(CandleStickChart candleStickChart)
{
candleStickChart.setDrawGridBackground(false);
@ -150,182 +307,6 @@ public class Home extends Fragment {
lineChart.setViewPortOffsets(0, 0, 0, 0);
}
private void initializeButtons()
{
LinearLayout buttonLayout = view.findViewById(R.id.layoutChartButtons);
for(int i = 0; i < buttonLayout.getChildCount(); i++)
{
final Button button = (Button) buttonLayout.getChildAt(i);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
buttonEvent(v);
}
});
}
}
private void buttonEvent(View v)
{
v.setEnabled(false);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
v.setElevation(MoodlBox.convertDpToPx(8, getResources()));
}
LinearLayout buttonLayout = (LinearLayout) v.getParent();
for(int i = 0; i < buttonLayout.getChildCount(); i++)
{
Button button = (Button) buttonLayout.getChildAt(i);
if(button != v)
{
button.setEnabled(true);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
button.setElevation(MoodlBox.convertDpToPx(2, getResources()));
}
}
}
updateCharts((Button) v);
}
private void updateCharts(Button button)
{
view.findViewById(R.id.chartPriceView).setVisibility(View.GONE);
view.findViewById(R.id.chartCandleStickView).setVisibility(View.GONE);
view.findViewById(R.id.chartVolumeView).setVisibility(View.GONE);
view.findViewById(R.id.progressLayoutChart).setVisibility(View.VISIBLE);
String interval = button.getText().toString().substring(button.getText().toString().length()-2);
switch (interval)
{
case "1h":
currency.updateHistoryMinutes(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Home.HOUR, 1);
}
});
}
});
break;
case "3h":
currency.updateHistoryMinutes(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Home.HOUR, 3);
}
});
}
});
break;
case "1d":
currency.updateHistoryMinutes(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Home.DAY, 1);
}
});
}
});
break;
case "3d":
currency.updateHistoryHours(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Home.DAY, 3);
}
});
}
});
break;
case "1w":
currency.updateHistoryHours(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Home.WEEK, 11);
}
});
}
});
break;
case "1M":
currency.updateHistoryHours(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Home.MONTH, 1);
}
});
}
});
break;
case "3M":
currency.updateHistoryDays(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Home.MONTH, 3);
}
});
}
});
break;
case "6M":
currency.updateHistoryDays(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Home.MONTH, 6);
}
});
}
});
break;
case "1y":
currency.updateHistoryDays(getContext(), preferencesManager.getDefaultCurrency(), new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateChartTab(Home.YEAR, 1);
}
});
}
});
break;
}
}
private void updateChartTab(int timeUnit, int amount)
{
updateChartsData(timeUnit, amount);

View File

@ -120,7 +120,7 @@ public class Informations extends Fragment {
((TextView) view.findViewById(R.id.txtViewDescription))
.setMovementMethod(LinkMovementMethod.getInstance());
((TextView) view.findViewById(R.id.txtViewPercentageCoinEmited))
.setText("Percentage of coin emited : " + numberConformer(currency.getMinedCoinSupply() / currency.getMaxCoinSupply() * 100) + "%");
.setText(PlaceholderManager.getEmitedPercentageString(numberConformer(currency.getMinedCoinSupply() / currency.getMaxCoinSupply() * 100), getContext()));
if(currency.getMarketCapitalization() != 0)
{
@ -139,7 +139,7 @@ public class Informations extends Fragment {
if(currency.getMaxCoinSupply() == 0)
{
((TextView) view.findViewById(R.id.txtViewTotalSupply))
.setText(PlaceholderManager.getSymbolString("Infinity", getActivity()));
.setText(PlaceholderManager.getSymbolString(getString(R.string.infinity), getActivity()));
}
else
{

View File

@ -1,8 +1,13 @@
package com.herbron.moodl.Activities;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
@ -27,6 +32,7 @@ import com.herbron.moodl.Activities.HomeActivityFragments.Summary;
import com.herbron.moodl.Activities.HomeActivityFragments.Watchlist;
import com.herbron.moodl.BalanceSwitchManagerInterface;
import com.herbron.moodl.BalanceUpdateInterface;
import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.PlaceholderManager;
import com.herbron.moodl.R;
@ -57,8 +63,9 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStatusBarGradiant(this);
/**Interface setup**/
Window w = getWindow();
setContentView(R.layout.activity_currency_summary);
@ -98,6 +105,8 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte
break;
case R.id.navigation_settings:
Intent settingIntent = new Intent(getApplicationContext(), SettingsActivity.class);
settingIntent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.MainPreferenceFragment.class.getName() );
settingIntent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true );
startActivity(settingIntent);
item.setChecked(false);
break;
@ -112,6 +121,18 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte
setupBalanceSwitch();
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void setStatusBarGradiant(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
Drawable background = activity.getResources().getDrawable(R.drawable.gradient_background);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(activity.getResources().getColor(android.R.color.transparent));
window.setNavigationBarColor(activity.getResources().getColor(android.R.color.transparent));
window.setBackgroundDrawable(background);
}
}
@Override
public void onBackPressed() {
drawerLayout.openDrawer(GravityCompat.START);
@ -126,6 +147,10 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte
{
Switch balanceSwitch = findViewById(R.id.switchHideBalance);
PreferencesManager preferencesManager = new PreferencesManager(getBaseContext());
balanceSwitch.setChecked(preferencesManager.isBalanceHidden());
balanceSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
@ -158,6 +183,11 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte
currentFragment = fragment;
}
public Fragment getHoldingsFragment()
{
return holdingsFragment;
}
@Override
protected void onResume() {
super.onResume();

View File

@ -42,6 +42,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import static com.herbron.moodl.MoodlBox.getColor;
import static java.lang.Math.abs;
/**
@ -235,10 +236,10 @@ public class MarketCapitalization extends Fragment {
colors.add(topCurrencies.get(i).getChartColor());
}
entries.add(new PieEntry(100-topCurrenciesDominance, "Others", "others"));
entries.add(new PieEntry(100-topCurrenciesDominance, getString(R.string.others), "others"));
colors.add(-12369084);
PieDataSet set = new PieDataSet(entries, "Market Cap Dominance");
PieDataSet set = new PieDataSet(entries, getString(R.string.market_dominance));
set.setColors(colors);
set.setSliceSpace(1);
set.setDrawValues(false);
@ -282,7 +283,7 @@ public class MarketCapitalization extends Fragment {
Palette.Builder builder = Palette.from(bitmapIcon);
marketCapManager.getTopCurrencies().get(index).setIcon(bitmapIcon);
marketCapManager.getTopCurrencies().get(index).setChartColor(builder.generate().getDominantColor(0));
marketCapManager.getTopCurrencies().get(index).setChartColor(builder.generate().getDominantColor(getColor(R.color.default_color, getContext())));
countIcons();
}
@ -309,7 +310,7 @@ public class MarketCapitalization extends Fragment {
pieChart.setTouchEnabled(true);
pieChart.setEntryLabelColor(Color.WHITE);
updateDetails(marketCapManager.getMarketCap(), marketCapManager.getDayVolume(), "Global", 0);
updateDetails(marketCapManager.getMarketCap(), marketCapManager.getDayVolume(), getString(R.string.global), 0);
((TextView) view.findViewById(R.id.textViewActiveCrypto))
.setText(marketCapManager.getActive_crypto());
((TextView) view.findViewById(R.id.textViewActiveMarkets))
@ -373,7 +374,7 @@ public class MarketCapitalization extends Fragment {
view.findViewById(R.id.currencyIcon).setVisibility(View.GONE);
view.findViewById(R.id.layoutPercentageDominance).setVisibility(View.VISIBLE);
updateDetails(othersMarketCap, othersVolume, "Other coins", h.getY());
updateDetails(othersMarketCap, othersVolume, getString(R.string.other_coins), h.getY());
pieChart.setDrawCenterText(true);
}
@ -389,7 +390,7 @@ public class MarketCapitalization extends Fragment {
view.findViewById(R.id.layoutActiveCrypto).setVisibility(View.VISIBLE);
view.findViewById(R.id.layoutActiveMarkets).setVisibility(View.VISIBLE);
updateDetails(marketCapManager.getMarketCap(), marketCapManager.getDayVolume(), "Global", 0);
updateDetails(marketCapManager.getMarketCap(), marketCapManager.getDayVolume(), getString(R.string.global), 0);
pieChart.setDrawCenterText(true);
}
@ -415,7 +416,7 @@ public class MarketCapitalization extends Fragment {
private SpannableString generateCenterSpannableText() {
SpannableString spannableString = new SpannableString("Market Capitalization Dominance");
SpannableString spannableString = new SpannableString(getString(R.string.market_dominance));
return spannableString;
}
}

View File

@ -2,6 +2,8 @@ package com.herbron.moodl.Activities.HomeActivityFragments;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.support.v4.app.Fragment;
import android.os.Bundle;
@ -27,6 +29,8 @@ import com.herbron.moodl.R;
import java.util.List;
import static com.herbron.moodl.MoodlBox.getDrawable;
/**
* Created by Administrator on 27/05/2018.
*/
@ -53,6 +57,8 @@ public class Overview extends Fragment {
currencyTickerList = CurrencyTickerList.getInstance(getContext());
currencyDetailsList = CurrencyDetailsList.getInstance(getContext());
fragmentView.findViewById(R.id.toolbar).bringToFront();
preferenceManager = new PreferencesManager(getContext());
listLayout = fragmentView.findViewById(R.id.linearLayoutOverview);
@ -185,7 +191,14 @@ public class Overview extends Fragment {
}
else
{
Bitmap icon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_moodl);
Drawable drawable = getDrawable(R.drawable.ic_panorama_fish_eye_24dp, getContext());
Bitmap icon = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(icon);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
icon = Bitmap.createScaledBitmap(icon, 50, 50, false);
currency.setIcon(icon);

View File

@ -1,17 +1,25 @@
package com.herbron.moodl.Activities.HomeActivityFragments;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.SwipeRefreshLayout;
@ -23,25 +31,34 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.daasuu.ei.Ease;
import com.daasuu.ei.EasingInterpolator;
import com.herbron.moodl.Activities.CurrencySelectionActivity;
import com.herbron.moodl.Activities.HomeActivity;
import com.herbron.moodl.BalanceUpdateInterface;
import com.herbron.moodl.DataManagers.BalanceManager;
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
import com.herbron.moodl.DataManagers.CurrencyData.CurrencyCardview;
import com.herbron.moodl.DataManagers.CurrencyData.CurrencyTickerList;
import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.BalanceSwitchManagerInterface;
import com.herbron.moodl.DataNotifierInterface;
import com.herbron.moodl.MoodlBox;
import com.herbron.moodl.PlaceholderManager;
import com.herbron.moodl.R;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import static com.herbron.moodl.MoodlBox.getColor;
import static com.herbron.moodl.MoodlBox.getDrawable;
import static com.herbron.moodl.MoodlBox.numberConformer;
import static java.lang.Math.abs;
@ -49,11 +66,11 @@ import static java.lang.Math.abs;
* Created by Tiji on 13/04/2018.
*/
public class Summary extends Fragment implements BalanceSwitchManagerInterface {
public class Summary extends Fragment implements BalanceSwitchManagerInterface, DataNotifierInterface {
private LinearLayout currencyLayout;
private PreferencesManager preferencesManager;
private com.herbron.moodl.DataManagers.BalanceManager balanceManager;
private BalanceManager balanceManager;
private SwipeRefreshLayout refreshLayout;
private Dialog loadingDialog;
private String defaultCurrency;
@ -83,7 +100,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
View fragmentView = inflater.inflate(R.layout.fragment_summary_homeactivity, container, false);
preferencesManager = new PreferencesManager(getActivity());
balanceManager = new com.herbron.moodl.DataManagers.BalanceManager(getActivity());
balanceManager = new BalanceManager(getContext());
currencyTickerList = CurrencyTickerList.getInstance(getActivity());
currencyLayout = fragmentView.findViewById(R.id.currencyListLayout);
@ -234,28 +251,48 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
private void generateSplashScreen()
{
LinearLayout loadingLayout = new LinearLayout(getActivity());
loadingLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
loadingLayout.setGravity(Gravity.CENTER);
loadingLayout.setOrientation(LinearLayout.VERTICAL);
loadingDialog = new Dialog(getActivity(), android.R.style.Theme_Black_NoTitleBar_Fullscreen);
TextView txtView = new TextView(getActivity());
txtView.setText("Loading data...");
txtView.setTextSize(20);
txtView.setGravity(Gravity.CENTER);
txtView.setTextColor(this.getResources().getColor(R.color.cardview_light_background));
Random random = new Random();
ProgressBar progressBar = new ProgressBar(getActivity());
progressBar.setIndeterminate(true);
LinearLayout splashLayout = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.splash_screen, null, true);
LinearLayout animatedLayout = splashLayout.findViewById(R.id.animatedViewsLayout);
loadingLayout.setBackgroundColor(getActivity().getResources().getColor(R.color.colorPrimaryDark));
loadingLayout.addView(txtView);
loadingLayout.addView(progressBar);
File cacheDir = new File(getContext().getCacheDir().getAbsolutePath());
File[] cacheFiles = cacheDir.listFiles();
loadingDialog.setContentView(loadingLayout);
for(int i = 0; i < 4; i++)
{
File cachedIcon = null;
while(cachedIcon == null || cachedIcon.isDirectory())
{
cachedIcon = cacheFiles[random.nextInt(cacheFiles.length)];
}
Bitmap icon = BitmapFactory.decodeFile(cachedIcon.getAbsolutePath());
Bitmap result = Bitmap.createBitmap(150, 150, icon.getConfig());
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
paint.setColor(ContextCompat.getColor(getContext(), R.color.white));
Canvas canvas = new Canvas(result);
canvas.drawCircle(result.getHeight()/2, result.getWidth()/2, 75, paint);
canvas.drawBitmap(Bitmap.createScaledBitmap(icon, 100, 100, false), result.getHeight()/2 - 50, result.getWidth()/2 - 50, null);
((ImageView) animatedLayout.getChildAt(i)).setImageBitmap(result);
ObjectAnimator animator = ObjectAnimator.ofFloat(animatedLayout.getChildAt(i), "translationY", 0, -100, 0);
animator.setInterpolator(new EasingInterpolator(Ease.CIRC_IN_OUT));
animator.setStartDelay(i*200);
animator.setDuration(1500);
animator.setRepeatCount(ValueAnimator.INFINITE);
animator.start();
}
loadingDialog.setContentView(splashLayout);
loadingDialog.show();
}
@ -304,14 +341,14 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
private void showErrorSnackbar()
{
/*Snackbar.make(getActivity().findViewById(R.id.snackbar_placer), "Error while updating data", Snackbar.LENGTH_LONG)
.setAction("Update", new View.OnClickListener() {
Snackbar.make(getActivity().findViewById(R.id.content_frame), getString(R.string.error_update_data), Snackbar.LENGTH_LONG)
.setAction(getString(R.string.update), new View.OnClickListener() {
@Override
public void onClick(View view) {
}
})
.show();*/
.show();
}
private void resetCounters()
@ -439,7 +476,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
}
else
{
updateBalanceDisplayedTitle(totalValue);
updateBalanceDisplayedTitle(totalFluctuationPercentage);
balanceUpdateInterface.onBalanceUpdated(totalValue);
}
}
@ -496,6 +533,87 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
displayBalance(preferencesManager.isBalanceHidden());
}
@Override
public void onTickerListUpdated() {
}
@Override
public void onDetailsUpdated() {
}
@Override
public void onBalanceDataUpdated() {
final List<Currency> balance = balanceManager.getTotalBalance();
if(balance.size() > 0)
{
for(int i = 0; i < balance.size(); i++)
{
balance.get(i).updatePrice(getActivity(), defaultCurrency, new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
countCoins(true, false, false);
}
});
}
}
else
{
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
countCoins(false, false, false);
}
});
}
}
@Override
public void onBalanceError(String error)
{
generateSnackBarError(error);
}
private void generateSnackBarError(String error)
{
View view = getActivity().findViewById(R.id.content_frame);
switch (error)
{
case "com.android.volley.AuthFailureError":
preferencesManager.disableHitBTC();
Snackbar.make(view, getString(R.string.invalid_keys_hitbtc), Snackbar.LENGTH_LONG)
.show();
refreshLayout.setRefreshing(false);
updateAll(true);
break;
case "API-key format invalid.":
preferencesManager.disableBinance();
Snackbar.make(view, getString(R.string.invalid_keys_binance), Snackbar.LENGTH_LONG)
.show();
updateAll(true);
break;
case "com.android.volley.NoConnectionError: java.net.UnknownHostException: Unable to resolve host \"api.hitbtc.com\": No address associated with hostname":
Snackbar.make(view, getString(R.string.cannot_resole_host), Snackbar.LENGTH_LONG)
.show();
break;
case "com.android.volley.TimeoutError":
break;
default:
Snackbar.make(view, R.string.unexpected, Snackbar.LENGTH_LONG)
.show();
Log.d("moodl", error);
updateAll(false);
}
}
private class UiHeavyLoadCalculator extends AsyncTask<Void, Integer, Void>
{
@ -520,11 +638,11 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
{
Palette.Builder builder = Palette.from(currency.getIcon());
currency.setChartColor(builder.generate().getDominantColor(0));
currency.setChartColor(builder.generate().getDominantColor(getColor(R.color.default_color, getContext())));
}
else
{
currency.setChartColor(12369084);
currency.setChartColor(getColor(R.color.default_color, getContext()));
}
}
@ -651,7 +769,14 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
}
else
{
Bitmap icon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_moodl);
Drawable drawable = getDrawable(R.drawable.ic_panorama_fish_eye_24dp, getContext());
Bitmap icon = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(icon);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
icon = Bitmap.createScaledBitmap(icon, 50, 50, false);
localCurrency.setIcon(icon);
@ -666,44 +791,6 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
private class DataUpdater extends AsyncTask<Void, Integer, Void>
{
private void generateSnackBarError(String error)
{
/*View view = getActivity().findViewById(R.id.snackbar_placer);
switch (error)
{
case "com.android.volley.AuthFailureError":
preferencesManager.disableHitBTC();
Snackbar.make(view, "HitBTC synchronization error : Invalid keys", Snackbar.LENGTH_LONG)
.show();
refreshLayout.setRefreshing(false);
updateAll(true);
break;
case "API-key format invalid.":
preferencesManager.disableBinance();
Snackbar.make(view, "Binance synchronization error : Invalid keys", Snackbar.LENGTH_LONG)
.show();
updateAll(true);
break;
case "com.android.volley.NoConnectionError: java.net.UnknownHostException: Unable to resolve host \"api.hitbtc.com\": No address associated with hostname":
Snackbar.make(view, "Can't resolve host", Snackbar.LENGTH_LONG)
.show();
break;
case "com.android.volley.TimeoutError":
break;
default:
Snackbar.make(view, "Unexpected error", Snackbar.LENGTH_LONG)
.show();
Log.d("moodl", error);
updateAll(false);
}*/
}
@Override
protected Void doInBackground(Void... params)
{
@ -729,39 +816,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
}
});
balanceManager.updateTotalBalance(new com.herbron.moodl.DataManagers.BalanceManager.VolleyCallBack() {
@Override
public void onSuccess() {
final List<Currency> balance = balanceManager.getTotalBalance();
if(balanceManager.getTotalBalance().size() > 0)
{
for(int i = 0; i < balanceManager.getTotalBalance().size(); i++)
{
balance.get(i).updatePrice(getActivity(), defaultCurrency, new Currency.CurrencyCallBack() {
@Override
public void onSuccess(Currency currency) {
countCoins(true, false, false);
}
});
}
}
else
{
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
countCoins(false, false, false);
}
});
}
}
public void onError(String error)
{
generateSnackBarError(error);
}
});
balanceManager.updateTotalBalance();
return null;
}

View File

@ -39,6 +39,7 @@ import org.json.JSONObject;
import static com.herbron.moodl.MoodlBox.collapseW;
import static com.herbron.moodl.MoodlBox.expandW;
import static com.herbron.moodl.MoodlBox.getColor;
import static java.lang.Math.abs;
/**
@ -354,11 +355,11 @@ public class Watchlist extends Fragment {
{
Palette.Builder builder = Palette.from(currency.getIcon());
currency.setChartColor(builder.generate().getDominantColor(0));
currency.setChartColor(builder.generate().getDominantColor(getColor(R.color.default_color, getContext())));
}
else
{
currency.setChartColor(12369084);
currency.setChartColor(getColor(R.color.default_color, getContext()));
}
}

View File

@ -19,6 +19,7 @@ import com.herbron.moodl.DataManagers.CurrencyData.Currency;
import com.herbron.moodl.DataManagers.CurrencyData.Transaction;
import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.PlaceholderManager;
import com.herbron.moodl.R;
import java.text.ParseException;
@ -168,7 +169,7 @@ public class RecordTransactionActivity extends AppCompatActivity {
if(transactionId != -1)
{
setTitle("Edit " + coin + " transaction");
setTitle(PlaceholderManager.getEditTransactionString(coin, getBaseContext()));
DatabaseManager databaseManager = new DatabaseManager(this);
Transaction transaction = databaseManager.getCurrencyTransactionById(transactionId);
@ -180,7 +181,7 @@ public class RecordTransactionActivity extends AppCompatActivity {
}
else
{
setTitle("Add " + coin + " transaction");
setTitle(getString(R.string.new_transaction));
purchaseDate.setText(sdf.format(calendar.getTime()));
symbolTxtView.setText(symbol);
@ -300,7 +301,6 @@ public class RecordTransactionActivity extends AppCompatActivity {
purchasedPriceEditText.setText(price);
}
}, calendar.getTimeInMillis() / 1000);
Log.d("moodl", "Time : " + calendar.getTimeInMillis());
}
},
calendar.get(Calendar.HOUR_OF_DAY),

View File

@ -2,40 +2,61 @@ package com.herbron.moodl.Activities;
import android.Manifest;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.hardware.fingerprint.FingerprintManager;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.RingtonePreference;
import android.preference.SwitchPreference;
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyPermanentlyInvalidatedException;
import android.security.keystore.KeyProperties;
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ExpandableListView;
import android.widget.TextView;
import android.widget.Toast;
import com.applandeo.FilePicker;
import com.applandeo.listeners.OnSelectFileListener;
import com.herbron.moodl.BuildConfig;
import com.herbron.moodl.DataManagers.DataCrypter;
import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.FingerprintToolkit.FingerprintDialogFragment;
import com.herbron.moodl.FingerprintToolkit.FingerprintHandler;
import com.herbron.moodl.MoodlBox;
import com.herbron.moodl.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.KeyStore;
@ -44,7 +65,13 @@ import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
@ -166,7 +193,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onBuildHeaders(List<Header> target) {
loadHeadersFromResource(R.xml.pref_headers, target);
//loadHeadersFromResource(R.xml.pref_headers, target);
}
/**
@ -175,41 +202,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
*/
protected boolean isValidFragment(String fragmentName) {
return PreferenceFragment.class.getName().equals(fragmentName)
|| GeneralPreferenceFragment.class.getName().equals(fragmentName)
|| ExchangePreferenceFragment.class.getName().equals(fragmentName);
}
/**
* This fragment shows general preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class GeneralPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_general);
setHasOptionsMenu(true);
findPreference("version").setSummary(BuildConfig.VERSION_NAME);
bindPreferenceSummaryToValue(findPreference("default_currency"));
bindPreferenceSummaryToValue(findPreference("minimum_value_displayed"));
EditTextPreference editTextPreference = (EditTextPreference) findPreference("minimum_value_displayed");
editTextPreference.setPositiveButtonText("Save");
editTextPreference.setNegativeButtonText("Cancel");
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
//startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
|| ExchangePreferenceFragment.class.getName().equals(fragmentName)
|| MainPreferenceFragment.class.getName().equals(fragmentName);
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@ -236,6 +230,14 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
bindPreferenceSummaryToValue(findPreference("hitbtc_privatekey"));
bindPreferenceSummaryToValue(findPreference("binance_privatekey"));
findPreference("enable_fingerprint").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
return false;
}
});
findPreference("enable_hitbtc").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
@ -397,4 +399,421 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
}
}
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class MainPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_main);
findPreference("version").setSummary(BuildConfig.VERSION_NAME);
bindPreferenceSummaryToValue(findPreference("default_currency"));
bindPreferenceSummaryToValue(findPreference("minimum_value_displayed"));
findPreference("export").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Context context = getContext();
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_export_data, null, true);
dialogBuilder.setView(dialogView);
final CheckBox backupManualEntriesCheckbox = dialogView.findViewById(R.id.checkboxBackupManualEntries);
final CheckBox backupWatchlistCheckbox = dialogView.findViewById(R.id.checkboxBackupWatchlist);
final CheckBox backupKeysCheckbox = dialogView.findViewById(R.id.checkboxBackupKeys);
final CheckBox enterPasswordCheckbox = dialogView.findViewById(R.id.checkboxEnterPassword);
final TextInputLayout textInputLayoutPassword = dialogView.findViewById(R.id.textInputLayoutPassword);
final TextView textViewFilePath = dialogView.findViewById(R.id.textViewFilePath);
File backupDirectory = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name));
createDefaultBackupDirectory(backupDirectory);
textViewFilePath.setText(backupDirectory.getAbsolutePath());
textViewFilePath.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new FilePicker.Builder(getActivity(), new OnSelectFileListener() {
@Override
public void onSelect(File file) {
textViewFilePath.setText(file.getAbsolutePath());
}
}).fileType(".moodl")
.hideFiles(true)
.directory(backupDirectory.getAbsolutePath())
.mainDirectory(Environment.getExternalStorageDirectory().getAbsolutePath())
.show();
}
});
enterPasswordCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(b && textInputLayoutPassword.getVisibility() == View.GONE)
{
MoodlBox.expandH(textInputLayoutPassword);
}
if(!b && textInputLayoutPassword.getVisibility() == View.VISIBLE)
{
MoodlBox.collapseH(textInputLayoutPassword);
}
}
});
dialogBuilder.setTitle(getString(R.string.create_backup));
dialogBuilder.setPositiveButton(getString(R.string.confirm), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
checkPermissions();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.getDefault());
Date currentDate = new Date();
String fileName = "Bakup_" + formatter.format(currentDate) + ".moodl";
DatabaseManager databaseManager = new DatabaseManager(getContext());
if(enterPasswordCheckbox.isChecked())
{
if(textInputLayoutPassword.getEditText().getText().equals(""))
{
textInputLayoutPassword.setError(getString(R.string.must_be_filled));
}
else
{
DataCrypter.updateKey(textInputLayoutPassword.getEditText().getText().toString());
}
}
File backupFile = new File(textViewFilePath.getText() + "/" + fileName);
try (PrintWriter printWriter = new PrintWriter(new FileWriter(backupFile, true))) {
try {
JSONObject backupJson = new JSONObject();
initiateJsonBackup(backupJson, enterPasswordCheckbox.isChecked());
if(backupManualEntriesCheckbox.isChecked())
{
backupJson.put("transactions",
databaseManager.getDatabaseBackup(getContext(),
DatabaseManager.TABLE_MANUAL_CURRENCIES,
enterPasswordCheckbox.isChecked()));
}
if(backupWatchlistCheckbox.isChecked())
{
backupJson.put("watchlist",
databaseManager.getDatabaseBackup(getContext(),
DatabaseManager.TABLE_WATCHLIST,
enterPasswordCheckbox.isChecked()));
}
if(backupKeysCheckbox.isChecked())
{
backupJson.put("apiKeys",
databaseManager.getDatabaseBackup(getContext(),
DatabaseManager.TABLE_EXCHANGE_KEYS,
enterPasswordCheckbox.isChecked()));
}
printWriter.write(backupJson.toString());
} catch (JSONException e) {
Log.d("moodl", "Error while creating backup json " + e.getMessage());
}
printWriter.close();
} catch (IOException e) {
Log.d("moodl", "Error > " + e);
}
dialog.dismiss();
}
});
dialogBuilder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
});
AlertDialog alertDialog = dialogBuilder.create();
alertDialog.show();
return false;
}
});
findPreference("import").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Context context = getContext();
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_import_data, null, true);
dialogBuilder.setView(dialogView);
final TextView textViewFilePath = dialogView.findViewById(R.id.textViewFilePath);
final TextInputLayout textInputLayoutPassword = dialogView.findViewById(R.id.textInputLayoutPassword);
final CheckBox enterPasswordCheckbox = dialogView.findViewById(R.id.checkboxEnterPassword);
final CheckBox restoreManualEntriesCheckbox = dialogView.findViewById(R.id.checkboxRestoreEntries);
final CheckBox restoreWatchlistCheckbox = dialogView.findViewById(R.id.checkboxRestoreWatchlist);
final CheckBox restoreApiKeysCheckbox = dialogView.findViewById(R.id.checkboxRestoreKeys);
final CheckBox wipeManualEntriesCheckbox = dialogView.findViewById(R.id.checkboxWipeManualEntries);
final CheckBox wipeWatchlistCheckbox = dialogView.findViewById(R.id.checkboxWipeWatchlist);
final CheckBox wipeApiKeyxCheckbox = dialogView.findViewById(R.id.checkboxWipeAPIKeys);
restoreManualEntriesCheckbox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(restoreManualEntriesCheckbox.isChecked())
{
MoodlBox.expandH(wipeManualEntriesCheckbox);
}
else
{
MoodlBox.collapseH(wipeManualEntriesCheckbox);
}
}
});
restoreWatchlistCheckbox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(restoreWatchlistCheckbox.isChecked())
{
MoodlBox.expandH(wipeWatchlistCheckbox);
}
else
{
MoodlBox.collapseH(wipeWatchlistCheckbox);
}
}
});
restoreApiKeysCheckbox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(restoreApiKeysCheckbox.isChecked())
{
MoodlBox.expandH(wipeApiKeyxCheckbox);
}
else
{
MoodlBox.collapseH(wipeApiKeyxCheckbox);
}
}
});
enterPasswordCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(b && textInputLayoutPassword.getVisibility() == View.GONE)
{
MoodlBox.expandH(textInputLayoutPassword);
}
if(!b && textInputLayoutPassword.getVisibility() == View.VISIBLE)
{
MoodlBox.collapseH(textInputLayoutPassword);
}
}
});
File backupDirectory = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name));
createDefaultBackupDirectory(backupDirectory);
textViewFilePath.setText(backupDirectory.getAbsolutePath());
textViewFilePath.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new FilePicker.Builder(getActivity(), new OnSelectFileListener() {
@Override
public void onSelect(File file) {
textViewFilePath.setText(file.getAbsolutePath());
}
}).hideFiles(false)
.directory(backupDirectory.getAbsolutePath())
.mainDirectory(Environment.getExternalStorageDirectory().getAbsolutePath())
.show();
}
});
dialogBuilder.setTitle(getString(R.string.restoreBackup));
dialogBuilder.setPositiveButton(getString(R.string.confirm), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int whichButton) {
checkPermissions();
DatabaseManager databaseManager = new DatabaseManager(context);
if(enterPasswordCheckbox.isChecked())
{
DataCrypter.updateKey(textInputLayoutPassword.getEditText().getText().toString());
}
File backupFile = new File(textViewFilePath.getText().toString());
try {
FileReader fileReader = new FileReader(backupFile);
BufferedReader bufferedReader = new BufferedReader(fileReader);
String str;
String completeFile = "";
while ((str = bufferedReader.readLine()) != null) {
completeFile += str;
}
try {
JSONObject backupJson = new JSONObject(completeFile);
String checker;
if(enterPasswordCheckbox.isChecked())
{
checker = DataCrypter.decrypt(getContext(), backupJson.getString("encodeChecker"));
}
else
{
checker = backupJson.getString("encodeChecker");
}
if(checker.equals("NaukVerification"))
{
if(restoreManualEntriesCheckbox.isChecked())
{
if(wipeManualEntriesCheckbox.isChecked())
{
databaseManager.wipeData(DatabaseManager.TABLE_MANUAL_CURRENCIES);
}
if(backupJson.has("transactions"))
{
JSONArray transactionsArray = backupJson.getJSONArray("transactions");
for(int i = 0; i < transactionsArray.length(); i++)
{
JSONObject transactionObject = transactionsArray.getJSONObject(i);
databaseManager.addRowTransaction(transactionObject, getContext(), enterPasswordCheckbox.isChecked());
}
}
}
if(restoreWatchlistCheckbox.isChecked())
{
if(wipeWatchlistCheckbox.isChecked())
{
databaseManager.wipeData(DatabaseManager.TABLE_WATCHLIST);
}
if(backupJson.has("watchlist"))
{
JSONArray watchlistArray = backupJson.getJSONArray("watchlist");
for(int i = 0; i < watchlistArray.length(); i++)
{
JSONObject transactionObject = watchlistArray.getJSONObject(i);
databaseManager.addRowWatchlist(transactionObject, getContext(), enterPasswordCheckbox.isChecked());
}
}
}
}
else
{
textInputLayoutPassword.setError(getString(R.string.wrong_password));
}
} catch (JSONException e) {
Log.d("moodl", "Error while creating backup json " + e);
}
} catch (IOException e) {
e.printStackTrace();
}
}
});
dialogBuilder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
AlertDialog alertDialog = dialogBuilder.create();
alertDialog.show();
return false;
}
});
EditTextPreference editTextPreference = (EditTextPreference) findPreference("minimum_value_displayed");
editTextPreference.setPositiveButtonText(getString(R.string.save));
editTextPreference.setNegativeButtonText(getString(R.string.cancel));
}
private void initiateJsonBackup(JSONObject backupJson, boolean mustEncrypt) throws JSONException
{
if(mustEncrypt)
{
backupJson.put("encodeChecker", DataCrypter.encrypt(getContext(), "NaukVerification"));
}
else
{
backupJson.put("encodeChecker", "NaukVerification");
}
}
private void createDefaultBackupDirectory(File backupDirectory)
{
if (!backupDirectory.exists()) {
if (!backupDirectory.mkdirs()) {
Log.d("moodl", "Error while creating directory");
}
}
}
private boolean checkPermissions() {
String[] permissions = new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
};
int result;
List<String> listPermissionsNeeded = new ArrayList<>();
for (String p : permissions) {
result = ContextCompat.checkSelfPermission(getContext(), p);
if (result != PackageManager.PERMISSION_GRANTED) {
listPermissionsNeeded.add(p);
}
}
if (!listPermissionsNeeded.isEmpty()) {
ActivityCompat.requestPermissions(getActivity(), listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), 100);
return false;
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
//startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
}

View File

@ -4,10 +4,12 @@ import android.util.Log;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.herbron.moodl.Activities.HomeActivity;
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
import com.herbron.moodl.DataManagers.CurrencyData.CurrencyDetailsList;
import com.herbron.moodl.DataManagers.ExchangeManager.BinanceManager;
import com.herbron.moodl.DataManagers.ExchangeManager.HitBtcManager;
import com.herbron.moodl.DataNotifierInterface;
import com.herbron.moodl.R;
import org.json.JSONException;
@ -49,6 +51,8 @@ public class BalanceManager {
private List<HitBtcManager> hitBtcManagers;
private List<BinanceManager> binanceManagers;
private DataNotifierInterface dataNotifierInterface;
public BalanceManager(android.content.Context context)
{
this.context = context;
@ -64,6 +68,13 @@ public class BalanceManager {
currencyDetailsList = CurrencyDetailsList.getInstance(context);
balanceCounter = 0;
setListener((DataNotifierInterface) ((HomeActivity) context).getHoldingsFragment());
}
public void setListener(DataNotifierInterface dataNotifierInterface)
{
this.dataNotifierInterface = dataNotifierInterface;
}
public List<String> getBiggestCurrencies()
@ -111,7 +122,7 @@ public class BalanceManager {
return totalBalance;
}
public void updateTotalBalance(final VolleyCallBack callBack)
public void updateTotalBalance()
{
boolean isUpdated = false;
@ -128,12 +139,12 @@ public class BalanceManager {
binanceManagers.get(i).updateBalance(new BinanceManager.BinanceCallBack() {
@Override
public void onSuccess() {
countBalances(callBack);
countBalances();
}
@Override
public void onError(String error) {
callBack.onError(error);
dataNotifierInterface.onBalanceError(error);
}
});
}
@ -148,12 +159,12 @@ public class BalanceManager {
hitBtcManagers.get(i).updateGlobalBalance(new HitBtcManager.HitBtcCallBack() {
@Override
public void onSuccess() {
countBalances(callBack);
countBalances();
}
@Override
public void onError(String error) {
callBack.onError(error);
dataNotifierInterface.onBalanceError(error);
}
});
}
@ -161,23 +172,23 @@ public class BalanceManager {
if(!isUpdated)
{
refreshAllBalances(callBack);
refreshAllBalances();
}
}
private void countBalances(VolleyCallBack callBack)
private void countBalances()
{
balanceCounter++;
if(balanceCounter == hitBtcManagers.size() + binanceManagers.size())
{
refreshAllBalances(callBack);
refreshAllBalances();
balanceCounter = 0;
}
}
private void refreshAllBalances(final VolleyCallBack callBack)
private void refreshAllBalances()
{
totalBalance = new ArrayList<>();
@ -193,7 +204,7 @@ public class BalanceManager {
mergeBalanceTotal(manualBalances);
callBack.onSuccess();
dataNotifierInterface.onBalanceDataUpdated();
}
private void mergeBalanceTotal(List<Currency> balance)
@ -257,23 +268,6 @@ public class BalanceManager {
{
callBack.onSuccess();
}
/*StringRequest strRequest = new StringRequest(Request.Method.GET, detailUrl,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
if (response.length() > 0) {
processDetailResult(response, callBack);
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
requestQueue.add(strRequest);*/
}
public String getIconUrl(String symbol)

View File

@ -4,6 +4,7 @@ import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
@ -92,25 +93,6 @@ public class Currency implements Parcelable {
}, timestamp);
}
public static String getIconUrl(String currencyDetails)
{
String url;
try {
JSONObject jsonObject = new JSONObject(currencyDetails);
url = "https://www.cryptocompare.com" + jsonObject.getString("ImageUrl") + "?width=50";
} catch (NullPointerException e) {
//Log.d(context.getResources().getString(R.string.debug), symbol + " has no icon URL");
url = null;
} catch (JSONException e) {
//Log.d(context.getResources().getString(R.string.debug), "Url parsing error for " + symbol);
url = null;
}
return url;
}
public void updatePrice(android.content.Context context, String toSymbol, final CurrencyCallBack callBack)
{
dataRetriver = new CurrencyDataRetriever(context);

View File

@ -12,6 +12,7 @@ import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.CardView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -35,6 +36,7 @@ import java.util.List;
import static com.herbron.moodl.MoodlBox.collapseH;
import static com.herbron.moodl.MoodlBox.expandH;
import static com.herbron.moodl.MoodlBox.getColor;
import static com.herbron.moodl.MoodlBox.numberConformer;
/**
@ -212,7 +214,8 @@ public class CurrencyCardview extends CardView {
private void setupCardView()
{
ViewGroup.MarginLayoutParams layoutParams = new ViewGroup.MarginLayoutParams(ViewGroup.MarginLayoutParams.MATCH_PARENT, ViewGroup.MarginLayoutParams.WRAP_CONTENT);
layoutParams.setMargins((int) MoodlBox.convertDpToPx(10, getResources()), 0, (int) MoodlBox.convertDpToPx(10, getResources()), (int) MoodlBox.convertDpToPx(10, getResources()));
int margin = (int) MoodlBox.convertDpToPx(10, getResources());
layoutParams.setMargins(margin, margin, margin, 0);
setLayoutParams(layoutParams);
@ -340,9 +343,9 @@ public class CurrencyCardview extends CardView {
dataSet = new LineDataSet(values, "");
dataSet.setDrawIcons(false);
dataSet.setColor(currency.getChartColor());
dataSet.setFillColor(getColorWithAplha(currency.getChartColor(), 0.5f));
dataSet.setLineWidth(1);
dataSet.setDrawFilled(true);
dataSet.setFillColor(getColorWithAplha(currency.getChartColor(), 0.5f));
dataSet.setFormLineWidth(1);
dataSet.setFormSize(15);
dataSet.setDrawCircles(false);

View File

@ -53,17 +53,16 @@ public class CurrencyDetailsList {
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
if (response.length() > 0) {
processDetailResult(response, callBack);
}
upToDate = true;
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
upToDate = true;
}
});
@ -77,7 +76,7 @@ public class CurrencyDetailsList {
private void processDetailResult(String response, final BalanceManager.IconCallBack callBack)
{
response = response.substring(response.indexOf("\"Data\"") + 7, response.lastIndexOf("},\"Type\":100}"));
response = response.substring(response.indexOf("\"Data\"") + 7, response.lastIndexOf("},\"BaseImageUrl\""));
String[] tab = response.split(Pattern.quote("},"));
coinInfosHashmap = new LinkedHashMap<>();
@ -109,6 +108,8 @@ public class CurrencyDetailsList {
sortDetails();
upToDate = true;
callBack.onSuccess();
}

View File

@ -0,0 +1,89 @@
package com.herbron.moodl.DataManagers;
import android.content.Context;
import android.util.Log;
import com.herbron.moodl.R;
import android.util.Base64;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public class DataCrypter {
private static Key aesKey;
public static void updateKey(String key)
{
try {
byte[] keyByte = key.getBytes("UTF-8");
byte[] finalKey = new byte[32];
System.arraycopy(keyByte, 0, finalKey, 0, keyByte.length);
aesKey = new SecretKeySpec(finalKey, "AES");
} catch (UnsupportedEncodingException e) {
Log.d("moodl", "Error while creating encryption key " + e.getMessage());
}
}
public static String encrypt(Context context, String data)
{
String encryptedData = null;
try {
IvParameterSpec ivParameterSpec = new IvParameterSpec(context.getString(R.string.ivKey).getBytes("UTF-8"));
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.ENCRYPT_MODE, aesKey, ivParameterSpec);
byte[] encryptedBytes = cipher.doFinal(data.getBytes("UTF-8"));
encryptedData = Base64.encodeToString(encryptedBytes, Base64.DEFAULT);
} catch (NoSuchPaddingException | NoSuchAlgorithmException
| InvalidKeyException | BadPaddingException
| IllegalBlockSizeException | UnsupportedEncodingException
| InvalidAlgorithmParameterException e) {
Log.d("moodl", "Error while encrypting data " + e.getMessage());
}
return encryptedData;
}
public static String decrypt(Context context, String data)
{
String decryptedData = null;
try {
IvParameterSpec ivParameterSpec = new IvParameterSpec(context.getString(R.string.ivKey).getBytes("UTF-8"));
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.ENCRYPT_MODE, aesKey, ivParameterSpec);
byte[] dataBytes = Base64.decode(data, Base64.DEFAULT);
decryptedData = new String(dataBytes, StandardCharsets.UTF_8);
} catch(NoSuchPaddingException | NoSuchAlgorithmException
| InvalidKeyException | UnsupportedEncodingException
| InvalidAlgorithmParameterException e) {
e.printStackTrace();
}
return decryptedData;
}
}

View File

@ -5,10 +5,15 @@ import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
import com.herbron.moodl.DataManagers.CurrencyData.Transaction;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -19,13 +24,13 @@ import java.util.List;
public class DatabaseManager extends SQLiteOpenHelper{
private static final int DATABASE_VERSION = 6;
private static final int DATABASE_VERSION = 7;
private static final String DATABASE_NAME = "Currencies.db";
private static final String TABLE_MANUAL_CURRENCIES = "ManualCurrencies";
private static final String TABLE_EXCHANGE_KEYS = "ExchangeKeys";
private static final String TABLE_WATCHLIST = "Watchlist";
public static final String TABLE_MANUAL_CURRENCIES = "ManualCurrencies";
public static final String TABLE_EXCHANGE_KEYS = "ExchangeKeys";
public static final String TABLE_WATCHLIST = "Watchlist";
private static final String KEY_CURRENCY_ID = "idCurrency";
private static final String KEY_CURRENCY_SYMBOL = "symbol";
@ -38,6 +43,7 @@ public class DatabaseManager extends SQLiteOpenHelper{
private static final String KEY_EXCHANGE_ID = "idExchange";
private static final String KEY_EXCHANGE_NAME = "name";
private static final String KEY_EXCHANGE_DESCRIPTION = "description";
private static final String KEY_EXCHANGE_PUBLIC_KEY = "publicKey";
private static final String KEY_EXCHANGE_SECRET_KEY = "secretKey";
@ -68,6 +74,7 @@ public class DatabaseManager extends SQLiteOpenHelper{
db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_EXCHANGE_KEYS + "("
+ KEY_EXCHANGE_ID + " INTEGER PRIMARY KEY,"
+ KEY_EXCHANGE_NAME + " TEXT,"
+ KEY_EXCHANGE_DESCRIPTION + " TEXT,"
+ KEY_EXCHANGE_PUBLIC_KEY + " TEXT,"
+ KEY_EXCHANGE_SECRET_KEY + " TEXT"
+ ");");
@ -85,11 +92,12 @@ public class DatabaseManager extends SQLiteOpenHelper{
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
db.execSQL("DROP TABLE IF EXISTS " + TABLE_MANUAL_CURRENCIES);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EXCHANGE_KEYS);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_WATCHLIST);
onCreate(db);
switch (oldVersion)
{
case 6:
db.execSQL("ALTER TABLE " + TABLE_EXCHANGE_KEYS
+ " ADD " + KEY_EXCHANGE_DESCRIPTION+ " VARCHAR");
}
}
private boolean isCurrencyInWatchlist(String symbol)
@ -144,11 +152,119 @@ public class DatabaseManager extends SQLiteOpenHelper{
return result.getInt(0);
}
public int deleteCurrencyFromWatchlist(String symbol)
public void deleteCurrencyFromWatchlist(String symbol)
{
SQLiteDatabase db = this.getWritableDatabase();
return db.delete(TABLE_WATCHLIST, KEY_WATCHLIST_SYMBOL + " = '" + symbol + "'", null);
db.delete(TABLE_WATCHLIST, KEY_WATCHLIST_SYMBOL + " = '" + symbol + "'", null);
db.close();
}
public JSONArray getDatabaseBackup(Context context, String table, boolean encryptData)
{
String selectQuerry = "SELECT * FROM " + table;
SQLiteDatabase db = this.getWritableDatabase();
Cursor result = db.rawQuery(selectQuerry, null);
JSONArray backupArray = new JSONArray();
while(result.moveToNext())
{
JSONObject backupObject = new JSONObject();
for(int i = 0; i < result.getColumnCount(); i++)
{
try {
if(result.getString(i) != null)
{
if(encryptData)
{
backupObject.put(result.getColumnName(i), DataCrypter.encrypt(context, result.getString(i)));
}
else
{
backupObject.put(result.getColumnName(i), result.getString(i));
}
}
else
{
backupObject.put(result.getColumnName(i), "");
}
} catch (JSONException e) {
Log.d("moodl", "Error while creating a json backup");
}
}
backupArray.put(backupObject);
}
return backupArray;
}
public void wipeData(String table)
{
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL("DELETE FROM "+ table);
}
public void addRowWatchlist(JSONObject rawValues, Context context, boolean decrypt)
{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
try {
if(decrypt)
{
values.put(KEY_WATCHLIST_SYMBOL, DataCrypter.decrypt(context, rawValues.getString(KEY_WATCHLIST_SYMBOL)));
values.put(KEY_WATCHLIST_NAME, DataCrypter.decrypt(context, rawValues.getString(KEY_WATCHLIST_NAME)));
values.put(KEY_WATCHLIST_POSITION, DataCrypter.decrypt(context, rawValues.getString(KEY_WATCHLIST_POSITION)));
}
else
{
values.put(KEY_WATCHLIST_SYMBOL, rawValues.getString(KEY_WATCHLIST_SYMBOL));
values.put(KEY_WATCHLIST_NAME, rawValues.getString(KEY_WATCHLIST_NAME));
values.put(KEY_WATCHLIST_POSITION, rawValues.getString(KEY_WATCHLIST_POSITION));
}
} catch (JSONException e) {
Log.d("moodl", "Error while inserting transaction");
}
db.insert(TABLE_MANUAL_CURRENCIES, null, values);
db.close();
}
public void addRowTransaction(JSONObject rawValues, Context context, boolean decrypt)
{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
try {
if(decrypt)
{
values.put(KEY_CURRENCY_SYMBOL, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_SYMBOL)));
values.put(KEY_CURRENCY_NAME, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_NAME)));
values.put(KEY_CURRENCY_BALANCE, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_BALANCE)));
values.put(KEY_CURRENCY_DATE, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_DATE)));
values.put(KEY_CURRENCY_PURCHASED_PRICE, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_PURCHASED_PRICE)));
values.put(KEY_CURRENCY_IS_MINED, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_IS_MINED)));
values.put(KEY_CURRENCY_FEES, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_FEES)));
}
else
{
values.put(KEY_CURRENCY_SYMBOL, rawValues.getString(KEY_CURRENCY_SYMBOL));
values.put(KEY_CURRENCY_NAME, rawValues.getString(KEY_CURRENCY_NAME));
values.put(KEY_CURRENCY_BALANCE, rawValues.getString(KEY_CURRENCY_BALANCE));
values.put(KEY_CURRENCY_DATE, rawValues.getString(KEY_CURRENCY_DATE));
values.put(KEY_CURRENCY_PURCHASED_PRICE, rawValues.getString(KEY_CURRENCY_PURCHASED_PRICE));
values.put(KEY_CURRENCY_IS_MINED, rawValues.getString(KEY_CURRENCY_IS_MINED));
values.put(KEY_CURRENCY_FEES, rawValues.getString(KEY_CURRENCY_FEES));
}
} catch (JSONException e) {
Log.d("moodl", "Error while inserting transaction");
}
db.insert(TABLE_MANUAL_CURRENCIES, null, values);
db.close();
}
public List<Currency> getAllCurrenciesFromWatchlist()

View File

@ -9,43 +9,11 @@ import android.preference.PreferenceManager;
public class PreferencesManager {
private static int fragmentUpdated = 0;
private static final String currencyListFile = "CustomCurrencies";
private static final String preferencesFile = "Preferences";
private SharedPreferences settingPreferences;
private SharedPreferences currencyList;
private SharedPreferences preferencesList;
public PreferencesManager(android.content.Context context)
{
settingPreferences = PreferenceManager.getDefaultSharedPreferences(context);
currencyList = context.getSharedPreferences(currencyListFile, 0);
preferencesList = context.getSharedPreferences(preferencesFile, 0);
}
public void setDetailOption(boolean isExtended)
{
SharedPreferences.Editor editor = preferencesList.edit();
editor.putBoolean("DetailOption", isExtended);
editor.apply();
}
public boolean getDetailOption()
{
return preferencesList.getBoolean("DetailOption", true);
}
public boolean mustRefreshDefaultCurrency()
{
fragmentUpdated++;
if(fragmentUpdated == 3)
{
disableRefreshDefaultCurrency();
fragmentUpdated = 0;
}
return settingPreferences.getBoolean("refresh_default_currency", false);
}
public float getMinimumAmount()
@ -65,13 +33,6 @@ public class PreferencesManager {
return ret;
}
private void disableRefreshDefaultCurrency()
{
SharedPreferences.Editor editor = settingPreferences.edit();
editor.putBoolean("refresh_default_currency", false);
editor.apply();
}
public String getDefaultCurrency()
{
return settingPreferences.getString("default_currency", "USD");

View File

@ -0,0 +1,16 @@
package com.herbron.moodl;
/**
* Created by Administrator on 17/06/2018.
*/
public interface DataNotifierInterface {
void onTickerListUpdated();
void onDetailsUpdated();
void onBalanceDataUpdated();
void onBalanceError(String error);
}

View File

@ -4,7 +4,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import com.herbron.moodl.Activities.DetailsActivityFragments.Home;
import com.herbron.moodl.Activities.DetailsActivityFragments.Charts;
import com.herbron.moodl.Activities.DetailsActivityFragments.Informations;
import com.herbron.moodl.Activities.DetailsActivityFragments.Transactions;
@ -27,7 +27,7 @@ public class DetailsActivityPagerAdapter extends FragmentStatePagerAdapter {
switch (position)
{
case 0:
return new Home();
return new Charts();
case 1:
return new Informations();
case 2:

View File

@ -35,7 +35,8 @@ public class FingerprintDialogFragment extends DialogFragment{
@Override
public void onClick(View view) {
dismiss();
getActivity().finish();
getActivity().getFragmentManager().popBackStack();
//getActivity().finish();
}
});

View File

@ -8,6 +8,8 @@ import android.os.CancellationSignal;
import android.os.Handler;
import android.support.v4.app.ActivityCompat;
import com.herbron.moodl.R;
/**
* Created by Guitoune on 28/02/2018.
*/
@ -39,7 +41,7 @@ public class FingerprintHandler extends FingerprintManager.AuthenticationCallbac
{
if(dialogFragment.isVisible())
{
dialogFragment.wrongFingerprint("Error");
dialogFragment.wrongFingerprint(context.getString(R.string.error));
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
@ -57,7 +59,7 @@ public class FingerprintHandler extends FingerprintManager.AuthenticationCallbac
{
if(dialogFragment.isVisible())
{
dialogFragment.wrongFingerprint("Wrong fingerprint");
dialogFragment.wrongFingerprint(context.getString(R.string.wrong_fingerprint));
new Handler().postDelayed(new Runnable() {
@Override
public void run() {

View File

@ -1,44 +0,0 @@
package com.herbron.moodl;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import com.herbron.moodl.Activities.HomeActivityFragments.MarketCapitalization;
import com.herbron.moodl.Activities.HomeActivityFragments.Summary;
import com.herbron.moodl.Activities.HomeActivityFragments.Watchlist;
/**
* Created by Tiji on 13/04/2018.
*/
public class HomeActivityPagerAdapter extends FragmentStatePagerAdapter {
private int numOfTabs;
public HomeActivityPagerAdapter(FragmentManager fm, int numOfTabs)
{
super(fm);
this.numOfTabs = numOfTabs;
}
@Override
public Fragment getItem(int position) {
switch (position)
{
case 0:
return new Watchlist();
case 1:
return new Summary();
case 2:
return new MarketCapitalization();
default:
return null;
}
}
@Override
public int getCount() {
return numOfTabs;
}
}

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v7.widget.CardView;

View File

@ -1,5 +1,7 @@
package com.herbron.moodl;
import android.content.Context;
import com.herbron.moodl.DataManagers.PreferencesManager;
/**
@ -32,7 +34,17 @@ public class PlaceholderManager {
return formattedString;
}
public static String getValuePercentageString(String value, String percentage, android.content.Context context)
public static String getEditTransactionString(String coinName, Context context)
{
return context.getResources().getString(R.string.edit_transaction, coinName);
}
public static String getEmitedPercentageString(String percentage, Context context)
{
return context.getResources().getString(R.string.emitedPlaceholder, percentage);
}
public static String getValuePercentageString(String value, String percentage, Context context)
{
PreferencesManager preferencesManager = new PreferencesManager(context);
String formattedString = null;

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/separationColor"/>
<corners android:radius="5dp"/>
<padding
android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp"/>
</shape>
</item>
</selector>

View File

@ -1,7 +1,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient
android:type="linear"
android:startColor="@color/colorPrimary"
android:endColor="@color/colorPrimaryDark"
android:startColor="@color/colorPrimaryDark"
android:endColor="@color/colorPrimary"
android:angle="0"/>
</shape>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/colorPrimary"
android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
</vector>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/summary_background"/>
<corners android:topLeftRadius="10dp"
android:topRightRadius="10dp"/>
</shape>
</item>
</selector>

View File

@ -5,6 +5,12 @@
android:layout_height="match_parent"
tools:context="com.herbron.moodl.Activities.RecordTransactionActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:theme="@style/AppTheme"
android:padding="5dp"
android:focusableInTouchMode="true">
<TextView
android:id="@+id/textViewFilePath"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_filepath"/>
<CheckBox
android:id="@+id/checkboxBackupManualEntries"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/backup_manual_entries" />
<CheckBox
android:id="@+id/checkboxBackupWatchlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/backup_watchlist" />
<CheckBox
android:id="@+id/checkboxBackupKeys"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/backup_keys" />
<CheckBox
android:id="@+id/checkboxEnterPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/enter_password" />
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayoutPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<EditText
android:id="@+id/editTextPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:theme="@style/AppTheme"
android:padding="5dp"
android:focusableInTouchMode="true">
<TextView
android:id="@+id/textViewFilePath"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_filepath"/>
<CheckBox
android:id="@+id/checkboxRestoreEntries"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/restore_manual_entries"/>
<CheckBox
android:id="@+id/checkboxWipeManualEntries"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/wipe_manual_entries"
android:layout_marginStart="10dp"
android:visibility="gone"/>
<CheckBox
android:id="@+id/checkboxRestoreWatchlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/restore_watchlist"/>
<CheckBox
android:id="@+id/checkboxWipeWatchlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/wipe_watchlist"
android:layout_marginStart="10dp"
android:visibility="gone"/>
<CheckBox
android:id="@+id/checkboxRestoreKeys"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/restore_keys"/>
<CheckBox
android:id="@+id/checkboxWipeAPIKeys"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/wipe_api_keys"
android:layout_marginStart="10dp"
android:visibility="gone"/>
<CheckBox
android:id="@+id/checkboxEnterPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/enter_password"/>
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayoutPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<EditText
android:id="@+id/editTextPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>

View File

@ -0,0 +1,278 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/chartsLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/timeIntervalSinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Spinner"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<Button
android:text="@string/line_chart"
android:id="@+id/lineChartButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:enabled="false"
style="@style/Widget.AppCompat.Button.Colored"/>
<Button
android:text="@string/candle_stick_chart"
android:id="@+id/candleStickChartButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
style="@style/Widget.AppCompat.Button.Colored"/>
</LinearLayout>
<LinearLayout
android:id="@+id/progressLayoutChart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.405"
android:visibility="gone"
android:gravity="center">
<ProgressBar
android:id="@+id/progressBarChart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleLarge"
android:layout_gravity="center"
android:background="@drawable/circular_progress_bar"/>
</LinearLayout>
<com.github.mikephil.charting.charts.LineChart
android:id="@+id/chartPriceView"
android:layout_width="match_parent"
android:layout_height="200dp"
android:transitionName="chart"/>
<com.github.mikephil.charting.charts.CandleStickChart
android:id="@+id/chartCandleStickView"
android:layout_width="match_parent"
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:orientation="horizontal">
<TextView
android:id="@+id/timestampHightlight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_weight="0.33"
android:text="@string/backline" />
<TextView
android:id="@+id/priceHightlight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_weight="0.33"
android:text="@string/backline" />
<TextView
android:id="@+id/volumeHightlight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_weight="0.33"
android:text="@string/backline" />
</LinearLayout>
<com.github.mikephil.charting.charts.BarChart
android:id="@+id/chartVolumeView"
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_marginTop="5dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/llCharts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:baselineAligned="false"
android:gravity="bottom"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/beginning_price"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewPriceStart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/current_price"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewPriceNow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/delta"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewPercentage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/total_volume"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/totalVolume"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/highest_price"
android:layout_weight="0.5"
android:textStyle="bold" />
<TextView
android:id="@+id/highestPrice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/lowest_price"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/lowestPrice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -1,358 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/chartsLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:text="@string/line_chart"
android:id="@+id/lineChartButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:enabled="false"
style="@style/Widget.AppCompat.Button.Colored"/>
<Button
android:text="@string/candle_stick_chart"
android:id="@+id/candleStickChartButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
style="@style/Widget.AppCompat.Button.Colored"/>
</LinearLayout>
<LinearLayout
android:id="@+id/progressLayoutChart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.405"
android:visibility="gone"
android:gravity="center">
<ProgressBar
android:id="@+id/progressBarChart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleLarge"
android:layout_gravity="center"
android:background="@drawable/circular_progress_bar"/>
</LinearLayout>
<com.github.mikephil.charting.charts.LineChart
android:id="@+id/chartPriceView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transitionName="chart"
android:layout_weight="0.5"/>
<com.github.mikephil.charting.charts.CandleStickChart
android:id="@+id/chartCandleStickView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:visibility="gone"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.85"
android:orientation="horizontal">
<TextView
android:id="@+id/timestampHightlight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_weight="0.33"
android:text="@string/backline" />
<TextView
android:id="@+id/priceHightlight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_weight="0.33"
android:text="@string/backline" />
<TextView
android:id="@+id/volumeHightlight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_weight="0.33"
android:text="@string/backline" />
</LinearLayout>
<com.github.mikephil.charting.charts.BarChart
android:id="@+id/chartVolumeView"
android:layout_width="match_parent"
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="match_parent"
android:layout_weight="0.82"
android:orientation="horizontal">
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/button1h"/>
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/button3h"/>
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="11.1"
android:enabled="false"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/button1d"/>
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/button3d"/>
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/button1w"/>
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/button1m"/>
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="11.1"
android:text="@string/button3m"/>
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/button6m"/>
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="11.1"
android:autoSizeTextType="uniform"
android:text="@string/button1y"/>
</LinearLayout>
<LinearLayout
android:id="@+id/llCharts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.71"
android:orientation="horizontal"
android:paddingStart="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="@string/beginning_price"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewPriceStart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="@string/current_price"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewPriceNow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="@string/delta"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtViewPercentage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="@string/total_volume"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/totalVolume"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="@string/highest_price"
android:layout_weight="0.5"
android:textStyle="bold" />
<TextView
android:id="@+id/highestPrice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.16">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:text="@string/lowest_price"
android:layout_weight="0.5"
android:textStyle="bold"/>
<TextView
android:id="@+id/lowestPrice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:layout_weight="0.5" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -4,48 +4,43 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/gradient_background">
android:layout_height="?attr/actionBarSize"
android:background="@drawable/gradient_background"
app:layout_collapseMode="pin"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin">
android:layout_height="wrap_content"
app:layout_collapseMode="pin"
android:layout_margin="10dp">
<FrameLayout
android:layout_width="match_parent"
<ImageButton
android:id="@+id/drawer_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_collapseMode="pin"
android:layout_margin="10dp">
android:text="@string/action_settings"
android:background="@drawable/ic_drawer_white_24dp"
android:visibility="visible"
android:layout_gravity="start|center_vertical"
android:contentDescription="@string/drawer"/>
<ImageButton
android:id="@+id/drawer_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action_settings"
android:background="@drawable/ic_drawer_white_24dp"
android:visibility="visible"
android:layout_gravity="start|center_vertical"
android:contentDescription="@string/drawer"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/title_market_cap"
android:textSize="18sp"
android:textColor="@color/white"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/title_market_cap"
android:textSize="18sp"
android:textColor="@color/white"
android:textStyle="bold"/>
</FrameLayout>
</FrameLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
</android.support.v7.widget.Toolbar>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swiperefreshmarketcap"
@ -53,13 +48,14 @@
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:background="@color/summary_background">
android:background="@drawable/gradient_background">
<LinearLayout android:id="@+id/layoutMarketCap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="20dp">
android:paddingTop="20dp"
android:background="@drawable/list_background">
<ProgressBar
android:id="@+id/progressBarMarketCap"

View File

@ -4,55 +4,49 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/gradient_background">
android:layout_height="?attr/actionBarSize"
android:background="@drawable/gradient_background"
app:layout_collapseMode="pin">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin">
android:layout_height="wrap_content"
app:layout_collapseMode="pin"
android:layout_margin="10dp">
<FrameLayout
android:layout_width="match_parent"
<ImageButton
android:id="@+id/drawer_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_collapseMode="pin"
android:layout_margin="10dp">
android:text="@string/action_settings"
android:background="@drawable/ic_drawer_white_24dp"
android:visibility="visible"
android:layout_gravity="start|center_vertical"
android:contentDescription="@string/drawer"/>
<ImageButton
android:id="@+id/drawer_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action_settings"
android:background="@drawable/ic_drawer_white_24dp"
android:visibility="visible"
android:layout_gravity="start|center_vertical"
android:contentDescription="@string/drawer"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/title_coin_list"
android:textSize="18sp"
android:textColor="@color/white"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/title_coin_list"
android:textSize="18sp"
android:textColor="@color/white"
android:textStyle="bold"/>
</FrameLayout>
</FrameLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
</android.support.v7.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize"
android:background="@color/summary_background"
android:paddingTop="15dp">
android:background="@drawable/gradient_background"
android:elevation="0dp">
<ListView android:id="@+id/linearLayoutOverview"
android:layout_width="match_parent"
@ -61,7 +55,9 @@
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
android:divider="@null"
android:dividerHeight="0dp"/>
android:dividerHeight="0dp"
android:clipChildren="false"
android:background="@drawable/list_background"/>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -5,14 +5,16 @@
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.herbron.moodl.Activities.HomeActivity">
tools:context="com.herbron.moodl.Activities.HomeActivity"
android:background="@drawable/gradient_background">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:theme="@style/AppTheme.AppBarOverlay"
android:background="@drawable/gradient_background">
android:background="@drawable/gradient_background"
app:elevation="0dp">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
@ -22,7 +24,8 @@
app:toolbarId="@+id/toolbar"
app:collapsedTitleGravity="center"
app:expandedTitleGravity="center"
app:titleEnabled="true">
app:titleEnabled="true"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
@ -70,19 +73,19 @@
android:id="@+id/swiperefreshsummary"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:background="@color/summary_background">
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedScrollViewLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@drawable/list_background">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp">
android:clipChildren="false">
<LinearLayout
android:id="@+id/currencyListLayout"
@ -96,11 +99,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_dashed_background"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_margin="10dp"
android:textColor="@color/separationColor"
style="@style/Widget.AppCompat.Button.Borderless"/>

View File

@ -4,58 +4,53 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/gradient_background">
android:layout_height="?attr/actionBarSize"
android:background="@drawable/gradient_background"
app:layout_collapseMode="pin"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin">
android:layout_height="wrap_content"
app:layout_collapseMode="pin"
android:layout_margin="10dp">
<FrameLayout
android:layout_width="match_parent"
<ImageButton
android:id="@+id/drawer_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_collapseMode="pin"
android:layout_margin="10dp">
android:text="@string/action_settings"
android:background="@drawable/ic_drawer_white_24dp"
android:visibility="visible"
android:layout_gravity="start|center_vertical"
android:contentDescription="@string/drawer"/>
<ImageButton
android:id="@+id/drawer_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action_settings"
android:background="@drawable/ic_drawer_white_24dp"
android:visibility="visible"
android:layout_gravity="start|center_vertical"
android:contentDescription="@string/drawer"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/title_watchlist"
android:textSize="18sp"
android:textColor="@color/white"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/title_watchlist"
android:textSize="18sp"
android:textColor="@color/white"
android:textStyle="bold"/>
<ImageButton
android:id="@+id/edit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action_edit_mode"
android:background="@drawable/ic_mode_edit_white_24dp"
android:visibility="visible"
android:layout_gravity="end|center_vertical"
android:contentDescription="@string/edit_mode"/>
<ImageButton
android:id="@+id/edit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action_edit_mode"
android:background="@drawable/ic_mode_edit_white_24dp"
android:visibility="visible"
android:layout_gravity="end|center_vertical"
android:contentDescription="@string/edit_mode"/>
</FrameLayout>
</FrameLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
</android.support.v7.widget.Toolbar>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swiperefreshwatchlist"
@ -63,18 +58,19 @@
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:background="@color/summary_background">
android:background="@drawable/gradient_background">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never">
android:overScrollMode="never"
android:background="@drawable/list_background">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="25dp">
android:clipChildren="false">
<com.jmedeisis.draglinearlayout.DragLinearLayout android:id="@+id/linearLayoutWatchlist"
android:layout_width="match_parent"
@ -96,11 +92,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_dashed_background"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_margin="10dp"
android:textColor="@color/separationColor"
style="@style/Widget.AppCompat.Button.Borderless"/>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@color/colorPrimaryDark">
<LinearLayout
android:id="@+id/animatedViewsLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
</LinearLayout>
</LinearLayout>

View File

@ -61,15 +61,6 @@
<string name="pref_title_kraken_privatekey">Clé privée</string>
<string name="title_watchlist">Liste suivie</string>
<string name="title_coin_list">Liste des monnaies</string>
<string name="button1h">1h</string>
<string name="button3h">3h</string>
<string name="button1d">1j</string>
<string name="button3d">3j</string>
<string name="button1w">1S</string>
<string name="button1m">1M</string>
<string name="button3m">3M</string>
<string name="button6m">6M</string>
<string name="button1y">1A</string>
<string name="timestampPlaceholder">Date\n%1$s</string>
<string name="volumeDollarPlaceholder">Volume\nUS$%1$s</string>
<string name="priceDollarPlaceholder">Prix\nUS$%1$s</string>
@ -89,4 +80,63 @@
<string name="field_empty">Ce champ en peut pas être vide</string>
<string name="field_nan">Ce champ doit être un nombre</string>
<string name="field_negative">Ce champ doit être positif</string>
<string name="pref_title_category_display">Affichage</string>
<string name="pref_title_category_data_backup">Sauvegarde des données</string>
<string name="pref_title_category_other">Autre</string>
<string name="pref_title_version">Version</string>
<string name="pref_title_export">Exporter les entrées manuelles</string>
<string name="pref_title_import">Importer de nouvelles entrées</string>
<string name="pref_title_category_synchronization">Synchronisation</string>
<string name="wipe_data">Supprimer les données actuelles</string>
<string name="restore_manual_entries">Restaurer les transactions manuelles</string>
<string name="restore_keys">Restaurer les clefs d\'API</string>
<string name="enter_password">Entrer un mot de passe</string>
<string name="password">Mot de passe</string>
<string name="title_activity_exchange_settings">Réglages</string>
<string name="save">Sauvegarder</string>
<string name="cancel">Annuler</string>
<string name="confirm">Confirmer</string>
<string name="restoreBackup">Restaurer une sauvegarde</string>
<string name="pref_header_wallet">Paramètre des portes-monnaies</string>
<string name="infinity">Infini</string>
<string name="others">Autres</string>
<string name="market_dominance">Dominance du marché</string>
<string name="global">Global</string>
<string name="other_coins">Autres monnaies</string>
<string-array name="time_interval_string_array">
<item>1 heure</item>
<item>3 heures</item>
<item>1 jour</item>
<item>3 jours</item>
<item>1 semaine</item>
<item>1 mois</item>
<item>3 mois</item>
<item>6 mois</item>
<item>1 année</item>
</string-array>
<string name="emitedPlaceholder">Pourcentage de coin émis : %1$s%%</string>
<string name="edit_transaction">Edition d\'une transaction de %1$s</string>
<string name="new_transaction">Nouvelle transaction</string>
<string name="error_update_data">Erreur lors de l\'actualisation des données</string>
<string name="update">Rafraichir</string>
<string name="invalid_keys_hitbtc">Erreur de synchronisation avec HitBTC : Clefs invalides</string>
<string name="invalid_keys_binance">Erreur de synchronisation avec Binance : Clefs invalides</string>
<string name="cannot_resole_host">Impossible de résoudre l\'hôte</string>
<string name="unexpected">Erreur inconnue</string>
<string name="select_coin">Selectionner une monnaie</string>
<string name="already_watchlisr">Monnaie déjà présente dans la liste suivie</string>
<string name="create_backup">Créer une sauvegarde</string>
<string name="wrong_password">Mauvais mot de passe</string>
<string name="error">Erreur</string>
<string name="wrong_fingerprint">Mauvaise empreinte digitale</string>
<string name="backup_manual_entries">Sauvegarder les entrées manuelles</string>
<string name="backup_watchlist">Sauvegarder la liste suivie</string>
<string name="backup_keys">Sauvegarder les clefs API</string>
<string name="must_be_filled">Ne peut pas être vide</string>
<string name="restore_watchlist">Restaurer la liste suivie</string>
<string name="wipe_manual_entries">Supprimer les entrées manuelles actuelles</string>
<string name="wipe_watchlist">Supprimer la liste suivie actuelle</string>
<string name="wipe_api_keys">Supprimer les clefs API actuelles</string>
</resources>

View File

@ -40,4 +40,5 @@
<color name="transparent_green">#225DBF61</color>
<color name="blue">#FF689afe</color>
<color name="transparent_blue">#22689afe</color>
<color name="default_color">#FFAAAAAA</color>
</resources>

View File

@ -12,8 +12,20 @@
<string name="pref_title_hide_balance">Hide balance</string>
<!-- Example settings for Data & Sync -->
<string name="pref_title_category_display">Display</string>
<string name="pref_title_category_data_backup">Data backup</string>
<string name="pref_title_category_synchronization">Synchronization</string>
<string name="pref_title_category_other">Other</string>
<string name="pref_title_minimum_amount_displayed">Minimum amount displayed</string>
<string name="pref_title_version">Version</string>
<string name="ivKey" translatable="false">0123456789MoodlH</string> <!--Must be 16 characters-->
<string name="pref_title_export">Export manual entries</string>
<string name="pref_title_import">Import manual entries</string>
<string name="pref_title_default_currency">Default currency</string>
<string-array name="pref_default_currencies_titles">
<item>Dollar (USD)</item>
@ -67,7 +79,7 @@
<string name="trade_loading">Looking for trades&#8230;</string>
<string name="default_value" translatable="false">--</string>
<!--Home activity-->
<!--Charts activity-->
<string name="drawer">Drawer</string>
<string name="dominance_percentage">Dominance percentage</string>
<string name="active_cryptocurrencies">Active cryptocurrencies</string>
@ -80,6 +92,7 @@
<!--Exchange strings-->
<string name="pref_header_exchange">Exchanges settings</string>
<string name="pref_header_wallet">Wallets settings</string>
<string name="pref_fingerprint" translatable="false">Touch ID</string>
<!--HitBTC-->
@ -126,16 +139,23 @@
<string name="title_market_cap">Market Capitalization</string>
<string name="title_coin_list">Coin list</string>
<!--Chart buttons texts-->
<string name="button1h">1h</string>
<string name="button3h">3h</string>
<string name="button1d">1d</string>
<string name="button3d">3d</string>
<string name="button1w">1w</string>
<string name="button1m">1M</string>
<string name="button3m">3M</string>
<string name="button6m">6M</string>
<string name="button1y">1y</string>
<string-array name="time_interval_string_array">
<item>1 hour</item>
<item>3 hours</item>
<item>1 day</item>
<item>3 days</item>
<item>1 week</item>
<item>1 month</item>
<item>3 months</item>
<item>6 months</item>
<item>1 year</item>
</string-array>
<string-array name="wipe_options_string_array">
<item>Manual entries</item>
<item>Watchlist</item>
<item>API keys</item>
</string-array>
<!--Cardview placeholders-->
<string name="currencySymbolPlaceholder" translatable="false">(%1$s)</string>
@ -160,6 +180,7 @@
<!--DetailsActivity placeholders-->
<string name="timestampPlaceholder">Date\n%1$s</string>
<string name="emitedPlaceholder">Percentage of coin emitted : %1$s%%</string>
<!--Dollar-->
<string name="volumeDollarPlaceholder">Volume\nUS$%1$s</string>
<string name="priceDollarPlaceholder">Price\nUS$%1$s</string>
@ -176,6 +197,9 @@
<string name="fingerprint_dialog_cancel">Cancel</string>
<string name="fingerprint_dialog_title">Verify your fingerprint to continue</string>
<string name="edit_transaction">Edit %1$s transaction</string>
<string name="new_transaction">New transaction</string>
<!--Marketcap placeholders-->
<!--Dollar-->
@ -189,5 +213,41 @@
<string name="field_empty">This field cannot be blank</string>
<string name="field_nan">This field must be a number</string>
<string name="field_negative">This field must be positive</string>
<string name="wipe_data">Wipe current data</string>
<string name="restore_manual_entries">Restore manual entries</string>
<string name="restore_keys">Restore API keys</string>
<string name="enter_password">Enter password</string>
<string name="password">Password</string>
<string name="title_activity_exchange_settings">Settings</string>
<string name="restoreBackup">Restore backup</string>
<string name="confirm">Confirm</string>
<string name="cancel">Cancel</string>
<string name="save">Save</string>
<string name="infinity">Infinity</string>
<string name="others">Others</string>
<string name="market_dominance">Market Cap Dominance</string>
<string name="global">Global</string>
<string name="other_coins">Other coins</string>
<string name="error_update_data">Error while updating data</string>
<string name="update">Update</string>
<string name="invalid_keys_hitbtc">HitBTC synchronization error : Invalid keys</string>
<string name="invalid_keys_binance">Binance synchronization error : Invalid keys</string>
<string name="cannot_resole_host">Can\'t resolve host</string>
<string name="unexpected">Unexpected error</string>
<string name="select_coin">Select a coin</string>
<string name="already_watchlisr">Currency already in watchlist</string>
<string name="create_backup">Create backup</string>
<string name="wrong_password">Wrong password</string>
<string name="error">Error</string>
<string name="wrong_fingerprint">Wrong fingerprint</string>
<string name="backup_manual_entries">Backup manual entries</string>
<string name="backup_watchlist">Backup watchlist</string>
<string name="backup_keys">Backup API keys</string>
<string name="must_be_filled">Cannot be blank</string>
<string name="restore_watchlist">Restore watchlist</string>
<string name="wipe_manual_entries">Wipe current entries</string>
<string name="wipe_watchlist">Wipe current watchlist</string>
<string name="wipe_api_keys">Wipe current API keys</string>
</resources>

View File

@ -8,16 +8,12 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="swirl_ridgeColor">@color/separationColor</item>
<item name="swirl_errorColor">@color/decrease</item>
</style>
<!--<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:navigationBarColor">@color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:actionBarStyle">@style/ThemeActionBar</item>
<item name="android:windowActionBarOverlay">true</item>-->
<!-- Support library compatibility -->
<!--<item name="actionBarStyle">@style/ThemeActionBar</item>
<item name="windowActionBarOverlay">true</item>-->
<style name="RecordTransactionTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
@ -29,4 +25,10 @@
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="TimeListView" parent="@android:style/Widget.ListView">
<item name="android:cacheColorHint">@android:color/transparent</item>
<item name="android:divider">@android:color/transparent</item>
<item name="android:dividerHeight">0dp</item>
</style>
</resources>

View File

@ -1,53 +0,0 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!--<SwitchPreference
android:defaultValue="false"
android:key="hide_balance"
android:title="@string/pref_title_hide_balance" />-->
<ListPreference
android:defaultValue="USD"
android:entries="@array/pref_default_currencies_titles"
android:entryValues="@array/pref_default_currencies_values"
android:key="default_currency"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_default_currency" />
<EditTextPreference
android:defaultValue="0"
android:key="minimum_value_displayed"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_minimum_amount_displayed"
android:inputType="numberDecimal"
android:hint="Let blank for none" />
<PreferenceScreen android:title="Version"
android:key="version"/>
<!-- NOTE: EditTextPreference accepts EditText attributes. -->
<!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
<!--<EditTextPreference
android:capitalize="words"
android:defaultValue="@string/pref_default_display_name"
android:inputType="textCapWords"
android:key="example_text"
android:maxLines="1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/pref_title_display_name" />-->
<!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
dismiss it. -->
<!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
<!--<ListPreference
android:defaultValue="-1"
android:entries="@array/pref_example_list_titles"
android:entryValues="@array/pref_example_list_values"
android:key="example_list"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_add_friends_to_messages" />-->
</PreferenceScreen>

View File

@ -1,27 +0,0 @@
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
<!-- These settings headers are only used on tablets. -->
<header
android:fragment="com.herbron.moodl.Activities.SettingsActivity$GeneralPreferenceFragment"
android:icon="@drawable/ic_info_black_24dp"
android:title="@string/pref_header_general" />
<header
android:fragment="com.herbron.moodl.Activities.SettingsActivity$ExchangePreferenceFragment"
android:icon="@drawable/ic_developer_board_black_24dp"
android:title="@string/pref_header_exchange" />
<!--<header
android:fragment="com.nauk.crystalvault.Activities.SettingsActivity$NotificationPreferenceFragment"
android:icon="@drawable/ic_notifications_black_24dp"
android:title="@string/pref_header_notifications" />
<header
android:fragment="com.nauk.crystalvault.Activities.SettingsActivity$DataSyncPreferenceFragment"
android:icon="@drawable/ic_sync_black_24dp"
android:title="@string/pref_header_data_sync" />-->
</preference-headers>

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="@string/pref_title_category_display">
<ListPreference
android:defaultValue="USD"
android:entries="@array/pref_default_currencies_titles"
android:entryValues="@array/pref_default_currencies_values"
android:key="default_currency"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_default_currency" />
<EditTextPreference
android:defaultValue="0"
android:key="minimum_value_displayed"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_minimum_amount_displayed"
android:inputType="numberDecimal"
android:hint="Let blank for none" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/pref_title_category_data_backup">
<PreferenceScreen android:title="@string/pref_title_export"
android:key="export"/>
<Preference android:title="@string/pref_title_import"
android:key="import"/>
</PreferenceCategory>
<PreferenceCategory
android:title="@string/pref_title_category_synchronization">
<PreferenceScreen
android:fragment="com.herbron.moodl.Activities.SettingsActivity$ExchangePreferenceFragment"
android:title="@string/pref_header_exchange"
android:key="exchange"/>
<PreferenceScreen
android:title="@string/pref_header_wallet"
android:enabled="false"/>
</PreferenceCategory>
<PreferenceCategory
android:title="@string/pref_title_category_other">
<PreferenceScreen android:title="@string/pref_title_version"
android:key="version"/>
</PreferenceCategory>
</PreferenceScreen>

View File

@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
@ -20,6 +20,7 @@ allprojects {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/lukaville/maven" }
}
}

View File

@ -1,4 +1,4 @@
#Sun May 13 20:31:16 CEST 2018
#Sun Jun 17 03:10:32 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

BIN
libs/commons-codec-1.11.jar Normal file

Binary file not shown.