mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-14 02:01:56 +00:00
Fix minor issues
This commit is contained in:
parent
da312bbc90
commit
66f20faeb7
6 changed files with 26 additions and 33 deletions
|
|
@ -57,7 +57,7 @@ class RealmUserLocalRepository(realm: Realm) : RealmBaseLocalRepository(realm),
|
|||
}
|
||||
|
||||
private fun removeOldChallenges(userId: String, onlineChallenges: List<Challenge>) {
|
||||
val challenges = realm.where(Challenge::class.java).equalTo("userId", userId).findAll().createSnapshot()
|
||||
val challenges = realm.where(Challenge::class.java).equalTo("isParticipating", true).findAll().createSnapshot()
|
||||
val challengesToDelete = challenges.filterNot { onlineChallenges.contains(it) }
|
||||
realm.executeTransaction {
|
||||
for (challenge in challengesToDelete) {
|
||||
|
|
|
|||
|
|
@ -349,10 +349,12 @@ class NavigationDrawerFragment : DialogFragment() {
|
|||
}
|
||||
|
||||
fun setUsername(name: String?) {
|
||||
if (name != null && name.isNotEmpty()) {
|
||||
toolbarTitle.text = name
|
||||
} else {
|
||||
toolbarTitle.text = "Habitica"
|
||||
if (toolbarTitle != null) {
|
||||
if (name != null && name.isNotEmpty()) {
|
||||
toolbarTitle.text = name
|
||||
} else {
|
||||
toolbarTitle.text = "Habitica"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,9 +73,7 @@ public class ItemRecyclerFragment extends BaseFragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (view == null) {
|
||||
view = inflater.inflate(R.layout.fragment_items, container, false);
|
||||
}
|
||||
view = inflater.inflate(R.layout.fragment_items, container, false);
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
|
||||
recyclerView.setEmptyView(emptyView);
|
||||
|
|
|
|||
|
|
@ -37,28 +37,26 @@ public class MountDetailRecyclerFragment extends BaseMainFragment {
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
this.usesTabLayout = false;
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (view == null) {
|
||||
view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
|
||||
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
|
||||
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
|
||||
|
||||
layoutManager = new GridLayoutManager(getActivity(), 2);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
recyclerView.addItemDecoration(new MarginDecoration(getActivity()));
|
||||
layoutManager = new GridLayoutManager(getActivity(), 2);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
recyclerView.addItemDecoration(new MarginDecoration(getActivity()));
|
||||
|
||||
adapter = (MountDetailRecyclerAdapter) recyclerView.getAdapter();
|
||||
if (adapter == null) {
|
||||
adapter = new MountDetailRecyclerAdapter(null, true);
|
||||
adapter.context = this.getActivity();
|
||||
adapter.itemType = this.animalType;
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setItemAnimator(new SafeDefaultItemAnimator());
|
||||
this.loadItems();
|
||||
adapter = (MountDetailRecyclerAdapter) recyclerView.getAdapter();
|
||||
if (adapter == null) {
|
||||
adapter = new MountDetailRecyclerAdapter(null, true);
|
||||
adapter.context = this.getActivity();
|
||||
adapter.itemType = this.animalType;
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setItemAnimator(new SafeDefaultItemAnimator());
|
||||
this.loadItems();
|
||||
|
||||
getCompositeSubscription().add(adapter.getEquipEvents()
|
||||
.flatMap(key -> inventoryRepository.equip(user, "mount", key))
|
||||
.subscribe(items -> {}, RxErrorHandler.handleEmptyError()));
|
||||
}
|
||||
getCompositeSubscription().add(adapter.getEquipEvents()
|
||||
.flatMap(key -> inventoryRepository.equip(user, "mount", key))
|
||||
.subscribe(items -> {}, RxErrorHandler.handleEmptyError()));
|
||||
}
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
|
|
|
|||
|
|
@ -47,8 +47,7 @@ public class TaskSetupFragment extends BaseFragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (view == null)
|
||||
view = inflater.inflate(R.layout.fragment_setup_tasks, container, false);
|
||||
view = inflater.inflate(R.layout.fragment_setup_tasks, container, false);
|
||||
|
||||
this.setTasks();
|
||||
|
||||
|
|
|
|||
|
|
@ -45,11 +45,7 @@ public class SkillTasksRecyclerViewFragment extends BaseFragment {
|
|||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
if (view == null) {
|
||||
view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
}
|
||||
|
||||
return view;
|
||||
return inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue