Update Room libraries to be compatible with the gradle version 3.1.2
This commit is contained in:
parent
008a24177e
commit
f482fa8354
22 changed files with 69 additions and 62 deletions
|
@ -1,11 +1,11 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 26
|
compileSdkVersion 27
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cy.agorise.crystalwallet"
|
applicationId "cy.agorise.crystalwallet"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 26
|
targetSdkVersion 27
|
||||||
versionCode 2
|
versionCode 2
|
||||||
versionName "0.2t.alpha"
|
versionName "0.2t.alpha"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
@ -49,14 +49,14 @@ dependencies {
|
||||||
exclude group: 'com.android.support', module: 'support-annotations'
|
exclude group: 'com.android.support', module: 'support-annotations'
|
||||||
})
|
})
|
||||||
//testCompile 'com.android.support.test:runner:1.0.1'
|
//testCompile 'com.android.support.test:runner:1.0.1'
|
||||||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
implementation 'com.android.support:support-v4:26.1.0'
|
implementation 'com.android.support:support-v4:27.1.1'
|
||||||
implementation 'com.android.support:design:26.1.0'
|
implementation 'com.android.support:design:27.1.1'
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
|
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
|
||||||
implementation 'android.arch.lifecycle:runtime:1.0.3'
|
implementation 'android.arch.lifecycle:runtime:1.1.1'
|
||||||
implementation 'android.arch.lifecycle:extensions:1.0.0'
|
implementation 'android.arch.lifecycle:extensions:1.1.1'
|
||||||
implementation 'android.arch.persistence.room:runtime:1.0.0'
|
implementation 'android.arch.persistence.room:runtime:1.1.0'
|
||||||
implementation 'android.arch.paging:runtime:1.0.0-alpha3'
|
implementation 'android.arch.paging:runtime:1.0.0'
|
||||||
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.0'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
|
||||||
|
@ -74,8 +74,8 @@ dependencies {
|
||||||
|
|
||||||
//testCompile 'junit:junit: 4.12'
|
//testCompile 'junit:junit: 4.12'
|
||||||
testImplementation 'org.mockito:mockito-core:1.10.19'
|
testImplementation 'org.mockito:mockito-core:1.10.19'
|
||||||
annotationProcessor 'android.arch.lifecycle:compiler:1.0.0'
|
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
|
||||||
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'
|
annotationProcessor 'android.arch.persistence.room:compiler:1.1.0'
|
||||||
annotationProcessor '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.squareup.picasso:picasso:2.5.2'
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(@Nullable List<ContactAddress> contactAddresses) {
|
public void onChanged(@Nullable List<ContactAddress> contactAddresses) {
|
||||||
contactAddressList = contactAddresses;
|
contactAddressList = contactAddresses;
|
||||||
listAdapter.setList(contactAddressList);
|
listAdapter.submitList(contactAddressList);
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -113,7 +113,7 @@ public class CreateContactActivity extends AppCompatActivity implements UIValida
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
contactAddressList = new ArrayList<ContactAddress>();
|
contactAddressList = new ArrayList<ContactAddress>();
|
||||||
listAdapter.setList(contactAddressList);
|
listAdapter.submitList(contactAddressList);
|
||||||
createContactValidator = new CreateContactValidator(this.getApplicationContext(),etName,etEmail);
|
createContactValidator = new CreateContactValidator(this.getApplicationContext(),etName,etEmail);
|
||||||
createContactValidator.setListener(this);
|
createContactValidator.setListener(this);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package cy.agorise.crystalwallet.dao;
|
package cy.agorise.crystalwallet.dao;
|
||||||
|
|
||||||
import android.arch.lifecycle.LiveData;
|
import android.arch.lifecycle.LiveData;
|
||||||
|
import android.arch.paging.DataSource;
|
||||||
import android.arch.paging.LivePagedListProvider;
|
import android.arch.paging.LivePagedListProvider;
|
||||||
import android.arch.persistence.room.Dao;
|
import android.arch.persistence.room.Dao;
|
||||||
import android.arch.persistence.room.Delete;
|
import android.arch.persistence.room.Delete;
|
||||||
|
@ -25,10 +26,10 @@ public interface ContactDao {
|
||||||
LiveData<List<Contact>> getAll();
|
LiveData<List<Contact>> getAll();
|
||||||
|
|
||||||
@Query("SELECT * FROM contact ORDER BY name ASC")
|
@Query("SELECT * FROM contact ORDER BY name ASC")
|
||||||
LivePagedListProvider<Integer, Contact> contactsByName();
|
DataSource.Factory<Integer, Contact> contactsByName();
|
||||||
|
|
||||||
@Query("SELECT c.* FROM contact c WHERE c.id IN (SELECT DISTINCT(ca.contact_id) FROM contact_address ca WHERE ca.crypto_net == :cryptoNet) ORDER BY name ASC, email ASC")
|
@Query("SELECT c.* FROM contact c WHERE c.id IN (SELECT DISTINCT(ca.contact_id) FROM contact_address ca WHERE ca.crypto_net == :cryptoNet) ORDER BY name ASC, email ASC")
|
||||||
LivePagedListProvider<Integer, Contact> contactsByNameAndCryptoNet(String cryptoNet);
|
DataSource.Factory<Integer, Contact> contactsByNameAndCryptoNet(String cryptoNet);
|
||||||
|
|
||||||
@Query("SELECT * FROM contact WHERE id = :id")
|
@Query("SELECT * FROM contact WHERE id = :id")
|
||||||
LiveData<Contact> getById(long id);
|
LiveData<Contact> getById(long id);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package cy.agorise.crystalwallet.dao;
|
package cy.agorise.crystalwallet.dao;
|
||||||
|
|
||||||
import android.arch.lifecycle.LiveData;
|
import android.arch.lifecycle.LiveData;
|
||||||
|
import android.arch.paging.DataSource;
|
||||||
import android.arch.paging.LivePagedListProvider;
|
import android.arch.paging.LivePagedListProvider;
|
||||||
import android.arch.persistence.room.Dao;
|
import android.arch.persistence.room.Dao;
|
||||||
import android.arch.persistence.room.Insert;
|
import android.arch.persistence.room.Insert;
|
||||||
|
@ -28,19 +29,19 @@ public interface TransactionDao {
|
||||||
LiveData<List<CryptoCoinTransaction>> getAll();
|
LiveData<List<CryptoCoinTransaction>> getAll();
|
||||||
|
|
||||||
@Query(transactionsQuery + " ORDER BY date DESC")
|
@Query(transactionsQuery + " ORDER BY date DESC")
|
||||||
LivePagedListProvider<Integer, CryptoCoinTransactionExtended> transactionsByDate(String search);
|
DataSource.Factory<Integer, CryptoCoinTransactionExtended> transactionsByDate(String search);
|
||||||
|
|
||||||
@Query(transactionsQuery + " ORDER BY amount DESC")
|
@Query(transactionsQuery + " ORDER BY amount DESC")
|
||||||
LivePagedListProvider<Integer, CryptoCoinTransactionExtended> transactionsByAmount(String search);
|
DataSource.Factory<Integer, CryptoCoinTransactionExtended> transactionsByAmount(String search);
|
||||||
|
|
||||||
@Query(transactionsQuery + " ORDER BY is_input DESC")
|
@Query(transactionsQuery + " ORDER BY is_input DESC")
|
||||||
LivePagedListProvider<Integer, CryptoCoinTransactionExtended> transactionsByIsInput(String search);
|
DataSource.Factory<Integer, CryptoCoinTransactionExtended> transactionsByIsInput(String search);
|
||||||
|
|
||||||
@Query(transactionsQuery + " ORDER BY `from` DESC")
|
@Query(transactionsQuery + " ORDER BY `from` DESC")
|
||||||
LivePagedListProvider<Integer, CryptoCoinTransactionExtended> transactionsByFrom(String search);
|
DataSource.Factory<Integer, CryptoCoinTransactionExtended> transactionsByFrom(String search);
|
||||||
|
|
||||||
@Query(transactionsQuery + " ORDER BY `to` DESC")
|
@Query(transactionsQuery + " ORDER BY `to` DESC")
|
||||||
LivePagedListProvider<Integer, CryptoCoinTransactionExtended> transactionsByTo(String search);
|
DataSource.Factory<Integer, CryptoCoinTransactionExtended> transactionsByTo(String search);
|
||||||
|
|
||||||
@Query("SELECT * FROM crypto_coin_transaction WHERE account_id = :idAccount ORDER BY date DESC")
|
@Query("SELECT * FROM crypto_coin_transaction WHERE account_id = :idAccount ORDER BY date DESC")
|
||||||
LiveData<List<CryptoCoinTransaction>> getByIdAccountLiveData(long idAccount);
|
LiveData<List<CryptoCoinTransaction>> getByIdAccountLiveData(long idAccount);
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class ContactSelectionFragment extends DialogFragment implements ContactS
|
||||||
contactsLiveData.observe(this, new Observer<PagedList<Contact>>() {
|
contactsLiveData.observe(this, new Observer<PagedList<Contact>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(@Nullable PagedList<Contact> contacts) {
|
public void onChanged(@Nullable PagedList<Contact> contacts) {
|
||||||
contactSelectionListAdapter.setList(contacts);
|
contactSelectionListAdapter.submitList(contacts);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import android.arch.persistence.room.Entity;
|
||||||
import android.arch.persistence.room.PrimaryKey;
|
import android.arch.persistence.room.PrimaryKey;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.recyclerview.extensions.DiffCallback;
|
import android.support.v7.util.DiffUtil;
|
||||||
|
|
||||||
import org.bitcoinj.core.ECKey;
|
import org.bitcoinj.core.ECKey;
|
||||||
import org.bitcoinj.crypto.HDKeyDerivation;
|
import org.bitcoinj.crypto.HDKeyDerivation;
|
||||||
|
@ -86,7 +86,7 @@ public class AccountSeed {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final DiffCallback<AccountSeed> DIFF_CALLBACK = new DiffCallback<AccountSeed>() {
|
public static final DiffUtil.ItemCallback<AccountSeed> DIFF_CALLBACK = new DiffUtil.ItemCallback<AccountSeed>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean areItemsTheSame(
|
public boolean areItemsTheSame(
|
||||||
@NonNull AccountSeed oldAccountSeed, @NonNull AccountSeed newAccountSeed) {
|
@NonNull AccountSeed oldAccountSeed, @NonNull AccountSeed newAccountSeed) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import android.arch.persistence.room.Ignore;
|
||||||
import android.arch.persistence.room.Index;
|
import android.arch.persistence.room.Index;
|
||||||
import android.arch.persistence.room.PrimaryKey;
|
import android.arch.persistence.room.PrimaryKey;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.recyclerview.extensions.DiffCallback;
|
import android.support.v7.util.DiffUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -110,7 +110,7 @@ public class Contact {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final DiffCallback<Contact> DIFF_CALLBACK = new DiffCallback<Contact>() {
|
public static final DiffUtil.ItemCallback<Contact> DIFF_CALLBACK = new DiffUtil.ItemCallback<Contact>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean areItemsTheSame(
|
public boolean areItemsTheSame(
|
||||||
@NonNull Contact oldContact, @NonNull Contact newContact) {
|
@NonNull Contact oldContact, @NonNull Contact newContact) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import android.arch.persistence.room.Entity;
|
||||||
import android.arch.persistence.room.Index;
|
import android.arch.persistence.room.Index;
|
||||||
import android.arch.persistence.room.PrimaryKey;
|
import android.arch.persistence.room.PrimaryKey;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.recyclerview.extensions.DiffCallback;
|
import android.support.v7.util.DiffUtil;
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.enums.CryptoNet;
|
import cy.agorise.crystalwallet.enums.CryptoNet;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class ContactAddress {
|
||||||
this.mAddress = address;
|
this.mAddress = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final DiffCallback<ContactAddress> DIFF_CALLBACK = new DiffCallback<ContactAddress>() {
|
public static final DiffUtil.ItemCallback<ContactAddress> DIFF_CALLBACK = new DiffUtil.ItemCallback<ContactAddress>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean areItemsTheSame(
|
public boolean areItemsTheSame(
|
||||||
@NonNull ContactAddress oldContactAddress, @NonNull ContactAddress newContactAddress) {
|
@NonNull ContactAddress oldContactAddress, @NonNull ContactAddress newContactAddress) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import android.arch.persistence.room.ForeignKey;
|
||||||
import android.arch.persistence.room.Index;
|
import android.arch.persistence.room.Index;
|
||||||
import android.arch.persistence.room.PrimaryKey;
|
import android.arch.persistence.room.PrimaryKey;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.recyclerview.extensions.DiffCallback;
|
import android.support.v7.util.DiffUtil;
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.enums.CryptoCoin;
|
import cy.agorise.crystalwallet.enums.CryptoCoin;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class CryptoCoinBalance {
|
||||||
this.mBalance = balance;
|
this.mBalance = balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final DiffCallback<CryptoCoinBalance> DIFF_CALLBACK = new DiffCallback<CryptoCoinBalance>() {
|
public static final DiffUtil.ItemCallback<CryptoCoinBalance> DIFF_CALLBACK = new DiffUtil.ItemCallback<CryptoCoinBalance>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean areItemsTheSame(
|
public boolean areItemsTheSame(
|
||||||
@NonNull CryptoCoinBalance oldBalance, @NonNull CryptoCoinBalance newBalance) {
|
@NonNull CryptoCoinBalance oldBalance, @NonNull CryptoCoinBalance newBalance) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import android.arch.persistence.room.Ignore;
|
||||||
import android.arch.persistence.room.Index;
|
import android.arch.persistence.room.Index;
|
||||||
import android.arch.persistence.room.PrimaryKey;
|
import android.arch.persistence.room.PrimaryKey;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.recyclerview.extensions.DiffCallback;
|
import android.support.v7.util.DiffUtil;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public class CryptoCoinTransaction {
|
||||||
public void setIdCurrency(int idCurrency) { this.idCurrency = idCurrency; }
|
public void setIdCurrency(int idCurrency) { this.idCurrency = idCurrency; }
|
||||||
|
|
||||||
|
|
||||||
public static final DiffCallback<CryptoCoinTransaction> DIFF_CALLBACK = new DiffCallback<CryptoCoinTransaction>() {
|
public static final DiffUtil.ItemCallback<CryptoCoinTransaction> DIFF_CALLBACK = new DiffUtil.ItemCallback<CryptoCoinTransaction>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean areItemsTheSame(
|
public boolean areItemsTheSame(
|
||||||
@NonNull CryptoCoinTransaction oldTransaction, @NonNull CryptoCoinTransaction newTransaction) {
|
@NonNull CryptoCoinTransaction oldTransaction, @NonNull CryptoCoinTransaction newTransaction) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import android.arch.persistence.room.Ignore;
|
||||||
import android.arch.persistence.room.Index;
|
import android.arch.persistence.room.Index;
|
||||||
import android.arch.persistence.room.PrimaryKey;
|
import android.arch.persistence.room.PrimaryKey;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.recyclerview.extensions.DiffCallback;
|
import android.support.v7.util.DiffUtil;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class CryptoCoinTransactionExtended {
|
||||||
|
|
||||||
public int getIdCurrency() { return this.cryptoCoinTransaction.getIdCurrency(); }
|
public int getIdCurrency() { return this.cryptoCoinTransaction.getIdCurrency(); }
|
||||||
|
|
||||||
public static final DiffCallback<CryptoCoinTransactionExtended> DIFF_CALLBACK = new DiffCallback<CryptoCoinTransactionExtended>() {
|
public static final DiffUtil.ItemCallback<CryptoCoinTransactionExtended> DIFF_CALLBACK = new DiffUtil.ItemCallback<CryptoCoinTransactionExtended>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean areItemsTheSame(
|
public boolean areItemsTheSame(
|
||||||
@NonNull CryptoCoinTransactionExtended oldTransaction, @NonNull CryptoCoinTransactionExtended newTransaction) {
|
@NonNull CryptoCoinTransactionExtended oldTransaction, @NonNull CryptoCoinTransactionExtended newTransaction) {
|
||||||
|
|
|
@ -8,7 +8,8 @@ import android.arch.persistence.room.Ignore;
|
||||||
import android.arch.persistence.room.Index;
|
import android.arch.persistence.room.Index;
|
||||||
import android.arch.persistence.room.PrimaryKey;
|
import android.arch.persistence.room.PrimaryKey;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.recyclerview.extensions.DiffCallback;
|
import android.support.v7.util.DiffUtil;
|
||||||
|
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.enums.CryptoNet;
|
import cy.agorise.crystalwallet.enums.CryptoNet;
|
||||||
|
|
||||||
|
@ -111,7 +112,7 @@ public class CryptoNetAccount {
|
||||||
return this.getName();
|
return this.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final DiffCallback<CryptoNetAccount> DIFF_CALLBACK = new DiffCallback<CryptoNetAccount>() {
|
public static final DiffUtil.ItemCallback<CryptoNetAccount> DIFF_CALLBACK = new DiffUtil.ItemCallback<CryptoNetAccount>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean areItemsTheSame(
|
public boolean areItemsTheSame(
|
||||||
@NonNull CryptoNetAccount oldAccount, @NonNull CryptoNetAccount newAccount) {
|
@NonNull CryptoNetAccount oldAccount, @NonNull CryptoNetAccount newAccount) {
|
||||||
|
|
|
@ -8,7 +8,8 @@ import android.arch.persistence.room.Ignore;
|
||||||
import android.arch.persistence.room.Index;
|
import android.arch.persistence.room.Index;
|
||||||
import android.arch.persistence.room.PrimaryKey;
|
import android.arch.persistence.room.PrimaryKey;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.recyclerview.extensions.DiffCallback;
|
import android.support.v7.util.DiffUtil;
|
||||||
|
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.enums.CryptoCoin;
|
import cy.agorise.crystalwallet.enums.CryptoCoin;
|
||||||
import cy.agorise.crystalwallet.enums.CryptoNet;
|
import cy.agorise.crystalwallet.enums.CryptoNet;
|
||||||
|
@ -52,7 +53,7 @@ public class CryptoNetBalance {
|
||||||
this.mCryptoNet = cryptoNet;
|
this.mCryptoNet = cryptoNet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final DiffCallback<CryptoNetBalance> DIFF_CALLBACK = new DiffCallback<CryptoNetBalance>() {
|
public static final DiffUtil.ItemCallback<CryptoNetBalance> DIFF_CALLBACK = new DiffUtil.ItemCallback<CryptoNetBalance>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean areItemsTheSame(
|
public boolean areItemsTheSame(
|
||||||
@NonNull CryptoNetBalance oldBalance, @NonNull CryptoNetBalance newBalance) {
|
@NonNull CryptoNetBalance oldBalance, @NonNull CryptoNetBalance newBalance) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import android.arch.persistence.room.ColumnInfo;
|
||||||
import android.arch.persistence.room.Entity;
|
import android.arch.persistence.room.Entity;
|
||||||
import android.arch.persistence.room.PrimaryKey;
|
import android.arch.persistence.room.PrimaryKey;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.recyclerview.extensions.DiffCallback;
|
import android.support.v7.util.DiffUtil;
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.enums.SeedType;
|
import cy.agorise.crystalwallet.enums.SeedType;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class GeneralSetting {
|
||||||
this.mValue = mValue;
|
this.mValue = mValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final DiffCallback<GeneralSetting> DIFF_CALLBACK = new DiffCallback<GeneralSetting>() {
|
public static final DiffUtil.ItemCallback<GeneralSetting> DIFF_CALLBACK = new DiffUtil.ItemCallback<GeneralSetting>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean areItemsTheSame(
|
public boolean areItemsTheSame(
|
||||||
@NonNull GeneralSetting oldSetting, @NonNull GeneralSetting newSetting) {
|
@NonNull GeneralSetting oldSetting, @NonNull GeneralSetting newSetting) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package cy.agorise.crystalwallet.viewmodels;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.arch.lifecycle.AndroidViewModel;
|
import android.arch.lifecycle.AndroidViewModel;
|
||||||
import android.arch.lifecycle.LiveData;
|
import android.arch.lifecycle.LiveData;
|
||||||
|
import android.arch.paging.LivePagedListBuilder;
|
||||||
import android.arch.paging.PagedList;
|
import android.arch.paging.PagedList;
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||||
|
@ -22,33 +23,33 @@ public class ContactListViewModel extends AndroidViewModel {
|
||||||
public ContactListViewModel(Application application) {
|
public ContactListViewModel(Application application) {
|
||||||
super(application);
|
super(application);
|
||||||
this.db = CrystalDatabase.getAppDatabase(application.getApplicationContext());
|
this.db = CrystalDatabase.getAppDatabase(application.getApplicationContext());
|
||||||
contactList = this.db.contactDao().contactsByName().create(0,
|
contactList = new LivePagedListBuilder(this.db.contactDao().contactsByName(),
|
||||||
new PagedList.Config.Builder()
|
new PagedList.Config.Builder()
|
||||||
.setEnablePlaceholders(true)
|
.setEnablePlaceholders(true)
|
||||||
.setPageSize(10)
|
.setPageSize(10)
|
||||||
.setPrefetchDistance(10)
|
.setPrefetchDistance(10)
|
||||||
.build()
|
.build()
|
||||||
);
|
).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(){
|
public void init(){
|
||||||
contactList = this.db.contactDao().contactsByName().create(0,
|
contactList = new LivePagedListBuilder(this.db.contactDao().contactsByName(),
|
||||||
new PagedList.Config.Builder()
|
new PagedList.Config.Builder()
|
||||||
.setEnablePlaceholders(true)
|
.setEnablePlaceholders(true)
|
||||||
.setPageSize(10)
|
.setPageSize(10)
|
||||||
.setPrefetchDistance(10)
|
.setPrefetchDistance(10)
|
||||||
.build()
|
.build()
|
||||||
);
|
).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(CryptoNet cryptoNet){
|
public void init(CryptoNet cryptoNet){
|
||||||
contactList = this.db.contactDao().contactsByNameAndCryptoNet(cryptoNet.name()).create(0,
|
contactList = new LivePagedListBuilder(this.db.contactDao().contactsByNameAndCryptoNet(cryptoNet.name()),
|
||||||
new PagedList.Config.Builder()
|
new PagedList.Config.Builder()
|
||||||
.setEnablePlaceholders(true)
|
.setEnablePlaceholders(true)
|
||||||
.setPageSize(10)
|
.setPageSize(10)
|
||||||
.setPrefetchDistance(10)
|
.setPrefetchDistance(10)
|
||||||
.build()
|
.build()
|
||||||
);
|
).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<PagedList<Contact>> getContactList(){
|
public LiveData<PagedList<Contact>> getContactList(){
|
||||||
|
|
|
@ -4,6 +4,8 @@ import android.app.Application;
|
||||||
import android.arch.lifecycle.AndroidViewModel;
|
import android.arch.lifecycle.AndroidViewModel;
|
||||||
import android.arch.lifecycle.LiveData;
|
import android.arch.lifecycle.LiveData;
|
||||||
import android.arch.lifecycle.ViewModel;
|
import android.arch.lifecycle.ViewModel;
|
||||||
|
import android.arch.paging.DataSource;
|
||||||
|
import android.arch.paging.LivePagedListBuilder;
|
||||||
import android.arch.paging.LivePagedListProvider;
|
import android.arch.paging.LivePagedListProvider;
|
||||||
import android.arch.paging.PagedList;
|
import android.arch.paging.PagedList;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -37,35 +39,35 @@ public class TransactionListViewModel extends AndroidViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initTransactionList(String orderField, String search){
|
public void initTransactionList(String orderField, String search){
|
||||||
LivePagedListProvider<Integer, CryptoCoinTransactionExtended> livePagedListProvider = null;
|
DataSource.Factory<Integer, CryptoCoinTransactionExtended> dataSource = null;
|
||||||
|
|
||||||
switch (orderField){
|
switch (orderField){
|
||||||
case "date":
|
case "date":
|
||||||
livePagedListProvider = this.db.transactionDao().transactionsByDate(search);
|
dataSource = this.db.transactionDao().transactionsByDate(search);
|
||||||
break;
|
break;
|
||||||
case "amount":
|
case "amount":
|
||||||
livePagedListProvider = this.db.transactionDao().transactionsByAmount(search);
|
dataSource = this.db.transactionDao().transactionsByAmount(search);
|
||||||
break;
|
break;
|
||||||
case "is_input":
|
case "is_input":
|
||||||
livePagedListProvider = this.db.transactionDao().transactionsByIsInput(search);
|
dataSource = this.db.transactionDao().transactionsByIsInput(search);
|
||||||
break;
|
break;
|
||||||
case "from":
|
case "from":
|
||||||
livePagedListProvider = this.db.transactionDao().transactionsByFrom(search);
|
dataSource = this.db.transactionDao().transactionsByFrom(search);
|
||||||
break;
|
break;
|
||||||
case "to":
|
case "to":
|
||||||
livePagedListProvider = this.db.transactionDao().transactionsByTo(search);
|
dataSource = this.db.transactionDao().transactionsByTo(search);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
livePagedListProvider = this.db.transactionDao().transactionsByDate(search);
|
dataSource = this.db.transactionDao().transactionsByDate(search);
|
||||||
}
|
}
|
||||||
if (livePagedListProvider != null) {
|
if (dataSource != null) {
|
||||||
this.transactionList = livePagedListProvider.create(0,
|
this.transactionList = new LivePagedListBuilder(dataSource,
|
||||||
new PagedList.Config.Builder()
|
new PagedList.Config.Builder()
|
||||||
.setEnablePlaceholders(true)
|
.setEnablePlaceholders(true)
|
||||||
.setPageSize(10)
|
.setPageSize(10)
|
||||||
.setPrefetchDistance(10)
|
.setPrefetchDistance(10)
|
||||||
.build()
|
.build()
|
||||||
);
|
).build();
|
||||||
} else {
|
} else {
|
||||||
this.transactionList = null;
|
this.transactionList = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class AccountSeedListView extends RelativeLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.listAdapter.setList(data);
|
this.listAdapter.submitList(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class ContactListView extends RelativeLayout {
|
||||||
|
|
||||||
//Sets the data of the transaction list
|
//Sets the data of the transaction list
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.listAdapter.setList(data);
|
this.listAdapter.submitList(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class CryptoCoinBalanceListView extends RelativeLayout {
|
||||||
//sets the data of the list adapter
|
//sets the data of the list adapter
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.listAdapter.setCryptoNetBalanceViewHolder(cryptoNetBalanceViewHolder);
|
this.listAdapter.setCryptoNetBalanceViewHolder(cryptoNetBalanceViewHolder);
|
||||||
this.listAdapter.setList(data);
|
this.listAdapter.submitList(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class CryptoNetAccountListView extends RelativeLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.listAdapter.setList(data);
|
this.listAdapter.submitList(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class CryptoNetBalanceListView extends RelativeLayout {
|
||||||
|
|
||||||
//sets the data of the list adapter
|
//sets the data of the list adapter
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.listAdapter.setList(data);
|
this.listAdapter.submitList(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class TransactionListView extends RelativeLayout {
|
||||||
|
|
||||||
//Sets the data of the transaction list
|
//Sets the data of the transaction list
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.listAdapter.setList(data);
|
this.listAdapter.submitList(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue