Commit 92a70c60 authored by laggedHero's avatar laggedHero Committed by GitHub

Merge pull request #88 from RocketChat/feature/unread-mode

Feature/unread mode
parents f91a845d 1880ace4
...@@ -2,42 +2,42 @@ apply plugin: 'com.android.library' ...@@ -2,42 +2,42 @@ apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda' apply plugin: 'me.tatarka.retrolambda'
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath rootProject.ext.androidPlugin classpath rootProject.ext.androidPlugin
classpath rootProject.ext.retroLambdaPlugin classpath rootProject.ext.retroLambdaPlugin
classpath rootProject.ext.retroLambdaPatch classpath rootProject.ext.retroLambdaPatch
} }
} }
android { android {
compileSdkVersion rootProject.ext.compileSdkVersion compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion buildToolsVersion rootProject.ext.buildToolsVersion
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
defaultConfig { defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.compileSdkVersion targetSdkVersion rootProject.ext.compileSdkVersion
versionCode 1 versionCode 1
versionName "0.0.8" versionName "0.0.8"
} }
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
}
} }
dependencies { dependencies {
compile project(':log-wrapper') compile project(':log-wrapper')
compile rootProject.ext.supportAnnotations compile rootProject.ext.supportAnnotations
compile 'com.squareup.okhttp3:okhttp-ws:3.4.1' compile 'com.squareup.okhttp3:okhttp-ws:3.4.1'
compile rootProject.ext.rxJava compile rootProject.ext.rxJava
compile rootProject.ext.boltsTask compile rootProject.ext.boltsTask
} }
...@@ -6,123 +6,123 @@ apply plugin: 'com.github.triplet.play' ...@@ -6,123 +6,123 @@ apply plugin: 'com.github.triplet.play'
apply from: '../config/quality/quality.gradle' apply from: '../config/quality/quality.gradle'
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath rootProject.ext.androidPlugin classpath rootProject.ext.androidPlugin
// 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
classpath rootProject.ext.retroLambdaPlugin classpath rootProject.ext.retroLambdaPlugin
classpath rootProject.ext.retroLambdaPatch classpath rootProject.ext.retroLambdaPatch
classpath rootProject.ext.realmPlugin classpath rootProject.ext.realmPlugin
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1' classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'com.google.gms:google-services:3.0.0' classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.github.triplet.gradle:play-publisher:1.1.5' classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
} }
// Exclude the version that the android plugin depends on. // Exclude the version that the android plugin depends on.
configurations.classpath.exclude group: 'com.android.tools.external.lombok' configurations.classpath.exclude group: 'com.android.tools.external.lombok'
} }
android { android {
compileSdkVersion rootProject.ext.compileSdkVersion compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig { defaultConfig {
applicationId "chat.rocket.android" applicationId "chat.rocket.android"
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.compileSdkVersion targetSdkVersion rootProject.ext.compileSdkVersion
versionCode 2 versionCode 2
versionName "1.0" versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
multiDexEnabled true multiDexEnabled true
} }
signingConfigs { signingConfigs {
release { release {
storeFile project.rootProject.file('Rocket.jks').getCanonicalFile() storeFile project.rootProject.file('Rocket.jks').getCanonicalFile()
storePassword System.getenv("KEYSTORE_PASSWORD") storePassword System.getenv("KEYSTORE_PASSWORD")
keyAlias System.getenv("KEY_ALIAS") keyAlias System.getenv("KEY_ALIAS")
keyPassword System.getenv("KEY_PASSWORD") keyPassword System.getenv("KEY_PASSWORD")
}
} }
buildTypes { }
release { buildTypes {
minifyEnabled false release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' minifyEnabled false
signingConfig signingConfigs.release proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} signingConfig signingConfigs.release
} }
productFlavors { }
qa { productFlavors {
// something - qa builds will have some extra stuff for alpha testers qa {
} // something - qa builds will have some extra stuff for alpha testers
prod {
// another
}
} }
packagingOptions { prod {
exclude 'META-INF/LICENSE.txt' // another
exclude 'META-INF/NOTICE.txt'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
//avoiding okio error: https://github.com/square/okhttp/issues/896
lintConfig file("lint.xml")
} }
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
//avoiding okio error: https://github.com/square/okhttp/issues/896
lintConfig file("lint.xml")
}
} }
play { play {
jsonFile = file('rocket-chat.json') jsonFile = file('rocket-chat.json')
track = "${track}" track = "${track}"
} }
repositories { repositories {
mavenCentral() mavenCentral()
maven { url 'https://github.com/lijingle1/stetho-realm/raw/master/maven-repo' } maven { url 'https://github.com/lijingle1/stetho-realm/raw/master/maven-repo' }
maven { url 'http://dl.bintray.com/amulyakhare/maven' } maven { url 'http://dl.bintray.com/amulyakhare/maven' }
maven { url "https://clojars.org/repo/" } //for icepick. maven { url "https://clojars.org/repo/" } //for icepick.
} }
dependencies { dependencies {
compile project(':log-wrapper') compile project(':log-wrapper')
compile project(':android-ddp') compile project(':android-ddp')
compile project(':rocket-chat-android-widgets') compile project(':rocket-chat-android-widgets')
compile project(':realm-helpers') compile project(':realm-helpers')
compile rootProject.ext.supportAppCompat compile rootProject.ext.supportAppCompat
compile rootProject.ext.supportDesign compile rootProject.ext.supportDesign
qaCompile('com.instabug.library:instabug:3.1.0') { qaCompile('com.instabug.library:instabug:3.1.0') {
exclude group: 'io.reactivex' exclude group: 'io.reactivex'
} }
compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-core:10.0.0' compile 'com.google.firebase:firebase-core:10.0.0'
compile 'com.google.firebase:firebase-crash:10.0.0' compile 'com.google.firebase:firebase-crash:10.0.0'
compile rootProject.ext.okhttp3 compile rootProject.ext.okhttp3
compile rootProject.ext.picasso compile rootProject.ext.picasso
compile 'com.facebook.stetho:stetho:1.4.1' compile 'com.facebook.stetho:stetho:1.4.1'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.1' compile 'com.facebook.stetho:stetho-okhttp3:1.4.1'
compile 'com.uphyca:stetho_realm:2.0.1' compile 'com.uphyca:stetho_realm:2.0.1'
compile 'com.jakewharton.rxbinding:rxbinding:0.4.0' compile 'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0' compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'
compile 'com.trello:rxlifecycle:1.0' compile 'com.trello:rxlifecycle:1.0'
compile 'com.trello:rxlifecycle-android:1.0' compile 'com.trello:rxlifecycle-android:1.0'
compile 'com.trello:rxlifecycle-components:1.0' compile 'com.trello:rxlifecycle-components:1.0'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'frankiesardo:icepick:3.2.0' compile 'frankiesardo:icepick:3.2.0'
provided 'frankiesardo:icepick-processor:3.2.0' provided 'frankiesardo:icepick-processor:3.2.0'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
...@@ -36,6 +36,6 @@ public class RocketChatApplication extends MultiDexApplication { ...@@ -36,6 +36,6 @@ public class RocketChatApplication extends MultiDexApplication {
InstabugWrapper.build(this, getString(R.string.instabug_api_key)); InstabugWrapper.build(this, getString(R.string.instabug_api_key));
//TODO: add periodic trigger for RocketChatService.keepalive(this) here! //TODO: add periodic trigger for RocketChatService.keepAlive(this) here!
} }
} }
package chat.rocket.android.api; package chat.rocket.android.api;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.UUID;
import bolts.Task; import bolts.Task;
import chat.rocket.android.helper.OkHttpHelper; import chat.rocket.android.helper.OkHttpHelper;
import chat.rocket.android.helper.TextUtils; import chat.rocket.android.helper.TextUtils;
...@@ -12,6 +9,11 @@ import chat.rocket.android.log.RCLog; ...@@ -12,6 +9,11 @@ import chat.rocket.android.log.RCLog;
import chat.rocket.android_ddp.DDPClient; import chat.rocket.android_ddp.DDPClient;
import chat.rocket.android_ddp.DDPClientCallback; import chat.rocket.android_ddp.DDPClientCallback;
import chat.rocket.android_ddp.DDPSubscription; import chat.rocket.android_ddp.DDPSubscription;
import java.util.UUID;
import org.json.JSONArray;
import org.json.JSONException;
import rx.Observable; import rx.Observable;
/** /**
......
...@@ -7,16 +7,14 @@ import android.widget.CompoundButton; ...@@ -7,16 +7,14 @@ import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.jakewharton.rxbinding.view.RxView;
import com.jakewharton.rxbinding.widget.RxCompoundButton;
import chat.rocket.android.R; import chat.rocket.android.R;
import chat.rocket.android.RocketChatCache; import chat.rocket.android.RocketChatCache;
import chat.rocket.android.api.MethodCallHelper; import chat.rocket.android.api.MethodCallHelper;
import chat.rocket.android.fragment.AbstractFragment; import chat.rocket.android.fragment.AbstractFragment;
import chat.rocket.android.fragment.sidebar.dialog.AbstractAddRoomDialogFragment; import chat.rocket.android.fragment.sidebar.dialog.AbstractAddRoomDialogFragment;
import chat.rocket.android.fragment.sidebar.dialog.AddChannelDialogFragment;
import chat.rocket.android.fragment.sidebar.dialog.AddDirectMessageDialogFragment; import chat.rocket.android.fragment.sidebar.dialog.AddDirectMessageDialogFragment;
import chat.rocket.android.fragment.sidebar.dialog.AddChannelDialogFragment;
import chat.rocket.android.helper.LogcatIfError; import chat.rocket.android.helper.LogcatIfError;
import chat.rocket.android.helper.TextUtils; import chat.rocket.android.helper.TextUtils;
import chat.rocket.android.layouthelper.chatroom.RoomListManager; import chat.rocket.android.layouthelper.chatroom.RoomListManager;
...@@ -29,6 +27,9 @@ import chat.rocket.android.realm_helper.RealmObjectObserver; ...@@ -29,6 +27,9 @@ import chat.rocket.android.realm_helper.RealmObjectObserver;
import chat.rocket.android.realm_helper.RealmStore; import chat.rocket.android.realm_helper.RealmStore;
import chat.rocket.android.renderer.UserRenderer; import chat.rocket.android.renderer.UserRenderer;
import com.jakewharton.rxbinding.view.RxView;
import com.jakewharton.rxbinding.widget.RxCompoundButton;
public class SidebarMainFragment extends AbstractFragment { public class SidebarMainFragment extends AbstractFragment {
private String serverConfigId; private String serverConfigId;
...@@ -75,7 +76,7 @@ public class SidebarMainFragment extends AbstractFragment { ...@@ -75,7 +76,7 @@ public class SidebarMainFragment extends AbstractFragment {
currentUserObserver = realmHelper currentUserObserver = realmHelper
.createObjectObserver(User::queryCurrentUser) .createObjectObserver(User::queryCurrentUser)
.setOnUpdateListener(this::onRenderCurrentUser); .setOnUpdateListener(this::onCurrentUser);
methodCallHelper = new MethodCallHelper(getContext(), serverConfigId); methodCallHelper = new MethodCallHelper(getContext(), serverConfigId);
} }
...@@ -103,6 +104,8 @@ public class SidebarMainFragment extends AbstractFragment { ...@@ -103,6 +104,8 @@ public class SidebarMainFragment extends AbstractFragment {
setupAddChannelButton(); setupAddChannelButton();
roomListManager = new RoomListManager( roomListManager = new RoomListManager(
rootView.findViewById(R.id.unread_title),
(LinearLayout) rootView.findViewById(R.id.unread_container),
(LinearLayout) rootView.findViewById(R.id.channels_container), (LinearLayout) rootView.findViewById(R.id.channels_container),
(LinearLayout) rootView.findViewById(R.id.direct_messages_container)); (LinearLayout) rootView.findViewById(R.id.direct_messages_container));
roomListManager.setOnItemClickListener(view -> { roomListManager.setOnItemClickListener(view -> {
...@@ -142,6 +145,11 @@ public class SidebarMainFragment extends AbstractFragment { ...@@ -142,6 +145,11 @@ public class SidebarMainFragment extends AbstractFragment {
} }
} }
private void onCurrentUser(User user) {
onRenderCurrentUser(user);
updateRoomListMode(user);
}
private void onRenderCurrentUser(User user) { private void onRenderCurrentUser(User user) {
if (user != null && !TextUtils.isEmpty(hostname)) { if (user != null && !TextUtils.isEmpty(hostname)) {
new UserRenderer(getContext(), user) new UserRenderer(getContext(), user)
...@@ -151,6 +159,13 @@ public class SidebarMainFragment extends AbstractFragment { ...@@ -151,6 +159,13 @@ public class SidebarMainFragment extends AbstractFragment {
} }
} }
private void updateRoomListMode(User user) {
if (user == null || user.getSettings() == null || user.getSettings().getPreferences() == null) {
return;
}
roomListManager.setUnreadRoomMode(user.getSettings().getPreferences().isUnreadRoomsMode());
}
private void setupLogoutButton() { private void setupLogoutButton() {
rootView.findViewById(R.id.btn_logout).setOnClickListener(view -> { rootView.findViewById(R.id.btn_logout).setOnClickListener(view -> {
if (methodCallHelper != null) { if (methodCallHelper != null) {
......
...@@ -3,61 +3,60 @@ package chat.rocket.android.layouthelper.chatroom; ...@@ -3,61 +3,60 @@ package chat.rocket.android.layouthelper.chatroom;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import java.util.List;
import chat.rocket.android.helper.TextUtils; import chat.rocket.android.helper.TextUtils;
import chat.rocket.android.model.ddp.RoomSubscription; import chat.rocket.android.model.ddp.RoomSubscription;
import chat.rocket.android.widget.internal.RoomListItemView; import chat.rocket.android.widget.internal.RoomListItemView;
import java.util.List;
/** /**
* Utility class for mapping Room list into channel list ViewGroup. * Utility class for mapping Room list into channel list ViewGroup.
*/ */
public class RoomListManager { public class RoomListManager {
private View unreadTitle;
private ViewGroup unreadRoomsContainer;
private ViewGroup channelsContainer; private ViewGroup channelsContainer;
private ViewGroup dmContainer; private ViewGroup dmContainer;
private boolean unreadRoomMode = false;
private List<RoomSubscription> roomSubscriptionList;
/**
* Callback interface for List item clicked.
*/
public interface OnItemClickListener {
void onItemClick(RoomListItemView roomListItemView);
}
private OnItemClickListener listener; private OnItemClickListener listener;
/**
* constructor with three ViewGroups.
*/
public RoomListManager(View unreadTitle, ViewGroup unreadRoomsContainer,
ViewGroup channelsContainer, ViewGroup dmContainer) {
this(unreadTitle, unreadRoomsContainer, channelsContainer, dmContainer, false);
}
/** /**
* constructor with two ViewGroups. * constructor with two ViewGroups.
*/ */
public RoomListManager(ViewGroup channelsContainer, ViewGroup dmContainer) { public RoomListManager(View unreadTitle, ViewGroup unreadRoomsContainer,
ViewGroup channelsContainer, ViewGroup dmContainer,
boolean unreadRoomMode) {
this.unreadTitle = unreadTitle;
this.unreadRoomsContainer = unreadRoomsContainer;
this.channelsContainer = channelsContainer; this.channelsContainer = channelsContainer;
this.dmContainer = dmContainer; this.dmContainer = dmContainer;
} this.unreadRoomMode = unreadRoomMode;
private static void removeItemIfExists(ViewGroup parent, String roomName) {
for (int i = 0; i < parent.getChildCount(); i++) {
RoomListItemView roomListItemView = (RoomListItemView) parent.getChildAt(i);
if (roomName.equals(roomListItemView.getRoomName())) {
parent.removeViewAt(i);
break;
}
}
} }
/** /**
* update ViewGroups with room list. * update ViewGroups with room list.
*/ */
public void setRooms(List<RoomSubscription> roomSubscriptionList) { public void setRooms(List<RoomSubscription> roomSubscriptionList) {
removeDeletedItem(channelsContainer, roomSubscriptionList); this.roomSubscriptionList = roomSubscriptionList;
removeDeletedItem(dmContainer, roomSubscriptionList); updateRoomsList();
for (RoomSubscription roomSubscription : roomSubscriptionList) {
String name = roomSubscription.getName();
if (TextUtils.isEmpty(name)) {
continue;
}
String type = roomSubscription.getType();
if (RoomSubscription.TYPE_CHANNEL.equals(type)
|| RoomSubscription.TYPE_PRIVATE.equals(type)) {
insertOrUpdateItem(channelsContainer, roomSubscription);
removeItemIfExists(dmContainer, name);
} else if (RoomSubscription.TYPE_DIRECT_MESSAGE.equals(type)) {
removeItemIfExists(channelsContainer, name);
insertOrUpdateItem(dmContainer, roomSubscription);
}
}
} }
/** /**
...@@ -86,6 +85,11 @@ public class RoomListManager { ...@@ -86,6 +85,11 @@ public class RoomListManager {
} }
} }
public void setUnreadRoomMode(boolean unreadRoomMode) {
this.unreadRoomMode = unreadRoomMode;
updateRoomsList();
}
private void insertOrUpdateItem(ViewGroup parent, RoomSubscription roomSubscription) { private void insertOrUpdateItem(ViewGroup parent, RoomSubscription roomSubscription) {
final String roomName = roomSubscription.getName(); final String roomName = roomSubscription.getName();
...@@ -129,10 +133,47 @@ public class RoomListManager { ...@@ -129,10 +133,47 @@ public class RoomListManager {
} }
} }
/** private void updateRoomsList() {
* Callback interface for List item clicked. removeDeletedItem(unreadRoomsContainer, roomSubscriptionList);
*/ removeDeletedItem(channelsContainer, roomSubscriptionList);
public interface OnItemClickListener { removeDeletedItem(dmContainer, roomSubscriptionList);
void onItemClick(RoomListItemView roomListItemView);
for (RoomSubscription roomSubscription : roomSubscriptionList) {
String name = roomSubscription.getName();
if (TextUtils.isEmpty(name)) {
continue;
}
String type = roomSubscription.getType();
if (unreadRoomMode && roomSubscription.isAlert()) {
insertOrUpdateItem(unreadRoomsContainer, roomSubscription);
removeItemIfExists(channelsContainer, name);
removeItemIfExists(dmContainer, name);
} else if (RoomSubscription.TYPE_CHANNEL.equals(type)
|| RoomSubscription.TYPE_PRIVATE.equals(type)) {
removeItemIfExists(unreadRoomsContainer, name);
insertOrUpdateItem(channelsContainer, roomSubscription);
removeItemIfExists(dmContainer, name);
} else if (RoomSubscription.TYPE_DIRECT_MESSAGE.equals(type)) {
removeItemIfExists(unreadRoomsContainer, name);
removeItemIfExists(channelsContainer, name);
insertOrUpdateItem(dmContainer, roomSubscription);
}
}
boolean showUnread = unreadRoomMode && unreadRoomsContainer.getChildCount() != 0;
unreadTitle.setVisibility(showUnread ? View.VISIBLE : View.GONE);
unreadRoomsContainer.setVisibility(showUnread ? View.VISIBLE : View.GONE);
}
private static void removeItemIfExists(ViewGroup parent, String roomName) {
for (int i = 0; i < parent.getChildCount(); i++) {
RoomListItemView roomListItemView = (RoomListItemView) parent.getChildAt(i);
if (roomName.equals(roomListItemView.getRoomName())) {
parent.removeViewAt(i);
break;
}
}
} }
} }
package chat.rocket.android.model.ddp;
import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;
@SuppressWarnings({"PMD.ShortVariable"})
public class Preferences extends RealmObject {
@PrimaryKey private String id;
private boolean newRoomNotification;
private boolean newMessageNotification;
private boolean useEmojis;
private boolean convertAsciiEmoji;
private boolean saveMobileBandwidth;
private boolean collapseMediaByDefault;
private boolean unreadRoomsMode;
private boolean autoImageLoad;
private String emailNotificationMode;
private boolean unreadAlert;
private int desktopNotificationDuration;
private int viewMode;
private boolean hideUsernames;
private boolean hideAvatars;
private boolean hideFlexTab;
// private List<String> highlights; // Realm does not support this yet
public boolean isNewRoomNotification() {
return newRoomNotification;
}
public boolean isNewMessageNotification() {
return newMessageNotification;
}
public boolean isUseEmojis() {
return useEmojis;
}
public boolean isConvertAsciiEmoji() {
return convertAsciiEmoji;
}
public boolean isSaveMobileBandwidth() {
return saveMobileBandwidth;
}
public boolean isCollapseMediaByDefault() {
return collapseMediaByDefault;
}
public boolean isUnreadRoomsMode() {
return unreadRoomsMode;
}
public boolean isAutoImageLoad() {
return autoImageLoad;
}
public String getEmailNotificationMode() {
return emailNotificationMode;
}
public boolean isUnreadAlert() {
return unreadAlert;
}
public int getDesktopNotificationDuration() {
return desktopNotificationDuration;
}
public int getViewMode() {
return viewMode;
}
public boolean isHideUsernames() {
return hideUsernames;
}
public boolean isHideAvatars() {
return hideAvatars;
}
public boolean isHideFlexTab() {
return hideFlexTab;
}
}
package chat.rocket.android.model.ddp;
import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;
@SuppressWarnings({"PMD.ShortVariable"})
public class Settings extends RealmObject {
@PrimaryKey private String id;
private Preferences preferences;
public Preferences getPreferences() {
return preferences;
}
}
...@@ -22,6 +22,7 @@ public class User extends RealmObject { ...@@ -22,6 +22,7 @@ public class User extends RealmObject {
private String status; private String status;
private double utcOffset; private double utcOffset;
private RealmList<Email> emails; private RealmList<Email> emails;
private Settings settings;
public static RealmQuery<User> queryCurrentUser(Realm realm) { public static RealmQuery<User> queryCurrentUser(Realm realm) {
return realm.where(User.class).isNotEmpty("emails"); return realm.where(User.class).isNotEmpty("emails");
...@@ -66,4 +67,8 @@ public class User extends RealmObject { ...@@ -66,4 +67,8 @@ public class User extends RealmObject {
public void setEmails(RealmList<Email> emails) { public void setEmails(RealmList<Email> emails) {
this.emails = emails; this.emails = emails;
} }
public Settings getSettings() {
return settings;
}
} }
...@@ -14,6 +14,7 @@ public class LoadMessageProcedure extends RealmObject { ...@@ -14,6 +14,7 @@ public class LoadMessageProcedure extends RealmObject {
private long timestamp; private long timestamp;
private int count; private int count;
@SuppressWarnings({"PMD.AvoidFieldNameMatchingMethodName"})
private boolean hasNext; private boolean hasNext;
public String getRoomId() { public String getRoomId() {
......
...@@ -71,7 +71,7 @@ public class RocketChatService extends Service { ...@@ -71,7 +71,7 @@ public class RocketChatService extends Service {
if (webSocketThreads.containsKey(serverConfigId)) { if (webSocketThreads.containsKey(serverConfigId)) {
RocketChatWebSocketThread thread = webSocketThreads.get(serverConfigId); RocketChatWebSocketThread thread = webSocketThreads.get(serverConfigId);
if (thread != null) { if (thread != null) {
thread.keepalive(); thread.keepAlive();
} }
} }
} }
...@@ -110,7 +110,7 @@ public class RocketChatService extends Service { ...@@ -110,7 +110,7 @@ public class RocketChatService extends Service {
.onSuccessTask(task -> { .onSuccessTask(task -> {
RocketChatWebSocketThread thread = task.getResult(); RocketChatWebSocketThread thread = task.getResult();
if (thread != null) { if (thread != null) {
thread.keepalive(); thread.keepAlive();
} }
return ServerConfig.updateState(serverConfigId, ServerConfig.STATE_CONNECTED); return ServerConfig.updateState(serverConfigId, ServerConfig.STATE_CONNECTED);
}).continueWith(new LogcatIfError()); }).continueWith(new LogcatIfError());
......
...@@ -140,7 +140,7 @@ public class RocketChatWebSocketThread extends HandlerThread { ...@@ -140,7 +140,7 @@ public class RocketChatWebSocketThread extends HandlerThread {
* synchronize the state of the thread with ServerConfig. * synchronize the state of the thread with ServerConfig.
*/ */
@DebugLog @DebugLog
public void keepalive() { public void keepAlive() {
if (ddpClient == null || !ddpClient.isConnected()) { if (ddpClient == null || !ddpClient.isConnected()) {
defaultRealm.executeTransaction(realm -> { defaultRealm.executeTransaction(realm -> {
ServerConfig config = realm.where(ServerConfig.class) ServerConfig config = realm.where(ServerConfig.class)
...@@ -242,9 +242,9 @@ public class RocketChatWebSocketThread extends HandlerThread { ...@@ -242,9 +242,9 @@ public class RocketChatWebSocketThread extends HandlerThread {
Object obj = ctor.newInstance(appContext, hostname, serverConfigRealm, ddpClient); Object obj = ctor.newInstance(appContext, hostname, serverConfigRealm, ddpClient);
if (obj instanceof Registrable) { if (obj instanceof Registrable) {
Registrable registerable = (Registrable) obj; Registrable registrable = (Registrable) obj;
registerable.register(); registrable.register();
listeners.add(registerable); listeners.add(registrable);
} }
} catch (Exception exception) { } catch (Exception exception) {
RCLog.w(exception, "Failed to register listeners!!"); RCLog.w(exception, "Failed to register listeners!!");
...@@ -260,8 +260,8 @@ public class RocketChatWebSocketThread extends HandlerThread { ...@@ -260,8 +260,8 @@ public class RocketChatWebSocketThread extends HandlerThread {
Iterator<Registrable> iterator = listeners.iterator(); Iterator<Registrable> iterator = listeners.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Registrable registerable = iterator.next(); Registrable registrable = iterator.next();
registerable.unregister(); registrable.unregister();
iterator.remove(); iterator.remove();
} }
if (ddpClient != null) { if (ddpClient != null) {
......
...@@ -3,6 +3,9 @@ package chat.rocket.android.service.ddp.base; ...@@ -3,6 +3,9 @@ package chat.rocket.android.service.ddp.base;
import android.content.Context; import android.content.Context;
import io.realm.RealmObject; import io.realm.RealmObject;
import org.json.JSONException;
import org.json.JSONObject;
import chat.rocket.android.api.DDPClientWrapper; import chat.rocket.android.api.DDPClientWrapper;
import chat.rocket.android.model.ddp.User; import chat.rocket.android.model.ddp.User;
import chat.rocket.android.realm_helper.RealmHelper; import chat.rocket.android.realm_helper.RealmHelper;
...@@ -30,4 +33,23 @@ public class UserDataSubscriber extends AbstractBaseSubscriber { ...@@ -30,4 +33,23 @@ public class UserDataSubscriber extends AbstractBaseSubscriber {
protected Class<? extends RealmObject> getModelClass() { protected Class<? extends RealmObject> getModelClass() {
return User.class; return User.class;
} }
@Override
protected JSONObject customizeFieldJson(JSONObject json) throws JSONException {
json = super.customizeFieldJson(json);
// The user object may have some children without a proper primary key (ex.: settings)
// Here we identify this and add a local key
if (json.has("settings")) {
final JSONObject settingsJson = json.getJSONObject("settings");
settingsJson.put("id", json.getString("_id"));
if (settingsJson.has("preferences")) {
final JSONObject preferencesJson = settingsJson.getJSONObject("preferences");
preferencesJson.put("id", json.getString("_id"));
}
}
return json;
}
} }
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:theme="@style/AppTheme.Dark" android:theme="@style/AppTheme.Dark">
>
<LinearLayout <LinearLayout
android:id="@+id/user_info_container" android:id="@+id/user_info_container"
...@@ -16,26 +15,22 @@ ...@@ -16,26 +15,22 @@
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="@dimen/margin_16" android:padding="@dimen/margin_16">
>
<ImageView <ImageView
android:id="@+id/current_user_status" android:id="@+id/current_user_status"
android:layout_width="8dp" android:layout_width="8dp"
android:layout_height="8dp" android:layout_height="8dp"
android:src="@drawable/userstatus_online" android:src="@drawable/userstatus_online" />
/>
<Space <Space
android:layout_width="@dimen/margin_8" android:layout_width="@dimen/margin_8"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
/>
<ImageView <ImageView
android:id="@+id/current_user_avatar" android:id="@+id/current_user_avatar"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp" />
/>
<TextView <TextView
android:id="@+id/current_user_name" android:id="@+id/current_user_name"
...@@ -46,14 +41,12 @@ ...@@ -46,14 +41,12 @@
android:layout_marginRight="@dimen/margin_8" android:layout_marginRight="@dimen/margin_8"
android:layout_weight="1" android:layout_weight="1"
android:textSize="14sp" android:textSize="14sp"
tools:text="John Doe" tools:text="John Doe" />
/>
<chat.rocket.android.widget.DownUpToggleView <chat.rocket.android.widget.DownUpToggleView
android:id="@+id/toggle_user_action" android:id="@+id/toggle_user_action"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
/>
</LinearLayout> </LinearLayout>
...@@ -62,21 +55,37 @@ ...@@ -62,21 +55,37 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_below="@+id/user_info_container" android:layout_below="@+id/user_info_container"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary">
>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="?attr/listPreferredItemPaddingLeft" android:paddingStart="?attr/listPreferredItemPaddingLeft">
>
<TextView
android:id="@+id/unread_title"
android:layout_marginTop="@dimen/margin_8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="48dp"
android:alpha="0.62"
android:text="@string/fragment_sidebar_main_unread_rooms_title"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/unread_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="?attr/listPreferredItemPaddingRight"
android:orientation="vertical" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_8" android:layout_marginTop="@dimen/margin_8">
>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -85,8 +94,7 @@ ...@@ -85,8 +94,7 @@
android:alpha="0.62" android:alpha="0.62"
android:text="@string/fragment_sidebar_main_channels_title" android:text="@string/fragment_sidebar_main_channels_title"
android:textAppearance="@style/TextAppearance.AppCompat.Body2" android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textStyle="bold" android:textStyle="bold" />
/>
<chat.rocket.android.widget.FontAwesomeButton <chat.rocket.android.widget.FontAwesomeButton
android:id="@+id/btn_add_channel" android:id="@+id/btn_add_channel"
...@@ -95,8 +103,7 @@ ...@@ -95,8 +103,7 @@
android:layout_height="48dp" android:layout_height="48dp"
android:layout_gravity="end|center_vertical" android:layout_gravity="end|center_vertical"
android:text="@string/fa_plus" android:text="@string/fa_plus"
android:textSize="12dp" android:textSize="12dp" />
/>
</FrameLayout> </FrameLayout>
...@@ -105,14 +112,12 @@ ...@@ -105,14 +112,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="?attr/listPreferredItemPaddingRight" android:layout_marginEnd="?attr/listPreferredItemPaddingRight"
android:orientation="vertical" android:orientation="vertical" />
/>
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_8" android:layout_marginTop="@dimen/margin_8">
>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -121,8 +126,7 @@ ...@@ -121,8 +126,7 @@
android:alpha="0.62" android:alpha="0.62"
android:text="@string/fragment_sidebar_main_direct_messages_title" android:text="@string/fragment_sidebar_main_direct_messages_title"
android:textAppearance="@style/TextAppearance.AppCompat.Body2" android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textStyle="bold" android:textStyle="bold" />
/>
<chat.rocket.android.widget.FontAwesomeButton <chat.rocket.android.widget.FontAwesomeButton
android:id="@+id/btn_add_direct_message" android:id="@+id/btn_add_direct_message"
...@@ -131,8 +135,7 @@ ...@@ -131,8 +135,7 @@
android:layout_height="48dp" android:layout_height="48dp"
android:layout_gravity="end|center_vertical" android:layout_gravity="end|center_vertical"
android:text="@string/fa_plus" android:text="@string/fa_plus"
android:textSize="12dp" android:textSize="12dp" />
/>
</FrameLayout> </FrameLayout>
...@@ -141,8 +144,7 @@ ...@@ -141,8 +144,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="?attr/listPreferredItemPaddingRight" android:layout_marginEnd="?attr/listPreferredItemPaddingRight"
android:orientation="vertical" android:orientation="vertical" />
/>
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </android.support.v4.widget.NestedScrollView>
...@@ -156,14 +158,12 @@ ...@@ -156,14 +158,12 @@
android:background="?attr/colorPrimaryDark" android:background="?attr/colorPrimaryDark"
android:elevation="2dp" android:elevation="2dp"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" tools:visibility="gone">
>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical">
>
<TextView <TextView
android:id="@+id/btn_status_online" android:id="@+id/btn_status_online"
...@@ -172,8 +172,7 @@ ...@@ -172,8 +172,7 @@
android:drawableLeft="@drawable/userstatus_online" android:drawableLeft="@drawable/userstatus_online"
android:drawablePadding="16dp" android:drawablePadding="16dp"
android:text="@string/user_status_online" android:text="@string/user_status_online"
android:textAppearance="?attr/textAppearanceListItemSmall" android:textAppearance="?attr/textAppearanceListItemSmall" />
/>
<TextView <TextView
android:id="@+id/btn_status_away" android:id="@+id/btn_status_away"
...@@ -182,8 +181,7 @@ ...@@ -182,8 +181,7 @@
android:drawableLeft="@drawable/userstatus_away" android:drawableLeft="@drawable/userstatus_away"
android:drawablePadding="16dp" android:drawablePadding="16dp"
android:text="@string/user_status_away" android:text="@string/user_status_away"
android:textAppearance="?attr/textAppearanceListItemSmall" android:textAppearance="?attr/textAppearanceListItemSmall" />
/>
<TextView <TextView
android:id="@+id/btn_status_busy" android:id="@+id/btn_status_busy"
...@@ -192,8 +190,7 @@ ...@@ -192,8 +190,7 @@
android:drawableLeft="@drawable/userstatus_busy" android:drawableLeft="@drawable/userstatus_busy"
android:drawablePadding="16dp" android:drawablePadding="16dp"
android:text="@string/user_status_busy" android:text="@string/user_status_busy"
android:textAppearance="?attr/textAppearanceListItemSmall" android:textAppearance="?attr/textAppearanceListItemSmall" />
/>
<TextView <TextView
android:id="@+id/btn_status_invisible" android:id="@+id/btn_status_invisible"
...@@ -202,24 +199,20 @@ ...@@ -202,24 +199,20 @@
android:drawableLeft="@drawable/userstatus_offline" android:drawableLeft="@drawable/userstatus_offline"
android:drawablePadding="16dp" android:drawablePadding="16dp"
android:text="@string/user_status_invisible" android:text="@string/user_status_invisible"
android:textAppearance="?attr/textAppearanceListItemSmall" android:textAppearance="?attr/textAppearanceListItemSmall" />
/>
<chat.rocket.android.widget.DividerView <chat.rocket.android.widget.DividerView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
/>
<LinearLayout <LinearLayout
android:id="@+id/btn_logout" android:id="@+id/btn_logout"
style="@style/sidebar_list_item" style="@style/sidebar_list_item"
android:orientation="horizontal" android:orientation="horizontal">
>
<FrameLayout <FrameLayout
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="match_parent" android:layout_height="match_parent">
>
<chat.rocket.android.widget.FontAwesomeTextView <chat.rocket.android.widget.FontAwesomeTextView
android:layout_width="16dp" android:layout_width="16dp"
...@@ -227,17 +220,15 @@ ...@@ -227,17 +220,15 @@
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:text="@string/fa_sign_out" android:text="@string/fa_sign_out"
android:textSize="14dp" android:textSize="14dp" />
/>
</FrameLayout> </FrameLayout>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/fragment_sidebar_main_logout_title" android:text="@string/fragment_sidebar_main_logout_title"
android:textAppearance="?attr/textAppearanceListItemSmall" android:textAppearance="?attr/textAppearanceListItemSmall" />
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </android.support.v4.widget.NestedScrollView>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -33,4 +33,5 @@ ...@@ -33,4 +33,5 @@
<string name="add_server_activity_waiting_server">Connecting to server…</string> <string name="add_server_activity_waiting_server">Connecting to server…</string>
<string name="server_config_activity_authenticating">Authenticating…</string> <string name="server_config_activity_authenticating">Authenticating…</string>
<string name="home_fragment_title">Rocket.Chat - Home</string> <string name="home_fragment_title">Rocket.Chat - Home</string>
<string name="fragment_sidebar_main_unread_rooms_title">UNREAD ROOMS</string>
</resources> </resources>
ext { ext {
androidPlugin = 'com.android.tools.build:gradle:2.2.3' androidPlugin = 'com.android.tools.build:gradle:2.2.3'
realmPlugin = 'io.realm:realm-gradle-plugin:2.2.1' realmPlugin = 'io.realm:realm-gradle-plugin:2.2.1'
retroLambdaPlugin = 'me.tatarka:gradle-retrolambda:3.3.1' retroLambdaPlugin = 'me.tatarka:gradle-retrolambda:3.3.1'
retroLambdaPatch = 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2' retroLambdaPatch = 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
compileSdkVersion = 25 compileSdkVersion = 25
buildToolsVersion = '25.0.1' buildToolsVersion = '25.0.1'
minSdkVersion = 21 //for accelerating multi-dex build. OVERRIDEN BY Circle CI to 17 minSdkVersion = 16
supportVersion = '25.0.1' supportVersion = '25.0.1'
supportAnnotations = "com.android.support:support-annotations:$supportVersion" supportAnnotations = "com.android.support:support-annotations:$supportVersion"
supportRecyclerView = "com.android.support:recyclerview-v7:$supportVersion" supportRecyclerView = "com.android.support:recyclerview-v7:$supportVersion"
supportAppCompat = "com.android.support:appcompat-v7:$supportVersion" supportAppCompat = "com.android.support:appcompat-v7:$supportVersion"
supportDesign = "com.android.support:design:$supportVersion" supportDesign = "com.android.support:design:$supportVersion"
rxJava = 'io.reactivex:rxjava:1.2.2' rxJava = 'io.reactivex:rxjava:1.2.2'
boltsTask = 'com.parse.bolts:bolts-tasks:1.4.0' boltsTask = 'com.parse.bolts:bolts-tasks:1.4.0'
okhttp3 = 'com.squareup.okhttp3:okhttp:3.4.1' okhttp3 = 'com.squareup.okhttp3:okhttp:3.4.1'
picasso = 'com.squareup.picasso:picasso:2.5.2' picasso = 'com.squareup.picasso:picasso:2.5.2'
picasso2Okhttp3Downloader = 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0' picasso2Okhttp3Downloader = 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
preDexLibs = !"true".equals(System.getenv("CI")) preDexLibs = !"true".equals(System.getenv("CI"))
} }
subprojects { project -> subprojects { project ->
project.configurations.all { project.configurations.all {
resolutionStrategy { resolutionStrategy {
eachDependency { details -> eachDependency { details ->
if (details.requested.group == 'com.android.support' if (details.requested.group == 'com.android.support'
&& details.requested.name.indexOf("multidex") == -1) { && details.requested.name.indexOf("multidex") == -1) {
details.useVersion(rootProject.ext.supportVersion) details.useVersion(rootProject.ext.supportVersion)
}
}
} }
}
} }
}
} }
subprojects { subprojects {
project.plugins.whenPluginAdded { plugin -> project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) { if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) { } else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
} }
}
} }
\ No newline at end of file
...@@ -3,44 +3,44 @@ apply plugin: 'realm-android' ...@@ -3,44 +3,44 @@ apply plugin: 'realm-android'
apply plugin: 'me.tatarka.retrolambda' apply plugin: 'me.tatarka.retrolambda'
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath rootProject.ext.androidPlugin classpath rootProject.ext.androidPlugin
classpath rootProject.ext.realmPlugin classpath rootProject.ext.realmPlugin
classpath rootProject.ext.retroLambdaPlugin classpath rootProject.ext.retroLambdaPlugin
classpath rootProject.ext.retroLambdaPatch classpath rootProject.ext.retroLambdaPatch
} }
} }
android { android {
compileSdkVersion rootProject.ext.compileSdkVersion compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion buildToolsVersion rootProject.ext.buildToolsVersion
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
defaultConfig { defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.compileSdkVersion targetSdkVersion rootProject.ext.compileSdkVersion
versionCode 1 versionCode 1
versionName "1" versionName "1"
} }
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
}
} }
dependencies { dependencies {
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
compile project(':log-wrapper') compile project(':log-wrapper')
compile rootProject.ext.boltsTask compile rootProject.ext.boltsTask
compile rootProject.ext.supportAnnotations compile rootProject.ext.supportAnnotations
compile rootProject.ext.supportAppCompat compile rootProject.ext.supportAppCompat
compile rootProject.ext.supportDesign compile rootProject.ext.supportDesign
} }
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath rootProject.ext.androidPlugin classpath rootProject.ext.androidPlugin
} }
} }
android { android {
compileSdkVersion rootProject.ext.compileSdkVersion compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig { defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.compileSdkVersion targetSdkVersion rootProject.ext.compileSdkVersion
versionCode 1 versionCode 1
versionName "1" versionName "1"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
}
} }
dependencies { dependencies {
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
compile rootProject.ext.supportAnnotations compile rootProject.ext.supportAnnotations
compile rootProject.ext.supportAppCompat compile rootProject.ext.supportAppCompat
compile rootProject.ext.supportDesign compile rootProject.ext.supportDesign
compile 'org.nibor.autolink:autolink:0.5.0' compile 'org.nibor.autolink:autolink:0.5.0'
compile rootProject.ext.okhttp3 compile rootProject.ext.okhttp3
compile rootProject.ext.picasso compile rootProject.ext.picasso
compile rootProject.ext.picasso2Okhttp3Downloader compile rootProject.ext.picasso2Okhttp3Downloader
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment