mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 01:38:21 +00:00
improve displaying tutorials. Fixes #824
This commit is contained in:
parent
e7b5d2a424
commit
e27eb60cef
32 changed files with 184 additions and 189 deletions
|
|
@ -2,7 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.habitrpg.android.habitica"
|
||||
android:versionCode="1955"
|
||||
android:versionCode="1956"
|
||||
android:versionName="1.3"
|
||||
android:screenOrientation="portrait"
|
||||
android:installLocation="auto" >
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class TutorialView extends FrameLayout {
|
|||
|
||||
private void displayNextTutorialText() {
|
||||
currentTextIndex++;
|
||||
if (currentTextIndex < tutorialTexts.size()) {
|
||||
if (tutorialTexts != null && currentTextIndex < tutorialTexts.size()) {
|
||||
speechBubbleView.animateText(tutorialTexts.get(currentTextIndex));
|
||||
if (isDisplayingLastStep()) {
|
||||
speechBubbleView.setConfirmationButtonVisibility(View.VISIBLE);
|
||||
|
|
|
|||
|
|
@ -1,144 +0,0 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.CallSuper;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.habitrpg.android.habitica.HabiticaApplication;
|
||||
import com.habitrpg.android.habitica.HabiticaBaseApplication;
|
||||
import com.habitrpg.android.habitica.components.AppComponent;
|
||||
import com.habitrpg.android.habitica.data.TutorialRepository;
|
||||
import com.habitrpg.android.habitica.events.DisplayTutorialEvent;
|
||||
import com.habitrpg.android.habitica.helpers.AmplitudeManager;
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler;
|
||||
import com.squareup.leakcanary.RefWatcher;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.EventBusException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import rx.subscriptions.CompositeSubscription;
|
||||
|
||||
public abstract class BaseFragment extends DialogFragment {
|
||||
|
||||
@Inject
|
||||
protected
|
||||
TutorialRepository tutorialRepository;
|
||||
|
||||
public String tutorialStepIdentifier;
|
||||
public String tutorialText;
|
||||
public Unbinder unbinder;
|
||||
protected boolean tutorialCanBeDeferred = true;
|
||||
public List<String> tutorialTexts;
|
||||
|
||||
protected CompositeSubscription compositeSubscription;
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser) {
|
||||
super.setUserVisibleHint(isVisibleToUser);
|
||||
if (isVisibleToUser) {
|
||||
if (this.tutorialStepIdentifier != null && tutorialRepository != null) {
|
||||
tutorialRepository.getTutorialStep(this.tutorialStepIdentifier).first().subscribe(step -> {
|
||||
if (step != null && step.isValid() && step.isManaged() && step.shouldDisplay()) {
|
||||
DisplayTutorialEvent event = new DisplayTutorialEvent();
|
||||
event.step = step;
|
||||
if (tutorialText != null) {
|
||||
event.tutorialText = tutorialText;
|
||||
} else {
|
||||
event.tutorialTexts = tutorialTexts;
|
||||
}
|
||||
event.canBeDeferred = tutorialCanBeDeferred;
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
}, RxErrorHandler.handleEmptyError());
|
||||
}
|
||||
|
||||
String displayedClassName = this.getDisplayedClassName();
|
||||
|
||||
if (displayedClassName != null) {
|
||||
Map<String, Object> additionalData = new HashMap<>();
|
||||
additionalData.put("page", displayedClassName);
|
||||
AmplitudeManager.sendEvent("navigate", AmplitudeManager.EVENT_CATEGORY_NAVIGATION, AmplitudeManager.EVENT_HITTYPE_PAGEVIEW, additionalData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
injectFragment(HabiticaBaseApplication.getComponent());
|
||||
this.setShowsDialog(false);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
compositeSubscription = new CompositeSubscription();
|
||||
|
||||
// Receive Events
|
||||
try {
|
||||
EventBus.getDefault().register(this);
|
||||
} catch (EventBusException ignored) {
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract void injectFragment(AppComponent component);
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
if (unbinder == null) {
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
if (unbinder != null) {
|
||||
unbinder.unbind();
|
||||
unbinder = null;
|
||||
}
|
||||
if (compositeSubscription != null && !compositeSubscription.isUnsubscribed()) {
|
||||
compositeSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
super.onDestroyView();
|
||||
RefWatcher refWatcher = HabiticaApplication.getInstance(getContext()).refWatcher;
|
||||
refWatcher.watch(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (tutorialRepository != null) {
|
||||
tutorialRepository.close();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public String getDisplayedClassName() {
|
||||
return this.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
public boolean addToBackStack() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.annotation.CallSuper
|
||||
import android.support.v4.app.DialogFragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import butterknife.ButterKnife
|
||||
import butterknife.Unbinder
|
||||
import com.habitrpg.android.habitica.HabiticaApplication
|
||||
import com.habitrpg.android.habitica.HabiticaBaseApplication
|
||||
import com.habitrpg.android.habitica.components.AppComponent
|
||||
import com.habitrpg.android.habitica.data.TutorialRepository
|
||||
import com.habitrpg.android.habitica.events.DisplayTutorialEvent
|
||||
import com.habitrpg.android.habitica.helpers.AmplitudeManager
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.EventBusException
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.functions.Action1
|
||||
import rx.subscriptions.CompositeSubscription
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
abstract class BaseFragment : DialogFragment() {
|
||||
|
||||
@Inject
|
||||
lateinit var tutorialRepository: TutorialRepository
|
||||
|
||||
var tutorialStepIdentifier: String? = null
|
||||
var tutorialText: String? = null
|
||||
var unbinder: Unbinder? = null
|
||||
protected var tutorialCanBeDeferred = true
|
||||
var tutorialTexts: MutableList<String> = ArrayList()
|
||||
|
||||
protected var compositeSubscription: CompositeSubscription = CompositeSubscription()
|
||||
|
||||
open val displayedClassName: String?
|
||||
get() = this.javaClass.simpleName
|
||||
|
||||
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
|
||||
super.setUserVisibleHint(isVisibleToUser)
|
||||
showTutorialIfNeeded()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
injectFragment(HabiticaBaseApplication.getComponent())
|
||||
this.showsDialog = false
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
compositeSubscription = CompositeSubscription()
|
||||
|
||||
// Receive Events
|
||||
try {
|
||||
EventBus.getDefault().register(this)
|
||||
} catch (ignored: EventBusException) {
|
||||
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
abstract fun injectFragment(component: AppComponent)
|
||||
|
||||
@CallSuper
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
if (unbinder == null) {
|
||||
unbinder = ButterKnife.bind(this, view)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
showTutorialIfNeeded()
|
||||
}
|
||||
|
||||
private fun showTutorialIfNeeded() {
|
||||
if (userVisibleHint && view != null) {
|
||||
if (this.tutorialStepIdentifier != null) {
|
||||
tutorialRepository.getTutorialStep(this.tutorialStepIdentifier!!).first()
|
||||
.delay(1, TimeUnit.SECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(Action1 { step ->
|
||||
if (step != null && step.isValid && step.isManaged && step.shouldDisplay()) {
|
||||
val event = DisplayTutorialEvent()
|
||||
event.step = step
|
||||
if (tutorialText != null) {
|
||||
event.tutorialText = tutorialText
|
||||
} else {
|
||||
event.tutorialTexts = tutorialTexts
|
||||
}
|
||||
event.canBeDeferred = tutorialCanBeDeferred
|
||||
EventBus.getDefault().post(event)
|
||||
}
|
||||
}, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
|
||||
val displayedClassName = this.displayedClassName
|
||||
|
||||
if (displayedClassName != null) {
|
||||
val additionalData = HashMap<String, Any>()
|
||||
additionalData.put("page", displayedClassName)
|
||||
AmplitudeManager.sendEvent("navigate", AmplitudeManager.EVENT_CATEGORY_NAVIGATION, AmplitudeManager.EVENT_HITTYPE_PAGEVIEW, additionalData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
if (unbinder != null) {
|
||||
unbinder!!.unbind()
|
||||
unbinder = null
|
||||
}
|
||||
if (!compositeSubscription.isUnsubscribed) {
|
||||
compositeSubscription.unsubscribe()
|
||||
}
|
||||
|
||||
super.onDestroyView()
|
||||
val refWatcher = HabiticaApplication.getInstance(context).refWatcher
|
||||
refWatcher.watch(this)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
tutorialRepository.close()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
open fun addToBackStack(): Boolean = true
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ public abstract class BaseMainFragment extends BaseFragment {
|
|||
if (savedInstanceState != null && savedInstanceState.containsKey("userId")) {
|
||||
String userId = savedInstanceState.getString("userId");
|
||||
if (userId != null && userRepository != null) {
|
||||
compositeSubscription.add(userRepository.getUser(userId).subscribe(habitRPGUser -> user = habitRPGUser, RxErrorHandler.handleEmptyError()));
|
||||
getCompositeSubscription().add(userRepository.getUser(userId).subscribe(habitRPGUser -> user = habitRPGUser, RxErrorHandler.handleEmptyError()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class FAQDetailFragment extends BaseMainFragment {
|
|||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View view = inflater.inflate(R.layout.fragment_faq_detail, container, false);
|
||||
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
|
||||
if (this.article != null) {
|
||||
this.questionTextView.setText(this.article.getQuestion());
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class FAQOverviewFragment extends BaseMainFragment {
|
|||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
adapter = new FAQOverviewRecyclerAdapter();
|
||||
adapter.getResetWalkthroughEvents().subscribe(aVoid -> this.userRepository.resetTutorial(user), RxErrorHandler.handleEmptyError());
|
||||
adapter.activity = activity;
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ public class AvatarCustomizationFragment extends BaseMainFragment {
|
|||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
adapter = new CustomizationRecyclerViewAdapter();
|
||||
|
||||
compositeSubscription.add(adapter.getSelectCustomizationEvents()
|
||||
getCompositeSubscription().add(adapter.getSelectCustomizationEvents()
|
||||
.flatMap(customization -> {
|
||||
String updatePath = "preferences." + customization.getType();
|
||||
if (customization.getCategory() != null) {
|
||||
|
|
@ -60,10 +60,10 @@ public class AvatarCustomizationFragment extends BaseMainFragment {
|
|||
return userRepository.updateUser(user, updatePath, customization.getIdentifier());
|
||||
})
|
||||
.subscribe(user1 -> {}, RxErrorHandler.handleEmptyError()));
|
||||
compositeSubscription.add(adapter.getUnlockCustomizationEvents()
|
||||
getCompositeSubscription().add(adapter.getUnlockCustomizationEvents()
|
||||
.flatMap(customization -> userRepository.unlockPath(user, customization))
|
||||
.subscribe(unlockResponse -> {}, RxErrorHandler.handleEmptyError()));
|
||||
compositeSubscription.add(adapter.getUnlockSetEvents()
|
||||
getCompositeSubscription().add(adapter.getUnlockSetEvents()
|
||||
.flatMap(set -> userRepository.unlockPath(user, set))
|
||||
.subscribe(unlockResponse -> {}, RxErrorHandler.handleEmptyError()));
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class EquipmentDetailFragment extends BaseMainFragment {
|
|||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View v = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
|
||||
unbinder = ButterKnife.bind(this, v);
|
||||
setUnbinder(ButterKnife.bind(this, v));
|
||||
|
||||
|
||||
this.adapter = new EquipmentRecyclerViewAdapter(null, true);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class ItemRecyclerFragment extends BaseFragment {
|
|||
if (view == null) {
|
||||
view = inflater.inflate(R.layout.fragment_items, container, false);
|
||||
}
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
|
||||
recyclerView.setEmptyView(emptyView);
|
||||
emptyTextView.setText(getString(R.string.empty_items, itemTypeText));
|
||||
|
|
@ -106,11 +106,11 @@ public class ItemRecyclerFragment extends BaseFragment {
|
|||
}
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
compositeSubscription.add(adapter.getSellItemEvents()
|
||||
getCompositeSubscription().add(adapter.getSellItemEvents()
|
||||
.flatMap(item -> inventoryRepository.sellItem(user, item))
|
||||
.subscribe(item -> {}, RxErrorHandler.handleEmptyError()));
|
||||
|
||||
compositeSubscription.add(adapter.getQuestInvitationEvents()
|
||||
getCompositeSubscription().add(adapter.getQuestInvitationEvents()
|
||||
.flatMap(quest -> inventoryRepository.inviteToQuest(quest))
|
||||
.subscribe(group -> {
|
||||
OpenMenuItemCommand event1 = new OpenMenuItemCommand();
|
||||
|
|
@ -208,7 +208,7 @@ public class ItemRecyclerFragment extends BaseFragment {
|
|||
}
|
||||
}, RxErrorHandler.handleEmptyError());
|
||||
|
||||
compositeSubscription.add(inventoryRepository.getOwnedPets().subscribe(adapter::setOwnedPets, RxErrorHandler.handleEmptyError()));
|
||||
getCompositeSubscription().add(inventoryRepository.getOwnedPets().subscribe(adapter::setOwnedPets, RxErrorHandler.handleEmptyError()));
|
||||
}
|
||||
|
||||
@OnClick(R.id.openMarketButton)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class MountDetailRecyclerFragment extends BaseMainFragment {
|
|||
recyclerView.setItemAnimator(new SafeDefaultItemAnimator());
|
||||
this.loadItems();
|
||||
|
||||
compositeSubscription.add(adapter.getEquipEvents()
|
||||
getCompositeSubscription().add(adapter.getEquipEvents()
|
||||
.flatMap(key -> inventoryRepository.equip(user, "mount", key))
|
||||
.subscribe(items -> {}, RxErrorHandler.handleEmptyError()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class PetDetailRecyclerFragment extends BaseMainFragment {
|
|||
recyclerView.setItemAnimator(new SafeDefaultItemAnimator());
|
||||
this.loadItems();
|
||||
|
||||
compositeSubscription.add(adapter.getEquipEvents()
|
||||
getCompositeSubscription().add(adapter.getEquipEvents()
|
||||
.flatMap(key -> inventoryRepository.equip(user, "pet", key))
|
||||
.subscribe(items -> {}, RxErrorHandler.handleEmptyError()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class StableRecyclerFragment extends BaseFragment {
|
|||
setupViews = true;
|
||||
}
|
||||
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
|
||||
if (setupViews) {
|
||||
recyclerView.setEmptyView(emptyView);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class AvatarSetupFragment extends BaseFragment {
|
|||
view = inflater.inflate(R.layout.fragment_setup_avatar, container, false);
|
||||
}
|
||||
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
this.adapter = new CustomizationSetupAdapter();
|
||||
if (this.user != null) {
|
||||
this.adapter.userSize = this.user.getPreferences().getSize();
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class IntroFragment extends BaseFragment {
|
|||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View v = inflater.inflate(R.layout.fragment_intro, container, false);
|
||||
|
||||
unbinder = ButterKnife.bind(this, v);
|
||||
setUnbinder(ButterKnife.bind(this, v));
|
||||
|
||||
if (this.image != null) {
|
||||
this.imageView.setImageDrawable(this.image);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class TaskSetupFragment extends BaseFragment {
|
|||
|
||||
this.setTasks();
|
||||
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
this.adapter = new TaskSetupAdapter();
|
||||
this.adapter.setTaskList(this.taskGroups);
|
||||
this.recyclerView.setLayoutManager(new GridLayoutManager(activity, 2));
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class WelcomeFragment extends BaseFragment {
|
|||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View v = inflater.inflate(R.layout.fragment_welcome, container, false);
|
||||
|
||||
unbinder = ButterKnife.bind(this, v);
|
||||
setUnbinder(ButterKnife.bind(this, v));
|
||||
|
||||
speechBubbleView.animateText(getContext().getString(R.string.welcome_text));
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ public class SkillsFragment extends BaseMainFragment {
|
|||
adapter = new SkillsRecyclerViewAdapter();
|
||||
checkUserLoadSkills();
|
||||
|
||||
this.tutorialStepIdentifier = "skills";
|
||||
this.tutorialText = getString(R.string.tutorial_skills);
|
||||
this.setTutorialStepIdentifier("skills");
|
||||
this.setTutorialText(getString(R.string.tutorial_skills));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class GuildFragment extends BaseMainFragment {
|
|||
setViewPagerAdapter();
|
||||
|
||||
if (guildId != null && this.socialRepository != null) {
|
||||
compositeSubscription.add(socialRepository.getGroup(this.guildId).subscribe(this::setGroup, RxErrorHandler.handleEmptyError()));
|
||||
getCompositeSubscription().add(socialRepository.getGroup(this.guildId).subscribe(this::setGroup, RxErrorHandler.handleEmptyError()));
|
||||
socialRepository.retrieveGroup(this.guildId).subscribe(group -> {}, RxErrorHandler.handleEmptyError());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ public class GuildsOverviewFragment extends BaseMainFragment implements View.OnC
|
|||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View v = inflater.inflate(R.layout.fragment_guilds_overview, container, false);
|
||||
unbinder = ButterKnife.bind(this, v);
|
||||
setUnbinder(ButterKnife.bind(this, v));
|
||||
swipeRefreshLayout.setOnRefreshListener(this);
|
||||
this.publicGuildsButton.setOnClickListener(this);
|
||||
compositeSubscription.add(socialRepository.getUserGroups().subscribe(this::setGuilds, RxErrorHandler.handleEmptyError()));
|
||||
getCompositeSubscription().add(socialRepository.getUserGroups().subscribe(this::setGuilds, RxErrorHandler.handleEmptyError()));
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class InboxFragment extends BaseMainFragment
|
|||
.subscribe(aVoid -> {}, RxErrorHandler.handleEmptyError());
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_inbox, container, false);
|
||||
unbinder = ButterKnife.bind(this, v);
|
||||
setUnbinder(ButterKnife.bind(this, v));
|
||||
|
||||
swipeRefreshLayout.setOnRefreshListener(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class PublicGuildsFragment extends BaseMainFragment implements SearchView
|
|||
if (view == null) {
|
||||
view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this.activity));
|
||||
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
|
||||
viewAdapter = new PublicGuildsRecyclerViewAdapter(null, true);
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@ public class QuestDetailFragment extends BaseMainFragment {
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
compositeSubscription.add(socialRepository.getGroup(partyId).subscribe(this::updateParty, RxErrorHandler.handleEmptyError()));
|
||||
compositeSubscription.add(inventoryRepository.getQuestContent(questKey).subscribe(this::updateQuestContent, RxErrorHandler.handleEmptyError()));
|
||||
getCompositeSubscription().add(socialRepository.getGroup(partyId).subscribe(this::updateParty, RxErrorHandler.handleEmptyError()));
|
||||
getCompositeSubscription().add(inventoryRepository.getQuestContent(questKey).subscribe(this::updateQuestContent, RxErrorHandler.handleEmptyError()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class TavernDetailFragment extends BaseFragment {
|
|||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
compositeSubscription.add(userRepository.getUser(userId).subscribe(user -> {
|
||||
getCompositeSubscription().add(userRepository.getUser(userId).subscribe(user -> {
|
||||
this.user = user;
|
||||
this.updatePausedState();
|
||||
}, RxErrorHandler.handleEmptyError()));
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ public class TavernFragment extends BaseMainFragment {
|
|||
|
||||
setViewPagerAdapter();
|
||||
|
||||
this.tutorialStepIdentifier = "tavern";
|
||||
this.tutorialText = getString(R.string.tutorial_tavern);
|
||||
this.setTutorialStepIdentifier("tavern");
|
||||
this.setTutorialText(getString(R.string.tutorial_tavern));
|
||||
|
||||
return v;
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ public class TavernFragment extends BaseMainFragment {
|
|||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
if (this.socialRepository != null) {
|
||||
compositeSubscription.add(socialRepository.getGroup("habitrpg")
|
||||
getCompositeSubscription().add(socialRepository.getGroup("habitrpg")
|
||||
.subscribe(group -> {
|
||||
TavernFragment.this.tavern = group;
|
||||
if (group.quest != null && group.quest.key != null && TavernFragment.this.isAdded()) {
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class ChallengeListFragment extends BaseMainFragment implements SwipeRefr
|
|||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View v = inflater.inflate(R.layout.fragment_challengeslist, container, false);
|
||||
unbinder = ButterKnife.bind(this, v);
|
||||
setUnbinder(ButterKnife.bind(this, v));
|
||||
|
||||
challengeAdapter = new ChallengesListViewAdapter(null, true, viewUserChallengesOnly, userId);
|
||||
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ public class PartyDetailFragment extends BaseFragment {
|
|||
|
||||
refreshLayout.setOnRefreshListener(this::refreshParty);
|
||||
|
||||
compositeSubscription.add(socialRepository.getGroup(partyId).subscribe(this::updateParty, RxErrorHandler.handleEmptyError()));
|
||||
compositeSubscription.add(userRepository.getUser(userId).subscribe(this::updateUser, RxErrorHandler.handleEmptyError()));
|
||||
getCompositeSubscription().add(socialRepository.getGroup(partyId).subscribe(this::updateParty, RxErrorHandler.handleEmptyError()));
|
||||
getCompositeSubscription().add(userRepository.getUser(userId).subscribe(this::updateUser, RxErrorHandler.handleEmptyError()));
|
||||
}
|
||||
|
||||
private void refreshParty() {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class PartyFragment extends BaseMainFragment {
|
|||
// Get the full group data
|
||||
if (userHasParty()) {
|
||||
if (user != null) {
|
||||
compositeSubscription.add(socialRepository.getGroup(user.getParty().getId())
|
||||
getCompositeSubscription().add(socialRepository.getGroup(user.getParty().getId())
|
||||
.first()
|
||||
//delay, so that realm can save party first
|
||||
.delay(500, TimeUnit.MILLISECONDS)
|
||||
|
|
@ -86,8 +86,8 @@ public class PartyFragment extends BaseMainFragment {
|
|||
}
|
||||
|
||||
setViewPagerAdapter();
|
||||
this.tutorialStepIdentifier = "party";
|
||||
this.tutorialText = getString(R.string.tutorial_party);
|
||||
this.setTutorialStepIdentifier("party");
|
||||
this.setTutorialText(getString(R.string.tutorial_party));
|
||||
|
||||
return v;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class PartyInviteFragment extends BaseFragment {
|
|||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View v = inflater.inflate(R.layout.fragment_party_invite, container, false);
|
||||
unbinder = ButterKnife.bind(this, v);
|
||||
setUnbinder(ButterKnife.bind(this, v));
|
||||
|
||||
if (isEmailInvite) {
|
||||
inviteDescription.setText(getString(R.string.invite_email_description));
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class PartyMemberListFragment extends BaseFragment {
|
|||
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
adapter = new PartyMemberRecyclerViewAdapter(null, true, getContext());
|
||||
compositeSubscription.add(adapter.getUserClickedEvents().subscribe(userId -> FullProfileActivity.open(getContext(), userId), RxErrorHandler.handleEmptyError()));
|
||||
getCompositeSubscription().add(adapter.getUserClickedEvents().subscribe(userId -> FullProfileActivity.open(getContext(), userId), RxErrorHandler.handleEmptyError()));
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setItemAnimator(new SafeDefaultItemAnimator());
|
||||
|
||||
|
|
|
|||
|
|
@ -248,7 +248,8 @@ open class TaskRecyclerViewFragment : BaseFragment(), View.OnClickListener, Swip
|
|||
EventBus.getDefault().post(event)
|
||||
}
|
||||
|
||||
override fun getDisplayedClassName(): String = this.classType + super.getDisplayedClassName()
|
||||
override val displayedClassName: String?
|
||||
get() = this.classType + super.displayedClassName
|
||||
|
||||
override fun onRefresh() {
|
||||
refreshLayout.isRefreshing = true
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ class TasksFragment : BaseMainFragment() {
|
|||
val fragment = viewFragmentsDictionary?.get(indexForTaskType(activeTutorialFragments[0]))
|
||||
if (fragment?.tutorialTexts != null && context != null) {
|
||||
val finalText = context?.getString(R.string.tutorial_tasks_complete)
|
||||
if (!fragment.tutorialTexts.contains(finalText)) {
|
||||
if (!fragment.tutorialTexts.contains(finalText) && finalText != null) {
|
||||
fragment.tutorialTexts.add(finalText)
|
||||
}
|
||||
}
|
||||
|
|
@ -378,7 +378,8 @@ class TasksFragment : BaseMainFragment() {
|
|||
return -1
|
||||
}
|
||||
|
||||
override fun getDisplayedClassName(): String? = null
|
||||
override val displayedClassName: String?
|
||||
get() = null
|
||||
|
||||
override fun customTitle(): String? = null
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue