- Update libraries and remove unused ones.
- Update Gradle version and remove unused Gradle plugin. - Remove Picasso images library and replace its usages by Glide. - Fix CreateSeedActivity which was using Buterknife with Kotlin and that stopped working after updating the kotlin version.
This commit is contained in:
parent
a13bbadd2e
commit
ea57899027
6 changed files with 70 additions and 196 deletions
|
@ -66,7 +66,7 @@ dependencies {
|
||||||
exclude group: 'com.android.support'
|
exclude group: 'com.android.support'
|
||||||
}
|
}
|
||||||
implementation 'com.jaredrummler:material-spinner:1.2.5'
|
implementation 'com.jaredrummler:material-spinner:1.2.5'
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.1.60"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
//testCompile 'com.android.support.test:runner:1.0.1'
|
//testCompile 'com.android.support.test:runner:1.0.1'
|
||||||
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
|
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
|
||||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
|
@ -76,14 +76,13 @@ dependencies {
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||||
implementation 'android.arch.lifecycle:runtime:1.1.1'
|
implementation 'android.arch.lifecycle:runtime:1.1.1'
|
||||||
implementation 'android.arch.lifecycle:extensions:1.1.1'
|
implementation 'android.arch.lifecycle:extensions:1.1.1'
|
||||||
implementation 'android.arch.paging:runtime:1.0.0'
|
implementation 'android.arch.paging:runtime:1.0.1'
|
||||||
implementation 'com.idescout.sql:sqlscout-server:2.0'
|
implementation 'com.idescout.sql:sqlscout-server:2.0'
|
||||||
implementation 'com.google.code.gson:gson:2.8.0'
|
implementation 'com.google.code.gson:gson:2.8.4'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
|
||||||
implementation 'org.bitcoinj:bitcoinj-core:0.14.3'
|
implementation 'org.bitcoinj:bitcoinj-core:0.14.3'
|
||||||
implementation 'com.neovisionaries:nv-websocket-client:1.30'
|
implementation 'com.neovisionaries:nv-websocket-client:1.30'
|
||||||
implementation 'org.tukaani:xz:1.6'
|
|
||||||
implementation 'com.jakewharton:butterknife:8.8.1'
|
implementation 'com.jakewharton:butterknife:8.8.1'
|
||||||
implementation 'com.github.bilthon:graphenej:0.4.6'
|
implementation 'com.github.bilthon:graphenej:0.4.6'
|
||||||
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
|
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
|
||||||
|
@ -94,19 +93,15 @@ dependencies {
|
||||||
implementation 'de.hdodenhof:circleimageview:2.2.0'
|
implementation 'de.hdodenhof:circleimageview:2.2.0'
|
||||||
|
|
||||||
//testCompile 'junit:junit: 4.12'
|
//testCompile 'junit:junit: 4.12'
|
||||||
testImplementation 'org.mockito:mockito-core:1.10.19'
|
testImplementation 'org.mockito:mockito-core:2.19.0'
|
||||||
implementation 'android.arch.persistence.room:runtime:1.1.0'
|
implementation 'android.arch.persistence.room:runtime:1.1.1'
|
||||||
|
|
||||||
|
kapt 'android.arch.persistence.room:runtime:1.1.1'
|
||||||
|
kapt 'android.arch.persistence.room:compiler:1.1.1'
|
||||||
|
|
||||||
kapt 'android.arch.persistence.room:runtime:1.1.0'
|
|
||||||
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
|
|
||||||
kapt 'android.arch.lifecycle:compiler:1.1.1'
|
kapt 'android.arch.lifecycle:compiler:1.1.1'
|
||||||
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
|
|
||||||
kapt 'android.arch.persistence.room:compiler:1.1.0'
|
|
||||||
annotationProcessor 'android.arch.persistence.room:compiler:1.1.0'
|
|
||||||
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
|
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
|
||||||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
|
|
||||||
|
|
||||||
implementation 'com.squareup.picasso:picasso:2.5.2'
|
|
||||||
implementation 'com.github.esafirm.android-image-picker:imagepicker:1.11.1'
|
implementation 'com.github.esafirm.android-image-picker:imagepicker:1.11.1'
|
||||||
implementation 'id.zelory:compressor:2.1.0'
|
implementation 'id.zelory:compressor:2.1.0'
|
||||||
implementation 'com.vincent.filepicker:MultiTypeFilePicker:1.0.7'
|
implementation 'com.vincent.filepicker:MultiTypeFilePicker:1.0.7'
|
||||||
|
@ -118,16 +113,14 @@ dependencies {
|
||||||
exclude group: 'org.json', module: 'json'
|
exclude group: 'org.json', module: 'json'
|
||||||
}
|
}
|
||||||
|
|
||||||
kapt "android.arch.lifecycle:compiler:1.1.1"
|
|
||||||
kapt "android.arch.persistence.room:compiler:1.1.0"
|
|
||||||
|
|
||||||
// Glide dependencies
|
// Glide dependencies
|
||||||
implementation 'com.github.bumptech.glide:glide:4.8.0'
|
implementation 'com.github.bumptech.glide:glide:4.8.0'
|
||||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
|
kapt 'com.github.bumptech.glide:compiler:4.8.0'
|
||||||
|
|
||||||
|
// Android Debug Database
|
||||||
debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'
|
debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'
|
||||||
|
|
||||||
implementation 'com.google.zxing:core:3.2.1'
|
implementation 'com.google.zxing:core:3.3.1'
|
||||||
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
|
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
|
||||||
testImplementation 'org.testng:testng:6.9.6'
|
testImplementation 'org.testng:testng:6.9.6'
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,20 +3,17 @@ package cy.agorise.crystalwallet.activities
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.support.design.widget.TextInputEditText
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.view.View
|
import android.text.TextWatcher
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import butterknife.ButterKnife
|
|
||||||
import butterknife.OnClick
|
|
||||||
import butterknife.OnTextChanged
|
|
||||||
import com.thekhaeng.pushdownanim.PushDownAnim
|
import com.thekhaeng.pushdownanim.PushDownAnim
|
||||||
import com.vincent.filepicker.ToastUtil
|
import com.vincent.filepicker.ToastUtil
|
||||||
import cy.agorise.crystalwallet.R
|
import cy.agorise.crystalwallet.R
|
||||||
import cy.agorise.crystalwallet.dialogs.material.*
|
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.viewmodels.validators.customImpl.interfaces.UIValidatorListener
|
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.interfaces.UIValidatorListener
|
||||||
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields.BitsharesAccountNameValidation
|
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields.BitsharesAccountNameValidation
|
||||||
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields.BitsharesAccountNameValidation.OnAccountExist
|
import cy.agorise.crystalwallet.viewmodels.validators.customImpl.validationFields.BitsharesAccountNameValidation.OnAccountExist
|
||||||
|
@ -41,11 +38,6 @@ class CreateSeedActivity : CustomActivity() {
|
||||||
* */
|
* */
|
||||||
setContentView(R.layout.create_seed)
|
setContentView(R.layout.create_seed)
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialice butterknife MVC
|
|
||||||
* */
|
|
||||||
ButterKnife.bind(this)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add the controls to the validator
|
* Add the controls to the validator
|
||||||
* */
|
* */
|
||||||
|
@ -54,10 +46,10 @@ class CreateSeedActivity : CustomActivity() {
|
||||||
this.fieldsValidator.add(tietAccountName)
|
this.fieldsValidator.add(tietAccountName)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Integration of library with button efects
|
* Integration of library with button effects
|
||||||
* */
|
* */
|
||||||
PushDownAnim.setPushDownAnimTo(btnCancel)
|
PushDownAnim.setPushDownAnimTo(btnCancel)
|
||||||
.setOnClickListener { cancel() }
|
.setOnClickListener { finish() }
|
||||||
PushDownAnim.setPushDownAnimTo(btnCreate)
|
PushDownAnim.setPushDownAnimTo(btnCreate)
|
||||||
.setOnClickListener { createSeed() }
|
.setOnClickListener { createSeed() }
|
||||||
|
|
||||||
|
@ -97,20 +89,14 @@ class CreateSeedActivity : CustomActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
//Create the pin double validation
|
||||||
* Create the pin double validation
|
|
||||||
* */
|
|
||||||
val pinDoubleConfirmationValidationField = PinDoubleConfirmationValidationField(this, tietPin, tietPinConfirmation, uiValidatorListener)
|
val pinDoubleConfirmationValidationField = PinDoubleConfirmationValidationField(this, tietPin, tietPinConfirmation, uiValidatorListener)
|
||||||
|
|
||||||
/*
|
// Listener for the validation for success or fail
|
||||||
* Listener for the validation for success or fail
|
|
||||||
* */
|
|
||||||
tietPin?.setUiValidator(pinDoubleConfirmationValidationField) //Validator for the field
|
tietPin?.setUiValidator(pinDoubleConfirmationValidationField) //Validator for the field
|
||||||
tietPinConfirmation?.setUiValidator(pinDoubleConfirmationValidationField) //Validator for the field
|
tietPinConfirmation?.setUiValidator(pinDoubleConfirmationValidationField) //Validator for the field
|
||||||
|
|
||||||
/*
|
// Account name validator
|
||||||
* Account name validator
|
|
||||||
* */
|
|
||||||
val bitsharesAccountNameValidation = BitsharesAccountNameValidation(this, tietAccountName, uiValidatorListener)
|
val bitsharesAccountNameValidation = BitsharesAccountNameValidation(this, tietAccountName, uiValidatorListener)
|
||||||
val onAccountExist = object : OnAccountExist {
|
val onAccountExist = object : OnAccountExist {
|
||||||
override fun onAccountExists() {
|
override fun onAccountExists() {
|
||||||
|
@ -124,58 +110,49 @@ class CreateSeedActivity : CustomActivity() {
|
||||||
tietAccountName?.setUiValidator(bitsharesAccountNameValidation)
|
tietAccountName?.setUiValidator(bitsharesAccountNameValidation)
|
||||||
|
|
||||||
/*This button should not be enabled till all the fields be correctly filled*/
|
/*This button should not be enabled till all the fields be correctly filled*/
|
||||||
disableCreate()
|
btnCreate.isEnabled = false
|
||||||
|
|
||||||
/*
|
// Set the focus on the first field and show keyboard
|
||||||
* Set the focus on the fisrt field and show keyboard
|
|
||||||
* */
|
|
||||||
tilPin?.requestFocus()
|
tilPin?.requestFocus()
|
||||||
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
imm.showSoftInput(tilPin, InputMethodManager.SHOW_IMPLICIT)
|
imm.showSoftInput(tilPin, InputMethodManager.SHOW_IMPLICIT)
|
||||||
}
|
|
||||||
|
|
||||||
@OnTextChanged(value = R.id.tietPin, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
tietPin.afterTextChanged {
|
||||||
internal fun afterPinChanged(editable: Editable) {
|
|
||||||
this.fieldsValidator.validate()
|
this.fieldsValidator.validate()
|
||||||
|
|
||||||
/*
|
|
||||||
* Validate continue to create account
|
|
||||||
* */
|
|
||||||
validateFieldsToContinue()
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnTextChanged(value = R.id.tietPinConfirmation, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
|
||||||
internal fun afterPinConfirmationChanged(editable: Editable) {
|
|
||||||
this.fieldsValidator.validate()
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Validate continue to create account
|
|
||||||
* */
|
|
||||||
validateFieldsToContinue()
|
validateFieldsToContinue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnTextChanged(value = R.id.tietAccountName, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
tietPinConfirmation.afterTextChanged {
|
||||||
internal fun afterAccountNameChanged(editable: Editable) {
|
|
||||||
this.fieldsValidator.validate()
|
this.fieldsValidator.validate()
|
||||||
|
|
||||||
/*
|
|
||||||
* Validate continue to create account
|
|
||||||
* */
|
|
||||||
validateFieldsToContinue()
|
validateFieldsToContinue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.btnCancel)
|
tietAccountName.afterTextChanged {
|
||||||
fun cancel() {
|
this.fieldsValidator.validate()
|
||||||
|
validateFieldsToContinue()
|
||||||
/*
|
}
|
||||||
* Exit of the activity
|
|
||||||
* */
|
btnCancel.setOnClickListener { finish() }
|
||||||
this.finish()
|
btnCreate.setOnClickListener { createSeed() }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension function to easily add a text watcher
|
||||||
|
*/
|
||||||
|
fun TextInputEditText.afterTextChanged(afterTextChanged: (String) -> Unit) {
|
||||||
|
this.addTextChangedListener(object :TextWatcher {
|
||||||
|
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun afterTextChanged(editable: Editable?) {
|
||||||
|
afterTextChanged.invoke(editable.toString())
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.btnCreate)
|
|
||||||
fun createSeed() {
|
fun createSeed() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -191,11 +168,10 @@ class CreateSeedActivity : CustomActivity() {
|
||||||
questionDialog.setOnPositive(object : PositiveResponse{
|
questionDialog.setOnPositive(object : PositiveResponse{
|
||||||
override fun onPositive() {
|
override fun onPositive() {
|
||||||
|
|
||||||
// Make request to create a bitshare account
|
// Make request to create a bitshares account
|
||||||
var accountName:String = tietAccountName?.getText().toString().trim()
|
var accountName:String = tietAccountName?.getText().toString().trim()
|
||||||
val request = ValidateCreateBitsharesAccountRequest(accountName, applicationContext)
|
val request = ValidateCreateBitsharesAccountRequest(accountName, applicationContext)
|
||||||
|
|
||||||
//DTVV: Friday 27 July 2018
|
|
||||||
//Makes dialog to tell the user that the account is been created
|
//Makes dialog to tell the user that the account is been created
|
||||||
val creatingAccountMaterialDialog = CrystalDialog(globalActivity)
|
val creatingAccountMaterialDialog = CrystalDialog(globalActivity)
|
||||||
creatingAccountMaterialDialog.setText(globalActivity.resources.getString(R.string.window_create_seed_DialogMessage))
|
creatingAccountMaterialDialog.setText(globalActivity.resources.getString(R.string.window_create_seed_DialogMessage))
|
||||||
|
@ -215,7 +191,7 @@ class CreateSeedActivity : CustomActivity() {
|
||||||
}
|
}
|
||||||
else if (request.status == ValidateCreateBitsharesAccountRequest.StatusCode.ACCOUNT_EXIST) {
|
else if (request.status == ValidateCreateBitsharesAccountRequest.StatusCode.ACCOUNT_EXIST) {
|
||||||
ToastUtil.getInstance(globalActivity).showToast(globalActivity.getString(R.string.Account_already_exists))
|
ToastUtil.getInstance(globalActivity).showToast(globalActivity.getString(R.string.Account_already_exists))
|
||||||
disableCreate()
|
btnCreate.isEnabled = false
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fieldsValidator.validate()
|
fieldsValidator.validate()
|
||||||
|
@ -224,10 +200,7 @@ class CreateSeedActivity : CustomActivity() {
|
||||||
|
|
||||||
(object : Thread() {
|
(object : Thread() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
/* Run thread*/
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Run thread*/
|
|
||||||
CryptoNetInfoRequests.getInstance().addRequest(request)
|
CryptoNetInfoRequests.getInstance().addRequest(request)
|
||||||
}
|
}
|
||||||
}).start()
|
}).start()
|
||||||
|
@ -253,40 +226,7 @@ class CreateSeedActivity : CustomActivity() {
|
||||||
result = true //Validation is correct
|
result = true //Validation is correct
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the result is true so the user can continue to the creation of the account
|
||||||
/*
|
btnCreate.isEnabled = result
|
||||||
* If the result is true so the user can continue to the creation of the account
|
|
||||||
* */
|
|
||||||
if (result) {
|
|
||||||
|
|
||||||
enableCreate()
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Disaible button create
|
|
||||||
* */
|
|
||||||
disableCreate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable create button
|
|
||||||
* */
|
|
||||||
private fun enableCreate() {
|
|
||||||
runOnUiThread(Runnable {
|
|
||||||
//btnCreate?.setBackgroundColor(resources.getColor(R.color.colorPrimary))
|
|
||||||
btnCreate?.setEnabled(true)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Disable create button
|
|
||||||
* */
|
|
||||||
private fun disableCreate() {
|
|
||||||
runOnUiThread(Runnable {
|
|
||||||
btnCreate?.setEnabled(false)
|
|
||||||
//btnCreate?.setBackground(resources.getDrawable(R.drawable.disable_style))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,47 +0,0 @@
|
||||||
package cy.agorise.crystalwallet.util;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Henry Varona on 25/2/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.BitmapShader;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Paint;
|
|
||||||
|
|
||||||
import com.squareup.picasso.Transformation;
|
|
||||||
|
|
||||||
public class CircleTransformation implements Transformation {
|
|
||||||
@Override
|
|
||||||
public Bitmap transform(Bitmap source) {
|
|
||||||
int size = Math.min(source.getWidth(), source.getHeight());
|
|
||||||
|
|
||||||
int x = (source.getWidth() - size) / 2;
|
|
||||||
int y = (source.getHeight() - size) / 2;
|
|
||||||
|
|
||||||
Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
|
|
||||||
if (squaredBitmap != source) {
|
|
||||||
source.recycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());
|
|
||||||
|
|
||||||
Canvas canvas = new Canvas(bitmap);
|
|
||||||
Paint paint = new Paint();
|
|
||||||
BitmapShader shader = new BitmapShader(squaredBitmap,
|
|
||||||
BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
|
|
||||||
paint.setShader(shader);
|
|
||||||
paint.setAntiAlias(true);
|
|
||||||
|
|
||||||
float r = size / 2f;
|
|
||||||
canvas.drawCircle(r, r, r, paint);
|
|
||||||
|
|
||||||
squaredBitmap.recycle();
|
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String key() {
|
|
||||||
return "CircleTransformation";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +1,16 @@
|
||||||
package cy.agorise.crystalwallet.views;
|
package cy.agorise.crystalwallet.views;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.squareup.picasso.Picasso;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.R;
|
import cy.agorise.crystalwallet.R;
|
||||||
import cy.agorise.crystalwallet.activities.CreateContactActivity;
|
|
||||||
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
|
||||||
import cy.agorise.crystalwallet.models.Contact;
|
import cy.agorise.crystalwallet.models.Contact;
|
||||||
import cy.agorise.crystalwallet.util.CircleTransformation;
|
import cy.agorise.crystalwallet.util.GlideApp;
|
||||||
import cy.agorise.crystalwallet.util.MD5Hash;
|
import cy.agorise.crystalwallet.util.MD5Hash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,9 +65,9 @@ public class ContactSelectionViewHolder extends RecyclerView.ViewHolder {
|
||||||
String emailHash = MD5Hash.hash(contact.getEmail());
|
String emailHash = MD5Hash.hash(contact.getEmail());
|
||||||
String gravatarUrl = "http://www.gravatar.com/avatar/" + emailHash + "?s=204&d=404";
|
String gravatarUrl = "http://www.gravatar.com/avatar/" + emailHash + "?s=204&d=404";
|
||||||
|
|
||||||
Picasso.with(this.context)
|
GlideApp.with(this.context)
|
||||||
.load(gravatarUrl)
|
.load(gravatarUrl)
|
||||||
.transform(new CircleTransformation())
|
.apply(RequestOptions.circleCropTransform())
|
||||||
.into(ivThumbnail);
|
.into(ivThumbnail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,21 +3,17 @@ package cy.agorise.crystalwallet.views;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.provider.ContactsContract;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.ThemedSpinnerAdapter;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.squareup.picasso.Picasso;
|
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.R;
|
import cy.agorise.crystalwallet.R;
|
||||||
import cy.agorise.crystalwallet.activities.CreateContactActivity;
|
import cy.agorise.crystalwallet.activities.CreateContactActivity;
|
||||||
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||||
import cy.agorise.crystalwallet.models.Contact;
|
import cy.agorise.crystalwallet.models.Contact;
|
||||||
import cy.agorise.crystalwallet.util.CircleTransformation;
|
import cy.agorise.crystalwallet.util.GlideApp;
|
||||||
import cy.agorise.crystalwallet.util.MD5Hash;
|
import cy.agorise.crystalwallet.util.MD5Hash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,13 +29,13 @@ public class ContactViewHolder extends RecyclerView.ViewHolder {
|
||||||
private ImageView ivDeleteContact;
|
private ImageView ivDeleteContact;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
public ContactViewHolder(View itemView) {
|
ContactViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
//TODO: use ButterKnife to load this
|
//TODO: use ButterKnife to load this
|
||||||
tvName = (TextView) itemView.findViewById(R.id.tvContactName);
|
tvName = itemView.findViewById(R.id.tvContactName);
|
||||||
ivThumbnail = (ImageView) itemView.findViewById(R.id.ivContactThumbnail);
|
ivThumbnail = itemView.findViewById(R.id.ivContactThumbnail);
|
||||||
tvLastPaid = (TextView) itemView.findViewById(R.id.tvLastPaid);
|
tvLastPaid = itemView.findViewById(R.id.tvLastPaid);
|
||||||
ivDeleteContact = (ImageView) itemView.findViewById(R.id.ivDeleteContact);
|
ivDeleteContact = itemView.findViewById(R.id.ivDeleteContact);
|
||||||
this.context = itemView.getContext();
|
this.context = itemView.getContext();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -76,10 +72,9 @@ public class ContactViewHolder extends RecyclerView.ViewHolder {
|
||||||
String emailHash = MD5Hash.hash(contact.getEmail());
|
String emailHash = MD5Hash.hash(contact.getEmail());
|
||||||
String gravatarUrl = "http://www.gravatar.com/avatar/" + emailHash + "?s=204&d=404";
|
String gravatarUrl = "http://www.gravatar.com/avatar/" + emailHash + "?s=204&d=404";
|
||||||
|
|
||||||
Picasso.with(this.context)
|
GlideApp.with(context)
|
||||||
.load(gravatarUrl)
|
.load(gravatarUrl)
|
||||||
.placeholder(R.drawable.avatar_placeholder)
|
.placeholder(R.drawable.avatar_placeholder)
|
||||||
//.transform(new CircleTransformation())
|
|
||||||
.into(ivThumbnail);
|
.into(ivThumbnail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlinVersion = '1.1.51'
|
ext.kotlin_version = '1.3.0'
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
ext.kotlin_version = '1.2.51'
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.2.0'
|
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51"
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue