diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b185b0d..8739183 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,6 +7,7 @@
+
-1) {
diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java
index 815e70f..4a8a2de 100644
--- a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java
+++ b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java
@@ -98,6 +98,14 @@ public class BoardActivity extends CustomActivity {
File photoDirectory;
+ /*
+ * For the window animation
+ * */
+ private MediaPlayer mediaPlayer;
+
+
+
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -170,7 +178,7 @@ public class BoardActivity extends CustomActivity {
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
//Log.d(TAG,"surfaceCreated");
- MediaPlayer mediaPlayer = MediaPlayer.create(BoardActivity.this, R.raw.appbar_background);
+ mediaPlayer = MediaPlayer.create(BoardActivity.this, R.raw.appbar_background);
mediaPlayer.setDisplay(mSurfaceView.getHolder());
mediaPlayer.setLooping(true);
mediaPlayer.start();
@@ -271,6 +279,17 @@ public class BoardActivity extends CustomActivity {
loadUserImage();
}
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
+ //Release the media player
+ if(mediaPlayer!=null){
+ mediaPlayer.release();
+ mediaPlayer = null;
+ }
+ }
+
public void loadUserImage(){
//Search for a existing photo
File photoFile = new File(photoDirectory + File.separator + "photo.png");
diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.kt b/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.kt
index 1f3f535..fdeaf06 100644
--- a/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.kt
+++ b/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.kt
@@ -200,6 +200,7 @@ class CreateSeedActivity : CustomActivity() {
val intent = Intent(applicationContext, BackupSeedActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
intent.putExtra("SEED_ID", accountSeed.id)
+ intent.putExtra("newAccount", true)
startActivity(intent)
}
else if (request.status == ValidateCreateBitsharesAccountRequest.StatusCode.ACCOUNT_EXIST) {
diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/CryptoNetAccountSettingsActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/CryptoNetAccountSettingsActivity.java
index 460cfdc..429f6f4 100644
--- a/app/src/main/java/cy/agorise/crystalwallet/activities/CryptoNetAccountSettingsActivity.java
+++ b/app/src/main/java/cy/agorise/crystalwallet/activities/CryptoNetAccountSettingsActivity.java
@@ -56,6 +56,14 @@ public class CryptoNetAccountSettingsActivity extends AppCompatActivity{
private CryptoNetAccount cryptoNetAccount;
+ /*
+ * For the window animation
+ * */
+ private MediaPlayer mediaPlayer;
+
+
+
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -98,7 +106,7 @@ public class CryptoNetAccountSettingsActivity extends AppCompatActivity{
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
//Log.d(TAG,"surfaceCreated");
- MediaPlayer mediaPlayer = MediaPlayer.create(CryptoNetAccountSettingsActivity.this, R.raw.appbar_background);
+ mediaPlayer = MediaPlayer.create(CryptoNetAccountSettingsActivity.this, R.raw.appbar_background);
mediaPlayer.setDisplay(mSurfaceView.getHolder());
mediaPlayer.setLooping(true);
mediaPlayer.start();
@@ -121,6 +129,19 @@ public class CryptoNetAccountSettingsActivity extends AppCompatActivity{
}
}
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
+ //Release the media player
+ if(mediaPlayer!=null){
+ mediaPlayer.release();
+ mediaPlayer = null;
+ }
+ }
+
+
private class SettingsPagerAdapter extends FragmentStatePagerAdapter {
SettingsPagerAdapter(FragmentManager fm) {
super(fm);
diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java
index f0e00d3..1d2d91f 100644
--- a/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java
+++ b/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java
@@ -2,9 +2,11 @@ package cy.agorise.crystalwallet.activities;
import android.arch.lifecycle.ViewModelProviders;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.support.annotation.Nullable;
+import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
@@ -52,6 +54,14 @@ public class IntroActivity extends CustomActivity {
@BindView(R.id.btnImportAccount)
public Button btnImportAccount;
+ /*
+ * For the window animation
+ * */
+ private MediaPlayer mediaPlayer;
+
+
+
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -64,7 +74,7 @@ public class IntroActivity extends CustomActivity {
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
//Log.d(TAG,"surfaceCreated");
- MediaPlayer mediaPlayer = MediaPlayer.create(IntroActivity.this, R.raw.appbar_background);
+ mediaPlayer = MediaPlayer.create(IntroActivity.this, R.raw.appbar_background);
mediaPlayer.setDisplay(mSurfaceView.getHolder());
mediaPlayer.setLooping(true);
mediaPlayer.start();
@@ -146,6 +156,17 @@ public class IntroActivity extends CustomActivity {
startActivity(intent);
}
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
+ //Release the media player
+ if(mediaPlayer!=null){
+ mediaPlayer.release();
+ mediaPlayer = null;
+ }
+ }
+
@OnClick(R.id.btnImportAccount)
public void importAccount() {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java
index a953b05..a17931c 100644
--- a/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java
+++ b/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java
@@ -50,6 +50,14 @@ public class SettingsActivity extends AppCompatActivity{
private SecuritySettingsFragment securitySettingsFragment;
+ /*
+ * For the window animation
+ * */
+ private MediaPlayer mediaPlayer;
+
+
+
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -64,7 +72,7 @@ public class SettingsActivity extends AppCompatActivity{
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
//Log.d(TAG,"surfaceCreated");
- MediaPlayer mediaPlayer = MediaPlayer.create(SettingsActivity.this, R.raw.appbar_background);
+ mediaPlayer = MediaPlayer.create(SettingsActivity.this, R.raw.appbar_background);
mediaPlayer.setDisplay(mSurfaceView.getHolder());
mediaPlayer.setLooping(true);
mediaPlayer.start();
@@ -123,6 +131,17 @@ public class SettingsActivity extends AppCompatActivity{
}
}
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
+ //Release the media player
+ if(mediaPlayer != null){
+ mediaPlayer.release();
+ mediaPlayer = null;
+ }
+ }
+
@OnClick(R.id.ivGoBack)
public void goBack(){
onBackPressed();
diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java
index 4b1e38c..845cb9c 100644
--- a/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java
+++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java
@@ -5,12 +5,17 @@ import android.app.Dialog;
import android.arch.lifecycle.ViewModelProviders;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
+import android.support.v4.app.ActivityCompat;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
+import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -19,6 +24,8 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
+import com.vincent.filepicker.ToastUtil;
+
import java.net.URISyntaxException;
import butterknife.BindView;
@@ -50,6 +57,7 @@ public class ImportAccountOptionsFragment extends DialogFragment {
@BindView(R.id.btnImportBackup)
Button btnImportBackup;
+ private static final int PERMISSION_REQUEST_CODE = 1;
/*
Dialog for loading
@@ -110,18 +118,88 @@ public class ImportAccountOptionsFragment extends DialogFragment {
@OnClick (R.id.btnImportBackup)
public void importBackup(){
- Intent fileIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
- fileIntent.setType("*/*");
- fileIntent.addCategory(Intent.CATEGORY_OPENABLE);
- startActivityForResult(fileIntent, FILE_CONTENT_REQUEST_CODE);
+ if (Build.VERSION.SDK_INT >= 23) {
+ if (checkPermission()) {
+
+ Intent fileIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
+ fileIntent.setType("*/*");
+ fileIntent.addCategory(Intent.CATEGORY_OPENABLE);
+ startActivityForResult(fileIntent, FILE_CONTENT_REQUEST_CODE);
+
+ } else {
+ requestPermission(); // Code for permission
+ }
+ }
+ else {
+
+ Intent fileIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
+ fileIntent.setType("*/*");
+ fileIntent.addCategory(Intent.CATEGORY_OPENABLE);
+ startActivityForResult(fileIntent, FILE_CONTENT_REQUEST_CODE);
+ }
}
@OnClick (R.id.btnImportSeed)
public void importSeed(){
- Intent intent = new Intent(this.getActivity(), ImportSeedActivity.class);
- startActivity(intent);
+
+ if (Build.VERSION.SDK_INT >= 23) {
+
+ if (checkPermission()) {
+
+ Intent intent = new Intent(this.getActivity(), ImportSeedActivity.class);
+ startActivity(intent);
+
+ } else {
+ requestPermission(); // Code for permission
+ }
+ }
+ else {
+ Intent intent = new Intent(this.getActivity(), ImportSeedActivity.class);
+ startActivity(intent);
+ }
+ }
+
+
+ private boolean checkPermission() {
+ int result = ContextCompat.checkSelfPermission(getActivity(), android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
+ if (result == PackageManager.PERMISSION_GRANTED) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+
+ private void requestPermission() {
+
+ Log.i("log", "requestPermission() entered");
+
+ if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
+ Toast.makeText(getActivity(), "Write External Storage permission allows us to do store images. Please allow this permission in App Settings.", Toast.LENGTH_LONG).show();
+ } else {
+ // ActivityCompat.requestPermissions(getActivity(), new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
+ requestPermissions(new String[] {android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
+ }
+ }
+
+
+ @Override
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+
+ switch (requestCode) {
+ case PERMISSION_REQUEST_CODE:
+ if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+
+ Intent intent = new Intent(getActivity(), ImportSeedActivity.class);
+ startActivity(intent);
+
+ } else {
+ ToastUtil.getInstance(getActivity()).showToast(getActivity().getString(R.string.Permission_Denied_WRITE_EXTERNAL_STORAGE));
+ }
+ break;
+ }
}
@Override
diff --git a/app/src/main/java/cy/agorise/crystalwallet/views/CryptoNetBalanceViewHolder.java b/app/src/main/java/cy/agorise/crystalwallet/views/CryptoNetBalanceViewHolder.java
index 1596577..4a2e126 100644
--- a/app/src/main/java/cy/agorise/crystalwallet/views/CryptoNetBalanceViewHolder.java
+++ b/app/src/main/java/cy/agorise/crystalwallet/views/CryptoNetBalanceViewHolder.java
@@ -125,7 +125,9 @@ public class CryptoNetBalanceViewHolder extends RecyclerView.ViewHolder {
preferedCurrencySetting.observe((LifecycleOwner)this.itemView.getContext(), new Observer() {
@Override
public void onChanged(@Nullable GeneralSetting generalSetting) {
- preferredCurrency = generalSetting.getValue();
+ if(generalSetting != null){
+ preferredCurrency = generalSetting.getValue();
+ }
}
});
diff --git a/app/src/main/res/layout/crypto_net_account_activity_settings.xml b/app/src/main/res/layout/crypto_net_account_activity_settings.xml
index d832726..425946c 100644
--- a/app/src/main/res/layout/crypto_net_account_activity_settings.xml
+++ b/app/src/main/res/layout/crypto_net_account_activity_settings.xml
@@ -56,8 +56,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
- android:text="Account Settings"
- android:textColor="@color/gray"
+ android:text="@string/Account_Settings"
+ android:textColor="@color/semiTransparentWhite"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
diff --git a/app/src/main/res/layout/fragment_import_account_options.xml b/app/src/main/res/layout/fragment_import_account_options.xml
index dc12e70..0ed744c 100644
--- a/app/src/main/res/layout/fragment_import_account_options.xml
+++ b/app/src/main/res/layout/fragment_import_account_options.xml
@@ -32,9 +32,10 @@
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
- app:layout_constraintTop_toBottomOf="@id/tvDescription"
+ app:layout_constraintEnd_toEndOf="@id/tvDescription"
+ app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@id/tvDescription"
- app:layout_constraintEnd_toEndOf="@id/tvDescription"/>
+ app:layout_constraintTop_toBottomOf="@id/tvDescription" />