Permalink
Browse files

Update to version 34

  • Loading branch information...
webmaster128 committed Jul 25, 2016
1 parent 382c239 commit 4b701e1f92f972f3b1809661ea486539d5cecc11
Showing with 824 additions and 566 deletions.
  1. +26 −12 app/build.gradle
  2. +12 −0 app/changelog.md
  3. +2 −2 app/google-services.json
  4. +42 −0 app/src/androidTest/java/net/kullo/android/littlehelpers/ListHelperTest.java
  5. +7 −15 app/src/main/AndroidManifest.xml
  6. +4 −15 app/src/main/java/net/kullo/android/kulloapi/MessagesComparatorAsc.java
  7. +0 −6 app/src/main/java/net/kullo/android/kulloapi/MessagesComparatorDsc.java
  8. +11 −10 app/src/main/java/net/kullo/android/kulloapi/SessionConnector.java
  9. +10 −7 app/src/main/java/net/kullo/android/littlehelpers/Debug.java
  10. +13 −0 app/src/main/java/net/kullo/android/littlehelpers/ListHelper.java
  11. +127 −0 app/src/main/java/net/kullo/android/littlehelpers/StreamCopy.java
  12. +2 −1 app/src/main/java/net/kullo/android/screens/AboutActivity.java
  13. +2 −1 app/src/main/java/net/kullo/android/screens/AccountActivity.java
  14. +85 −124 app/src/main/java/net/kullo/android/screens/ComposeActivity.java
  15. +1 −1 app/src/main/java/net/kullo/android/screens/ConversationsListActivity.java
  16. +2 −1 app/src/main/java/net/kullo/android/screens/CropImageActivity.java
  17. +2 −1 app/src/main/java/net/kullo/android/screens/ImpressumActivity.java
  18. +2 −1 app/src/main/java/net/kullo/android/screens/LicensesActivity.java
  19. +4 −10 app/src/main/java/net/kullo/android/screens/MessagesListActivity.java
  20. +43 −43 app/src/main/java/net/kullo/android/screens/SettingsActivity.java
  21. +12 −3 app/src/main/java/net/kullo/android/screens/SingleMessageActivity.java
  22. +2 −1 app/src/main/java/net/kullo/android/screens/StartConversationActivity.java
  23. +0 −270 app/src/main/java/net/kullo/android/screens/messageslist/MessageAttachmentsOpener.java
  24. +2 −4 app/src/main/java/net/kullo/android/screens/messageslist/MessagesAdapter.java
  25. +362 −0 app/src/main/java/net/kullo/android/screens/singlemessage/MessageAttachmentsOpener.java
  26. +3 −2 app/src/main/res/values-de/strings.xml
  27. +5 −4 app/src/main/res/values/strings.xml
  28. +2 −2 build.gradle
  29. BIN gradle/wrapper/gradle-wrapper.jar
  30. +2 −2 gradle/wrapper/gradle-wrapper.properties
  31. +25 −21 gradlew
  32. +4 −4 gradlew.bat
  33. +8 −3 libkullo/build.gradle
@@ -1,15 +1,23 @@
apply plugin: 'com.android.application'

ext {
SUPPORT_LIBRARY_VERSION = "24.0.0"
TARGET_SDK_VERSION = 24
BUILD_TOOLS_VERSION = "24.0.0"
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileSdkVersion TARGET_SDK_VERSION
buildToolsVersion BUILD_TOOLS_VERSION

defaultConfig {
applicationId 'net.kullo.android'
minSdkVersion 15
targetSdkVersion 23
versionCode 3300
versionName "33"
targetSdkVersion TARGET_SDK_VERSION
versionCode 3400
versionName "34"

testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
buildTypes {
debug {
@@ -35,11 +43,12 @@ dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'org.apache.commons:commons-lang3:3.4'

compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile "com.android.support:support-annotations:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:appcompat-v7:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:cardview-v7:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:recyclerview-v7:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:design:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:support-v4:${SUPPORT_LIBRARY_VERSION}"

compile 'com.timehop.stickyheadersrecyclerview:library:0.4.2@aar'
compile 'de.hdodenhof:circleimageview:2.0.0'
@@ -49,12 +58,17 @@ dependencies {

// MaterialDialogs pulls in MaterialProgressBar as a dependency
// At the moment, the versions match.
compile('com.github.afollestad.material-dialogs:core:0.8.5.6@aar') { transitive = true }
compile 'com.afollestad.material-dialogs:core:0.8.5.9'

compile "com.google.android.gms:play-services-gcm:8.4.0"
compile "com.google.android.gms:play-services-gcm:9.2.1"

compile project(':libkullo')
compile project(':javautils')

// tests
// androidTestCompile "com.android.support:support-annotations:${SUPPORT_LIBRARY_VERSION}"
// androidTestCompile "com.android.support.test:runner:0.4.1"
// androidTestCompile "com.android.support.test:rules:0.4.1"
}

android {
@@ -1,6 +1,18 @@
Kullo for Android
-----------------

## v34 (2016-07-22)

* Fix a timeout issue when sending or receiving large attachments
* Fix crash when leaving inbox in landscape mode
* Fix bug in "Save to" action for attachments
* Other minor stability improvements and dependency updates

### Components

* Update libkullo to v53
* Update SmartSqlite to v12

## v33 (2016-06-20)

* Fixing a compatibility issue with message encryption
@@ -15,7 +15,7 @@
}
},
"oauth_client": [],
"api_key": [],
"api_key": [{ "current_key": "" }],
"services": {
"analytics_service": {
"status": 1
@@ -39,4 +39,4 @@
],
"client_info": [],
"ARTIFACT_VERSION": "1"
}
}
@@ -0,0 +1,42 @@
/* Copyright 2015-2016 Kullo GmbH. All rights reserved. */
package net.kullo.android.littlehelpers;

import android.test.AndroidTestCase;

import java.util.List;

public class ListHelperTest extends AndroidTestCase {
public void testSimple() {
{
int inValue = 333;
Integer expectedOutValue = 333;
List actual = ListHelper.asList(inValue);
assertEquals(actual.size(), 1);
assertEquals(actual.get(0), expectedOutValue);
}

{
long inValue = 333;
Long expectedOutValue = 333L;
List actual = ListHelper.asList(inValue);
assertEquals(actual.size(), 1);
assertEquals(actual.get(0), expectedOutValue);
}

{
Long inValue = 333L;
Long expectedOutValue = 333L;
List actual = ListHelper.asList(inValue);
assertEquals(actual.size(), 1);
assertEquals(actual.get(0), expectedOutValue);
}

{
String inValue = "foobar";
String expectedOutValue = "foobar";
List actual = ListHelper.asList(inValue);
assertEquals(actual.size(), 1);
assertEquals(actual.get(0), expectedOutValue);
}
}
}
@@ -5,7 +5,11 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.androidc2dm.permission.RECEIVE" />

<!-- GCM -->
<permission android:name="net.kullo.android.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="net.kullo.android.permission.C2D_MESSAGE" />

<uses-feature
android:name="android.hardware.camera"
@@ -14,14 +18,12 @@
<application
android:name=".application.KulloApplication"
android:allowBackup="true"
android:configChanges="orientation"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme">
<activity
android:name=".screens.WelcomeActivity"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true"
android:screenOrientation="portrait">
<intent-filter>
@@ -32,16 +34,13 @@
</activity>
<activity
android:name=".screens.LoginActivity"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true"
android:screenOrientation="portrait" />
<activity
android:name=".screens.RegistrationActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait" />
<activity
android:name=".screens.ConversationsListActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:launchMode="singleTop">
<intent-filter>
@@ -50,11 +49,9 @@
</intent-filter>
</activity>
<activity
android:name=".screens.MessagesListActivity"
android:configChanges="orientation|keyboardHidden" />
android:name=".screens.MessagesListActivity" />
<activity
android:name=".screens.SingleMessageActivity"
android:configChanges="orientation|keyboardHidden" />
android:name=".screens.SingleMessageActivity" />
<activity
android:name=".screens.ComposeActivity"
android:windowSoftInputMode="adjustResize">
@@ -71,23 +68,18 @@
</activity>
<activity
android:name=".screens.StartConversationActivity"
android:configChanges="orientation|keyboardHidden"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".screens.AboutActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/menu_about" />
<activity
android:name=".screens.SettingsActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/menu_settings" />
<activity
android:name=".screens.CropImageActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/crop_image" />
<activity
android:name=".screens.AccountActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/menu_account" />
<activity android:name=".screens.DebugActivity">
<intent-filter>
@@ -1,25 +1,14 @@
/* Copyright 2015-2016 Kullo GmbH. All rights reserved. */
package net.kullo.android.kulloapi;

import net.kullo.libkullo.api.DateTime;
import net.kullo.libkullo.api.Session;
import java.util.Comparator;

/**
* Comparator for ascending sorting of messages based on dateReceived
* Uses libkullo's DateTime compare functions directly. No Joda conversion needed.
* Comparator for ascending sorting of messages based on id
*/
public class MessagesComparatorAsc extends KulloComparator {
public MessagesComparatorAsc(Session session) {
super(session);
}

public class MessagesComparatorAsc implements Comparator<Long> {
@Override
public int compare(Long lhsMessageId, Long rhsMessageId) {
count();

DateTime lhsDate = mSession.messages().dateReceived(lhsMessageId);
DateTime rhsDate = mSession.messages().dateReceived(rhsMessageId);

return lhsDate.compareTo(rhsDate);
return lhsMessageId.compareTo(rhsMessageId);
}
}
@@ -1,13 +1,7 @@
/* Copyright 2015-2016 Kullo GmbH. All rights reserved. */
package net.kullo.android.kulloapi;

import net.kullo.libkullo.api.Session;

public class MessagesComparatorDsc extends MessagesComparatorAsc {
public MessagesComparatorDsc(Session session) {
super(session);
}

@Override
public int compare(Long lhsMessageId, Long rhsMessageId) {
return super.compare(lhsMessageId, rhsMessageId) * -1;
@@ -577,8 +577,10 @@ public void removeConversation(long conversationId) {
mSession.conversations().remove(conversationId);
}

// Get all data at once to avoid unnecessary JNI calls when scolling the list
// Get all data at once to avoid unnecessary JNI calls when scrolling the list
public ConversationData getConversationData(Context context, long conversationId) {
RuntimeAssertion.require(mSession != null);

ConversationData out = new ConversationData();
out.mParticipants = getParticipantAddresses(conversationId);

@@ -653,6 +655,7 @@ public void clearDraftForConversation(long conversationId) {
mSession.drafts().clear(conversationId);
}

@NonNull
public String getDraftText(long conversationId) {
RuntimeAssertion.require(mSession != null);

@@ -679,7 +682,7 @@ public AsyncTask addAttachmentToDraft(long conversationId, String filePath, Stri
RuntimeAssertion.require(filePath != null);
RuntimeAssertion.require(mimeType != null);

return mSession.draftAttachments().addAsync(conversationId, filePath, mimeType, new DraftAttachmentsAddListener() {
AsyncTask task = mSession.draftAttachments().addAsync(conversationId, filePath, mimeType, new DraftAttachmentsAddListener() {
@Override
public void finished(long convId, long attId, String path) {
synchronized (mListenerObservers.get(DraftAttachmentsAddListenerObserver.class)) {
@@ -698,6 +701,9 @@ public void error(long convId, String path, LocalError error) {
}
}
});

mTaskHolder.add(task);
return task;
}

public void removeDraftAttachment(long conversationId, long attachmentId) {
@@ -842,17 +848,12 @@ public void removeMessage(final long messageId) {
}

@NonNull
public ArrayList<Long> getAllMessageIdsSorted(long conversationId) {
public List<Long> getAllMessageIdsSorted(long conversationId) {
RuntimeAssertion.require(mSession != null);

// presort IDs list (by ID, descending)
ArrayList<Long> list = mSession.messages().allForConversation(conversationId); // unsorted
// List is sorted by id (equal to dateReceived); Reverse to get newest first
List<Long> list = mSession.messages().allForConversation(conversationId);
Collections.reverse(list);

KulloComparator countingComp = new MessagesComparatorDsc(mSession);
KulloSort.insertionsort(list, countingComp);
Log.d(TAG, "Done sorting messages. " + countingComp.getStats());

return list;
}

@@ -3,6 +3,7 @@

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

public class Debug {
public static String getUriDetails(Uri uri) {
@@ -26,6 +27,8 @@ public static String getUriDetails(Uri uri) {
}

public static String getIntentDetails(Intent intent) {
Uri data = intent.getData();
Bundle extras = intent.getExtras();
return String.format("Intent: %s\n" +
" Data: %s\n" +
" scheme: %s\n" +
@@ -35,13 +38,13 @@ public static String getIntentDetails(Intent intent) {
" fragment encoded: %s\n" +
" Extras: %s",
intent,
intent.getData().toString(),
intent.getData().getScheme(),
intent.getData().getSchemeSpecificPart(),
intent.getData().getEncodedSchemeSpecificPart(),
intent.getData().getFragment(),
intent.getData().getEncodedFragment(),
(intent.getExtras() != null ? intent.getExtras().toString() : "null")
data != null ? data.toString() : "null",
data != null ? data.getScheme() : "",
data != null ? data.getSchemeSpecificPart() : "",
data != null ? data.getEncodedSchemeSpecificPart() : "",
data != null ? data.getFragment() : "",
data != null ? data.getEncodedFragment() : "",
extras != null ? extras.toString() : "null"
);
}
}
@@ -0,0 +1,13 @@
/* Copyright 2015-2016 Kullo GmbH. All rights reserved. */
package net.kullo.android.littlehelpers;

import java.util.ArrayList;
import java.util.List;

public class ListHelper {
public static <T> List<T> asList(T element) {
ArrayList<T> out = new ArrayList<T>(1 /*initialCapacity*/);
out.add(element);
return out;
}
}
Oops, something went wrong.

0 comments on commit 4b701e1

Please sign in to comment.