mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-17 19:29:02 +00:00
fix minor issues
This commit is contained in:
parent
70d0bd955f
commit
5b0bfae1e9
6 changed files with 20 additions and 18 deletions
|
|
@ -49,7 +49,7 @@ class TaskRepositoryImpl(localRepository: TaskLocalRepository, apiClient: ApiCli
|
|||
override fun taskChecked(user: User?, task: Task, up: Boolean, force: Boolean): Observable<TaskScoringResult> {
|
||||
val now = Date().time
|
||||
if (lastTaskAction > now - 500 && !force) {
|
||||
return Observable.just(null)
|
||||
return Observable.just(TaskScoringResult())
|
||||
}
|
||||
lastTaskAction = now
|
||||
return this.apiClient.postTaskDirection(task.id, (if (up) TaskDirection.up else TaskDirection.down).toString())
|
||||
|
|
@ -185,7 +185,7 @@ class TaskRepositoryImpl(localRepository: TaskLocalRepository, apiClient: ApiCli
|
|||
if (task.isValid) {
|
||||
return@flatMap apiClient.postTaskNewPosition(task.id, newPosition)
|
||||
}
|
||||
return@flatMap Observable.just<List<String>>(null)
|
||||
return@flatMap Observable.just<List<String>>(ArrayList())
|
||||
}
|
||||
.doOnNext({ localRepository.updateTaskPositions(it) })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class UserRepositoryImpl(localRepository: UserLocalRepository, apiClient: ApiCli
|
|||
|
||||
override fun updateUser(user: User?, updateData: Map<String, Any>): Observable<User> {
|
||||
return if (user == null) {
|
||||
Observable.just(null)
|
||||
Observable.just(User())
|
||||
} else apiClient.updateUser(updateData).map { newUser -> mergeUser(user, newUser) }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,11 +77,7 @@ class ChatListFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
if (view == null) {
|
||||
return inflater.inflate(R.layout.fragment_chat, container, false)
|
||||
}
|
||||
return view
|
||||
return inflater.inflate(R.layout.fragment_chat, container, false)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
|
|
|||
|
|
@ -144,10 +144,12 @@ public class ChallengeListFragment extends BaseMainFragment implements SwipeRefr
|
|||
|
||||
|
||||
RelativeLayout badgeLayout = (RelativeLayout) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
|
||||
TextView filterCountTextView = (TextView) badgeLayout.findViewById(R.id.badge_textview);
|
||||
filterCountTextView.setText(null);
|
||||
filterCountTextView.setVisibility(View.GONE);
|
||||
badgeLayout.setOnClickListener(view -> showFilterDialog());
|
||||
if (badgeLayout != null) {
|
||||
TextView filterCountTextView = badgeLayout.findViewById(R.id.badge_textview);
|
||||
filterCountTextView.setText(null);
|
||||
filterCountTextView.setVisibility(View.GONE);
|
||||
badgeLayout.setOnClickListener(view -> showFilterDialog());
|
||||
}
|
||||
}
|
||||
|
||||
private void showFilterDialog() {
|
||||
|
|
|
|||
|
|
@ -21,10 +21,8 @@ import java.util.*
|
|||
class RewardsRecyclerviewFragment : TaskRecyclerViewFragment() {
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
val view = super.onCreateView(inflater, container, savedInstanceState)
|
||||
|
||||
inventoryRepository.retrieveInAppRewards().subscribe(Action1 { }, RxErrorHandler.handleEmptyError())
|
||||
return view
|
||||
return super.onCreateView(inflater, container, savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
|
@ -60,7 +58,7 @@ class RewardsRecyclerviewFragment : TaskRecyclerViewFragment() {
|
|||
userRepository.retrieveUser(true, true)
|
||||
.flatMap<List<ShopItem>> { inventoryRepository.retrieveInAppRewards() }
|
||||
.doOnTerminate {
|
||||
refreshLayout.isRefreshing = false
|
||||
refreshLayout?.isRefreshing = false
|
||||
}.subscribe(Action1 { }, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,10 @@ public class PetListDeserializer implements JsonDeserializer<RealmList<Pet>> {
|
|||
for (Pet item : existingItems) {
|
||||
if (object.has(item.getKey())) {
|
||||
JsonElement itemObject = object.get(item.getKey());
|
||||
item.setTrained(itemObject.getAsInt());
|
||||
try {
|
||||
item.setTrained(itemObject.getAsInt());
|
||||
} catch (UnsupportedOperationException ignored) {
|
||||
}
|
||||
vals.add(item);
|
||||
object.remove(item.getKey());
|
||||
}
|
||||
|
|
@ -43,7 +46,10 @@ public class PetListDeserializer implements JsonDeserializer<RealmList<Pet>> {
|
|||
if (entry.getValue().isJsonNull()) {
|
||||
pet.setTrained(0);
|
||||
} else {
|
||||
pet.setTrained(entry.getValue().getAsInt());
|
||||
try {
|
||||
pet.setTrained(entry.getValue().getAsInt());
|
||||
} catch (UnsupportedOperationException ignored) {
|
||||
}
|
||||
}
|
||||
vals.add(pet);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue