feat_androidx_migration
Javier Varona 2018-10-03 21:57:44 -04:00
commit 6a5ac7cc58
14 changed files with 227 additions and 28 deletions

View File

@ -7,6 +7,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.CAMERA" />
<application
android:name=".application.CrystalApplication"

View File

@ -43,6 +43,14 @@ public class AccountSettingsActivity extends AppCompatActivity{
@BindView(R.id.tvBuildVersion)
public TextView tvBuildVersion;
/*
* For the window animation
* */
private MediaPlayer mediaPlayer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -57,7 +65,7 @@ public class AccountSettingsActivity extends AppCompatActivity{
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
//Log.d(TAG,"surfaceCreated");
MediaPlayer mediaPlayer = MediaPlayer.create(AccountSettingsActivity.this, R.raw.appbar_background);
mediaPlayer = MediaPlayer.create(AccountSettingsActivity.this, R.raw.appbar_background);
mediaPlayer.setDisplay(mSurfaceView.getHolder());
mediaPlayer.setLooping(true);
mediaPlayer.start();
@ -83,6 +91,19 @@ public class AccountSettingsActivity extends AppCompatActivity{
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager));
}
@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);

View File

@ -10,6 +10,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
@ -34,6 +35,7 @@ public class BackupSeedActivity extends AppCompatActivity {
@BindView(R.id.btnCopy)
Button btnCopy;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -41,6 +43,15 @@ public class BackupSeedActivity extends AppCompatActivity {
ButterKnife.bind(this);
/*
* If comes from new account creation hide the cancel button
* */
Bundle b = getIntent().getExtras();
boolean newAccount = b.getBoolean("newAccount");
if(newAccount ){
btnOk.setVisibility(View.INVISIBLE);
}
long seedId = getIntent().getLongExtra("SEED_ID",-1);
if (seedId > -1) {

View File

@ -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");

View File

@ -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) {

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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

View File

@ -125,7 +125,9 @@ public class CryptoNetBalanceViewHolder extends RecyclerView.ViewHolder {
preferedCurrencySetting.observe((LifecycleOwner)this.itemView.getContext(), new Observer<GeneralSetting>() {
@Override
public void onChanged(@Nullable GeneralSetting generalSetting) {
preferredCurrency = generalSetting.getValue();
if(generalSetting != null){
preferredCurrency = generalSetting.getValue();
}
}
});

View File

@ -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"

View File

@ -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" />
<Button
android:id="@+id/btnImportSeed"

View File

@ -8,19 +8,20 @@
tools:context=".activities.CreateSeedActivity">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true">
<android.support.design.widget.TextInputLayout
android:id="@+id/tilPin"
android:layout_width="290dp"
android:layout_width="330dp"
android:layout_marginTop="40dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true">
<cy.agorise.crystalwallet.views.natives.CustomTextInputEditText
android:id="@+id/etPin"
android:layout_width="match_parent"
android:layout_width="330dp"
android:layout_height="wrap_content"
android:hint="@string/txt_6_digits_pin"
android:inputType="number"
@ -31,7 +32,7 @@
<android.support.design.widget.TextInputLayout
android:id="@+id/tilPinConfirmation"
android:layout_width="290dp"
android:layout_width="330dp"
android:layout_height="wrap_content"
android:layout_below="@+id/tilPin"
android:layout_marginTop="8dp"
@ -39,7 +40,7 @@
<cy.agorise.crystalwallet.views.natives.CustomTextInputEditText
android:id="@+id/etPinConfirmation"
android:layout_width="match_parent"
android:layout_width="330dp"
android:layout_height="wrap_content"
android:hint="@string/txt_6_digits_pin_confirm"
android:inputType="number"
@ -48,10 +49,9 @@
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/etSeedWordsLayout"
android:layout_width="290dp"
android:layout_width="330dp"
android:layout_height="wrap_content"
android:layout_below="@+id/tilPinConfirmation"
android:layout_marginTop="8dp"
@ -59,7 +59,7 @@
<cy.agorise.crystalwallet.views.natives.CustomTextInputEditText
android:id="@+id/etSeedWords"
android:layout_width="match_parent"
android:layout_width="330dp"
android:layout_height="120dp"
android:hint="@string/Seed"
android:inputType="textMultiLine" />
@ -68,7 +68,7 @@
<android.support.design.widget.TextInputLayout
android:id="@+id/tilAccountName"
android:layout_width="290dp"
android:layout_width="330dp"
android:layout_height="wrap_content"
android:layout_below="@+id/etSeedWordsLayout"
android:layout_marginTop="8dp"
@ -76,7 +76,7 @@
<cy.agorise.crystalwallet.views.natives.CustomTextInputEditText
android:id="@+id/etAccountName"
android:layout_width="match_parent"
android:layout_width="330dp"
android:layout_height="wrap_content"
android:digits="abcdefghijklmnopqrstuvwxyz1234567890 -"
android:hint="@string/txt_account_name"
@ -91,8 +91,9 @@
android:id="@+id/linearlayoutButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/tilAccountName"
android:layout_marginTop="20dp">
android:layout_marginTop="40dp">
<Button
android:id="@+id/btnCancel"

View File

@ -18,6 +18,8 @@
<string name="You_dont_have_transactions">You dont have transactions</string>
<string name="You_dont_have_contacts">You dont have contacts</string>
<string name="Permission_Denied_WRITE_EXTERNAL_STORAGE">Permission Denied, You cannot use local drive.</string>
<string name="account_create_register_or_import">ACCOUNT CREATE/REGISTER OR IMPORT</string>
<string name="txt_account_name">Account Name</string>
<string name="time_stamp">Time stamp</string>
@ -523,6 +525,7 @@
<string name="Account_already_exists">Account already exists</string>
<string name="connection_status">Connection status</string>
<string name="people_icon">People icon</string>
<string name="Account_Settings">Account Settings</string>
<string name="camera_feed_to_scan_qr">Camera feed to scan QR</string>
<string name="create_account">Create Account</string>
<string name="import_account">Import Account</string>