This commit is contained in:
Javier Varona 2018-09-21 00:46:18 -04:00
commit 5356331a25
11 changed files with 215 additions and 93 deletions

View file

@ -39,11 +39,6 @@ public class BackupSeedActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.backup_seed); setContentView(R.layout.backup_seed);
//Note: Test porpouses
/*final TextView textView = findViewById(R.id.tvBrainKey);
textView.setText("sakk902909321o p3k21kldsa0'dsa90'e930eidakdñsakdñlsakdi90i03 2i90idopsasakk902909321op3k21 kldsa0'dsa90'e930eid akdñsakdñlsakdi90i032i90idopsa");
*/
ButterKnife.bind(this); ButterKnife.bind(this);
long seedId = getIntent().getLongExtra("SEED_ID",-1); long seedId = getIntent().getLongExtra("SEED_ID",-1);
@ -61,17 +56,22 @@ public class BackupSeedActivity extends AppCompatActivity {
accountSeedViewModel.loadSeed(seedId); accountSeedViewModel.loadSeed(seedId);
} else { } else {
finish(); finish();
} }
} }
@OnClick(R.id.btnCancel) @OnClick(R.id.btnCancel)
public void btnCancelClick(){
Intent intent = new Intent(this, BoardActivity.class);
startActivity(intent);
finish();
}
@OnClick(R.id.btnOK)
public void btnOkClick(){ public void btnOkClick(){
Intent intent = new Intent(this, BoardActivity.class); Intent intent = new Intent(this, BoardActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent); startActivity(intent);
//finish(); finish();
} }
/* /*

View file

@ -120,50 +120,50 @@ public class BoardActivity extends CustomActivity {
* Listener tabLayout to resalt text when clicked * Listener tabLayout to resalt text when clicked
* */ * */
final TabLayout tabLayoutFinal = tabLayout; final TabLayout tabLayoutFinal = tabLayout;
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { // tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override // @Override
public void onTabSelected(final TabLayout.Tab tab) { // public void onTabSelected(final TabLayout.Tab tab) {
//
globalActivity.runOnUiThread(new Runnable() { // globalActivity.runOnUiThread(new Runnable() {
@Override // @Override
public void run() { // public void run() {
//
LinearLayout tabLayout = (LinearLayout)((ViewGroup) tabLayoutFinal.getChildAt(0)).getChildAt(tab.getPosition()); // LinearLayout tabLayout = (LinearLayout)((ViewGroup) tabLayoutFinal.getChildAt(0)).getChildAt(tab.getPosition());
tabLayout.setBackgroundColor(Color.TRANSPARENT); // tabLayout.setBackgroundColor(Color.TRANSPARENT);
TextView tabTextView = (TextView) tabLayout.getChildAt(1); // TextView tabTextView = (TextView) tabLayout.getChildAt(1);
//tabTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP ,50); // //tabTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP ,50);
Spannable WordtoSpan = new SpannableString(tabTextView.getText()); // Spannable WordtoSpan = new SpannableString(tabTextView.getText());
WordtoSpan.setSpan(new ForegroundColorSpan(Color.WHITE), 0, tabTextView.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // WordtoSpan.setSpan(new ForegroundColorSpan(Color.WHITE), 0, tabTextView.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
tabTextView.setText(WordtoSpan); // tabTextView.setText(WordtoSpan);
tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.BOLD); // tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.BOLD);
} // }
}); // });
} // }
//
@Override // @Override
public void onTabUnselected(final TabLayout.Tab tab) { // public void onTabUnselected(final TabLayout.Tab tab) {
//
globalActivity.runOnUiThread(new Runnable() { // globalActivity.runOnUiThread(new Runnable() {
@Override // @Override
public void run() { // public void run() {
//
LinearLayout tabLayout = (LinearLayout)((ViewGroup) tabLayoutFinal.getChildAt(0)).getChildAt(tab.getPosition()); // LinearLayout tabLayout = (LinearLayout)((ViewGroup) tabLayoutFinal.getChildAt(0)).getChildAt(tab.getPosition());
TextView tabTextView = (TextView) tabLayout.getChildAt(1); // TextView tabTextView = (TextView) tabLayout.getChildAt(1);
//tabTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP ,50); // //tabTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP ,50);
Spannable WordtoSpan = new SpannableString(tabTextView.getText()); // Spannable WordtoSpan = new SpannableString(tabTextView.getText());
WordtoSpan.setSpan(new ForegroundColorSpan(globalActivity.getResources().getColor(R.color.lightGrayClear)), 0, tabTextView.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // WordtoSpan.setSpan(new ForegroundColorSpan(globalActivity.getResources().getColor(R.color.lightGrayClear)), 0, tabTextView.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
tabTextView.setText(WordtoSpan); // tabTextView.setText(WordtoSpan);
tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.NORMAL); // tabTextView.setTypeface(tabTextView.getTypeface(), Typeface.NORMAL);
} // }
}); // });
} // }
//
@Override // @Override
public void onTabReselected(TabLayout.Tab tab) { // public void onTabReselected(TabLayout.Tab tab) {
//
//
} // }
}); // });
// Appbar animation // Appbar animation
mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
@ -234,12 +234,19 @@ public class BoardActivity extends CustomActivity {
.setInterpolator(new LinearInterpolator()).start(); .setInterpolator(new LinearInterpolator()).start();
break; break;
default: case 2:
fabReceive.hide(); fabReceive.hide();
fabSend.hide(); fabSend.hide();
fabAddContact.animate().translationY(0) fabAddContact.animate().translationY(0)
.setInterpolator(new LinearInterpolator()).start(); .setInterpolator(new LinearInterpolator()).start();
break; break;
default:
fabReceive.hide();
fabSend.hide();
fabAddContact.animate().translationY(fabDistanceToHide)
.setInterpolator(new LinearInterpolator()).start();
break;
} }
} }

View file

@ -9,8 +9,9 @@ import android.widget.Toast
import butterknife.ButterKnife import butterknife.ButterKnife
import butterknife.OnClick import butterknife.OnClick
import butterknife.OnTextChanged import butterknife.OnTextChanged
import com.vincent.filepicker.ToastUtil
import cy.agorise.crystalwallet.R import cy.agorise.crystalwallet.R
import cy.agorise.crystalwallet.dialogs.material.CrystalDialog import cy.agorise.crystalwallet.dialogs.material.*
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests
import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest
import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest
@ -167,39 +168,61 @@ class CreateSeedActivity : CustomActivity() {
@OnClick(R.id.btnCreate) @OnClick(R.id.btnCreate)
fun createSeed() { fun createSeed() {
// Make request to create a bitshare account /*
val request = ValidateCreateBitsharesAccountRequest(tietAccountName?.getText().toString(), applicationContext) * Question if continue or not
* */
//DTVV: Friday 27 July 2018 var questionDialog:QuestionDialog = QuestionDialog(globalActivity)
//Makes dialog to tell the user that the account is been created questionDialog.setText(getString(R.string.continue_question))
val creatingAccountMaterialDialog = CrystalDialog(this) questionDialog.setOnNegative(object : NegativeResponse{
creatingAccountMaterialDialog.setText(this.resources.getString(R.string.window_create_seed_DialogMessage)) override fun onNegative(dialogMaterial: DialogMaterial) {
creatingAccountMaterialDialog.progress() dialogMaterial.dismiss()
this@CreateSeedActivity.runOnUiThread {
creatingAccountMaterialDialog.show()
}
request.setListener {
creatingAccountMaterialDialog.dismiss()
if (request.status == ValidateCreateBitsharesAccountRequest.StatusCode.SUCCEEDED) {
val accountSeed = request.account
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)
startActivity(intent)
} else {
fieldsValidator.validate()
} }
} })
questionDialog.setOnPositive(object : PositiveResponse{
override fun onPositive() {
(object : Thread() { // Make request to create a bitshare account
override fun run() { var accountName:String = tietAccountName?.getText().toString().trim()
val request = ValidateCreateBitsharesAccountRequest(accountName, applicationContext)
/* //DTVV: Friday 27 July 2018
* //Makes dialog to tell the user that the account is been created
* Run thread*/ val creatingAccountMaterialDialog = CrystalDialog(globalActivity)
CryptoNetInfoRequests.getInstance().addRequest(request) creatingAccountMaterialDialog.setText(globalActivity.resources.getString(R.string.window_create_seed_DialogMessage))
creatingAccountMaterialDialog.progress()
this@CreateSeedActivity.runOnUiThread {
creatingAccountMaterialDialog.show()
}
request.setListener {
creatingAccountMaterialDialog.dismiss()
if (request.status == ValidateCreateBitsharesAccountRequest.StatusCode.SUCCEEDED) {
val accountSeed = request.account
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)
startActivity(intent)
}
else if (request.status == ValidateCreateBitsharesAccountRequest.StatusCode.ACCOUNT_EXIST) {
ToastUtil.getInstance(globalActivity).showToast(globalActivity.getString(R.string.Account_already_exists))
disableCreate()
}
else {
fieldsValidator.validate()
}
}
(object : Thread() {
override fun run() {
/*
*
* Run thread*/
CryptoNetInfoRequests.getInstance().addRequest(request)
}
}).start()
} }
}).start() })
questionDialog.show()
} }
/* /*

View file

@ -219,7 +219,7 @@ public abstract class BitsharesFaucetApiGenerator {
public interface IWebService { public interface IWebService {
@Headers({"Content-Type: application/json"}) @Headers({"Content-Type: application/json"})
@POST("/api/v1/accounts") @POST("/faucet/api/v1/accounts")
Call<RegisterAccountResponse> getReg(@Body Map<String, HashMap> params); Call<RegisterAccountResponse> getReg(@Body Map<String, HashMap> params);
} }

View file

@ -32,7 +32,7 @@ public abstract class BitsharesConstant {
//testnet faucet //testnet faucet
//public final static String FAUCET_URL = "http://185.208.208.147:5010"; //public final static String FAUCET_URL = "http://185.208.208.147:5010";
public final static String FAUCET_URL = "https://faucet.palmpay.io"; public final static String FAUCET_URL = "https://de.palmpay.io";
public final static String EQUIVALENT_URL = "wss://bitshares.openledger.info/ws"; public final static String EQUIVALENT_URL = "wss://bitshares.openledger.info/ws";
public final static BitsharesAsset[] SMARTCOINS = new BitsharesAsset[]{ public final static BitsharesAsset[] SMARTCOINS = new BitsharesAsset[]{

View file

@ -1,8 +1,6 @@
package cy.agorise.crystalwallet.dialogs.material package cy.agorise.crystalwallet.dialogs.material
import android.app.Activity import android.app.Activity
import cy.agorise.crystalwallet.R
import kotlinx.android.synthetic.main.account_seed_list.view.*
/* /*
* Dialog material that shows loading gif and and explicit message * Dialog material that shows loading gif and and explicit message
@ -26,5 +24,5 @@ interface PositiveResponse{
fun onPositive() fun onPositive()
} }
interface NegativeResponse{ interface NegativeResponse{
fun onNegative() fun onNegative(dialogMaterial:DialogMaterial)
} }

View file

@ -20,16 +20,20 @@ open abstract class DialogMaterial{
* */ * */
protected var activity:Activity; protected var activity:Activity;
/*
* Contains pointer to myself
* */
protected var dialogMaterial:DialogMaterial;
/* /*
* Contains the response for positive button click * Contains the response for positive button click
* */ * */
var positiveResponse:PositiveResponse? = null protected var positiveResponse:PositiveResponse? = null
/* /*
* Contains the response for negative button click * Contains the response for negative button click
* */ * */
var negativeResponse:NegativeResponse? = null protected var negativeResponse:NegativeResponse? = null
constructor(activity: Activity) { constructor(activity: Activity) {
@ -39,6 +43,8 @@ open abstract class DialogMaterial{
* */ * */
this.activity = activity this.activity = activity
dialogMaterial = this;
/* /*
* Init the builder * Init the builder
* */ * */
@ -80,7 +86,7 @@ open abstract class DialogMaterial{
* If response is not null deliver response * If response is not null deliver response
* */ * */
if(negativeResponse != null){ if(negativeResponse != null){
negativeResponse!!.onNegative() negativeResponse!!.onNegative(dialogMaterial)
} }
} }
} }
@ -142,6 +148,14 @@ open abstract class DialogMaterial{
this.builder.content(message) this.builder.content(message)
} }
fun setOnPositive(onPositive:PositiveResponse){
this.positiveResponse = onPositive
}
fun setOnNegative(onNegative:NegativeResponse){
this.negativeResponse = onNegative
}
fun setTitle(title: String) { fun setTitle(title: String) {
this.builder.title(title) this.builder.title(title)
} }

View file

@ -0,0 +1,61 @@
package cy.agorise.crystalwallet.dialogs.material
import android.app.Activity
import com.afollestad.materialdialogs.DialogAction
import com.afollestad.materialdialogs.MaterialDialog
import cy.agorise.crystalwallet.R
/*
* This class is used to show a question dialog
*
*
* Use example:
*
*
* var questionDialog:QuestionDialog = QuestionDialog(globalActivity)
questionDialog.setText(getString(R.string.continue_question))
questionDialog.setOnNegative(object : NegativeResponse{
override fun onNegative(dialogMaterial: DialogMaterial) {
var test:String = ""
test = ""
dialogMaterial.dismiss()
}
})
questionDialog.setOnPositive(object : PositiveResponse{
override fun onPositive() {
var test:String = ""
test = ""
}
})
questionDialog.show()
* */
class QuestionDialog : CrystalDialog {
constructor(activity: Activity) : super(activity) {
/*
* Create the buttons needed
* */
this.builder.positiveText(activity.getString(R.string.ok))
this.builder.negativeText(activity.getString(R.string.cancel))
this.builder.onPositive(object : MaterialDialog.SingleButtonCallback{
override fun onClick(dialog: MaterialDialog, which: DialogAction) {
if(positiveResponse != null){
positiveResponse!!.onPositive()
}
}
})
this.builder.onNegative(object : MaterialDialog.SingleButtonCallback {
override fun onClick(dialog: MaterialDialog, which: DialogAction) {
if(negativeResponse != null){
negativeResponse!!.onNegative(dialogMaterial)
}
}
})
}
}

View file

@ -44,6 +44,7 @@
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin"
android:gravity="center" android:gravity="center"
android:text=""
android:background="#00000000" android:background="#00000000"
android:textColor="@color/gray" /> android:textColor="@color/gray" />
@ -68,20 +69,31 @@
android:layout_marginTop="35dp" android:layout_marginTop="35dp"
android:layout_toLeftOf="@+id/btnCopy" android:layout_toLeftOf="@+id/btnCopy"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:text="@string/ok" android:text="@string/cancel"
android:textColor="#0099ff" /> android:textColor="#0099ff" />
<Button <Button
android:id="@+id/btnCopy" android:id="@+id/btnCopy"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_toLeftOf="@+id/btnOK"
android:layout_below="@+id/backup_seed_textview_leyend_backup" android:layout_below="@+id/backup_seed_textview_leyend_backup"
android:layout_marginTop="35dp" android:layout_marginTop="35dp"
android:text="@string/window_seed_copy" android:text="@string/window_seed_copy"
android:textColor="#0099ff" android:textColor="#0099ff"
android:background="?android:attr/selectableItemBackground"/> android:background="?android:attr/selectableItemBackground"/>
<Button
android:id="@+id/btnOK"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/backup_seed_textview_leyend_backup"
android:layout_marginTop="35dp"
android:text="@string/ok"
android:textColor="#0099ff"
android:background="?android:attr/selectableItemBackground"/>
</RelativeLayout> </RelativeLayout>

View file

@ -10,6 +10,10 @@
<TextView <TextView
android:id="@+id/tvPasswordInput" android:id="@+id/tvPasswordInput"
android:layout_marginTop="30dp"
android:textSize="15dp"
android:textColor="@color/gray"
android:textStyle="bold"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"

View file

@ -280,6 +280,8 @@
<string name="head_block_number">head_block_number</string> <string name="head_block_number">head_block_number</string>
<string name="e_receipt">e_receipt</string> <string name="e_receipt">e_receipt</string>
<string name="continue_question">Are you sure to continue?</string>
<string name="Restoring_backup_from_file">Restoring backup from file</string> <string name="Restoring_backup_from_file">Restoring backup from file</string>
<string name="folder_name">SmartcoinsWallet</string> <string name="folder_name">SmartcoinsWallet</string>
@ -512,6 +514,7 @@
<string name="pattern">Pattern</string> <string name="pattern">Pattern</string>
<string name="new_user">New user?</string> <string name="new_user">New user?</string>
<string name="existing_user">Existing user?</string> <string name="existing_user">Existing user?</string>
<string name="Account_already_exists">Account already exists</string>
<string name="connection_status">Connection status</string> <string name="connection_status">Connection status</string>
<string name="people_icon">People icon</string> <string name="people_icon">People icon</string>
<string name="camera_feed_to_scan_qr">Camera feed to scan QR</string> <string name="camera_feed_to_scan_qr">Camera feed to scan QR</string>