Commit aede4750 authored by Tiago Cunha's avatar Tiago Cunha

Some updates and clean ups

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