forked from upstream-mirrors/quik
Migrate to AndroidX
This commit is contained in:
@@ -20,10 +20,10 @@ package com.moez.QKSMS.common
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.support.annotation.ArrayRes
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.ArrayRes
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.base.QkAdapter
|
||||
|
||||
@@ -22,9 +22,9 @@ import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.app.Service
|
||||
import android.content.BroadcastReceiver
|
||||
import android.support.text.emoji.EmojiCompat
|
||||
import android.support.text.emoji.FontRequestEmojiCompatConfig
|
||||
import android.support.v4.provider.FontRequest
|
||||
import androidx.emoji.text.EmojiCompat
|
||||
import androidx.emoji.text.FontRequestEmojiCompatConfig
|
||||
import androidx.core.provider.FontRequest
|
||||
import com.akaita.java.rxjava2debug.RxJava2Debug
|
||||
import com.bugsnag.android.Bugsnag
|
||||
import com.bugsnag.android.Configuration
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.moez.QKSMS.common
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.support.annotation.StringRes
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||
import com.moez.QKSMS.common.util.extensions.setPadding
|
||||
import com.moez.QKSMS.injection.appComponent
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.moez.QKSMS.common
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Provider
|
||||
|
||||
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.moez.QKSMS.common.androidxcompat;
|
||||
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import com.uber.autodispose.LifecycleEndedException;
|
||||
import com.uber.autodispose.LifecycleScopeProvider;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
/**
|
||||
* A {@link LifecycleScopeProvider} that can provide scoping for Android {@link Lifecycle} and
|
||||
* {@link LifecycleOwner} classes.
|
||||
* <p>
|
||||
* <pre><code>
|
||||
* AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(lifecycleOwner))
|
||||
* </code></pre>
|
||||
*/
|
||||
public final class AndroidLifecycleScopeProvider
|
||||
implements LifecycleScopeProvider<Lifecycle.Event> {
|
||||
|
||||
private static final Function<Lifecycle.Event, Lifecycle.Event> DEFAULT_CORRESPONDING_EVENTS =
|
||||
new Function<Lifecycle.Event, Lifecycle.Event>() {
|
||||
@Override public Lifecycle.Event apply(Lifecycle.Event lastEvent) throws Exception {
|
||||
switch (lastEvent) {
|
||||
case ON_CREATE:
|
||||
return Lifecycle.Event.ON_DESTROY;
|
||||
case ON_START:
|
||||
return Lifecycle.Event.ON_STOP;
|
||||
case ON_RESUME:
|
||||
return Lifecycle.Event.ON_PAUSE;
|
||||
case ON_PAUSE:
|
||||
return Lifecycle.Event.ON_STOP;
|
||||
case ON_STOP:
|
||||
case ON_DESTROY:
|
||||
default:
|
||||
throw new LifecycleEndedException("Lifecycle has ended! Last event was " + lastEvent);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final Function<Lifecycle.Event, Lifecycle.Event> boundaryResolver;
|
||||
|
||||
/**
|
||||
* Creates a {@link AndroidLifecycleScopeProvider} for Android LifecycleOwners.
|
||||
*
|
||||
* @param owner the owner to scope for.
|
||||
* @return a {@link AndroidLifecycleScopeProvider} against this owner.
|
||||
*/
|
||||
public static AndroidLifecycleScopeProvider from(LifecycleOwner owner) {
|
||||
return from(owner.getLifecycle());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link AndroidLifecycleScopeProvider} for Android LifecycleOwners.
|
||||
*
|
||||
* @param owner the owner to scope for.
|
||||
* @param untilEvent the event until the scope is valid.
|
||||
* @return a {@link AndroidLifecycleScopeProvider} against this owner.
|
||||
*/
|
||||
public static AndroidLifecycleScopeProvider from(
|
||||
LifecycleOwner owner,
|
||||
Lifecycle.Event untilEvent) {
|
||||
return from(owner.getLifecycle(), untilEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link AndroidLifecycleScopeProvider} for Android Lifecycles.
|
||||
*
|
||||
* @param lifecycle the lifecycle to scope for.
|
||||
* @return a {@link AndroidLifecycleScopeProvider} against this lifecycle.
|
||||
*/
|
||||
public static AndroidLifecycleScopeProvider from(Lifecycle lifecycle) {
|
||||
return from(lifecycle, DEFAULT_CORRESPONDING_EVENTS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link AndroidLifecycleScopeProvider} for Android Lifecycles.
|
||||
*
|
||||
* @param lifecycle the lifecycle to scope for.
|
||||
* @param untilEvent the event until the scope is valid.
|
||||
* @return a {@link AndroidLifecycleScopeProvider} against this lifecycle.
|
||||
*/
|
||||
public static AndroidLifecycleScopeProvider from(
|
||||
Lifecycle lifecycle,
|
||||
Lifecycle.Event untilEvent) {
|
||||
return from(lifecycle, new UntilEventFunction(untilEvent));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link AndroidLifecycleScopeProvider} for Android Lifecycles.
|
||||
*
|
||||
* @param owner the owner to scope for.
|
||||
* @param boundaryResolver function that resolves the event boundary.
|
||||
* @return a {@link AndroidLifecycleScopeProvider} against this owner.
|
||||
*/
|
||||
public static AndroidLifecycleScopeProvider from(
|
||||
LifecycleOwner owner,
|
||||
Function<Lifecycle.Event, Lifecycle.Event> boundaryResolver) {
|
||||
return from(owner.getLifecycle(), boundaryResolver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link AndroidLifecycleScopeProvider} for Android Lifecycles.
|
||||
*
|
||||
* @param lifecycle the lifecycle to scope for.
|
||||
* @param boundaryResolver function that resolves the event boundary.
|
||||
* @return a {@link AndroidLifecycleScopeProvider} against this lifecycle.
|
||||
*/
|
||||
public static AndroidLifecycleScopeProvider from(
|
||||
Lifecycle lifecycle,
|
||||
Function<Lifecycle.Event, Lifecycle.Event> boundaryResolver) {
|
||||
return new AndroidLifecycleScopeProvider(lifecycle, boundaryResolver);
|
||||
}
|
||||
|
||||
private final LifecycleEventsObservable lifecycleObservable;
|
||||
|
||||
private AndroidLifecycleScopeProvider(Lifecycle lifecycle,
|
||||
Function<Lifecycle.Event, Lifecycle.Event> boundaryResolver) {
|
||||
this.lifecycleObservable = new LifecycleEventsObservable(lifecycle);
|
||||
this.boundaryResolver = boundaryResolver;
|
||||
}
|
||||
|
||||
@Override public Observable<Lifecycle.Event> lifecycle() {
|
||||
return lifecycleObservable;
|
||||
}
|
||||
|
||||
@Override public Function<Lifecycle.Event, Lifecycle.Event> correspondingEvents() {
|
||||
return boundaryResolver;
|
||||
}
|
||||
|
||||
@Override public Lifecycle.Event peekLifecycle() {
|
||||
lifecycleObservable.backfillEvents();
|
||||
return lifecycleObservable.getValue();
|
||||
}
|
||||
|
||||
private static class UntilEventFunction implements Function<Lifecycle.Event, Lifecycle.Event> {
|
||||
private final Lifecycle.Event untilEvent;
|
||||
|
||||
UntilEventFunction(Lifecycle.Event untilEvent) {
|
||||
this.untilEvent = untilEvent;
|
||||
}
|
||||
|
||||
@Override public Lifecycle.Event apply(Lifecycle.Event event) throws Exception {
|
||||
return untilEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.common.androidxcompat
|
||||
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.Lifecycle.Event
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.uber.autodispose.LifecycleScopeProvider
|
||||
import io.reactivex.annotations.CheckReturnValue
|
||||
import io.reactivex.functions.Function
|
||||
|
||||
/**
|
||||
* Extension that returns a [LifecycleScopeProvider] for this [LifecycleOwner].
|
||||
*/
|
||||
@CheckReturnValue
|
||||
inline fun LifecycleOwner.scope(): LifecycleScopeProvider<*> = AndroidLifecycleScopeProvider.from(this)
|
||||
|
||||
/**
|
||||
* Extension that returns a [LifecycleScopeProvider] for this [LifecycleOwner].
|
||||
*
|
||||
* @param untilEvent the event until the scope is valid.
|
||||
*/
|
||||
@CheckReturnValue
|
||||
inline fun LifecycleOwner.scope(untilEvent: Lifecycle.Event): LifecycleScopeProvider<*>
|
||||
= AndroidLifecycleScopeProvider.from(this, untilEvent)
|
||||
|
||||
/**
|
||||
* Extension that returns a [LifecycleScopeProvider] for this [LifecycleOwner].
|
||||
*
|
||||
* @param boundaryResolver function that resolves the event boundary.
|
||||
*/
|
||||
@CheckReturnValue
|
||||
inline fun LifecycleOwner.scope(boundaryResolver: Function<Event, Event>): LifecycleScopeProvider<*>
|
||||
= AndroidLifecycleScopeProvider.from(this, boundaryResolver)
|
||||
|
||||
/**
|
||||
* Extension that returns a [LifecycleScopeProvider] for this [Lifecycle].
|
||||
*/
|
||||
@CheckReturnValue
|
||||
inline fun Lifecycle.scope(): LifecycleScopeProvider<*> = AndroidLifecycleScopeProvider.from(this)
|
||||
|
||||
/**
|
||||
* Extension that returns a [LifecycleScopeProvider] for this [Lifecycle].
|
||||
*
|
||||
* @param untilEvent the event until the scope is valid.
|
||||
*/
|
||||
@CheckReturnValue
|
||||
inline fun Lifecycle.scope(untilEvent: Lifecycle.Event): LifecycleScopeProvider<*>
|
||||
= AndroidLifecycleScopeProvider.from(this, untilEvent)
|
||||
|
||||
/**
|
||||
* Extension that returns a [LifecycleScopeProvider] for this [Lifecycle].
|
||||
*
|
||||
* @param boundaryResolver function that resolves the event boundary.
|
||||
*/
|
||||
@CheckReturnValue
|
||||
inline fun Lifecycle.scope(boundaryResolver: Function<Event, Event>): LifecycleScopeProvider<*>
|
||||
= AndroidLifecycleScopeProvider.from(this, boundaryResolver)
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.common.androidxcompat;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import com.jakewharton.rxbinding2.InitialValueObservable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.MainThreadDisposable;
|
||||
|
||||
import static com.jakewharton.rxbinding2.internal.Preconditions.checkMainThread;
|
||||
|
||||
final class DrawerLayoutDrawerOpenedObservable extends InitialValueObservable<Boolean> {
|
||||
private final DrawerLayout view;
|
||||
private final int gravity;
|
||||
|
||||
DrawerLayoutDrawerOpenedObservable(DrawerLayout view, int gravity) {
|
||||
this.view = view;
|
||||
this.gravity = gravity;
|
||||
}
|
||||
|
||||
@Override protected void subscribeListener(Observer<? super Boolean> observer) {
|
||||
if (!checkMainThread(observer)) {
|
||||
return;
|
||||
}
|
||||
Listener listener = new Listener(view, gravity, observer);
|
||||
observer.onSubscribe(listener);
|
||||
view.addDrawerListener(listener);
|
||||
}
|
||||
|
||||
@Override protected Boolean getInitialValue() {
|
||||
return view.isDrawerOpen(gravity);
|
||||
}
|
||||
|
||||
static final class Listener extends MainThreadDisposable implements DrawerLayout.DrawerListener {
|
||||
private final DrawerLayout view;
|
||||
private final int gravity;
|
||||
private final Observer<? super Boolean> observer;
|
||||
|
||||
Listener(DrawerLayout view, int gravity, Observer<? super Boolean> observer) {
|
||||
this.view = view;
|
||||
this.gravity = gravity;
|
||||
this.observer = observer;
|
||||
}
|
||||
|
||||
@Override public void onDrawerSlide(View drawerView, float slideOffset) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onDrawerOpened(View drawerView) {
|
||||
if (!isDisposed()) {
|
||||
int drawerGravity = ((DrawerLayout.LayoutParams) drawerView.getLayoutParams()).gravity;
|
||||
if (drawerGravity == gravity) {
|
||||
observer.onNext(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onDrawerClosed(View drawerView) {
|
||||
if (!isDisposed()) {
|
||||
int drawerGravity = ((DrawerLayout.LayoutParams) drawerView.getLayoutParams()).gravity;
|
||||
if (drawerGravity == gravity) {
|
||||
observer.onNext(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onDrawerStateChanged(int newState) {
|
||||
|
||||
}
|
||||
|
||||
@Override protected void onDispose() {
|
||||
view.removeDrawerListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.moez.QKSMS.common.androidxcompat;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RestrictTo;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.Lifecycle.Event;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.OnLifecycleEvent;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.MainThreadDisposable;
|
||||
import io.reactivex.subjects.BehaviorSubject;
|
||||
|
||||
import static androidx.annotation.RestrictTo.Scope.LIBRARY;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_CREATE;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_DESTROY;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_START;
|
||||
import static com.uber.autodispose.android.internal.AutoDisposeAndroidUtil.isMainThread;
|
||||
|
||||
@RestrictTo(LIBRARY) class LifecycleEventsObservable extends Observable<Event> {
|
||||
|
||||
private final Lifecycle lifecycle;
|
||||
private final BehaviorSubject<Event> eventsObservable = BehaviorSubject.create();
|
||||
|
||||
@SuppressWarnings("CheckReturnValue") LifecycleEventsObservable(Lifecycle lifecycle) {
|
||||
this.lifecycle = lifecycle;
|
||||
}
|
||||
|
||||
Event getValue() {
|
||||
return eventsObservable.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Backfill if already created for boundary checking. We do a trick here for corresponding events
|
||||
* where we pretend something is created upon initialized state so that it assumes the
|
||||
* corresponding event is DESTROY.
|
||||
*/
|
||||
void backfillEvents() {
|
||||
@Nullable Lifecycle.Event correspondingEvent;
|
||||
switch (lifecycle.getCurrentState()) {
|
||||
case INITIALIZED:
|
||||
correspondingEvent = ON_CREATE;
|
||||
break;
|
||||
case CREATED:
|
||||
correspondingEvent = ON_START;
|
||||
break;
|
||||
case STARTED:
|
||||
case RESUMED:
|
||||
correspondingEvent = ON_RESUME;
|
||||
break;
|
||||
case DESTROYED:
|
||||
default:
|
||||
correspondingEvent = ON_DESTROY;
|
||||
break;
|
||||
}
|
||||
eventsObservable.onNext(correspondingEvent);
|
||||
}
|
||||
|
||||
@Override protected void subscribeActual(Observer<? super Event> observer) {
|
||||
ArchLifecycleObserver archObserver =
|
||||
new ArchLifecycleObserver(lifecycle, observer, eventsObservable);
|
||||
observer.onSubscribe(archObserver);
|
||||
if (!isMainThread()) {
|
||||
observer.onError(
|
||||
new IllegalStateException("Lifecycles can only be bound to on the main thread!"));
|
||||
return;
|
||||
}
|
||||
lifecycle.addObserver(archObserver);
|
||||
if (archObserver.isDisposed()) {
|
||||
lifecycle.removeObserver(archObserver);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ArchLifecycleObserver extends MainThreadDisposable
|
||||
implements LifecycleObserver {
|
||||
private final Lifecycle lifecycle;
|
||||
private final Observer<? super Event> observer;
|
||||
private final BehaviorSubject<Event> eventsObservable;
|
||||
|
||||
ArchLifecycleObserver(Lifecycle lifecycle, Observer<? super Event> observer,
|
||||
BehaviorSubject<Event> eventsObservable) {
|
||||
this.lifecycle = lifecycle;
|
||||
this.observer = observer;
|
||||
this.eventsObservable = eventsObservable;
|
||||
}
|
||||
|
||||
@Override protected void onDispose() {
|
||||
lifecycle.removeObserver(this);
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Event.ON_ANY)
|
||||
void onStateChange(@SuppressWarnings("unused") LifecycleOwner owner, Event event) {
|
||||
if (!isDisposed()) {
|
||||
if (!(event == ON_CREATE && eventsObservable.getValue() == event)) {
|
||||
// Due to the INITIALIZED->ON_CREATE mapping trick we do in backfill(),
|
||||
// we fire this conditionally to avoid duplicate CREATE events.
|
||||
eventsObservable.onNext(event);
|
||||
}
|
||||
observer.onNext(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+228
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.moez.QKSMS.common.androidxcompat;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import io.realm.OrderedCollectionChangeSet;
|
||||
import io.realm.OrderedRealmCollection;
|
||||
import io.realm.OrderedRealmCollectionChangeListener;
|
||||
import io.realm.RealmList;
|
||||
import io.realm.RealmModel;
|
||||
import io.realm.RealmResults;
|
||||
|
||||
/**
|
||||
* The RealmBaseRecyclerAdapter class is an abstract utility class for binding RecyclerView UI elements to Realm data.
|
||||
* <p>
|
||||
* This adapter will automatically handle any updates to its data and call {@code notifyDataSetChanged()},
|
||||
* {@code notifyItemInserted()}, {@code notifyItemRemoved()} or {@code notifyItemRangeChanged(} as appropriate.
|
||||
* <p>
|
||||
* The RealmAdapter will stop receiving updates if the Realm instance providing the {@link OrderedRealmCollection} is
|
||||
* closed.
|
||||
*
|
||||
* @param <T> type of {@link RealmModel} stored in the adapter.
|
||||
* @param <S> type of RecyclerView.ViewHolder used in the adapter.
|
||||
*/
|
||||
public abstract class RealmRecyclerViewAdapter<T extends RealmModel, S extends RecyclerView.ViewHolder>
|
||||
extends RecyclerView.Adapter<S> {
|
||||
|
||||
private final boolean hasAutoUpdates;
|
||||
private final boolean updateOnModification;
|
||||
private final OrderedRealmCollectionChangeListener listener;
|
||||
@Nullable
|
||||
private OrderedRealmCollection<T> adapterData;
|
||||
|
||||
private OrderedRealmCollectionChangeListener createListener() {
|
||||
return new OrderedRealmCollectionChangeListener() {
|
||||
@Override
|
||||
public void onChange(Object collection, OrderedCollectionChangeSet changeSet) {
|
||||
// null Changes means the async query returns the first time.
|
||||
if (changeSet == null) {
|
||||
notifyDataSetChanged();
|
||||
return;
|
||||
}
|
||||
// For deletions, the adapter has to be notified in reverse order.
|
||||
OrderedCollectionChangeSet.Range[] deletions = changeSet.getDeletionRanges();
|
||||
for (int i = deletions.length - 1; i >= 0; i--) {
|
||||
OrderedCollectionChangeSet.Range range = deletions[i];
|
||||
notifyItemRangeRemoved(range.startIndex, range.length);
|
||||
}
|
||||
|
||||
OrderedCollectionChangeSet.Range[] insertions = changeSet.getInsertionRanges();
|
||||
for (OrderedCollectionChangeSet.Range range : insertions) {
|
||||
notifyItemRangeInserted(range.startIndex, range.length);
|
||||
}
|
||||
|
||||
if (!updateOnModification) {
|
||||
return;
|
||||
}
|
||||
|
||||
OrderedCollectionChangeSet.Range[] modifications = changeSet.getChangeRanges();
|
||||
for (OrderedCollectionChangeSet.Range range : modifications) {
|
||||
notifyItemRangeChanged(range.startIndex, range.length);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This is equivalent to {@code RealmRecyclerViewAdapter(data, autoUpdate, true)}.
|
||||
*
|
||||
* @see #RealmRecyclerViewAdapter(OrderedRealmCollection, boolean, boolean)
|
||||
*/
|
||||
public RealmRecyclerViewAdapter(@Nullable OrderedRealmCollection<T> data, boolean autoUpdate) {
|
||||
this(data, autoUpdate, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data collection data to be used by this adapter.
|
||||
* @param autoUpdate when it is {@code false}, the adapter won't be automatically updated when collection data
|
||||
* changes.
|
||||
* @param updateOnModification when it is {@code true}, this adapter will be updated when deletions, insertions or
|
||||
* modifications happen to the collection data. When it is {@code false}, only
|
||||
* deletions and insertions will trigger the updates. This param will be ignored if
|
||||
* {@code autoUpdate} is {@code false}.
|
||||
*/
|
||||
public RealmRecyclerViewAdapter(@Nullable OrderedRealmCollection<T> data, boolean autoUpdate,
|
||||
boolean updateOnModification) {
|
||||
if (data != null && !data.isManaged())
|
||||
throw new IllegalStateException("Only use this adapter with managed RealmCollection, " +
|
||||
"for un-managed lists you can just use the BaseRecyclerViewAdapter");
|
||||
this.adapterData = data;
|
||||
this.hasAutoUpdates = autoUpdate;
|
||||
this.listener = hasAutoUpdates ? createListener() : null;
|
||||
this.updateOnModification = updateOnModification;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToRecyclerView(final RecyclerView recyclerView) {
|
||||
super.onAttachedToRecyclerView(recyclerView);
|
||||
if (hasAutoUpdates && isDataValid()) {
|
||||
//noinspection ConstantConditions
|
||||
addListener(adapterData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromRecyclerView(final RecyclerView recyclerView) {
|
||||
super.onDetachedFromRecyclerView(recyclerView);
|
||||
if (hasAutoUpdates && isDataValid()) {
|
||||
//noinspection ConstantConditions
|
||||
removeListener(adapterData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current ID for an item. Note that item IDs are not stable so you cannot rely on the item ID being the
|
||||
* same after notifyDataSetChanged() or {@link #updateData(OrderedRealmCollection)} has been called.
|
||||
*
|
||||
* @param index position of item in the adapter.
|
||||
* @return current item ID.
|
||||
*/
|
||||
@Override
|
||||
public long getItemId(final int index) {
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
//noinspection ConstantConditions
|
||||
return isDataValid() ? adapterData.size() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the item associated with the specified position.
|
||||
* Can return {@code null} if provided Realm instance by {@link OrderedRealmCollection} is closed.
|
||||
*
|
||||
* @param index index of the item.
|
||||
* @return the item at the specified position, {@code null} if adapter data is not valid.
|
||||
*/
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
@Nullable
|
||||
public T getItem(int index) {
|
||||
//noinspection ConstantConditions
|
||||
return isDataValid() ? adapterData.get(index) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns data associated with this adapter.
|
||||
*
|
||||
* @return adapter data.
|
||||
*/
|
||||
@Nullable
|
||||
public OrderedRealmCollection<T> getData() {
|
||||
return adapterData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the data associated to the Adapter. Useful when the query has been changed.
|
||||
* If the query does not change you might consider using the automaticUpdate feature.
|
||||
*
|
||||
* @param data the new {@link OrderedRealmCollection} to display.
|
||||
*/
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
public void updateData(@Nullable OrderedRealmCollection<T> data) {
|
||||
if (hasAutoUpdates) {
|
||||
if (isDataValid()) {
|
||||
//noinspection ConstantConditions
|
||||
removeListener(adapterData);
|
||||
}
|
||||
if (data != null) {
|
||||
addListener(data);
|
||||
}
|
||||
}
|
||||
|
||||
this.adapterData = data;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void addListener(@NonNull OrderedRealmCollection<T> data) {
|
||||
if (data instanceof RealmResults) {
|
||||
RealmResults<T> results = (RealmResults<T>) data;
|
||||
//noinspection unchecked
|
||||
results.addChangeListener(listener);
|
||||
} else if (data instanceof RealmList) {
|
||||
RealmList<T> list = (RealmList<T>) data;
|
||||
//noinspection unchecked
|
||||
list.addChangeListener(listener);
|
||||
} else {
|
||||
throw new IllegalArgumentException("RealmCollection not supported: " + data.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
private void removeListener(@NonNull OrderedRealmCollection<T> data) {
|
||||
if (data instanceof RealmResults) {
|
||||
RealmResults<T> results = (RealmResults<T>) data;
|
||||
//noinspection unchecked
|
||||
results.removeChangeListener(listener);
|
||||
} else if (data instanceof RealmList) {
|
||||
RealmList<T> list = (RealmList<T>) data;
|
||||
//noinspection unchecked
|
||||
list.removeChangeListener(listener);
|
||||
} else {
|
||||
throw new IllegalArgumentException("RealmCollection not supported: " + data.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDataValid() {
|
||||
return adapterData != null && adapterData.isValid();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.common.androidxcompat;
|
||||
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import com.jakewharton.rxbinding2.InitialValueObservable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
import static com.jakewharton.rxbinding2.internal.Preconditions.checkNotNull;
|
||||
|
||||
public final class RxDrawerLayout {
|
||||
/**
|
||||
* Create an observable of the open state of the drawer of {@code view}.
|
||||
* <p>
|
||||
* <em>Warning:</em> The created observable keeps a strong reference to {@code view}. Unsubscribe
|
||||
* to free this reference.
|
||||
* <p>
|
||||
* <em>Note:</em> A value will be emitted immediately on subscribe.
|
||||
*/
|
||||
@CheckResult
|
||||
@NonNull
|
||||
public static InitialValueObservable<Boolean> drawerOpen(
|
||||
@NonNull DrawerLayout view, int gravity) {
|
||||
checkNotNull(view, "view == null");
|
||||
return new DrawerLayoutDrawerOpenedObservable(view, gravity);
|
||||
}
|
||||
|
||||
/**
|
||||
* An action which sets whether the drawer with {@code gravity} of {@code view} is open.
|
||||
* <p>
|
||||
* <em>Warning:</em> The created observable keeps a strong reference to {@code view}. Unsubscribe
|
||||
* to free this reference.
|
||||
*/
|
||||
@CheckResult @NonNull public static Consumer<? super Boolean> open(
|
||||
@NonNull final DrawerLayout view, final int gravity) {
|
||||
checkNotNull(view, "view == null");
|
||||
return new Consumer<Boolean>() {
|
||||
@Override public void accept(Boolean aBoolean) {
|
||||
if (aBoolean) {
|
||||
view.openDrawer(gravity);
|
||||
} else {
|
||||
view.closeDrawer(gravity);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private RxDrawerLayout() {
|
||||
throw new AssertionError("No instances.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@file:Suppress("NOTHING_TO_INLINE")
|
||||
|
||||
package com.moez.QKSMS.common.androidxcompat
|
||||
|
||||
import androidx.annotation.CheckResult
|
||||
import androidx.drawerlayout.widget.DrawerLayout
|
||||
import com.jakewharton.rxbinding2.InitialValueObservable
|
||||
import io.reactivex.functions.Consumer
|
||||
import kotlin.Int
|
||||
import kotlin.Suppress
|
||||
|
||||
/**
|
||||
* Create an observable of the open state of the drawer of `view`.
|
||||
*
|
||||
* *Warning:* The created observable keeps a strong reference to `view`. Unsubscribe
|
||||
* to free this reference.
|
||||
*
|
||||
* *Note:* A value will be emitted immediately on subscribe.
|
||||
*/
|
||||
@CheckResult
|
||||
inline fun DrawerLayout.drawerOpen(gravity: Int): InitialValueObservable<Boolean> = RxDrawerLayout.drawerOpen(this, gravity)
|
||||
|
||||
/**
|
||||
* An action which sets whether the drawer with `gravity` of `view` is open.
|
||||
*
|
||||
* *Warning:* The created observable keeps a strong reference to `view`. Unsubscribe
|
||||
* to free this reference.
|
||||
*/
|
||||
@CheckResult
|
||||
inline fun DrawerLayout.open(gravity: Int): Consumer<in Boolean> = RxDrawerLayout.open(this, gravity)
|
||||
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package com.moez.QKSMS.common.base
|
||||
|
||||
import android.support.annotation.CallSuper
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ package com.moez.QKSMS.common.base
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import io.reactivex.subjects.BehaviorSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
package com.moez.QKSMS.common.base
|
||||
|
||||
import android.support.v7.util.DiffUtil
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.moez.QKSMS.common.util.extensions.setVisible
|
||||
import io.reactivex.subjects.BehaviorSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.moez.QKSMS.common.base
|
||||
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.moez.QKSMS.common.androidxcompat.RealmRecyclerViewAdapter
|
||||
import com.moez.QKSMS.common.util.extensions.setVisible
|
||||
import io.reactivex.subjects.BehaviorSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
import io.realm.OrderedRealmCollection
|
||||
import io.realm.RealmList
|
||||
import io.realm.RealmModel
|
||||
import io.realm.RealmRecyclerViewAdapter
|
||||
import io.realm.RealmResults
|
||||
|
||||
abstract class QkRealmAdapter<T : RealmModel> : RealmRecyclerViewAdapter<T, QkViewHolder>(null, true) {
|
||||
|
||||
@@ -20,16 +20,16 @@ package com.moez.QKSMS.common.base
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.ActivityManager
|
||||
import android.arch.lifecycle.Lifecycle
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.util.Colors
|
||||
import com.moez.QKSMS.common.util.extensions.resolveThemeColor
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.rxkotlin.Observables
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package com.moez.QKSMS.common.base
|
||||
|
||||
import android.arch.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
|
||||
interface QkView<in State> : LifecycleOwner {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package com.moez.QKSMS.common.base
|
||||
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
class QkViewHolder(view: View) : RecyclerView.ViewHolder(view)
|
||||
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
package com.moez.QKSMS.common.base
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import android.support.annotation.CallSuper
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
||||
@@ -20,7 +20,7 @@ package com.moez.QKSMS.common.util
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import android.support.v4.content.res.ResourcesCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import com.moez.QKSMS.R
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package com.moez.QKSMS.common.util
|
||||
|
||||
import android.arch.lifecycle.LiveData
|
||||
import androidx.lifecycle.LiveData
|
||||
import io.realm.RealmChangeListener
|
||||
import io.realm.RealmModel
|
||||
import io.realm.RealmResults
|
||||
|
||||
@@ -28,10 +28,10 @@ import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.support.v4.app.NotificationCompat
|
||||
import android.support.v4.app.NotificationManagerCompat
|
||||
import android.support.v4.app.RemoteInput
|
||||
import android.support.v4.app.TaskStackBuilder
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.app.RemoteInput
|
||||
import androidx.core.app.TaskStackBuilder
|
||||
import android.telephony.PhoneNumberUtils
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package com.moez.QKSMS.common.util.extensions
|
||||
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
fun RecyclerView.Adapter<*>.autoScrollToStart(recyclerView: RecyclerView) {
|
||||
registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ package com.moez.QKSMS.common.util.extensions
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.support.annotation.StringRes
|
||||
import android.support.v4.content.ContextCompat
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import android.util.TypedValue
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Toast
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.PorterDuff
|
||||
import android.os.Build
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -31,6 +30,7 @@ import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageView
|
||||
import android.widget.ProgressBar
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
var ViewGroup.animateLayoutChanges: Boolean
|
||||
get() = layoutTransition != null
|
||||
|
||||
@@ -20,9 +20,9 @@ package com.moez.QKSMS.common.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.support.constraint.ConstraintLayout
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.model.Recipient
|
||||
import kotlinx.android.synthetic.main.group_avatar_view.view.*
|
||||
|
||||
@@ -20,11 +20,11 @@ package com.moez.QKSMS.common.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.support.v4.view.ViewPager
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.util.Colors
|
||||
import com.moez.QKSMS.common.util.extensions.forEach
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package com.moez.QKSMS.common.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v7.widget.LinearLayoutCompat
|
||||
import androidx.appcompat.widget.LinearLayoutCompat
|
||||
import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
|
||||
@@ -20,9 +20,9 @@ package com.moez.QKSMS.common.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.support.v13.view.inputmethod.EditorInfoCompat
|
||||
import android.support.v13.view.inputmethod.InputConnectionCompat
|
||||
import android.support.v13.view.inputmethod.InputContentInfoCompat
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat
|
||||
import androidx.core.view.inputmethod.InputConnectionCompat
|
||||
import androidx.core.view.inputmethod.InputContentInfoCompat
|
||||
import android.util.AttributeSet
|
||||
import android.view.KeyEvent
|
||||
import android.view.inputmethod.EditorInfo
|
||||
|
||||
@@ -20,7 +20,7 @@ package com.moez.QKSMS.common.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.support.v7.widget.SwitchCompat
|
||||
import androidx.appcompat.widget.SwitchCompat
|
||||
import android.util.AttributeSet
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.util.Colors
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package com.moez.QKSMS.common.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.support.text.emoji.widget.EmojiAppCompatTextView
|
||||
import androidx.emoji.widget.EmojiAppCompatTextView
|
||||
import android.util.AttributeSet
|
||||
import com.moez.QKSMS.common.util.TextViewStyler
|
||||
import com.moez.QKSMS.injection.appComponent
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
package com.moez.QKSMS.feature.blocked
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import android.os.Bundle
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.R
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.feature.blocked
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
||||
@@ -20,12 +20,12 @@ package com.moez.QKSMS.feature.blocked
|
||||
|
||||
import android.content.Context
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkViewModel
|
||||
import com.moez.QKSMS.interactor.MarkUnblocked
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.moez.QKSMS.util.tryOrNull
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import io.reactivex.rxkotlin.withLatestFrom
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
package com.moez.QKSMS.feature.compose
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.R
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package com.moez.QKSMS.feature.compose
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
@@ -20,8 +20,8 @@ package com.moez.QKSMS.feature.compose
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Activity
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import android.content.ContentValues
|
||||
import android.content.Intent
|
||||
import android.graphics.PorterDuff
|
||||
@@ -29,15 +29,16 @@ import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.MediaStore
|
||||
import android.support.v4.app.ActivityCompat
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import com.google.android.flexbox.FlexboxLayoutManager
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.jakewharton.rxbinding2.widget.textChanges
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkThemedActivity
|
||||
import com.moez.QKSMS.common.util.extensions.autoScrollToStart
|
||||
import com.moez.QKSMS.common.util.extensions.resolveThemeColor
|
||||
@@ -49,7 +50,6 @@ import com.moez.QKSMS.common.util.extensions.showKeyboard
|
||||
import com.moez.QKSMS.model.Attachment
|
||||
import com.moez.QKSMS.model.Contact
|
||||
import com.moez.QKSMS.model.Message
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import dagger.android.AndroidInjection
|
||||
import io.reactivex.Observable
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.feature.compose
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package com.moez.QKSMS.feature.compose
|
||||
|
||||
import android.net.Uri
|
||||
import android.support.v13.view.inputmethod.InputContentInfoCompat
|
||||
import androidx.core.view.inputmethod.InputContentInfoCompat
|
||||
import com.moez.QKSMS.common.base.QkView
|
||||
import com.moez.QKSMS.model.Attachment
|
||||
import com.moez.QKSMS.model.Contact
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.telephony.SmsMessage
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkViewModel
|
||||
import com.moez.QKSMS.common.util.ClipboardUtils
|
||||
import com.moez.QKSMS.common.util.MessageDetailsFormatter
|
||||
@@ -52,7 +53,6 @@ import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import com.moez.QKSMS.util.ActiveSubscriptionObservable
|
||||
import com.moez.QKSMS.util.tryOrNull
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
|
||||
@@ -21,7 +21,7 @@ package com.moez.QKSMS.feature.compose
|
||||
import android.app.Activity
|
||||
import android.graphics.Rect
|
||||
import android.os.Build
|
||||
import android.support.annotation.RequiresApi
|
||||
import androidx.annotation.RequiresApi
|
||||
import android.view.ActionMode
|
||||
import android.view.KeyEvent
|
||||
import android.view.Menu
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.moez.QKSMS.feature.compose
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.telephony.PhoneNumberUtils
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableStringBuilder
|
||||
@@ -31,6 +30,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.ProgressBar
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
|
||||
+4
-4
@@ -18,14 +18,15 @@
|
||||
*/
|
||||
package com.moez.QKSMS.feature.conversationinfo
|
||||
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AlertDialog
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import android.text.InputFilter
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkThemedActivity
|
||||
import com.moez.QKSMS.common.util.extensions.animateLayoutChanges
|
||||
import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||
@@ -33,7 +34,6 @@ import com.moez.QKSMS.common.util.extensions.resolveThemeColor
|
||||
import com.moez.QKSMS.common.util.extensions.scrapViews
|
||||
import com.moez.QKSMS.common.util.extensions.setVisible
|
||||
import com.moez.QKSMS.common.widget.QkEditText
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import dagger.android.AndroidInjection
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.feature.conversationinfo
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
||||
+1
-1
@@ -19,6 +19,7 @@
|
||||
package com.moez.QKSMS.feature.conversationinfo
|
||||
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkViewModel
|
||||
import com.moez.QKSMS.extensions.asObservable
|
||||
import com.moez.QKSMS.interactor.DeleteConversations
|
||||
@@ -29,7 +30,6 @@ import com.moez.QKSMS.interactor.MarkUnblocked
|
||||
import com.moez.QKSMS.model.Conversation
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import io.reactivex.rxkotlin.withLatestFrom
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
package com.moez.QKSMS.feature.conversationinfo
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package com.moez.QKSMS.feature.conversationinfo
|
||||
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.moez.QKSMS.R
|
||||
|
||||
+1
-1
@@ -20,8 +20,8 @@ package com.moez.QKSMS.feature.conversationinfo
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
+2
-2
@@ -22,9 +22,9 @@ import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.support.v7.widget.helper.ItemTouchHelper
|
||||
import androidx.graphics.drawable.toBitmap
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package com.moez.QKSMS.feature.gallery
|
||||
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.transition.ChangeBounds
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.feature.gallery
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import android.content.Intent
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
import dagger.Module
|
||||
|
||||
@@ -21,13 +21,13 @@ package com.moez.QKSMS.feature.gallery
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkViewModel
|
||||
import com.moez.QKSMS.common.util.extensions.makeToast
|
||||
import com.moez.QKSMS.extensions.mapNotNull
|
||||
import com.moez.QKSMS.interactor.SaveImage
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
|
||||
@@ -20,24 +20,25 @@ package com.moez.QKSMS.feature.main
|
||||
|
||||
import android.Manifest
|
||||
import android.app.AlertDialog
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import android.content.res.ColorStateList
|
||||
import android.os.Bundle
|
||||
import android.support.design.widget.Snackbar
|
||||
import android.support.v4.app.ActivityCompat
|
||||
import android.support.v7.app.ActionBarDrawerToggle
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.helper.ItemTouchHelper
|
||||
import android.view.Gravity
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import com.jakewharton.rxbinding2.support.v4.widget.drawerOpen
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.jakewharton.rxbinding2.widget.textChanges
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.drawerOpen
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkThemedActivity
|
||||
import com.moez.QKSMS.common.util.extensions.autoScrollToStart
|
||||
import com.moez.QKSMS.common.util.extensions.dismissKeyboard
|
||||
@@ -49,7 +50,6 @@ import com.moez.QKSMS.common.util.extensions.setVisible
|
||||
import com.moez.QKSMS.feature.conversations.ConversationItemTouchCallback
|
||||
import com.moez.QKSMS.feature.conversations.ConversationsAdapter
|
||||
import com.moez.QKSMS.repository.SyncRepository
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import dagger.android.AndroidInjection
|
||||
import io.reactivex.Observable
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.feature.main
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
||||
@@ -20,6 +20,7 @@ package com.moez.QKSMS.feature.main
|
||||
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkViewModel
|
||||
import com.moez.QKSMS.extensions.removeAccents
|
||||
import com.moez.QKSMS.interactor.DeleteConversations
|
||||
@@ -37,7 +38,6 @@ import com.moez.QKSMS.model.SyncLog
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import com.moez.QKSMS.repository.SyncRepository
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
|
||||
+2
-2
@@ -19,8 +19,8 @@
|
||||
package com.moez.QKSMS.feature.notificationprefs
|
||||
|
||||
import android.app.Activity
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import android.content.Intent
|
||||
import android.media.RingtoneManager
|
||||
import android.net.Uri
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.feature.notificationprefs
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import android.content.Intent
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
import dagger.Module
|
||||
|
||||
+1
-1
@@ -25,11 +25,11 @@ import android.net.Uri
|
||||
import com.f2prateek.rx.preferences2.Preference
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkViewModel
|
||||
import com.moez.QKSMS.extensions.mapNotNull
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package com.moez.QKSMS.feature.plus
|
||||
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import android.graphics.Typeface
|
||||
import android.os.Bundle
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.feature.plus
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
package com.moez.QKSMS.feature.plus
|
||||
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkViewModel
|
||||
import com.moez.QKSMS.common.util.BillingManager
|
||||
import com.moez.QKSMS.manager.AnalyticsManager
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
*/
|
||||
package com.moez.QKSMS.feature.qkreply
|
||||
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.ViewGroup
|
||||
@@ -31,6 +31,7 @@ import android.view.WindowManager
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.jakewharton.rxbinding2.widget.textChanges
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkThemedActivity
|
||||
import com.moez.QKSMS.common.util.extensions.autoScrollToStart
|
||||
import com.moez.QKSMS.common.util.extensions.resolveThemeColor
|
||||
@@ -38,7 +39,6 @@ import com.moez.QKSMS.common.util.extensions.setBackgroundTint
|
||||
import com.moez.QKSMS.common.util.extensions.setTint
|
||||
import com.moez.QKSMS.common.util.extensions.setVisible
|
||||
import com.moez.QKSMS.feature.compose.MessagesAdapter
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import dagger.android.AndroidInjection
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.feature.qkreply
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
||||
@@ -21,6 +21,7 @@ package com.moez.QKSMS.feature.qkreply
|
||||
import android.telephony.SmsMessage
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkViewModel
|
||||
import com.moez.QKSMS.compat.SubscriptionManagerCompat
|
||||
import com.moez.QKSMS.extensions.asObservable
|
||||
@@ -32,7 +33,6 @@ import com.moez.QKSMS.model.Message
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import com.moez.QKSMS.util.ActiveSubscriptionObservable
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.rxkotlin.Observables
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
|
||||
@@ -20,22 +20,22 @@ package com.moez.QKSMS.feature.settings
|
||||
|
||||
import android.app.ProgressDialog
|
||||
import android.app.TimePickerDialog
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import android.os.Bundle
|
||||
import android.support.design.widget.Snackbar
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import android.text.format.DateFormat
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.BuildConfig
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.QkDialog
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkThemedActivity
|
||||
import com.moez.QKSMS.common.util.extensions.animateLayoutChanges
|
||||
import com.moez.QKSMS.common.util.extensions.setBackgroundTint
|
||||
import com.moez.QKSMS.common.util.extensions.setVisible
|
||||
import com.moez.QKSMS.common.widget.PreferenceView
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import dagger.android.AndroidInjection
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.feature.settings
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
||||
@@ -21,6 +21,7 @@ package com.moez.QKSMS.feature.settings
|
||||
import android.content.Context
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkViewModel
|
||||
import com.moez.QKSMS.common.util.BillingManager
|
||||
import com.moez.QKSMS.common.util.Colors
|
||||
@@ -28,7 +29,6 @@ import com.moez.QKSMS.common.util.DateFormatter
|
||||
import com.moez.QKSMS.interactor.SyncMessages
|
||||
import com.moez.QKSMS.util.NightModeManager
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import io.reactivex.rxkotlin.withLatestFrom
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.moez.QKSMS.feature.settings.about
|
||||
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import android.os.Bundle
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.BuildConfig
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.feature.settings.about
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.moez.QKSMS.feature.settings.about
|
||||
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkViewModel
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ package com.moez.QKSMS.feature.themepicker
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.support.constraint.ConstraintLayout
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.util.extensions.setBackgroundTint
|
||||
import com.moez.QKSMS.common.util.extensions.setTint
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
package com.moez.QKSMS.feature.themepicker
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v4.view.PagerAdapter
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.viewpager.widget.PagerAdapter
|
||||
import com.moez.QKSMS.R
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
+4
-4
@@ -18,11 +18,11 @@
|
||||
*/
|
||||
package com.moez.QKSMS.feature.themepicker
|
||||
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import android.os.Bundle
|
||||
import android.support.design.widget.Snackbar
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.base.QkThemedActivity
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.feature.themepicker
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
||||
+1
-1
@@ -20,11 +20,11 @@ package com.moez.QKSMS.feature.themepicker
|
||||
|
||||
import com.f2prateek.rx.preferences2.Preference
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.base.QkViewModel
|
||||
import com.moez.QKSMS.common.util.BillingManager
|
||||
import com.moez.QKSMS.common.util.Colors
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.rxkotlin.Observables
|
||||
import io.reactivex.rxkotlin.withLatestFrom
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package com.moez.QKSMS.injection
|
||||
|
||||
import android.app.Application
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import android.content.ContentResolver
|
||||
import android.content.Context
|
||||
import android.preference.PreferenceManager
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.moez.QKSMS.injection
|
||||
|
||||
import android.arch.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModel
|
||||
import dagger.MapKey
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user