Skip to content
Permalink
Browse files

use long instead of int as per new jmap lib

R8 has the nasty side effect of 'optimizing' JSON entity fields to null.

https://r8.googlesource.com/r8/+/refs/heads/master/compatibility-faq.md
  • Loading branch information...
iNPUTmice committed Oct 15, 2019
1 parent a54bf52 commit 26bce5b094fa604915f9bc25558cf35c2207357f
@@ -39,15 +39,16 @@ android {

dependencies {

def lifecycle_version = "2.2.0-alpha03"
def nav_version = "2.2.0-alpha01"
def appcompat_version = "1.1.0"
def lifecycle_version = "2.2.0-beta01"
def nav_version = "2.2.0-beta01"
def paging_version = "2.1.0"
def recycler_view_version = "1.1.0-beta03"
def recycler_view_version = "1.1.0-beta05"
def recycler_view_selection_version = "1.1.0-alpha06"
def room_version = "2.2.0-alpha02"
def room_version = "2.2.0"
def work_version = "2.2.0"

implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation 'rs.ltt.jmap:jmap-mua:0.1.0'
implementation 'rs.ltt.jmap:jmap-common:0.1.0'

@@ -60,7 +61,7 @@ dependencies {
implementation "androidx.recyclerview:recyclerview-selection:$recycler_view_selection_version"

implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha09'
implementation 'com.google.android.material:material:1.1.0-beta01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "androidx.paging:paging-common:$paging_version"
@@ -73,16 +73,16 @@
public abstract List<MailboxWithRoleAndName> getMailboxesForThread(String threadId);

@Query("update mailbox set totalEmails=:value where id=:id")
public abstract void updateTotalEmails(String id, Integer value);
public abstract void updateTotalEmails(String id, Long value);

@Query("update mailbox set unreadEmails=:value where id=:id")
public abstract void updateUnreadEmails(String id, Integer value);
public abstract void updateUnreadEmails(String id, Long value);

@Query("update mailbox set totalThreads=:value where id=:id")
public abstract void updateTotalThreads(String id, Integer value);
public abstract void updateTotalThreads(String id, Long value);

@Query("update mailbox set unreadThreads=:value where id=:id")
public abstract void updateUnreadThreads(String id, Integer value);
public abstract void updateUnreadThreads(String id, Long value);

@Query("delete from mailbox where id=:id")
public abstract void delete(String id);
@@ -110,7 +110,7 @@ public void add(String queryString, QueryResult queryResult) {
abstract QueryEntity getQueryEntity(String queryString);

@Query("update query_item set position=position+1 where queryId=:queryId and position>=:position ")
abstract int incrementAllPositionsFrom(Long queryId, Integer position);
abstract int incrementAllPositionsFrom(Long queryId, Long position);

//TODO: is this query safe to run when emailId is not found
@Query("update query_item set position=position-1 where queryId=:queryId and position>(select position from query_item where emailId=:emailId and queryId=:queryId)")
@@ -40,10 +40,10 @@
@NonNull
public EmailBodyPartType bodyPartType;
@NonNull
public Integer position;
public Long position;
public String partId;
public String blobId;
public Integer size;
public Long size;
public String name;
public String type;
public String charset;
@@ -63,7 +63,7 @@
return builder.build();
}

private static EmailBodyPartEntity of(String emailId, EmailBodyPartType type, int position, EmailBodyPart emailBodyPart) {
private static EmailBodyPartEntity of(String emailId, EmailBodyPartType type, long position, EmailBodyPart emailBodyPart) {
final EmailBodyPartEntity entity = new EmailBodyPartEntity();
entity.emailId = emailId;
entity.bodyPartType = type;
@@ -34,7 +34,7 @@

public String threadId;

public Integer size;
public Long size;

public Date receivedAt;

@@ -74,7 +74,7 @@ public String getText() {
textBody.add(entity);
}
}
Collections.sort(textBody, (o1, o2) -> o1.position - o2.position);
Collections.sort(textBody, (o1, o2) -> o1.position.compareTo(o2.position));
EmailBodyPartEntity first = Iterables.getFirst(textBody, null);
Map<String, EmailBodyValueEntity> map = Maps.uniqueIndex(bodyValueEntities, value -> value.partId);
EmailBodyValueEntity value = map.get(first.partId);
@@ -36,15 +36,15 @@

public Role role;

public Integer sortOrder;
public Long sortOrder;

public Integer totalEmails;
public Long totalEmails;

public Integer unreadEmails;
public Long unreadEmails;

public Integer totalThreads;
public Long totalThreads;

public Integer unreadThreads;
public Long unreadThreads;

@Embedded
public MailboxRightsEmbed myRights;
@@ -42,20 +42,20 @@
public Long queryId;

//TODO: delete position; we just needed that for debugging stuff
public Integer position;
public Long position;
public String emailId;
public String threadId;


public QueryItemEntity(@NonNull Long queryId, Integer position, String emailId, String threadId) {
public QueryItemEntity(@NonNull Long queryId, Long position, String emailId, String threadId) {
this.queryId = queryId;
this.position = position;
this.emailId = emailId;
this.threadId = threadId;
}


public static List<QueryItemEntity> of(final Long queryId, final QueryResultItem[] items, final int offset) {
public static List<QueryItemEntity> of(final Long queryId, final QueryResultItem[] items, final long offset) {
ImmutableList.Builder<QueryItemEntity> builder = new ImmutableList.Builder<>();
for (int i = 0; i < items.length; ++i) {
QueryResultItem item = items[i];
@@ -64,7 +64,7 @@ public QueryItemEntity(@NonNull Long queryId, Integer position, String emailId,
return builder.build();
}

public static QueryItemEntity of(final Long queryId, Integer position, QueryResultItem item) {
public static QueryItemEntity of(final Long queryId, Long position, QueryResultItem item) {
return new QueryItemEntity(queryId, position, item.getEmailId(), item.getThreadId());
}
}
@@ -70,7 +70,7 @@ public LttrsRepository(Application application) {
.username(Credentials.username)
.cache(new DatabaseCache(this.database))
.sessionCache(new SessionFileCache(application.getCacheDir()))
.queryPageSize(20)
.queryPageSize(20L)
.build();
}

@@ -6,8 +6,8 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.2.0-alpha01"
classpath 'com.android.tools.build:gradle:3.5.1'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.2.0-beta01"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

0 comments on commit 26bce5b

Please sign in to comment.
You can’t perform that action at this time.