Commit aede4750 authored by Tiago Cunha's avatar Tiago Cunha

Some updates and clean ups

parent ffaa0baf
...@@ -6,7 +6,7 @@ buildscript { ...@@ -6,7 +6,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'me.tatarka:gradle-retrolambda:3.5.0' classpath 'me.tatarka:gradle-retrolambda:3.5.0'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2' classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
} }
......
...@@ -2,7 +2,6 @@ package chat.rocket.android_ddp.rx; ...@@ -2,7 +2,6 @@ package chat.rocket.android_ddp.rx;
import io.reactivex.BackpressureStrategy; import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable; import io.reactivex.Flowable;
import io.reactivex.FlowableEmitter;
import io.reactivex.FlowableOnSubscribe; import io.reactivex.FlowableOnSubscribe;
import io.reactivex.exceptions.OnErrorNotImplementedException; import io.reactivex.exceptions.OnErrorNotImplementedException;
import io.reactivex.flowables.ConnectableFlowable; import io.reactivex.flowables.ConnectableFlowable;
...@@ -27,39 +26,35 @@ public class RxWebSocket { ...@@ -27,39 +26,35 @@ public class RxWebSocket {
final Request request = new Request.Builder().url(url).build(); final Request request = new Request.Builder().url(url).build();
return Flowable.create( return Flowable.create(
new FlowableOnSubscribe<RxWebSocketCallback.Base>() { (FlowableOnSubscribe<RxWebSocketCallback.Base>) emitter -> httpClient
@Override .newWebSocket(request, new WebSocketListener() {
public void subscribe(FlowableEmitter<RxWebSocketCallback.Base> emitter)
throws Exception {
httpClient.newWebSocket(request, new WebSocketListener() {
@Override @Override
public void onOpen(WebSocket webSocket, Response response) { public void onOpen(WebSocket webSocket1, Response response) {
RxWebSocket.this.webSocket = webSocket; RxWebSocket.this.webSocket = webSocket1;
emitter.onNext(new RxWebSocketCallback.Open(RxWebSocket.this.webSocket, response)); emitter.onNext(new RxWebSocketCallback.Open(RxWebSocket.this.webSocket, response));
} }
@Override @Override
public void onFailure(WebSocket webSocket, Throwable err, Response response) { public void onFailure(WebSocket webSocket1, Throwable err, Response response) {
try { try {
emitter.onError(new RxWebSocketCallback.Failure(webSocket, err, response)); emitter.onError(new RxWebSocketCallback.Failure(webSocket1, err, response));
} catch (OnErrorNotImplementedException ex) { } catch (OnErrorNotImplementedException ex) {
RCLog.w(ex, "OnErrorNotImplementedException ignored"); RCLog.w(ex, "OnErrorNotImplementedException ignored");
} }
} }
@Override @Override
public void onMessage(WebSocket webSocket, String text) { public void onMessage(WebSocket webSocket1, String text) {
emitter.onNext(new RxWebSocketCallback.Message(webSocket, text)); emitter.onNext(new RxWebSocketCallback.Message(webSocket1, text));
} }
@Override @Override
public void onClosed(WebSocket webSocket, int code, String reason) { public void onClosed(WebSocket webSocket1, int code, String reason) {
emitter.onNext(new RxWebSocketCallback.Close(webSocket, code, reason)); emitter.onNext(new RxWebSocketCallback.Close(webSocket1, code, reason));
emitter.onComplete(); emitter.onComplete();
} }
}); }),
} BackpressureStrategy.BUFFER
}, BackpressureStrategy.BUFFER
).publish(); ).publish();
} }
......
...@@ -10,7 +10,7 @@ buildscript { ...@@ -10,7 +10,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.android.tools.build:gradle:2.3.0'
// 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
...@@ -75,10 +75,10 @@ play { ...@@ -75,10 +75,10 @@ play {
} }
ext { ext {
supportVersion = '25.1.1' supportVersion = '25.2.0'
playLibVersion = '10.2.0' playLibVersion = '10.2.0'
stethoVersion = '1.4.2' stethoVersion = '1.4.2'
rxbindingVersion = '1.0.0' rxbindingVersion = '2.0.0'
rxlifecycleVersion = '2.0.1' rxlifecycleVersion = '2.0.1'
icepickVersion = '3.2.0' icepickVersion = '3.2.0'
permissionsdispatcherVersion = '2.3.1' permissionsdispatcherVersion = '2.3.1'
...@@ -107,8 +107,8 @@ dependencies { ...@@ -107,8 +107,8 @@ dependencies {
compile "com.facebook.stetho:stetho-okhttp3:$stethoVersion" compile "com.facebook.stetho:stetho-okhttp3:$stethoVersion"
compile 'com.uphyca:stetho_realm:2.0.1' compile 'com.uphyca:stetho_realm:2.0.1'
compile "com.jakewharton.rxbinding:rxbinding:$rxbindingVersion" compile "com.jakewharton.rxbinding2:rxbinding:$rxbindingVersion"
compile "com.jakewharton.rxbinding:rxbinding-support-v4:$rxbindingVersion" compile "com.jakewharton.rxbinding2:rxbinding-support-v4:$rxbindingVersion"
compile "com.trello.rxlifecycle2:rxlifecycle:$rxlifecycleVersion" compile "com.trello.rxlifecycle2:rxlifecycle:$rxlifecycleVersion"
compile "com.trello.rxlifecycle2:rxlifecycle-android:$rxlifecycleVersion" compile "com.trello.rxlifecycle2:rxlifecycle-android:$rxlifecycleVersion"
......
...@@ -20,7 +20,7 @@ import android.support.v7.widget.LinearLayoutManager; ...@@ -20,7 +20,7 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.View; import android.view.View;
import com.jakewharton.rxbinding.support.v4.widget.RxDrawerLayout; import com.jakewharton.rxbinding2.support.v4.widget.RxDrawerLayout;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -57,7 +57,6 @@ import chat.rocket.persistence.realm.RealmStore; ...@@ -57,7 +57,6 @@ import chat.rocket.persistence.realm.RealmStore;
import chat.rocket.android.service.ConnectivityManager; import chat.rocket.android.service.ConnectivityManager;
import chat.rocket.android.widget.internal.ExtraActionPickerDialogFragment; import chat.rocket.android.widget.internal.ExtraActionPickerDialogFragment;
import chat.rocket.android.widget.message.MessageFormLayout; import chat.rocket.android.widget.message.MessageFormLayout;
import hu.akarnokd.rxjava.interop.RxJavaInterop;
import permissions.dispatcher.NeedsPermission; import permissions.dispatcher.NeedsPermission;
import permissions.dispatcher.RuntimePermissions; import permissions.dispatcher.RuntimePermissions;
...@@ -235,7 +234,7 @@ public class RoomFragment extends AbstractChatRoomFragment ...@@ -235,7 +234,7 @@ public class RoomFragment extends AbstractChatRoomFragment
DrawerLayout drawerLayout = (DrawerLayout) rootView.findViewById(R.id.drawer_layout); DrawerLayout drawerLayout = (DrawerLayout) rootView.findViewById(R.id.drawer_layout);
SlidingPaneLayout pane = (SlidingPaneLayout) getActivity().findViewById(R.id.sliding_pane); SlidingPaneLayout pane = (SlidingPaneLayout) getActivity().findViewById(R.id.sliding_pane);
if (drawerLayout != null && pane != null) { if (drawerLayout != null && pane != null) {
RxJavaInterop.toV2Flowable(RxDrawerLayout.drawerOpen(drawerLayout, GravityCompat.END)) RxDrawerLayout.drawerOpen(drawerLayout, GravityCompat.END)
.compose(bindToLifecycle()) .compose(bindToLifecycle())
.subscribe(opened -> { .subscribe(opened -> {
try { try {
......
...@@ -10,7 +10,8 @@ import android.view.View; ...@@ -10,7 +10,8 @@ import android.view.View;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.jakewharton.rxbinding.widget.RxCompoundButton;
import com.jakewharton.rxbinding2.widget.RxCompoundButton;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -34,7 +35,6 @@ import chat.rocket.android.renderer.UserRenderer; ...@@ -34,7 +35,6 @@ import chat.rocket.android.renderer.UserRenderer;
import chat.rocket.persistence.realm.repositories.RealmRoomRepository; import chat.rocket.persistence.realm.repositories.RealmRoomRepository;
import chat.rocket.persistence.realm.repositories.RealmUserRepository; import chat.rocket.persistence.realm.repositories.RealmUserRepository;
import chat.rocket.android.widget.RocketChatAvatar; import chat.rocket.android.widget.RocketChatAvatar;
import hu.akarnokd.rxjava.interop.RxJavaInterop;
public class SidebarMainFragment extends AbstractFragment implements SidebarMainContract.View { public class SidebarMainFragment extends AbstractFragment implements SidebarMainContract.View {
...@@ -119,12 +119,10 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain ...@@ -119,12 +119,10 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
rootView.findViewById(R.id.user_info_container) rootView.findViewById(R.id.user_info_container)
.setOnClickListener(view -> toggleUserAction.toggle()); .setOnClickListener(view -> toggleUserAction.toggle());
RxJavaInterop.toV2Flowable(RxCompoundButton.checkedChanges(toggleUserAction)) RxCompoundButton.checkedChanges(toggleUserAction)
.compose(bindToLifecycle()) .compose(bindToLifecycle())
.subscribe(aBoolean -> { .subscribe(aBoolean -> rootView.findViewById(R.id.user_action_outer_container)
rootView.findViewById(R.id.user_action_outer_container) .setVisibility(aBoolean ? View.VISIBLE : View.GONE));
.setVisibility(aBoolean ? View.VISIBLE : View.GONE);
});
} }
private void setupUserStatusButtons() { private void setupUserStatusButtons() {
......
...@@ -4,12 +4,12 @@ import android.os.Bundle; ...@@ -4,12 +4,12 @@ import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.TextView; import android.widget.TextView;
import com.jakewharton.rxbinding.widget.RxTextView;
import com.jakewharton.rxbinding2.widget.RxTextView;
import bolts.Task; import bolts.Task;
import chat.rocket.android.R; import chat.rocket.android.R;
import chat.rocket.android.helper.TextUtils; import chat.rocket.android.helper.TextUtils;
import hu.akarnokd.rxjava.interop.RxJavaInterop;
/** /**
* add Channel, add Private-group. * add Channel, add Private-group.
...@@ -36,8 +36,7 @@ public class AddChannelDialogFragment extends AbstractAddRoomDialogFragment { ...@@ -36,8 +36,7 @@ public class AddChannelDialogFragment extends AbstractAddRoomDialogFragment {
protected void onSetupDialog() { protected void onSetupDialog() {
View buttonAddChannel = getDialog().findViewById(R.id.btn_add_channel); View buttonAddChannel = getDialog().findViewById(R.id.btn_add_channel);
RxJavaInterop.toV2Flowable( RxTextView.textChanges((TextView) getDialog().findViewById(R.id.editor_channel_name))
RxTextView.textChanges((TextView) getDialog().findViewById(R.id.editor_channel_name)))
.map(text -> !TextUtils.isEmpty(text)) .map(text -> !TextUtils.isEmpty(text))
.compose(bindToLifecycle()) .compose(bindToLifecycle())
.subscribe(buttonAddChannel::setEnabled); .subscribe(buttonAddChannel::setEnabled);
......
...@@ -4,7 +4,7 @@ import android.os.Bundle; ...@@ -4,7 +4,7 @@ import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.AutoCompleteTextView; import android.widget.AutoCompleteTextView;
import android.widget.TextView; import android.widget.TextView;
import com.jakewharton.rxbinding.widget.RxTextView; import com.jakewharton.rxbinding2.widget.RxTextView;
import io.realm.Case; import io.realm.Case;
import bolts.Task; import bolts.Task;
...@@ -13,7 +13,6 @@ import chat.rocket.android.helper.TextUtils; ...@@ -13,7 +13,6 @@ import chat.rocket.android.helper.TextUtils;
import chat.rocket.android.layouthelper.sidebar.dialog.SuggestUserAdapter; import chat.rocket.android.layouthelper.sidebar.dialog.SuggestUserAdapter;
import chat.rocket.persistence.realm.models.ddp.RealmUser; import chat.rocket.persistence.realm.models.ddp.RealmUser;
import chat.rocket.persistence.realm.RealmAutoCompleteAdapter; import chat.rocket.persistence.realm.RealmAutoCompleteAdapter;
import hu.akarnokd.rxjava.interop.RxJavaInterop;
/** /**
* add Direct RealmMessage. * add Direct RealmMessage.
...@@ -47,7 +46,7 @@ public class AddDirectMessageDialogFragment extends AbstractAddRoomDialogFragmen ...@@ -47,7 +46,7 @@ public class AddDirectMessageDialogFragment extends AbstractAddRoomDialogFragmen
context -> new SuggestUserAdapter(context, hostname)); context -> new SuggestUserAdapter(context, hostname));
autoCompleteTextView.setAdapter(adapter); autoCompleteTextView.setAdapter(adapter);
RxJavaInterop.toV2Flowable(RxTextView.textChanges(autoCompleteTextView)) RxTextView.textChanges(autoCompleteTextView)
.map(text -> !TextUtils.isEmpty(text)) .map(text -> !TextUtils.isEmpty(text))
.compose(bindToLifecycle()) .compose(bindToLifecycle())
.subscribe(buttonAddDirectMessage::setEnabled); .subscribe(buttonAddDirectMessage::setEnabled);
......
ext { ext {
preDexLibs = !"true".equals(System.getenv("CI")) preDexLibs = "true" != System.getenv("CI")
} }
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" == 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" == plugin.class.name) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} }
} }
......
...@@ -5,7 +5,7 @@ buildscript { ...@@ -5,7 +5,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.android.tools.build:gradle:2.3.0'
} }
} }
......
...@@ -8,7 +8,7 @@ buildscript { ...@@ -8,7 +8,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'io.realm:realm-gradle-plugin:2.3.1' classpath 'io.realm:realm-gradle-plugin:2.3.1'
classpath 'me.tatarka:gradle-retrolambda:3.5.0' classpath 'me.tatarka:gradle-retrolambda:3.5.0'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2' classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
...@@ -39,7 +39,7 @@ android { ...@@ -39,7 +39,7 @@ android {
} }
ext { ext {
supportVersion = '25.1.1' supportVersion = '25.2.0'
} }
dependencies { dependencies {
......
...@@ -5,7 +5,7 @@ buildscript { ...@@ -5,7 +5,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.android.tools.build:gradle:2.3.0'
} }
} }
...@@ -30,7 +30,7 @@ android { ...@@ -30,7 +30,7 @@ android {
} }
ext { ext {
supportVersion = '25.1.1' supportVersion = '25.2.0'
frescoVersion = '1.1.0' frescoVersion = '1.1.0'
} }
...@@ -48,8 +48,6 @@ dependencies { ...@@ -48,8 +48,6 @@ dependencies {
compile 'com.squareup.okhttp3:okhttp:3.6.0' compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.parse.bolts:bolts-tasks:1.4.0'
compile 'com.github.yusukeiwaki.android-widget:widget-fontawesome:0.0.1' compile 'com.github.yusukeiwaki.android-widget:widget-fontawesome:0.0.1'
compile "com.facebook.fresco:fresco:$frescoVersion" compile "com.facebook.fresco:fresco:$frescoVersion"
......
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