diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index a5f05cd..2370474 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -21,5 +21,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index c8a7c96..9ef7b34 100644
--- a/README.md
+++ b/README.md
@@ -8,8 +8,20 @@ Dogecoin Price is an Android app that allows you to see the current Dogecoin pri
### Versions
+- [v0.2](https://github.com/D3nn7/Dogecoin-Price-Android/releases/tag/v0.2)
+ - Darkmode fixed
+ - Binance Button fixed
+ - Offlinemode fixed
+ - Disabled APP Rotation.
+ - add custom amount of Dogecoin feature
- [v0.1](https://github.com/D3nn7/Dogecoin-Price-Android/releases/tag/v0.1) UI & Basic funcionality
## License – Much license ⚖️
Dogecoin Price is released under the terms of the MIT license. See
[opensource.org](https://opensource.org/licenses/MIT)
+
+## Special Thanks to️
+- [Dogecoin](https://dogecoin.com) for the best Coin i ever seen.
+- [Binance](https://binance.com) for current price data.
+- [FontAwesome](https://fontawesome.com) for the icons. [License](https://fontawesome.com/license)
+- [Volley Library](https://github.com/google/volley) for the HTTP Libary. [License](https://github.com/google/volley/blob/master/LICENSE)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 85723cc..4202eb9 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -13,15 +13,16 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.CryptKurs">
-
+
-
-
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/danny/cryptkurs/MainActivity.java b/app/src/main/java/com/danny/cryptkurs/MainActivity.java
index 824c959..ddbe94a 100644
--- a/app/src/main/java/com/danny/cryptkurs/MainActivity.java
+++ b/app/src/main/java/com/danny/cryptkurs/MainActivity.java
@@ -1,20 +1,24 @@
package com.danny.cryptkurs;
-import androidx.annotation.RequiresApi;
+import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
-import android.app.Application;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
+import android.content.SharedPreferences;
+import android.content.res.Configuration;
import android.net.Uri;
-import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
+import android.text.InputType;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
@@ -26,18 +30,43 @@
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
-import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
+
public class MainActivity extends AppCompatActivity {
+ SharedPreferences preferences = null;
+ String storedDoge = "1";
+ TextView DogeAmount = null;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+ DogeAmount = (TextView)findViewById(R.id.doge);
RelativeLayout BuyBTN =(RelativeLayout)findViewById(R.id.buyBTN);
+ LinearLayout changeDogeAmount =(LinearLayout)findViewById(R.id.doge_container);
+
+ preferences = getSharedPreferences("com.danny.cryptkurs", 0);
+ if (preferences.getBoolean("firstrun", true)) {
+
+ SharedPreferences.Editor preferencesEditor = preferences.edit();
+ preferencesEditor.putString("AMOUNT", "1");
+ preferencesEditor.apply();
+
+ preferences.edit().putBoolean("firstrun", false).apply();
+ } else {
+ preferences = getSharedPreferences("com.danny.cryptkurs", 0);
+ storedDoge = preferences.getString("AMOUNT", "1");
+ }
+
+
+ DogeAmount.setText(storedDoge);
BuyBTN.setOnClickListener(new View.OnClickListener(){
@Override
@@ -49,16 +78,64 @@ public void onClick(View v){
}
});
+ changeDogeAmount.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v){
+ changeDoge();
+ }
+ });
+
content();
}
+ private void changeDoge()
+ {
+ preferences = getSharedPreferences("com.danny.cryptkurs", 0);
+ String getAmount = preferences.getString("AMOUNT", "1");
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setMessage(R.string.set_doge_message);
+ final EditText input = new EditText(this);
+ input.setInputType(InputType.TYPE_CLASS_NUMBER);
+ input.setRawInputType(Configuration.KEYBOARD_12KEY);
+ input.setText(getAmount);
+ builder.setView(input);
+ builder.setPositiveButton(R.string.set, new DialogInterface.OnClickListener(){
+
+ public void onClick(DialogInterface dialog,int id){
+ String newDogeAmount = input.getText().toString();
+
+ SharedPreferences.Editor preferencesEditor = preferences.edit();
+ preferencesEditor.putString("AMOUNT", newDogeAmount);
+ preferencesEditor.apply();
+
+ String getNewAmount = preferences.getString("AMOUNT", "1");
+ DogeAmount = (TextView)findViewById(R.id.doge);
+ DogeAmount.setText(getNewAmount);
+
+ dialog.dismiss();
+ content();
+ }
+ });
+ builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener(){
+ public void onClick(DialogInterface dialog,int id){
+ if(dialog!=null){
+ dialog.dismiss();
+ }
+ }
+ });
+
+ AlertDialog alertDialog=builder.create();
+ alertDialog.show();
+ }
+
private void content()
{
getDogePrice("https://api.binance.com/api/v3/ticker/price?symbol=DOGEEUR");
getDogePrice("https://api.binance.com/api/v3/ticker/price?symbol=DOGEBUSD");
getDogePrice("https://api.binance.com/api/v3/ticker/price?symbol=DOGEBTC");
- refresh(15000);
+ refresh(8000);
}
private void refresh(int milliseconds)
@@ -89,6 +166,7 @@ public void onResponse(String string) {
public void onErrorResponse(VolleyError volleyError) {
if (volleyError instanceof NetworkError) {
setErrorIntent();
+
} else {
Toast.makeText(getApplicationContext(), "can't get data...", Toast.LENGTH_SHORT).show();
}
@@ -103,6 +181,7 @@ private void setErrorIntent()
{
Intent offlineIntent = new Intent(this, OfflineActivity.class);
startActivity(offlineIntent);
+ finish();
}
public void parseJsonData(String jsonString) {
@@ -111,18 +190,29 @@ public void parseJsonData(String jsonString) {
String currencyPrice = object.getString("price");
String currencySymbol = object.getString("symbol");
+ preferences = getSharedPreferences("com.danny.cryptkurs", 0);
+ storedDoge = preferences.getString("AMOUNT", "1");
+
+ DecimalFormat df = new DecimalFormat("0", DecimalFormatSymbols.getInstance(Locale.ENGLISH));
+ df.setMaximumFractionDigits(340);
+ String calculateCurrencyPrice = df.format(Double.parseDouble(currencyPrice) * Integer.parseInt(storedDoge));
+ String calculatedPrice = null;
+
switch (currencySymbol) {
case "DOGEEUR":
+ calculatedPrice = round(calculateCurrencyPrice, false);
TextView DogeEuroTextView = (TextView) findViewById(R.id.euroPrice);
- DogeEuroTextView.setText(currencyPrice);
+ DogeEuroTextView.setText(calculatedPrice);
break;
case "DOGEBTC":
+ calculatedPrice = round(calculateCurrencyPrice, true);
TextView DogeBTCTextView = (TextView) findViewById(R.id.btcPrice);
- DogeBTCTextView.setText(currencyPrice);
+ DogeBTCTextView.setText(calculatedPrice);
break;
case "DOGEBUSD":
+ calculatedPrice = round(calculateCurrencyPrice, false);
TextView DogeBUSDTextView = (TextView) findViewById(R.id.usdPrice);
- DogeBUSDTextView.setText(currencyPrice);
+ DogeBUSDTextView.setText(calculatedPrice);
break;
default:
break;
@@ -132,6 +222,26 @@ public void parseJsonData(String jsonString) {
}
}
+ private String round(String stringValue, boolean isBTC) {
+ double value = Double.parseDouble(stringValue);
+
+ if (isBTC) {
+ value = value * 10000000;
+ value = (int) value;
+ value = (double) value / 10000000;
+ } else {
+ value = value * 1000;
+ value = (int) value;
+ value = (double) value / 1000;
+ }
+
+ DecimalFormat df = new DecimalFormat("0", DecimalFormatSymbols.getInstance(Locale.ENGLISH));
+ df.setMaximumFractionDigits(340);
+ String result = df.format(value);
+
+ return result;
+ }
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.doge_info, menu);
diff --git a/app/src/main/res/drawable/pen_edit.png b/app/src/main/res/drawable/pen_edit.png
new file mode 100644
index 0000000..ce98cb8
Binary files /dev/null and b/app/src/main/res/drawable/pen_edit.png differ
diff --git a/app/src/main/res/layout/activity_info.xml b/app/src/main/res/layout/activity_info.xml
index 410d2f5..63b43c9 100644
--- a/app/src/main/res/layout/activity_info.xml
+++ b/app/src/main/res/layout/activity_info.xml
@@ -69,8 +69,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/links"
+ android:id="@+id/thirdparty"
android:layout_marginTop="20dp"
- android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index b346098..506ccef 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -20,7 +20,6 @@
android:layout_marginTop="40dp"
android:layout_centerHorizontal="true"
android:src="@drawable/doge_logo"/>
-
-
+ android:orientation="horizontal"
+ android:id="@+id/doge_container">
+
+
+
+
@@ -110,39 +128,43 @@
+
+ android:background="@color/doge3"
+ android:padding="5dp">
+
+ android:paddingBottom="10dp">
+
+ android:text="Buy on Binance"
+ android:textSize="17sp" />
+
+ android:textSize="10sp" />
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
index de4f0d5..821dc89 100644
--- a/app/src/main/res/values-night/themes.xml
+++ b/app/src/main/res/values-night/themes.xml
@@ -1,6 +1,6 @@
-
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a8384ba..6e06768 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,10 +1,16 @@
Dogecoin Price
current price
- 1 Ð ≈
+ 1
Info
created by
D3nn7
Third Party
Special Thanks to
+ cancel
+ set
+ Set you amount of Dogecoin
+ Ð ≈
+ version:
+ v0.2
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index de4f0d5..821dc89 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -1,6 +1,6 @@
-
\ No newline at end of file