Fisrt push
Initial push -HitBTC synchronisation -Quick charts -Detailed/Quick view
9
.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
19
.idea/gradle.xml
generated
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="LOCAL" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-4.1" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
33
.idea/misc.xml
generated
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<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">
|
||||
<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" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="4">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
9
.idea/modules.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/CrystalVault.iml" filepath="$PROJECT_DIR$/CrystalVault.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
12
.idea/runConfigurations.xml
generated
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
37
app/build.gradle
Normal file
@ -0,0 +1,37 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
defaultConfig {
|
||||
applicationId "com.nauk.coinfolio"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/binance/src'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
||||
implementation 'com.android.support:design:26.1.0'
|
||||
implementation 'com.android.support:cardview-v7:26.1.0'
|
||||
implementation 'com.mcxiaoke.volley:library:1.0.19'
|
||||
implementation 'com.diogobernardino:williamchart:2.5.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||
implementation 'com.android.support:support-v4:26.1.0'
|
||||
implementation 'com.android.support:palette-v7:26.1.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.1'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
|
||||
}
|
21
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
@ -0,0 +1,26 @@
|
||||
package com.nauk.coinfolio;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("com.nauk.crystalvault", appContext.getPackageName());
|
||||
}
|
||||
}
|
31
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.nauk.coinfolio">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/icon_crystalvault"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name="com.nauk.coinfolio.Activities.HomeActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.nauk.coinfolio.Activities.SettingsActivity"
|
||||
android:label="@string/title_activity_settings" />
|
||||
<activity android:name="com.nauk.coinfolio.Activities.CurrencySelectionActivity" />
|
||||
<activity android:name="com.nauk.coinfolio.Activities.RecordTransactionActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
BIN
app/src/main/Icon_CrystalVault-web.png
Normal file
After Width: | Height: | Size: 290 KiB |
BIN
app/src/main/ic_hitbtc-web.png
Normal file
After Width: | Height: | Size: 126 KiB |
@ -0,0 +1,109 @@
|
||||
package com.nauk.coinfolio.Activities;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
||||
* to be used with AppCompat.
|
||||
*/
|
||||
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
||||
|
||||
private AppCompatDelegate mDelegate;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getDelegate().installViewFactory();
|
||||
getDelegate().onCreate(savedInstanceState);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
getDelegate().onPostCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public ActionBar getSupportActionBar() {
|
||||
return getDelegate().getSupportActionBar();
|
||||
}
|
||||
|
||||
public void setSupportActionBar(@Nullable Toolbar toolbar) {
|
||||
getDelegate().setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MenuInflater getMenuInflater() {
|
||||
return getDelegate().getMenuInflater();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(@LayoutRes int layoutResID) {
|
||||
getDelegate().setContentView(layoutResID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view) {
|
||||
getDelegate().setContentView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().setContentView(view, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().addContentView(view, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
getDelegate().onPostResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTitleChanged(CharSequence title, int color) {
|
||||
super.onTitleChanged(title, color);
|
||||
getDelegate().setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
getDelegate().onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getDelegate().onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
getDelegate().onDestroy();
|
||||
}
|
||||
|
||||
public void invalidateOptionsMenu() {
|
||||
getDelegate().invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
private AppCompatDelegate getDelegate() {
|
||||
if (mDelegate == null) {
|
||||
mDelegate = AppCompatDelegate.create(this, null);
|
||||
}
|
||||
return mDelegate;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.nauk.coinfolio.Activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
|
||||
import com.nauk.coinfolio.DataManagers.CurrencyData.Currency;
|
||||
import com.nauk.coinfolio.LayoutManagers.CurrencyAdapter;
|
||||
import com.nauk.coinfolio.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CurrencySelectionActivity extends AppCompatActivity {
|
||||
|
||||
String[] currencySymbols;
|
||||
String[] currencyNames;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
||||
setContentView(R.layout.activity_add_currency);
|
||||
|
||||
Intent intent = getIntent();
|
||||
|
||||
currencySymbols = intent.getStringArrayExtra("currencyListSymbols");
|
||||
currencyNames = intent.getStringArrayExtra("currencyListNames");
|
||||
|
||||
setTitle("Select a coin");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu)
|
||||
{
|
||||
final AutoCompleteTextView searchAutoComplete = findViewById(R.id.search_bar);
|
||||
|
||||
searchAutoComplete.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
Intent intent = new Intent(CurrencySelectionActivity.this, RecordTransactionActivity.class);
|
||||
intent.putExtra("coin", searchAutoComplete.getText().toString());
|
||||
intent.putExtra("symbol", searchAutoComplete.getCompletionHint().toString());
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
String[] currencyFullname = new String[currencyNames.length];
|
||||
|
||||
for(int i = 0; i < currencyFullname.length; i++)
|
||||
{
|
||||
currencyFullname[i] = currencyNames[i] + " " + currencySymbols[i];
|
||||
}
|
||||
|
||||
ArrayList<Currency> currencyArrayList = new ArrayList<>();
|
||||
|
||||
for(int i = 0; i < currencyNames.length; i++)
|
||||
{
|
||||
currencyArrayList.add(new Currency(currencyNames[i], currencySymbols[i]));
|
||||
}
|
||||
|
||||
CurrencyAdapter adapter = new CurrencyAdapter(this, currencyArrayList);
|
||||
|
||||
searchAutoComplete.setAdapter(adapter);
|
||||
searchAutoComplete.setThreshold(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,470 @@
|
||||
package com.nauk.coinfolio.Activities;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.CollapsingToolbarLayout;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.graphics.Palette;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nauk.coinfolio.DataManagers.BalanceManager;
|
||||
import com.nauk.coinfolio.DataManagers.CurrencyData.Currency;
|
||||
import com.nauk.coinfolio.DataManagers.DatabaseManager;
|
||||
import com.nauk.coinfolio.LayoutManagers.HomeLayoutGenerator;
|
||||
import com.nauk.coinfolio.DataManagers.PreferencesManager;
|
||||
import com.nauk.coinfolio.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.List;
|
||||
|
||||
//Use WilliamChart for charts https://github.com/diogobernardino/WilliamChart
|
||||
|
||||
//Auto refresh with predefined intervals
|
||||
//Adding manually currencies (date, purchased price)
|
||||
//Multiple portfolio (exchanges & custom)
|
||||
//Add currency details (market cap, 1h, 3h, 3d, 1w, 1m, 3m, 1y)
|
||||
//Add roadmap to buy a coin
|
||||
//Add reddit link ?
|
||||
//
|
||||
|
||||
public class HomeActivity extends AppCompatActivity {
|
||||
|
||||
private BalanceManager balanceManager;
|
||||
private int coinCounter;
|
||||
private HomeLayoutGenerator layoutGenerator;
|
||||
private LinearLayout currencyLayout;
|
||||
private Toolbar toolbar;
|
||||
private CollapsingToolbarLayout toolbarLayout;
|
||||
private SwipeRefreshLayout refreshLayout;
|
||||
private TextView toolbarSubtitle;
|
||||
private boolean view;
|
||||
private Dialog loadingDialog;
|
||||
private boolean iconChecker;
|
||||
private PreferencesManager preferencesManager;
|
||||
private DatabaseManager databaseManager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
setContentView(R.layout.activity_currency_summary);
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
preferencesManager = new PreferencesManager(this);
|
||||
|
||||
view = preferencesManager.getDetailOption();
|
||||
|
||||
generateSplash();
|
||||
|
||||
ImageButton detailsButton = findViewById(R.id.switch_button);
|
||||
ImageButton settingsButton = findViewById(R.id.settings_button);
|
||||
|
||||
refreshLayout = findViewById(R.id.swiperefresh);
|
||||
|
||||
toolbarLayout = findViewById(R.id.toolbar_layout);
|
||||
|
||||
toolbarSubtitle = findViewById(R.id.toolbarSubtitle);
|
||||
|
||||
toolbarLayout.setExpandedTitleGravity(Gravity.CENTER);
|
||||
toolbarLayout.setCollapsedTitleGravity(Gravity.CENTER);
|
||||
toolbarLayout.setForegroundGravity(Gravity.CENTER);
|
||||
toolbarLayout.setTitle("US$0.00");
|
||||
|
||||
toolbarSubtitle.setText("US$0.00");
|
||||
|
||||
detailsButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switchView();
|
||||
}
|
||||
});
|
||||
|
||||
settingsButton.setBackground(this.getResources().getDrawable(R.drawable.ic_settings_black_24dp));
|
||||
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent settingIntent = new Intent(HomeActivity.this, SettingsActivity.class);
|
||||
startActivity(settingIntent);
|
||||
}
|
||||
});
|
||||
|
||||
layoutGenerator = new HomeLayoutGenerator(this);
|
||||
|
||||
balanceManager = new BalanceManager(this);
|
||||
|
||||
currencyLayout = findViewById(R.id.currencyListLayout);
|
||||
|
||||
refreshLayout.setOnRefreshListener(
|
||||
new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
updateAll();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
final ImageButton addCurrencyButton = findViewById(R.id.addCurrencyButton);
|
||||
|
||||
addCurrencyButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent addIntent = new Intent(HomeActivity.this, CurrencySelectionActivity.class);
|
||||
|
||||
String[] symbolList = new String[balanceManager.getCurrenciesSymbol().size()];
|
||||
symbolList = balanceManager.getCurrenciesSymbol().toArray(symbolList);
|
||||
String[] nameList = new String[balanceManager.getCurrenciesName().size()];
|
||||
nameList = balanceManager.getCurrenciesName().toArray(nameList);
|
||||
|
||||
addIntent.putExtra("currencyListSymbols", symbolList);
|
||||
addIntent.putExtra("currencyListNames", nameList);
|
||||
|
||||
startActivity(addIntent);
|
||||
|
||||
|
||||
/*Snackbar.make(findViewById(R.id.currencyListLayout), "This feature is not yet available...", Snackbar.LENGTH_LONG)
|
||||
.show();*/
|
||||
}
|
||||
});
|
||||
|
||||
databaseManager = new DatabaseManager(this);
|
||||
databaseManager.getAllCurrencyFromManualCurrency();
|
||||
|
||||
updateViewButtonIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
updateAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
//getMenuInflater().inflate(R.menu.menu_currency_summary, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
/*case R.id.action_settings:
|
||||
Log.d(this.getResources().getString(R.string.debug), "Setting button toggled");
|
||||
break;*/
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void switchView()
|
||||
{
|
||||
if(!view)
|
||||
{
|
||||
view = true;
|
||||
|
||||
adaptView();
|
||||
}
|
||||
else
|
||||
{
|
||||
view = false;
|
||||
|
||||
adaptView();
|
||||
}
|
||||
}
|
||||
|
||||
private void adaptView()
|
||||
{
|
||||
if(!view)
|
||||
{
|
||||
for(int i = 0; i < currencyLayout.getChildCount(); i++)
|
||||
{
|
||||
currencyLayout.getChildAt(i).findViewWithTag("chart_layout").setVisibility(View.GONE);
|
||||
currencyLayout.getChildAt(i).findViewWithTag("separator_layout").setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currencyLayout.removeAllViews();
|
||||
|
||||
for(int i = 0; i < balanceManager.getTotalBalance().size(); i++)
|
||||
{
|
||||
final Currency currency = balanceManager.getTotalBalance().get(i);
|
||||
|
||||
if(!currency.getSymbol().equals("USD") && (currency.getBalance() * currency.getValue()) > 0.001)
|
||||
{
|
||||
if(currency.getIcon() != null)
|
||||
{
|
||||
Palette.Builder builder = Palette.from(currency.getIcon());
|
||||
|
||||
currencyLayout.addView(layoutGenerator.getInfoLayout(currency, builder.generate().getDominantColor(0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
currencyLayout.addView(layoutGenerator.getInfoLayout(currency, 12369084));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateViewButtonIcon();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void updateAll()
|
||||
{
|
||||
resetCounter();
|
||||
balanceManager.updateExchangeKeys();
|
||||
DataUpdater updater = new DataUpdater();
|
||||
updater.execute();
|
||||
refreshLayout.setRefreshing(true);
|
||||
}
|
||||
|
||||
private void resetCounter()
|
||||
{
|
||||
coinCounter = 0;
|
||||
iconChecker = false;
|
||||
}
|
||||
|
||||
private Bitmap getBitmapFromURL(String src) {
|
||||
try {
|
||||
java.net.URL url = new java.net.URL(src);
|
||||
HttpURLConnection connection = (HttpURLConnection) url
|
||||
.openConnection();
|
||||
connection.setDoInput(true);
|
||||
connection.connect();
|
||||
InputStream input = connection.getInputStream();
|
||||
return BitmapFactory.decodeStream(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void countCoins(boolean isCoin, boolean isIcon)
|
||||
{
|
||||
float totalValue = 0;
|
||||
float totalFluctuation = 0;
|
||||
|
||||
if(isCoin)
|
||||
{
|
||||
coinCounter++;
|
||||
}
|
||||
|
||||
if(isIcon)
|
||||
{
|
||||
iconChecker = true;
|
||||
}
|
||||
|
||||
if(balanceManager.getTotalBalance() != null)
|
||||
{
|
||||
if(coinCounter == balanceManager.getTotalBalance().size()-1 && iconChecker)
|
||||
{
|
||||
refreshLayout.setRefreshing(false);
|
||||
|
||||
balanceManager.sortCoins();
|
||||
|
||||
currencyLayout.removeAllViews();
|
||||
|
||||
for(int i = 0; i < balanceManager.getTotalBalance().size(); i++)
|
||||
{
|
||||
if(!balanceManager.getTotalBalance().get(i).getSymbol().equals("USD") && (balanceManager.getTotalBalance().get(i).getBalance() * balanceManager.getTotalBalance().get(i).getValue()) > 0.001)
|
||||
{
|
||||
totalValue += balanceManager.getTotalBalance().get(i).getValue() * balanceManager.getTotalBalance().get(i).getBalance();
|
||||
totalFluctuation += (balanceManager.getTotalBalance().get(i).getValue() * balanceManager.getTotalBalance().get(i).getBalance()) * (balanceManager.getTotalBalance().get(i).getDayFluctuationPercentage() / 100);
|
||||
balanceManager.getTotalBalance().get(i).setIcon(getBitmapFromURL(balanceManager.getIconUrl(balanceManager.getTotalBalance().get(i).getSymbol())));
|
||||
currencyLayout.addView(layoutGenerator.getInfoLayout(balanceManager.getTotalBalance().get(i),0));
|
||||
}
|
||||
}
|
||||
|
||||
adaptView();
|
||||
|
||||
toolbarLayout.setTitle("US$" + String.format("%.2f", totalValue));
|
||||
|
||||
if(totalFluctuation > 0)
|
||||
{
|
||||
toolbarSubtitle.setTextColor(getResources().getColor(R.color.increase));
|
||||
}
|
||||
else
|
||||
{
|
||||
toolbarSubtitle.setTextColor(getResources().getColor(R.color.decrease));
|
||||
}
|
||||
|
||||
toolbarSubtitle.setText("US$" + String.format("%.2f", totalFluctuation));
|
||||
|
||||
|
||||
if(loadingDialog.isShowing())
|
||||
{
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(balanceManager.getTotalBalance().size() == 0)
|
||||
{
|
||||
refreshLayout.setRefreshing(false);
|
||||
|
||||
currencyLayout.removeAllViews();
|
||||
|
||||
if(loadingDialog.isShowing())
|
||||
{
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateViewButtonIcon()
|
||||
{
|
||||
ImageButton imgButton = findViewById(R.id.switch_button);
|
||||
|
||||
if(view)
|
||||
{
|
||||
imgButton.setBackground(this.getResources().getDrawable(R.drawable.ic_unfold_less_black_24dp));
|
||||
preferencesManager.setDetailOption(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
imgButton.setBackground(this.getResources().getDrawable(R.drawable.ic_details_black_24dp));
|
||||
preferencesManager.setDetailOption(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void generateSplash()
|
||||
{
|
||||
LinearLayout loadingLayout = new LinearLayout(this);
|
||||
loadingLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
loadingLayout.setGravity(Gravity.CENTER);
|
||||
loadingLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
loadingDialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
|
||||
|
||||
TextView txtView = new TextView(this);
|
||||
txtView.setText("Loading data...");
|
||||
txtView.setTextSize(20);
|
||||
txtView.setGravity(Gravity.CENTER);
|
||||
txtView.setTextColor(this.getResources().getColor(R.color.cardview_light_background));
|
||||
|
||||
ProgressBar progressBar = new ProgressBar(this);
|
||||
progressBar.setIndeterminate(true);
|
||||
|
||||
loadingLayout.setBackgroundColor(this.getResources().getColor(R.color.colorPrimaryDark));
|
||||
loadingLayout.addView(txtView);
|
||||
loadingLayout.addView(progressBar);
|
||||
|
||||
loadingDialog.setContentView(loadingLayout);
|
||||
loadingDialog.show();
|
||||
}
|
||||
|
||||
private class DataUpdater extends AsyncTask<Void, Integer, Void>
|
||||
{
|
||||
@Override
|
||||
protected void onPreExecute()
|
||||
{
|
||||
super.onPreExecute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onProgressUpdate(Integer... values)
|
||||
{
|
||||
super.onProgressUpdate(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params)
|
||||
{
|
||||
balanceManager.updateTotalBalance(new 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).updateDayPriceHistory(getApplicationContext(), new Currency.CurrencyCallBack() {
|
||||
@Override
|
||||
public void onSuccess(Currency currency) {
|
||||
currency.updateName(getApplicationContext(), new Currency.CurrencyCallBack() {
|
||||
@Override
|
||||
public void onSuccess(Currency currency) {
|
||||
countCoins(true, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
countCoins(false, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void onError(String error)
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
case "com.android.volley.AuthFailureError":
|
||||
preferencesManager.disableHitBTC();
|
||||
Snackbar.make(findViewById(R.id.currencyListLayout), "HitBTC synchronization error : Invalid keys", Snackbar.LENGTH_LONG)
|
||||
.show();
|
||||
refreshLayout.setRefreshing(false);
|
||||
updateAll();
|
||||
break;
|
||||
default:
|
||||
updateAll();
|
||||
}
|
||||
//updateAll();
|
||||
}
|
||||
});
|
||||
|
||||
balanceManager.updateDetails(new BalanceManager.IconCallBack() {
|
||||
@Override
|
||||
public void onSuccess()
|
||||
{
|
||||
countCoins(false, true);
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.nauk.coinfolio.Activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nauk.coinfolio.DataManagers.DatabaseManager;
|
||||
import com.nauk.coinfolio.R;
|
||||
|
||||
public class RecordTransactionActivity extends AppCompatActivity {
|
||||
|
||||
String coin;
|
||||
String symbol;
|
||||
TextView symbolTxtView;
|
||||
Button validateButton;
|
||||
DatabaseManager databaseManager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_record_transaction);
|
||||
|
||||
Intent intent = getIntent();
|
||||
coin = intent.getStringExtra("coin");
|
||||
symbol = intent.getStringExtra("symbol");
|
||||
|
||||
setTitle("Add " + coin + " transaction");
|
||||
|
||||
databaseManager = new DatabaseManager(this);
|
||||
|
||||
validateButton = findViewById(R.id.validateButton);
|
||||
|
||||
validateButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
//databaseManager.addCurrencyToManualCurrency();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,290 @@
|
||||
package com.nauk.coinfolio.Activities;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.preference.RingtonePreference;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.nauk.coinfolio.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A {@link PreferenceActivity} that presents a set of application settings. On
|
||||
* handset devices, settings are presented as a single list. On tablets,
|
||||
* settings are split by category, with category headers shown to the left of
|
||||
* the list of settings.
|
||||
* <p>
|
||||
* See <a href="http://developer.android.com/design/patterns/settings.html">
|
||||
* Android Design: Settings</a> for design guidelines and the <a
|
||||
* href="http://developer.android.com/guide/topics/ui/settings.html">Settings
|
||||
* API Guide</a> for more information on developing a Settings UI.
|
||||
*/
|
||||
public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
|
||||
/**
|
||||
* A preference value change listener that updates the preference's summary
|
||||
* to reflect its new value.
|
||||
*/
|
||||
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object value) {
|
||||
String stringValue = value.toString();
|
||||
|
||||
if (preference instanceof ListPreference) {
|
||||
// For list preferences, look up the correct display value in
|
||||
// the preference's 'entries' list.
|
||||
ListPreference listPreference = (ListPreference) preference;
|
||||
int index = listPreference.findIndexOfValue(stringValue);
|
||||
|
||||
// Set the summary to reflect the new value.
|
||||
preference.setSummary(
|
||||
index >= 0
|
||||
? listPreference.getEntries()[index]
|
||||
: null);
|
||||
|
||||
} else if (preference instanceof RingtonePreference) {
|
||||
// For ringtone preferences, look up the correct display value
|
||||
// using RingtoneManager.
|
||||
if (TextUtils.isEmpty(stringValue)) {
|
||||
// Empty values correspond to 'silent' (no ringtone).
|
||||
preference.setSummary(R.string.pref_ringtone_silent);
|
||||
|
||||
} else {
|
||||
Ringtone ringtone = RingtoneManager.getRingtone(
|
||||
preference.getContext(), Uri.parse(stringValue));
|
||||
|
||||
if (ringtone == null) {
|
||||
// Clear the summary if there was a lookup error.
|
||||
preference.setSummary(null);
|
||||
} else {
|
||||
// Set the summary to reflect the new ringtone display
|
||||
// name.
|
||||
String name = ringtone.getTitle(preference.getContext());
|
||||
preference.setSummary(name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// For all other preferences, set the summary to the value's
|
||||
// simple string representation.
|
||||
preference.setSummary(stringValue);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper method to determine if the device has an extra-large screen. For
|
||||
* example, 10" tablets are extra-large.
|
||||
*/
|
||||
private static boolean isXLargeTablet(Context context) {
|
||||
return (context.getResources().getConfiguration().screenLayout
|
||||
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
if (id == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds a preference's summary to its value. More specifically, when the
|
||||
* preference's value is changed, its summary (line of text below the
|
||||
* preference title) is updated to reflect the value. The summary is also
|
||||
* immediately updated upon calling this method. The exact display format is
|
||||
* dependent on the type of preference.
|
||||
*
|
||||
* @see #sBindPreferenceSummaryToValueListener
|
||||
*/
|
||||
private static void bindPreferenceSummaryToValue(Preference preference) {
|
||||
// Set the listener to watch for value changes.
|
||||
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
|
||||
|
||||
// Trigger the listener immediately with the preference's
|
||||
// current value.
|
||||
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
|
||||
PreferenceManager
|
||||
.getDefaultSharedPreferences(preference.getContext())
|
||||
.getString(preference.getKey(), ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setupActionBar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the {@link android.app.ActionBar}, if the API is available.
|
||||
*/
|
||||
private void setupActionBar() {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
// Show the Up button in the action bar.
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean onIsMultiPane() {
|
||||
return isXLargeTablet(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public void onBuildHeaders(List<Header> target) {
|
||||
loadHeadersFromResource(R.xml.pref_headers, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method stops fragment injection in malicious applications.
|
||||
* Make sure to deny any unknown fragments here.
|
||||
*/
|
||||
protected boolean isValidFragment(String fragmentName) {
|
||||
return PreferenceFragment.class.getName().equals(fragmentName)
|
||||
//|| GeneralPreferenceFragment.class.getName().equals(fragmentName)
|
||||
|| DataSyncPreferenceFragment.class.getName().equals(fragmentName)
|
||||
|| NotificationPreferenceFragment.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);
|
||||
|
||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||
// to their values. When their values change, their summaries are
|
||||
// updated to reflect the new value, per the Android Design
|
||||
// guidelines.
|
||||
bindPreferenceSummaryToValue(findPreference("example_text"));
|
||||
bindPreferenceSummaryToValue(findPreference("example_list"));
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public static class ExchangePreferenceFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.pref_exchange);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
bindPreferenceSummaryToValue(findPreference("hitbtc_publickey"));
|
||||
bindPreferenceSummaryToValue(findPreference("hitbtc_privatekey"));
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This fragment shows notification preferences only. It is used when the
|
||||
* activity is showing a two-pane settings UI.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public static class NotificationPreferenceFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.pref_notification);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||
// to their values. When their values change, their summaries are
|
||||
// updated to reflect the new value, per the Android Design
|
||||
// guidelines.
|
||||
bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This fragment shows data and sync preferences only. It is used when the
|
||||
* activity is showing a two-pane settings UI.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public static class DataSyncPreferenceFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.pref_data_sync);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||
// to their values. When their values change, their summaries are
|
||||
// updated to reflect the new value, per the Android Design
|
||||
// guidelines.
|
||||
bindPreferenceSummaryToValue(findPreference("sync_frequency"));
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,293 @@
|
||||
package com.nauk.coinfolio.DataManagers;
|
||||
|
||||
import android.os.StrictMode;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.volley.AuthFailureError;
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.RequestQueue;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.JsonArrayRequest;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.android.volley.toolbox.Volley;
|
||||
import com.nauk.coinfolio.DataManagers.CurrencyData.Currency;
|
||||
import com.nauk.coinfolio.R;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Created by Tiji on 25/12/2017.
|
||||
*/
|
||||
|
||||
public class BalanceManager {
|
||||
|
||||
private String publicHitKey;
|
||||
private String publicBinanceKey;
|
||||
private String publicPoloniex;
|
||||
private String privateHitKey;
|
||||
private String privateBinanceKey;
|
||||
private String privatePoloniex;
|
||||
final private String hitBalanceUrl = "https://api.hitbtc.com/api/2/trading/balance";
|
||||
final private String detailUrl = "https://www.cryptocompare.com/api/data/coinlist/";
|
||||
final private String binanceBalanceUrl = "https://api.binance.com/api/v3/account";
|
||||
final private String binanceTimeUrl = "https://api.binance.com/api/v1/time";
|
||||
private RequestQueue requestQueue;
|
||||
private List<Currency> hitBalance;
|
||||
private List<Currency> otherBalances;
|
||||
private List<Currency> totalBalance;
|
||||
private android.content.Context context;
|
||||
private Map<String, String> iconUrlList;
|
||||
private Map<String, String> coinList;
|
||||
private PreferencesManager preferenceManager;
|
||||
|
||||
public BalanceManager(android.content.Context context)
|
||||
{
|
||||
this.context = context;
|
||||
preferenceManager = new PreferencesManager(context);
|
||||
requestQueue = Volley.newRequestQueue(context);
|
||||
hitBalance = new ArrayList<Currency>();
|
||||
otherBalances = new ArrayList<Currency>();
|
||||
}
|
||||
|
||||
public List<String> getCurrenciesName()
|
||||
{
|
||||
return new ArrayList<>(coinList.values());
|
||||
}
|
||||
|
||||
public List<String> getCurrenciesSymbol()
|
||||
{
|
||||
return new ArrayList<>(coinList.keySet());
|
||||
}
|
||||
|
||||
public void updateExchangeKeys()
|
||||
{
|
||||
publicHitKey = preferenceManager.getHitBTCPublicKey();
|
||||
privateHitKey = preferenceManager.getHitBTCPrivateKey();
|
||||
}
|
||||
|
||||
public boolean isHitBTCConfigured()
|
||||
{
|
||||
boolean isConfigured = true;
|
||||
|
||||
if(publicHitKey == null || privateHitKey == null)
|
||||
{
|
||||
isConfigured = false;
|
||||
}
|
||||
|
||||
return isConfigured;
|
||||
}
|
||||
|
||||
public void setPublicHitKey(String newKey)
|
||||
{
|
||||
publicHitKey = newKey;
|
||||
}
|
||||
|
||||
public void setPrivateHitKey(String newKey)
|
||||
{
|
||||
privateHitKey = newKey;
|
||||
}
|
||||
|
||||
public List<Currency> getTotalBalance()
|
||||
{
|
||||
return totalBalance;
|
||||
}
|
||||
|
||||
public List<Currency> getHitBalance()
|
||||
{
|
||||
return hitBalance;
|
||||
}
|
||||
|
||||
public List<Currency> getOtherBalances()
|
||||
{
|
||||
return otherBalances;
|
||||
}
|
||||
|
||||
public void updateTotalBalance(final VolleyCallBack callBack)
|
||||
{
|
||||
if(privateHitKey != null && publicHitKey != null && preferenceManager.isHitBTCActivated())
|
||||
{
|
||||
updateHitBalance(callBack);
|
||||
}
|
||||
else
|
||||
{
|
||||
hitBalance = new ArrayList<Currency>();
|
||||
refreshAllBalances(callBack);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateHitBalance(final VolleyCallBack callBack)
|
||||
{
|
||||
JsonArrayRequest arrReq = new JsonArrayRequest(Request.Method.GET, hitBalanceUrl,
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
if (response.length() > 0) {
|
||||
|
||||
parseHitBalance(response);
|
||||
refreshAllBalances(callBack);
|
||||
|
||||
} else {
|
||||
//No balance
|
||||
}
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
Log.e(context.getResources().getString(R.string.debug_volley), "API Error : " + error.toString() + ":");
|
||||
callBack.onError(error.toString());
|
||||
}
|
||||
}
|
||||
) {
|
||||
@Override
|
||||
public Map<String, String> getHeaders()throws AuthFailureError {
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
String credentials = publicHitKey + ":" + privateHitKey;
|
||||
String auth = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);
|
||||
headers.put("Content-Type", "application/json");
|
||||
headers.put("Authorization", auth);
|
||||
|
||||
return headers;
|
||||
}
|
||||
};
|
||||
|
||||
requestQueue.add(arrReq);
|
||||
}
|
||||
|
||||
private void parseHitBalance(JSONArray response)
|
||||
{
|
||||
hitBalance = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < response.length(); i++)
|
||||
{
|
||||
try {
|
||||
JSONObject jsonObj = response.getJSONObject(i);
|
||||
|
||||
if(Float.parseFloat(jsonObj.getString("available")) > 0)
|
||||
{
|
||||
hitBalance.add(new Currency(jsonObj.getString("currency"), Double.parseDouble(jsonObj.getString("available"))));
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
Log.e(context.getResources().getString(R.string.debug_volley), "Invalid JSON Object");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshAllBalances(final VolleyCallBack callBack)
|
||||
{
|
||||
totalBalance = new ArrayList<>();
|
||||
|
||||
totalBalance.addAll(hitBalance);
|
||||
|
||||
for(int i = 0; i < otherBalances.size(); i++)
|
||||
{
|
||||
boolean isIn = false;
|
||||
|
||||
for(int j = 0; j < totalBalance.size(); j++)
|
||||
{
|
||||
if(otherBalances.get(i).getSymbol().equals(totalBalance.get(j).getSymbol()))
|
||||
{
|
||||
totalBalance.get(j).setBalance(totalBalance.get(j).getBalance() + otherBalances.get(i).getBalance());
|
||||
|
||||
isIn = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!isIn)
|
||||
{
|
||||
totalBalance.add(otherBalances.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
callBack.onSuccess();
|
||||
}
|
||||
|
||||
public interface VolleyCallBack {
|
||||
void onSuccess();
|
||||
void onError(String error);
|
||||
}
|
||||
|
||||
public interface IconCallBack {
|
||||
void onSuccess();
|
||||
}
|
||||
|
||||
public void sortCoins()
|
||||
{
|
||||
for(int i = 0; i < totalBalance.size(); i++)
|
||||
{
|
||||
for(int j = i; j < totalBalance.size(); j++)
|
||||
{
|
||||
if(totalBalance.get(j).getBalance() * totalBalance.get(j).getValue() > totalBalance.get(i).getBalance() * totalBalance.get(i).getValue())
|
||||
{
|
||||
Currency temp = totalBalance.get(j);
|
||||
totalBalance.set(j, totalBalance.get(i));
|
||||
totalBalance.set(i, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDetails(final IconCallBack callBack)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return iconUrlList.get(symbol);
|
||||
}
|
||||
|
||||
private void processDetailResult(String response, final IconCallBack callBack)
|
||||
{
|
||||
response = response.substring(response.indexOf("\"Data\"") + 7, response.lastIndexOf("},\"Type\":100}"));
|
||||
String[] tab = response.split(Pattern.quote("},"));
|
||||
|
||||
iconUrlList = new HashMap<>();
|
||||
coinList = new HashMap<>();
|
||||
|
||||
for(int i = 0; i < tab.length; i++)
|
||||
{
|
||||
tab[i] = tab[i].substring(tab[i].indexOf("\":{")+2, tab[i].length()) + "}";
|
||||
try {
|
||||
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||
StrictMode.setThreadPolicy(policy);
|
||||
JSONObject jsonObject = new JSONObject(tab[i]);
|
||||
|
||||
iconUrlList.put(jsonObject.getString("Symbol"), "https://www.cryptocompare.com" + jsonObject.getString("ImageUrl") + "?width=50");
|
||||
|
||||
coinList.put(jsonObject.getString("Symbol"), jsonObject.getString("CoinName"));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
callBack.onSuccess();
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
package com.nauk.coinfolio.DataManagers.CurrencyData;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Tiji on 25/12/2017.
|
||||
*/
|
||||
|
||||
public class Currency {
|
||||
|
||||
private String name;
|
||||
private String symbol;
|
||||
private double value;
|
||||
private double balance;
|
||||
private float dayFluctuationPercentage;
|
||||
private double dayFluctuation;
|
||||
private List<CurrencyDataChart> dayPriceHistory;
|
||||
private CurrencyDataRetriver dataRetriver;
|
||||
private Bitmap icon;
|
||||
|
||||
public Currency(String symbol, double balance)
|
||||
{
|
||||
this.symbol = symbol;
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public Currency(String symbol, String name, double balance)
|
||||
{
|
||||
this.symbol = symbol;
|
||||
this.name = name;
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public Currency(String name, String symbol)
|
||||
{
|
||||
this.name = name;
|
||||
this.symbol = symbol;
|
||||
}
|
||||
|
||||
public void updateDayPriceHistory(android.content.Context context, final CurrencyCallBack callBack)
|
||||
{
|
||||
dataRetriver = new CurrencyDataRetriver(context);
|
||||
dataRetriver.updateLastDayHistory(symbol, new CurrencyDataRetriver.DataChartCallBack() {
|
||||
@Override
|
||||
public void onSuccess(List<CurrencyDataChart> dataChart) {
|
||||
setDayPriceHistory(dataChart);
|
||||
updateDayFluctuation();
|
||||
|
||||
setValue(dataChart.get(dataChart.size() - 1).getClose());
|
||||
|
||||
callBack.onSuccess(Currency.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateName(android.content.Context context, final CurrencyCallBack callBack)
|
||||
{
|
||||
dataRetriver = new CurrencyDataRetriver(context);
|
||||
dataRetriver.updateCurrencyName(symbol, new CurrencyDataRetriver.NameCallBack() {
|
||||
@Override
|
||||
public void onSuccess(String name) {
|
||||
if(name != null)
|
||||
{
|
||||
setName(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
setName("NameNotFound");
|
||||
}
|
||||
|
||||
callBack.onSuccess(Currency.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<CurrencyDataChart> getDayPriceHistory()
|
||||
{
|
||||
return dayPriceHistory;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String newName)
|
||||
{
|
||||
name = newName;
|
||||
}
|
||||
|
||||
public String getSymbol()
|
||||
{
|
||||
return symbol;
|
||||
}
|
||||
|
||||
public double getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(double newValue)
|
||||
{
|
||||
value = newValue;
|
||||
}
|
||||
|
||||
public double getBalance()
|
||||
{
|
||||
return balance;
|
||||
}
|
||||
|
||||
public float getDayFluctuationPercentage()
|
||||
{
|
||||
return dayFluctuationPercentage;
|
||||
}
|
||||
|
||||
public double getDayFluctuation()
|
||||
{
|
||||
return dayFluctuation;
|
||||
}
|
||||
|
||||
public void setBalance(double newBalance)
|
||||
{
|
||||
balance = newBalance;
|
||||
}
|
||||
|
||||
private void setDayPriceHistory(List<CurrencyDataChart> newDataChart)
|
||||
{
|
||||
dayPriceHistory = newDataChart;
|
||||
}
|
||||
|
||||
public void setIcon(Bitmap newIcon)
|
||||
{
|
||||
icon = newIcon;
|
||||
}
|
||||
|
||||
public Bitmap getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
private void updateDayFluctuation()
|
||||
{
|
||||
dayFluctuation = dayPriceHistory.get(dayPriceHistory.size() - 1).getOpen() - dayPriceHistory.get(0).getOpen();
|
||||
|
||||
dayFluctuationPercentage = (float) (dayFluctuation / dayPriceHistory.get(0).getOpen() * 100);
|
||||
}
|
||||
|
||||
public interface CurrencyCallBack {
|
||||
void onSuccess(Currency currency);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.nauk.coinfolio.DataManagers.CurrencyData;
|
||||
|
||||
/**
|
||||
* Created by Tiji on 05/01/2018.
|
||||
*/
|
||||
|
||||
public class CurrencyDataChart {
|
||||
|
||||
long timestamp;
|
||||
double close;
|
||||
double high;
|
||||
double low;
|
||||
double open;
|
||||
|
||||
public CurrencyDataChart(long timestamp, double close, double high, double low, double open)
|
||||
{
|
||||
this.timestamp = timestamp;
|
||||
this.close = close;
|
||||
this.high = high;
|
||||
this.low = low;
|
||||
this.open = open;
|
||||
}
|
||||
|
||||
public double getOpen()
|
||||
{
|
||||
return open;
|
||||
}
|
||||
|
||||
public double getClose()
|
||||
{
|
||||
return close;
|
||||
}
|
||||
|
||||
public long getTimestamp()
|
||||
{
|
||||
return timestamp;
|
||||
}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
package com.nauk.coinfolio.DataManagers.CurrencyData;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.RequestQueue;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.android.volley.toolbox.Volley;
|
||||
import com.nauk.coinfolio.R;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Created by Tiji on 05/01/2018.
|
||||
*/
|
||||
|
||||
public class CurrencyDataRetriver {
|
||||
|
||||
String minuteHistoryUrl = "https://min-api.cryptocompare.com/data/histominute";
|
||||
String hourHistoryUrl = "https://min-api.cryptocompare.com/data/histohour";
|
||||
String dayHistoryUrl = "https://min-api.cryptocompare.com/data/histoday";
|
||||
String nameUrl = "https://api.hitbtc.com/api/2/public/currency/";
|
||||
|
||||
RequestQueue requestQueue;
|
||||
|
||||
android.content.Context context;
|
||||
|
||||
public CurrencyDataRetriver(android.content.Context context)
|
||||
{
|
||||
this.context = context;
|
||||
|
||||
requestQueue = Volley.newRequestQueue(context);
|
||||
}
|
||||
|
||||
public void updateLastHourHistory(String symbolCurrencyFrom, String symbolCyrrencyTo, final DataChartCallBack callBack)
|
||||
{
|
||||
final String requestUrl = minuteHistoryUrl + "?fsym=" + symbolCurrencyFrom + "&tsym=" + symbolCyrrencyTo + "&limit=60";
|
||||
|
||||
StringRequest stringRequest = new StringRequest(Request.Method.GET, requestUrl,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
callBack.onSuccess(processHourResult(response));
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
requestQueue.add(stringRequest);
|
||||
}
|
||||
|
||||
public void updateCurrencyName(String symbol, final NameCallBack callBack)
|
||||
{
|
||||
final String requestUrl = nameUrl + symbol;
|
||||
|
||||
StringRequest stringRequest = new StringRequest(Request.Method.GET, requestUrl,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
response = response.substring(response.indexOf(",") + 13);
|
||||
response = response.substring(0, response.indexOf(",") - 1);
|
||||
|
||||
callBack.onSuccess(response);
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
callBack.onSuccess(null);
|
||||
}
|
||||
});
|
||||
|
||||
requestQueue.add(stringRequest);
|
||||
}
|
||||
|
||||
public void updateLastDayHistory(String symbolCurrencyFrom, String symbolCyrrencyTo, final DataChartCallBack callBack)
|
||||
{
|
||||
final String requestUrl = minuteHistoryUrl + "?fsym=" + symbolCurrencyFrom + "&tsym=" + symbolCyrrencyTo + "&limit=1440";
|
||||
|
||||
StringRequest stringRequest = new StringRequest(Request.Method.GET, requestUrl,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
callBack.onSuccess(processHourResult(response));
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
requestQueue.add(stringRequest);
|
||||
}
|
||||
|
||||
private List<CurrencyDataChart> processHourResult(String response)
|
||||
{
|
||||
List<CurrencyDataChart> dataChart = new ArrayList<>();
|
||||
|
||||
response = response.substring(response.indexOf("Data\":[{") + 7, response.lastIndexOf("}],\"TimeTo"));
|
||||
String[] tab = response.split(Pattern.quote("},{"));
|
||||
for(int i = 0; i < tab.length; i++)
|
||||
{
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
tab[i] = tab[i] + "}";
|
||||
}
|
||||
else
|
||||
{
|
||||
tab[i] = "{" + tab[i] + "}";
|
||||
}
|
||||
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(tab[i]);
|
||||
|
||||
long timestamp = Long.parseLong(jsonObject.getString("time"));
|
||||
double close = Double.parseDouble(jsonObject.getString("close"));
|
||||
double high = Double.parseDouble(jsonObject.getString("high"));
|
||||
double low = Double.parseDouble(jsonObject.getString("low"));
|
||||
double open = Double.parseDouble(jsonObject.getString("open"));
|
||||
|
||||
dataChart.add(new CurrencyDataChart(timestamp, close, high, low, open));
|
||||
|
||||
} catch (JSONException e) {
|
||||
Log.d(context.getResources().getString(R.string.debug_volley), "API Request error: " + e + " index: " + i);
|
||||
}
|
||||
}
|
||||
|
||||
return dataChart;
|
||||
}
|
||||
|
||||
public void updateLastHourHistory(String symbolCurrencyFrom, final DataChartCallBack callBack)
|
||||
{
|
||||
updateLastHourHistory(symbolCurrencyFrom, "USD", callBack);
|
||||
}
|
||||
|
||||
public void updateLastDayHistory(String symbolCurrencyFrom, final DataChartCallBack callBack)
|
||||
{
|
||||
if(!symbolCurrencyFrom.equals("USD"))
|
||||
{
|
||||
updateLastDayHistory(symbolCurrencyFrom, "USD", callBack);
|
||||
}
|
||||
}
|
||||
|
||||
public interface DataChartCallBack {
|
||||
void onSuccess(List<CurrencyDataChart> dataChart);
|
||||
}
|
||||
|
||||
public interface CurrencyDetailCallBack {
|
||||
void onSuccess();
|
||||
}
|
||||
|
||||
public interface NameCallBack {
|
||||
void onSuccess(String name);
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
package com.nauk.coinfolio.DataManagers;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.util.Log;
|
||||
|
||||
import com.nauk.coinfolio.DataManagers.CurrencyData.Currency;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Guitoune on 14/01/2018.
|
||||
*/
|
||||
|
||||
public class DatabaseManager extends SQLiteOpenHelper{
|
||||
|
||||
private static final int DATABASE_VERSION = 4;
|
||||
|
||||
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 KEY_CURRENCY_ID = "idCurrency";
|
||||
private static final String KEY_CURRENCY_SYMBOL = "symbol";
|
||||
private static final String KEY_CURRENCY_NAME = "name";
|
||||
private static final String KEY_CURRENCY_BALANCE = "balance";
|
||||
private static final String KEY_CURRENCY_DATE = "addDate";
|
||||
private static final String KEY_CURRENCY_PURCHASED_PRICE = "purchasedPrice";
|
||||
private static final String KEY_CURRENCY_IS_MINED = "isMined";
|
||||
|
||||
private static final String KEY_EXCHANGE_ID = "idExchange";
|
||||
private static final String KEY_EXCHANGE_NAME = "name";
|
||||
private static final String KEY_EXCHANGE_PUBLIC_KEY = "publicKey";
|
||||
private static final String KEY_EXCHANGE_SECRET_KEY = "secretKey";
|
||||
|
||||
public DatabaseManager(Context context)
|
||||
{
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db)
|
||||
{
|
||||
db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_MANUAL_CURRENCIES + "("
|
||||
+ KEY_CURRENCY_ID + " INTEGER PRIMARY KEY,"
|
||||
+ KEY_CURRENCY_SYMBOL + " VARCHAR(4),"
|
||||
+ KEY_CURRENCY_NAME + " VARCHAR(45),"
|
||||
+ KEY_CURRENCY_BALANCE + " TEXT,"
|
||||
+ KEY_CURRENCY_DATE + " DATE,"
|
||||
+ KEY_CURRENCY_PURCHASED_PRICE + " TEXT,"
|
||||
+ KEY_CURRENCY_IS_MINED + " INTEGER"
|
||||
+ ");");
|
||||
|
||||
db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_EXCHANGE_KEYS + "("
|
||||
+ KEY_EXCHANGE_ID + " INTEGER PRIMARY KEY,"
|
||||
+ KEY_EXCHANGE_NAME + " TEXT,"
|
||||
+ KEY_EXCHANGE_PUBLIC_KEY + " TEXT,"
|
||||
+ KEY_EXCHANGE_SECRET_KEY + " TEXT"
|
||||
+ ");");
|
||||
|
||||
//loadSample(db);
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
onCreate(db);
|
||||
}
|
||||
|
||||
public void addCurrencyToManualCurrency(String symbol, double balance)
|
||||
{
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
values.put(KEY_CURRENCY_SYMBOL, symbol);
|
||||
values.put(KEY_CURRENCY_BALANCE, balance);
|
||||
//values.put(KEY_CURRENCY_DATE, getDate());
|
||||
//values.put(KEY_CURRENCY_PURCHASED_PRICE, something);
|
||||
|
||||
db.insert(TABLE_MANUAL_CURRENCIES, null, values);
|
||||
db.close();
|
||||
}
|
||||
|
||||
public List<Currency> getAllCurrencyFromManualCurrency()
|
||||
{
|
||||
String searchQuerry = "SELECT * FROM " + TABLE_MANUAL_CURRENCIES;
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
Cursor resultatList = db.rawQuery(searchQuerry, null);
|
||||
|
||||
List<Currency> currencyList = new ArrayList<>();
|
||||
|
||||
while(resultatList.moveToNext())
|
||||
{
|
||||
//Currency currency = new Currency(resultatList.getString(1), resultatList.getString(2));
|
||||
Log.d("CrystalVault", "Database result : " + resultatList.getString(1) + " " + resultatList.getString(2) + " " + resultatList.getCount());
|
||||
//currencyList.add(new Currency(resultatList.getString(1), resultatList.getDouble(2)));
|
||||
}
|
||||
|
||||
resultatList.close();
|
||||
|
||||
db.close();
|
||||
|
||||
return currencyList;
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.nauk.coinfolio.DataManagers;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
/**
|
||||
* Created by Guitoune on 09/01/2018.
|
||||
*/
|
||||
|
||||
public class PreferencesManager {
|
||||
|
||||
private static final String currencyListFile = "CustomCurrencies";
|
||||
private static final String preferencesFile = "Preferences";
|
||||
private SharedPreferences settingPreferences;
|
||||
private SharedPreferences currencyList;
|
||||
private SharedPreferences preferencesList;
|
||||
android.content.Context context;
|
||||
|
||||
public PreferencesManager(android.content.Context context)
|
||||
{
|
||||
this.context = context;
|
||||
settingPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
currencyList = context.getSharedPreferences(currencyListFile, 0);
|
||||
preferencesList = context.getSharedPreferences(preferencesFile, 0);
|
||||
}
|
||||
|
||||
public void addCurrency(String symbol, double balance)
|
||||
{
|
||||
SharedPreferences.Editor editor = currencyList.edit();
|
||||
editor.putString(symbol, String.valueOf(balance));
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
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 String getHitBTCPublicKey()
|
||||
{
|
||||
return settingPreferences.getString("hitbtc_publickey", null);
|
||||
}
|
||||
|
||||
public String getHitBTCPrivateKey()
|
||||
{
|
||||
return settingPreferences.getString("hitbtc_privatekey", null);
|
||||
}
|
||||
|
||||
public boolean isHitBTCActivated()
|
||||
{
|
||||
return settingPreferences.getBoolean("enable_hitbtc", false);
|
||||
}
|
||||
|
||||
public void disableHitBTC()
|
||||
{
|
||||
SharedPreferences.Editor editor = settingPreferences.edit();
|
||||
editor.putBoolean("enable_hitbtc", false);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package com.nauk.coinfolio.LayoutManagers;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Filter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.nauk.coinfolio.DataManagers.CurrencyData.Currency;
|
||||
import com.nauk.coinfolio.R;
|
||||
|
||||
/**
|
||||
* Created by Guitoune on 17/01/2018.
|
||||
*/
|
||||
|
||||
public class CurrencyAdapter extends ArrayAdapter<Currency> {
|
||||
|
||||
private ArrayList<Currency> Currencys, tempCurrency, suggestions;
|
||||
private Context context;
|
||||
|
||||
public CurrencyAdapter(Context context, ArrayList<Currency> objects) {
|
||||
super(context, android.R.layout.simple_list_item_1, objects);
|
||||
this.Currencys = objects;
|
||||
this.tempCurrency = new ArrayList<Currency>(objects);
|
||||
this.suggestions = new ArrayList<Currency>(objects);
|
||||
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Currency currency = getItem(position);
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.custom_row, parent, false);
|
||||
}
|
||||
TextView currencyName = (TextView) convertView.findViewById(R.id.currencyName);
|
||||
TextView currencySymbol = (TextView) convertView.findViewById(R.id.currencySymbol);
|
||||
if (currencyName != null)
|
||||
currencyName.setText(currency.getName());
|
||||
if(currencySymbol != null)
|
||||
{
|
||||
currencySymbol.setText(currency.getSymbol());
|
||||
}
|
||||
// Now assign alternate color for rows
|
||||
if (position % 2 == 0)
|
||||
convertView.setBackgroundColor(context.getResources().getColor(R.color.listBackground));
|
||||
else
|
||||
convertView.setBackgroundColor(context.getResources().getColor(R.color.listBackground2));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Filter getFilter() {
|
||||
return myFilter;
|
||||
}
|
||||
|
||||
Filter myFilter = new Filter() {
|
||||
@Override
|
||||
public CharSequence convertResultToString(Object resultValue) {
|
||||
Currency currency = (Currency) resultValue;
|
||||
return currency.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence constraint) {
|
||||
if (constraint != null) {
|
||||
suggestions.clear();
|
||||
|
||||
String temp = constraint.toString().toLowerCase();
|
||||
for (Currency currency : tempCurrency) {
|
||||
if (currency.getName().toLowerCase().startsWith(temp)
|
||||
|| currency.getSymbol().toLowerCase().startsWith(temp)) {
|
||||
suggestions.add(currency);
|
||||
}
|
||||
}
|
||||
|
||||
FilterResults filterResults = new FilterResults();
|
||||
filterResults.values = suggestions;
|
||||
filterResults.count = suggestions.size();
|
||||
return filterResults;
|
||||
} else {
|
||||
return new FilterResults();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void publishResults(CharSequence constraint, FilterResults results) {
|
||||
ArrayList<Currency> c = (ArrayList<Currency>) results.values;
|
||||
if (results != null && results.count > 0) {
|
||||
clear();
|
||||
for (Currency currency : c) {
|
||||
add(currency);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
@ -0,0 +1,334 @@
|
||||
package com.nauk.coinfolio.LayoutManagers;
|
||||
|
||||
import android.animation.AnimatorInflater;
|
||||
import android.animation.StateListAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.db.chart.model.LineSet;
|
||||
import com.db.chart.renderer.AxisRenderer;
|
||||
import com.db.chart.view.LineChartView;
|
||||
import com.nauk.coinfolio.DataManagers.CurrencyData.Currency;
|
||||
import com.nauk.coinfolio.DataManagers.CurrencyData.CurrencyDataChart;
|
||||
import com.nauk.coinfolio.R;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static java.lang.Math.abs;
|
||||
|
||||
/**
|
||||
* Created by Tiji on 05/01/2018.
|
||||
*/
|
||||
|
||||
public class HomeLayoutGenerator {
|
||||
|
||||
android.content.Context context;
|
||||
|
||||
public HomeLayoutGenerator(Context context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public CardView getInfoLayout(Currency currency, int chartColor)
|
||||
{
|
||||
CardView mainCard = new CardView(context);
|
||||
LinearLayout mainLinear = new LinearLayout(context);
|
||||
View separationLine = new View(context);
|
||||
LinearLayout chartLayout = new LinearLayout(context);
|
||||
LinearLayout infoLayout = new LinearLayout(context);
|
||||
LinearLayout separatorLayout = new LinearLayout(context);
|
||||
TextView separatorTextView = new TextView(context);
|
||||
|
||||
StateListAnimator stateListAnimator = AnimatorInflater.loadStateListAnimator(context, R.drawable.cardview_animator);
|
||||
mainCard.setStateListAnimator(stateListAnimator);
|
||||
|
||||
/*int[] attrs = new int[] { R.attr.selectableItemBackground };
|
||||
TypedArray ta = context.obtainStyledAttributes(attrs);
|
||||
Drawable drawable = ta.getDrawable(0);
|
||||
ta.recycle();
|
||||
|
||||
mainCard.setBackground(drawable);*/
|
||||
|
||||
mainCard.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
view.animate();
|
||||
Snackbar.make(view, "This feature is not yet available...", Snackbar.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
});
|
||||
mainCard.setClickable(true);
|
||||
|
||||
CardView.LayoutParams paramsCard = new CardView.LayoutParams(CardView.LayoutParams.MATCH_PARENT, CardView.LayoutParams.WRAP_CONTENT);
|
||||
paramsCard.setMargins(10, 10, 10, 30);
|
||||
|
||||
LinearLayout.LayoutParams paramsInfo = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
paramsInfo.setMargins(10, 10, 10, 10);
|
||||
|
||||
chartLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
|
||||
LinearLayout.LayoutParams separatorParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 3);
|
||||
separatorParams.gravity = Gravity.CENTER_VERTICAL;
|
||||
separatorParams.setMargins(10, 0, 10, 0);
|
||||
|
||||
separationLine.setLayoutParams(separatorParams);
|
||||
separationLine.setBackgroundColor(context.getResources().getColor(R.color.separationLine));
|
||||
|
||||
LinearLayout.LayoutParams separatorLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
separatorLayoutParams.setMargins(10, 0, 10, 0);
|
||||
separatorLayout.setLayoutParams(separatorLayoutParams);
|
||||
|
||||
separatorTextView.setText("Day history");
|
||||
separatorTextView.setTextSize(context.getResources().getDimension(R.dimen.secondaryText));
|
||||
|
||||
separatorLayout.addView(separatorTextView);
|
||||
separatorLayout.addView(separationLine);
|
||||
separatorLayout.setTag("separator_layout");
|
||||
|
||||
infoLayout.setLayoutParams(paramsInfo);
|
||||
infoLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
mainLinear.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
mainLinear.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
mainCard.setLayoutParams(paramsCard);
|
||||
mainCard.setRadius(8);
|
||||
|
||||
infoLayout.addView(topLayoutGenerator(currency.getName(), currency.getSymbol(), currency.getValue(), currency.getIcon()));
|
||||
infoLayout.addView(bottomLayoutGenerator(currency.getSymbol(), currency.getBalance(), currency.getValue() * currency.getBalance(), currency.getDayFluctuationPercentage(), currency.getDayFluctuation()));
|
||||
|
||||
mainLinear.addView(infoLayout);
|
||||
|
||||
LineChartView lineChartView = chartGenerator(currency.getDayPriceHistory(), chartColor);
|
||||
chartLayout.setTag("chart_layout");
|
||||
chartLayout.addView(lineChartView);
|
||||
lineChartView.show();
|
||||
mainLinear.addView(separatorLayout);
|
||||
mainLinear.addView(chartLayout);
|
||||
|
||||
mainCard.addView(mainLinear);
|
||||
|
||||
return mainCard;
|
||||
}
|
||||
|
||||
private LinearLayout topLayoutGenerator(String name, String symbol, double value, Bitmap logo)
|
||||
{
|
||||
LinearLayout mainLayout = new LinearLayout(context);
|
||||
TextView nameTextView = new TextView(context);
|
||||
TextView symbolTextView = new TextView(context);
|
||||
TextView valueTextView = new TextView(context);
|
||||
ImageView currencyIcon = new ImageView(context);
|
||||
|
||||
mainLayout.setOrientation(LinearLayout.HORIZONTAL);
|
||||
mainLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
|
||||
LinearLayout.LayoutParams iconParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
iconParams.setMargins(5, 5, 5, 5);
|
||||
currencyIcon.setLayoutParams(iconParams);
|
||||
currencyIcon.setImageBitmap(logo);
|
||||
|
||||
nameTextView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
nameTextView.setTextSize(context.getResources().getDimension(R.dimen.mainText));
|
||||
nameTextView.setTextColor(context.getResources().getColor(R.color.mainTextViewColor));
|
||||
nameTextView.setGravity(Gravity.LEFT);
|
||||
nameTextView.setText(name);
|
||||
|
||||
symbolTextView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
symbolTextView.setTextSize(context.getResources().getDimension(R.dimen.secondaryText));
|
||||
symbolTextView.setTextColor(context.getResources().getColor(R.color.secondaryTextViewColor));
|
||||
symbolTextView.setGravity(Gravity.LEFT);
|
||||
symbolTextView.setText(" (" + symbol + ")");
|
||||
|
||||
valueTextView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
valueTextView.setTextSize(context.getResources().getDimension(R.dimen.mainText));
|
||||
valueTextView.setTextColor(context.getResources().getColor(R.color.secondaryTextViewColor));
|
||||
valueTextView.setGravity(Gravity.RIGHT);
|
||||
valueTextView.setText("US$" + value);
|
||||
|
||||
mainLayout.addView(currencyIcon);
|
||||
mainLayout.addView(nameTextView);
|
||||
mainLayout.addView(symbolTextView);
|
||||
mainLayout.addView(valueTextView);
|
||||
|
||||
return mainLayout;
|
||||
}
|
||||
|
||||
private LinearLayout bottomLayoutGenerator(String symbol, double owned, double value, float percentageFluctuation, double fluctuation)
|
||||
{
|
||||
LinearLayout mainLayout = new LinearLayout(context);
|
||||
LinearLayout secondaryLayout = new LinearLayout(context);
|
||||
TextView ownedTextView = new TextView(context);
|
||||
TextView valueTextView = new TextView(context);
|
||||
TextView percentageFluctuationTextView = new TextView(context);
|
||||
TextView fluctuationTextView = new TextView(context);
|
||||
|
||||
mainLayout.setOrientation(LinearLayout.HORIZONTAL);
|
||||
mainLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
|
||||
secondaryLayout.setOrientation(LinearLayout.HORIZONTAL);
|
||||
secondaryLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
secondaryLayout.setGravity(Gravity.RIGHT);
|
||||
|
||||
ownedTextView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
ownedTextView.setTextSize(context.getResources().getDimension(R.dimen.mainText));
|
||||
ownedTextView.setTextColor(context.getResources().getColor(R.color.mainTextViewColor));
|
||||
ownedTextView.setGravity(Gravity.LEFT);
|
||||
ownedTextView.setText(numberConformer(owned) + symbol);
|
||||
|
||||
valueTextView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
valueTextView.setTextSize(context.getResources().getDimension(R.dimen.secondaryText));
|
||||
valueTextView.setTextColor(context.getResources().getColor(R.color.secondaryTextViewColor));
|
||||
valueTextView.setGravity(Gravity.LEFT);
|
||||
valueTextView.setText(" (" + numberConformer(value) + "$)");
|
||||
|
||||
percentageFluctuationTextView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
percentageFluctuationTextView.setTextSize(context.getResources().getDimension(R.dimen.mainText));
|
||||
if(percentageFluctuation > 0)
|
||||
{
|
||||
percentageFluctuationTextView.setTextColor(context.getResources().getColor(R.color.increase));
|
||||
}
|
||||
else
|
||||
{
|
||||
percentageFluctuationTextView.setTextColor(context.getResources().getColor(R.color.decrease));
|
||||
}
|
||||
//percentageFluctuationTextView.setGravity(Gravity.RIGHT);
|
||||
percentageFluctuationTextView.setText(numberConformer(percentageFluctuation) + "%");
|
||||
|
||||
fluctuationTextView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
fluctuationTextView.setTextSize(context.getResources().getDimension(R.dimen.secondaryText));
|
||||
if(fluctuation > 0)
|
||||
{
|
||||
fluctuationTextView.setTextColor(context.getResources().getColor(R.color.increase));
|
||||
}
|
||||
else
|
||||
{
|
||||
fluctuationTextView.setTextColor(context.getResources().getColor(R.color.decrease));
|
||||
}
|
||||
//fluctuationTextView.setGravity(Gravity.RIGHT);
|
||||
fluctuationTextView.setText(" (" + numberConformer(fluctuation) + "$)");
|
||||
|
||||
secondaryLayout.addView(percentageFluctuationTextView);
|
||||
secondaryLayout.addView(fluctuationTextView);
|
||||
|
||||
mainLayout.addView(ownedTextView);
|
||||
mainLayout.addView(valueTextView);
|
||||
mainLayout.addView(secondaryLayout);
|
||||
//mainLayout.addView(percentageFluctuationTextView);
|
||||
//mainLayout.addView(fluctuationTextView);
|
||||
|
||||
return mainLayout;
|
||||
}
|
||||
|
||||
private LineChartView chartGenerator(List<CurrencyDataChart> dataChartList, int chartColor)
|
||||
{
|
||||
LineChartView chartView = new LineChartView(context);
|
||||
LineSet lineSet = new LineSet();
|
||||
double valMin;
|
||||
double valMax;
|
||||
int counter = 0;
|
||||
Calendar calendar = Calendar.getInstance(Locale.FRANCE);
|
||||
String hour;
|
||||
String minute;
|
||||
|
||||
valMin = dataChartList.get(0).getOpen();
|
||||
valMax = dataChartList.get(0).getOpen();
|
||||
for(int i = 1; i < dataChartList.size(); i++)
|
||||
{
|
||||
if(valMax < dataChartList.get(i).getOpen())
|
||||
{
|
||||
valMax = dataChartList.get(i).getOpen();
|
||||
}
|
||||
|
||||
if(valMin > dataChartList.get(i).getOpen())
|
||||
{
|
||||
valMin = dataChartList.get(i).getOpen();
|
||||
}
|
||||
}
|
||||
|
||||
chartView.setAxisBorderValues((float) valMin, (float) valMax);
|
||||
chartView.setYLabels(AxisRenderer.LabelPosition.NONE);
|
||||
chartView.setYAxis(false);
|
||||
chartView.setXAxis(false);
|
||||
|
||||
for(int i = 0; i < dataChartList.size(); i+=10)
|
||||
{
|
||||
if(counter == 30)
|
||||
{
|
||||
calendar.setTimeInMillis(dataChartList.get(i).getTimestamp()*1000);
|
||||
|
||||
hour = String.valueOf(calendar.get(Calendar.HOUR_OF_DAY));
|
||||
minute = String.valueOf(calendar.get(Calendar.MINUTE));
|
||||
|
||||
if(hour.length() < 2)
|
||||
{
|
||||
hour = "0" + hour;
|
||||
}
|
||||
|
||||
if(minute.length() < 2)
|
||||
{
|
||||
minute = "0" + minute;
|
||||
}
|
||||
|
||||
lineSet.addPoint(hour + ":" + minute, (float) dataChartList.get(i).getOpen());
|
||||
counter = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
counter++;
|
||||
lineSet.addPoint("", (float) dataChartList.get(i).getOpen());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
lineSet.setSmooth(true);
|
||||
lineSet.setThickness(4);
|
||||
lineSet.setFill(getColorWithAplha(chartColor, 0.5f));
|
||||
lineSet.setColor(chartColor);
|
||||
|
||||
chartView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 500));
|
||||
|
||||
chartView.setTag("Chart");
|
||||
|
||||
chartView.addData(lineSet);
|
||||
|
||||
return chartView;
|
||||
}
|
||||
|
||||
private int getColorWithAplha(int color, float ratio)
|
||||
{
|
||||
int transColor;
|
||||
int alpha = Math.round(Color.alpha(color) * ratio);
|
||||
int r = Color.red(color);
|
||||
int g = Color.green(color);
|
||||
int b = Color.blue(color);
|
||||
transColor = Color.argb(alpha, r, g, b);
|
||||
return transColor ;
|
||||
}
|
||||
|
||||
private String numberConformer(double number)
|
||||
{
|
||||
String str;
|
||||
|
||||
if(abs(number) > 1)
|
||||
{
|
||||
str = String.format("%.2f", number);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = String.format("%.4f", number);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
7
app/src/main/res/anim/fade_in_dialog.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<alpha
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0"
|
||||
android:duration="400" />
|
7
app/src/main/res/anim/fade_out_dialog.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<alpha
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:duration="400" />
|
15
app/src/main/res/anim/zoom_in.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:fillAfter="true" >
|
||||
|
||||
<scale
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="1000"
|
||||
android:fromXScale="1"
|
||||
android:fromYScale="1"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:toXScale="5"
|
||||
android:toYScale="5">
|
||||
</scale>
|
||||
|
||||
</set>
|
15
app/src/main/res/anim/zoom_out.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:fillAfter="true" >
|
||||
|
||||
<scale
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="1000"
|
||||
android:fromXScale="1.0"
|
||||
android:fromYScale="1.0"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:toXScale="0.5"
|
||||
android:toYScale="0.5" >
|
||||
</scale>
|
||||
|
||||
</set>
|
34
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
16
app/src/main/res/drawable/cardview_animator.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- animate the translationZ property of a view when pressed -->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_enabled="true"
|
||||
android:state_pressed="true">
|
||||
<set>
|
||||
<objectAnimator
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:propertyName="translationZ"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="8dp"
|
||||
android:valueType="floatType"/>
|
||||
</set>
|
||||
</item>
|
||||
</selector>
|
5
app/src/main/res/drawable/crystal_background.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<bitmap
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/crystal_cave"
|
||||
/>
|
BIN
app/src/main/res/drawable/crystal_cave.png
Normal file
After Width: | Height: | Size: 7.9 MiB |
13
app/src/main/res/drawable/gradient_background.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:startColor="@color/colorPrimary"
|
||||
android:endColor="@color/colorAccent"
|
||||
android:type="linear"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
18
app/src/main/res/drawable/gradient_button.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape
|
||||
android:shape="rectangle"
|
||||
android:innerRadius="15dp"
|
||||
android:thickness="10dp"
|
||||
android:useLevel="false">
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:startColor="@color/colorPrimaryDark"
|
||||
android:centerColor="@color/colorAccent"
|
||||
android:endColor="@color/colorPrimaryDark"
|
||||
android:type="linear"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
9
app/src/main/res/drawable/ic_add_black_24dp.xml
Normal 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="#FF000000"
|
||||
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</vector>
|
@ -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="#FF000000"
|
||||
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_details_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="36dp"
|
||||
android:height="36dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/listBackground"
|
||||
android:pathData="M3,4l9,16 9,-16L3,4zM6.38,6h11.25L12,16 6.38,6z"/>
|
||||
</vector>
|
@ -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="#FF000000"
|
||||
android:pathData="M22,9L22,7h-2L20,5c0,-1.1 -0.9,-2 -2,-2L4,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2v-2h2v-2h-2v-2h2v-2h-2L20,9h2zM18,19L4,19L4,5h14v14zM6,13h5v4L6,17zM12,7h4v3h-4zM6,7h5v5L6,12zM12,11h4v6h-4z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_info_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zm1,15h-2v-6h2v6zm0,-8h-2V7h2v2z" />
|
||||
</vector>
|
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillColor="#26A69A"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
</vector>
|
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M11.5,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zm6.5,-6v-5.5c0,-3.07 -2.13,-5.64 -5,-6.32V3.5c0,-0.83 -0.67,-1.5 -1.5,-1.5S10,2.67 10,3.5v0.68c-2.87,0.68 -5,3.25 -5,6.32V16l-2,2v1h17v-1l-2,-2z" />
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_settings_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="36dp"
|
||||
android:height="36dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/listBackground"
|
||||
android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_sync_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01,-.25 1.97,-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0,-4.42,-3.58,-8,-8,-8zm0 14c-3.31 0,-6,-2.69,-6,-6 0,-1.01.25,-1.97.7,-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4,-4,-4,-4v3z" />
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_unfold_less_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="36dp"
|
||||
android:height="36dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/listBackground"
|
||||
android:pathData="M7.41,18.59L8.83,20 12,16.83 15.17,20l1.41,-1.41L12,14l-4.59,4.59zM16.59,5.41L15.17,4 12,7.17 8.83,4 7.41,5.41 12,10l4.59,-4.59z"/>
|
||||
</vector>
|
74
app/src/main/res/drawable/icon_crystalvault_background.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#26A69A"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
</vector>
|
11
app/src/main/res/drawable/ripple_animation.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:color="#f816a463"
|
||||
tools:targetApi="lollipop">
|
||||
<item android:id="@android:id/mask">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#f816a463" />
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
15
app/src/main/res/drawable/rounded_corners.xml
Normal 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="#FF888888"/>
|
||||
<!--#88FFFFFF > Dark 88D4D4D4 > Bright-->
|
||||
<corners android:radius="5dp"/>
|
||||
<padding
|
||||
android:left="3dp"
|
||||
android:right="3dp"
|
||||
android:top="3dp"
|
||||
android:bottom="3dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
13
app/src/main/res/drawable/soft_gradient.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:angle="-90"
|
||||
android:startColor="@color/colorPrimary"
|
||||
android:endColor="@color/colorPrimaryDark"
|
||||
android:type="linear"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
31
app/src/main/res/layout/activity_add_currency.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.nauk.coinfolio.Activities.CurrencySelectionActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/soft_gradient"
|
||||
android:gravity="center">
|
||||
|
||||
<!--<EditText
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/rounded_corners"/>-->
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/search_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|top"
|
||||
android:padding="15dp"
|
||||
android:background="@color/listBackground"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
84
app/src/main/res/layout/activity_currency_summary.xml
Normal file
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="com.nauk.coinfolio.Activities.HomeActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/app_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/app_bar_height"
|
||||
android:fitsSystemWindows="true"
|
||||
android:theme="@style/AppTheme.AppBarOverlay"
|
||||
android:background="@drawable/gradient_background">
|
||||
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
android:id="@+id/toolbar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
app:contentScrim="@drawable/gradient_background"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
||||
app:toolbarId="@+id/toolbar">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toolbarSubtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|bottom"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:gravity="center"
|
||||
android:textSize="20dp"
|
||||
app:layout_collapseMode="parallax"/>
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:layout_collapseMode="pin"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
android:background="@drawable/gradient_background">
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_collapseMode="pin"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="left"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/switch_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quick_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_collapseMode="pin"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="right"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/settings_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_settings" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.design.widget.CollapsingToolbarLayout>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<include layout="@layout/content_currency_summary" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
38
app/src/main/res/layout/activity_record_transaction.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.nauk.coinfolio.Activities.RecordTransactionActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currencySymbol"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="25dp"/>
|
||||
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/activity_add_amount"/>
|
||||
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/activity_purchased_price"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/validateButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Validate"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
47
app/src/main/res/layout/content_currency_summary.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/swiperefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.nauk.coinfolio.Activities.HomeActivity"
|
||||
tools:showIn="@layout/activity_currency_summary"
|
||||
android:background="@color/listBackground">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/currencyListLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/addCurrencyButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
style="@style/Widget.AppCompat.Button"
|
||||
android:src="@drawable/ic_add_black_24dp"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
53
app/src/main/res/layout/custom_row.xml
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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="horizontal"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currencyName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="Sample text"
|
||||
android:textColor="@color/mainTextViewColor"
|
||||
android:textSize="15dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currencySymbol"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="Sample text"
|
||||
android:textColor="@color/secondaryTextViewColor"
|
||||
android:textSize="12dp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="end">
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/ic_chevron_right_black_24dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="@color/separationLine"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
10
app/src/main/res/layout/textview_autocompletion.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:textColor="?android:attr/textColorAlertDialogListItem"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="15dip"
|
||||
/>
|
10
app/src/main/res/menu/search_inflater.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_search"
|
||||
android:title="Search"
|
||||
app:actionViewClass="android.support.v7.widget.SearchView"
|
||||
app:showAsAction="always|collapseActionView"/>
|
||||
</menu>
|
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
5
app/src/main/res/mipmap-anydpi-v26/icon_crystalvault.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/icon_crystalvault_background"/>
|
||||
<foreground android:drawable="@mipmap/icon_crystalvault_foreground"/>
|
||||
</adaptive-icon>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/icon_crystalvault_background"/>
|
||||
<foreground android:drawable="@mipmap/icon_crystalvault_foreground"/>
|
||||
</adaptive-icon>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
app/src/main/res/mipmap-hdpi/icon_crystalvault.png
Normal file
After Width: | Height: | Size: 9.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/icon_crystalvault_foreground.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
app/src/main/res/mipmap-hdpi/icon_crystalvault_round.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/icon_crystalvault.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/icon_crystalvault_foreground.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
app/src/main/res/mipmap-mdpi/icon_crystalvault_round.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/icon_crystalvault.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
app/src/main/res/mipmap-xhdpi/icon_crystalvault_foreground.png
Normal file
After Width: | Height: | Size: 86 KiB |
BIN
app/src/main/res/mipmap-xhdpi/icon_crystalvault_round.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/icon_crystalvault.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/icon_crystalvault_foreground.png
Normal file
After Width: | Height: | Size: 179 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/icon_crystalvault_round.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/icon_crystalvault.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/icon_crystalvault_foreground.png
Normal file
After Width: | Height: | Size: 303 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/icon_crystalvault_round.png
Normal file
After Width: | Height: | Size: 56 KiB |
14
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#000046</color>
|
||||
<color name="colorPrimaryDark">#111124</color>
|
||||
<color name="colorAccent">#1CB5E0</color>
|
||||
<color name="mainTextViewColor">#FF000000</color>
|
||||
<color name="secondaryTextViewColor">#FF222222</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="decrease">#FFED143D</color>
|
||||
<color name="increase">#FF00E000</color>
|
||||
<color name="listBackground">#FFEEEEEE</color>
|
||||
<color name="listBackground2">#FFFFFFFF</color>
|
||||
<color name="separationLine">#FF999999</color>
|
||||
</resources>
|
7
app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<resources>
|
||||
<dimen name="app_bar_height">180dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
<dimen name="text_margin">16dp</dimen>
|
||||
<dimen name="mainText">6dp</dimen>
|
||||
<dimen name="secondaryText">5dp</dimen>
|
||||
</resources>
|
119
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,119 @@
|
||||
<resources>
|
||||
<string name="app_name">Coinfolio</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="donation">Fais un don wallah</string>
|
||||
<string name="debug">CrystalVault_debug</string>
|
||||
<string name="debug_volley">CrystalVault_debugVolley</string>
|
||||
<string name="quick_button">Switch view</string>
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
|
||||
<!-- Strings related to Settings -->
|
||||
|
||||
<!-- Example General settings -->
|
||||
<string name="pref_header_general">General</string>
|
||||
|
||||
<string name="pref_title_social_recommendations">Enable social recommendations</string>
|
||||
<string name="pref_description_social_recommendations">Recommendations for people to contact
|
||||
based on your message history
|
||||
</string>
|
||||
|
||||
<string name="pref_title_display_name">Display name</string>
|
||||
<string name="pref_default_display_name">John Smith</string>
|
||||
|
||||
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
|
||||
<string-array name="pref_example_list_titles">
|
||||
<item>Always</item>
|
||||
<item>When possible</item>
|
||||
<item>Never</item>
|
||||
</string-array>
|
||||
<string-array name="pref_example_list_values">
|
||||
<item>1</item>
|
||||
<item>0</item>
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Example settings for Data & Sync -->
|
||||
<string name="pref_header_data_sync">Data & sync</string>
|
||||
|
||||
<string name="pref_title_sync_frequency">Sync frequency</string>
|
||||
<string-array name="pref_sync_frequency_titles">
|
||||
<item>15 minutes</item>
|
||||
<item>30 minutes</item>
|
||||
<item>1 hour</item>
|
||||
<item>3 hours</item>
|
||||
<item>6 hours</item>
|
||||
<item>Never</item>
|
||||
</string-array>
|
||||
<string-array name="pref_sync_frequency_values">
|
||||
<item>15</item>
|
||||
<item>30</item>
|
||||
<item>60</item>
|
||||
<item>180</item>
|
||||
<item>360</item>
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="list_preference_entries">
|
||||
<item>Entry 1</item>
|
||||
<item>Entry 2</item>
|
||||
<item>Entry 3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="list_preference_entry_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="multi_select_list_preference_default_value" />
|
||||
|
||||
<string name="pref_title_system_sync_settings">System sync settings</string>
|
||||
|
||||
<!-- Example settings for Notifications -->
|
||||
<string name="pref_header_notifications">Notifications</string>
|
||||
|
||||
<string name="pref_title_new_message_notifications">New message notifications</string>
|
||||
|
||||
<string name="pref_title_ringtone">Ringtone</string>
|
||||
<string name="pref_ringtone_silent">Silent</string>
|
||||
|
||||
<string name="pref_title_vibrate">Vibrate</string>
|
||||
|
||||
|
||||
<!--Exchange strings-->
|
||||
<string name="pref_header_exchange">Exchanges settings</string>
|
||||
|
||||
<!--HitBTC-->
|
||||
<string name="pref_title_enable_synchronization_hitbtc">Enable synchronization</string>
|
||||
<string name="pref_title_hitbtc_publickey">Public key</string>
|
||||
<string name="pref_title_hitbtc_privatekey">Private key</string>
|
||||
<string name="pref_title_exchange_hitbtc">HitBTC</string>
|
||||
|
||||
<!--GDAX-->
|
||||
<string name="pref_title_enable_synchronization_gdax">Enable synchronization</string>
|
||||
<string name="pref_title_gdax_publickey">Public key</string>
|
||||
<string name="pref_title_gdax_privatekey">Private key</string>
|
||||
<string name="pref_title_exchange_gdax">GDAX</string>
|
||||
|
||||
<!--Binance-->
|
||||
<string name="pref_title_enable_synchronization_binance">Enable synchronization</string>
|
||||
<string name="pref_title_binance_publickey">Public key</string>
|
||||
<string name="pref_title_binance_privatekey">Private key</string>
|
||||
<string name="pref_title_exchange_binance">Binance</string>
|
||||
|
||||
<!--Poloniex-->
|
||||
<string name="pref_title_enable_synchronization_poloniex">Enable synchronization</string>
|
||||
<string name="pref_title_poloniex_publickey">Public key</string>
|
||||
<string name="pref_title_poloniex_privatekey">Private key</string>
|
||||
<string name="pref_title_exchange_poloniex">Poloniex</string>
|
||||
|
||||
<!--Kraken-->
|
||||
<string name="pref_title_enable_synchronization_kraken">Enable synchronization</string>
|
||||
<string name="pref_title_kraken_publickey">Public key</string>
|
||||
<string name="pref_title_kraken_privatekey">Private key</string>
|
||||
<string name="pref_title_exchange_kraken">Kraken</string>
|
||||
|
||||
<!--Add transaction activity-->
|
||||
<string name="activity_add_amount">Amount</string>
|
||||
<string name="activity_purchased_price">Purchased prive</string>
|
||||
</resources>
|
25
app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
<style name="dialog_animation_fade">
|
||||
<item name="android:windowEnterAnimation">@anim/fade_in_dialog</item>
|
||||
<item name="android:windowExitAnimation">@anim/zoom_in</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
21
app/src/main/res/xml/pref_data_sync.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 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="180"
|
||||
android:entries="@array/pref_sync_frequency_titles"
|
||||
android:entryValues="@array/pref_sync_frequency_values"
|
||||
android:key="sync_frequency"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="@string/pref_title_sync_frequency" />
|
||||
|
||||
<!-- This preference simply launches an intent when selected. Use this UI sparingly, per
|
||||
design guidelines. -->
|
||||
<Preference android:title="@string/pref_title_system_sync_settings">
|
||||
<intent android:action="android.settings.SYNC_SETTINGS" />
|
||||
</Preference>
|
||||
|
||||
</PreferenceScreen>
|
150
app/src/main/res/xml/pref_exchange.xml
Normal file
@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/pref_title_exchange_hitbtc">
|
||||
<SwitchPreference
|
||||
android:key="enable_hitbtc"
|
||||
android:title="@string/pref_title_enable_synchronization_hitbtc" />
|
||||
|
||||
<EditTextPreference
|
||||
android:capitalize="words"
|
||||
android:dependency="enable_hitbtc"
|
||||
android:inputType="text"
|
||||
android:key="hitbtc_publickey"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_title_hitbtc_publickey" />
|
||||
|
||||
<EditTextPreference
|
||||
android:capitalize="words"
|
||||
android:dependency="enable_hitbtc"
|
||||
android:inputType="text"
|
||||
android:key="hitbtc_privatekey"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_title_hitbtc_privatekey" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/pref_title_exchange_gdax"
|
||||
android:enabled="false">
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="enable_gdax"
|
||||
android:title="@string/pref_title_enable_synchronization_gdax" />
|
||||
|
||||
<EditTextPreference
|
||||
android:capitalize="words"
|
||||
android:dependency="enable_gdax"
|
||||
android:inputType="text"
|
||||
android:key="gdax_publickey"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_title_gdax_publickey" />
|
||||
|
||||
<EditTextPreference
|
||||
android:capitalize="words"
|
||||
android:dependency="enable_gdax"
|
||||
android:inputType="text"
|
||||
android:key="gdax_privatekey"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_title_gdax_privatekey" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/pref_title_exchange_binance"
|
||||
android:enabled="false">
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="enable_binance"
|
||||
android:title="@string/pref_title_enable_synchronization_binance" />
|
||||
|
||||
<EditTextPreference
|
||||
android:capitalize="words"
|
||||
android:dependency="enable_binance"
|
||||
android:inputType="text"
|
||||
android:key="binance_publickey"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_title_binance_publickey" />
|
||||
|
||||
<EditTextPreference
|
||||
android:capitalize="words"
|
||||
android:dependency="enable_binance"
|
||||
android:inputType="text"
|
||||
android:key="binance_privatekey"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_title_binance_privatekey" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/pref_title_exchange_poloniex"
|
||||
android:enabled="false">
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="enable_poloniex"
|
||||
android:title="@string/pref_title_enable_synchronization_poloniex" />
|
||||
|
||||
<EditTextPreference
|
||||
android:capitalize="words"
|
||||
android:dependency="enable_poloniex"
|
||||
android:inputType="text"
|
||||
android:key="poloniex_publickey"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_title_poloniex_publickey" />
|
||||
|
||||
<EditTextPreference
|
||||
android:capitalize="words"
|
||||
android:dependency="enable_poloniex"
|
||||
android:inputType="text"
|
||||
android:key="poloniex_privatekey"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_title_poloniex_privatekey" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/pref_title_exchange_kraken"
|
||||
android:enabled="false">
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="enable_kraken"
|
||||
android:title="@string/pref_title_enable_synchronization_kraken" />
|
||||
|
||||
<EditTextPreference
|
||||
android:capitalize="words"
|
||||
android:dependency="enable_kraken"
|
||||
android:inputType="text"
|
||||
android:key="kraken_publickey"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_title_kraken_publickey" />
|
||||
|
||||
<EditTextPreference
|
||||
android:capitalize="words"
|
||||
android:dependency="enable_kraken"
|
||||
android:inputType="text"
|
||||
android:key="kraken_privatekey"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_title_kraken_privatekey" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<!--Bittrex-->
|
||||
<!--KuCoin-->
|
||||
|
||||
</PreferenceScreen>
|
33
app/src/main/res/xml/pref_general.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="example_switch"
|
||||
android:summary="@string/pref_description_social_recommendations"
|
||||
android:title="@string/pref_title_social_recommendations" />
|
||||
|
||||
<!-- 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>
|
20
app/src/main/res/xml/pref_headers.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- These settings headers are only used on tablets. -->
|
||||
|
||||
<header
|
||||
android:fragment="com.nauk.coinfolio.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>
|
27
app/src/main/res/xml/pref_notification.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- A 'parent' preference, which enables/disables child preferences (below)
|
||||
when checked/unchecked. -->
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="notifications_new_message"
|
||||
android:title="@string/pref_title_new_message_notifications" />
|
||||
|
||||
<!-- Allows the user to choose a ringtone in the 'notification' category. -->
|
||||
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
|
||||
<!-- NOTE: RingtonePreference's summary should be set to its value by the activity code. -->
|
||||
<RingtonePreference
|
||||
android:defaultValue="content://settings/system/notification_sound"
|
||||
android:dependency="notifications_new_message"
|
||||
android:key="notifications_new_message_ringtone"
|
||||
android:ringtoneType="notification"
|
||||
android:title="@string/pref_title_ringtone" />
|
||||
|
||||
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:dependency="notifications_new_message"
|
||||
android:key="notifications_new_message_vibrate"
|
||||
android:title="@string/pref_title_vibrate" />
|
||||
|
||||
</PreferenceScreen>
|
17
app/src/test/java/com/nauk/coinfolio/ExampleUnitTest.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.nauk.coinfolio;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
27
build.gradle
Normal file
@ -0,0 +1,27 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
17
gradle.properties
Normal file
@ -0,0 +1,17 @@
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Mon Dec 25 21:39:15 CET 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
160
gradlew
vendored
Normal file
@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|