mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-17 03:22:04 +00:00
fix tutorials
This commit is contained in:
parent
e390abc3bb
commit
397752fa80
5 changed files with 23 additions and 14 deletions
|
|
@ -1,15 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:gravity="center"
|
||||
tools:background="@color/best_50">
|
||||
android:fitsSystemWindows="true">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:gravity="center"
|
||||
tools:background="@color/best_50">
|
||||
<TextView
|
||||
android:id="@+id/snackbar_title"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -28,4 +32,5 @@
|
|||
android:gravity="center"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/white_75_alpha"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
|
@ -18,16 +18,18 @@ public class RealmTutorialLocalRepository extends RealmBaseLocalRepository imple
|
|||
|
||||
@Override
|
||||
public Observable<TutorialStep> getTutorialStep(String key) {
|
||||
return realm.where(TutorialStep.class).equalTo("key", key).findFirstAsync()
|
||||
return realm.where(TutorialStep.class).equalTo("identifier", key)
|
||||
.findAllAsync()
|
||||
.asObservable()
|
||||
.filter(realmObject -> realmObject.isLoaded())
|
||||
.filter(realmObject -> realmObject.isLoaded() && realmObject.isValid() && !realmObject.isEmpty())
|
||||
.map(steps -> steps.first())
|
||||
.cast(TutorialStep.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Observable<RealmResults<TutorialStep>> getTutorialSteps(List<String> keys) {
|
||||
return realm.where(TutorialStep.class)
|
||||
.in("key", (String[]) keys.toArray())
|
||||
.in("identifier", (String[]) keys.toArray())
|
||||
.findAll()
|
||||
.asObservable()
|
||||
.filter(RealmResults::isLoaded);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ public class Flags extends RealmObject {
|
|||
@PrimaryKey
|
||||
private String userId;
|
||||
|
||||
User user;
|
||||
RealmList<TutorialStep> tutorial;
|
||||
private boolean showTour;
|
||||
private boolean dropsEnabled;
|
||||
|
|
|
|||
|
|
@ -124,6 +124,9 @@ public abstract class BaseFragment extends DialogFragment {
|
|||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (tutorialRepository != null) {
|
||||
tutorialRepository.close();
|
||||
}
|
||||
if (compositeSubscription != null && !compositeSubscription.isUnsubscribed()) {
|
||||
compositeSubscription.unsubscribe();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public class HabiticaSnackbar extends BaseTransientBottomBar<HabiticaSnackbar> {
|
|||
* @param content message.
|
||||
*/
|
||||
public static void showSnackbar(Context context, ViewGroup container, String content, SnackbarDisplayType displayType) {
|
||||
showSnackbar(context, container, null, content, displayType);
|
||||
showSnackbar(context, container, content, null, displayType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue