mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Fix various issues
This commit is contained in:
parent
8c3e1b18bf
commit
da312bbc90
19 changed files with 122 additions and 113 deletions
|
|
@ -30,3 +30,4 @@ file_filter = Habitica/res/values-<lang>/strings.xml
|
|||
source_file = Habitica/res/values/strings.xml
|
||||
source_lang = en
|
||||
type = ANDROID
|
||||
|
||||
|
|
|
|||
|
|
@ -161,9 +161,7 @@
|
|||
android:value=".ui.activities.MainActivity" />
|
||||
</activity>
|
||||
<activity android:name="com.facebook.FacebookActivity"
|
||||
android:configChanges=
|
||||
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
|
||||
android:label="@string/app_name" />
|
||||
<activity android:name=".ui.activities.MaintenanceActivity"
|
||||
android:screenOrientation="portrait"
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class TaskRepositoryImpl(localRepository: TaskLocalRepository, apiClient: ApiCli
|
|||
return apiClient.scoreChecklistItem(taskId, itemId)
|
||||
.flatMap { localRepository.getTask(taskId).first() }
|
||||
.doOnNext { task ->
|
||||
val updatedItem: ChecklistItem? = task.checklist.lastOrNull { itemId == it.id }
|
||||
val updatedItem: ChecklistItem? = task.checklist?.lastOrNull { itemId == it.id }
|
||||
if (updatedItem != null) {
|
||||
localRepository.executeTransaction { updatedItem.completed = !updatedItem.completed }
|
||||
}
|
||||
|
|
@ -132,18 +132,27 @@ class TaskRepositoryImpl(localRepository: TaskLocalRepository, apiClient: ApiCli
|
|||
return Observable.just(task)
|
||||
}
|
||||
lastTaskAction = now
|
||||
if (task.tags.size > 0) {
|
||||
val tags = RealmList(*localRepository.getUnmanagedCopy(task.tags).toTypedArray())
|
||||
task.tags = tags
|
||||
task.tags?.let {
|
||||
if (it.size > 0) {
|
||||
val tags = RealmList(*localRepository.getUnmanagedCopy(it).toTypedArray())
|
||||
task.tags = tags
|
||||
}
|
||||
}
|
||||
if (task.checklist.size > 0) {
|
||||
val checklist = RealmList(*localRepository.getUnmanagedCopy(task.checklist).toTypedArray())
|
||||
task.checklist = checklist
|
||||
|
||||
task.checklist?.let {
|
||||
if (it.size > 0) {
|
||||
val checklist = RealmList(*localRepository.getUnmanagedCopy(it).toTypedArray())
|
||||
task.checklist = checklist
|
||||
}
|
||||
}
|
||||
if (task.reminders.size > 0) {
|
||||
val reminders = RealmList(*localRepository.getUnmanagedCopy(task.reminders).toTypedArray())
|
||||
task.reminders = reminders
|
||||
|
||||
task.reminders?.let {
|
||||
if (it.size > 0) {
|
||||
val reminders = RealmList(*localRepository.getUnmanagedCopy(it).toTypedArray())
|
||||
task.reminders = reminders
|
||||
}
|
||||
}
|
||||
|
||||
return apiClient.createTask(task)
|
||||
.map { task1 ->
|
||||
task1.dateCreated = Date()
|
||||
|
|
@ -158,10 +167,7 @@ class TaskRepositoryImpl(localRepository: TaskLocalRepository, apiClient: ApiCli
|
|||
return Observable.just(task)
|
||||
}
|
||||
lastTaskAction = now
|
||||
val id = task.id
|
||||
if (id == null) {
|
||||
return Observable.just(task)
|
||||
}
|
||||
val id = task.id ?: return Observable.just(task)
|
||||
return localRepository.getTaskCopy(id).first()
|
||||
.flatMap { task1 -> apiClient.updateTask(id, task1) }
|
||||
.map { task1 ->
|
||||
|
|
|
|||
|
|
@ -40,16 +40,13 @@ class RealmTaskLocalRepository(realm: Realm) : RealmBaseLocalRepository(realm),
|
|||
removeOldTasks(userId, sortedTasks)
|
||||
|
||||
val allChecklistItems = ArrayList<ChecklistItem>()
|
||||
for (t in sortedTasks) {
|
||||
allChecklistItems.addAll(t.checklist)
|
||||
}
|
||||
sortedTasks.forEach { it.checklist?.let { it1 -> allChecklistItems.addAll(it1) } }
|
||||
removeOldChecklists(allChecklistItems)
|
||||
|
||||
val allReminders = ArrayList<RemindersItem>()
|
||||
for (t in sortedTasks) {
|
||||
allReminders.addAll(t.reminders)
|
||||
}
|
||||
sortedTasks.forEach { it.reminders?.let { it1 -> allReminders.addAll(it1) } }
|
||||
removeOldReminders(allReminders)
|
||||
|
||||
realm.executeTransactionAsync { realm1 -> realm1.insertOrUpdate(sortedTasks) }
|
||||
}
|
||||
|
||||
|
|
@ -93,8 +90,8 @@ class RealmTaskLocalRepository(realm: Realm) : RealmBaseLocalRepository(realm),
|
|||
val tasksToDelete = localTasks.filterNot { onlineTaskList.contains(it) }
|
||||
realm.executeTransaction {
|
||||
for (localTask in tasksToDelete) {
|
||||
localTask.checklist.deleteAllFromRealm()
|
||||
localTask.reminders.deleteAllFromRealm()
|
||||
localTask.checklist?.deleteAllFromRealm()
|
||||
localTask.reminders?.deleteAllFromRealm()
|
||||
localTask.deleteFromRealm()
|
||||
}
|
||||
}
|
||||
|
|
@ -110,8 +107,8 @@ class RealmTaskLocalRepository(realm: Realm) : RealmBaseLocalRepository(realm),
|
|||
val tasksToDelete = localTasks.filterNot { onlineTaskList.contains(it) }
|
||||
realm.executeTransaction {
|
||||
for (localTask in tasksToDelete) {
|
||||
localTask.checklist.deleteAllFromRealm()
|
||||
localTask.reminders.deleteAllFromRealm()
|
||||
localTask.checklist?.deleteAllFromRealm()
|
||||
localTask.reminders?.deleteAllFromRealm()
|
||||
localTask.deleteFromRealm()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.habitrpg.android.habitica.data.local.UserLocalRepository
|
|||
import com.habitrpg.android.habitica.models.Skill
|
||||
import com.habitrpg.android.habitica.models.Tag
|
||||
import com.habitrpg.android.habitica.models.TutorialStep
|
||||
import com.habitrpg.android.habitica.models.social.Challenge
|
||||
import com.habitrpg.android.habitica.models.social.ChatMessage
|
||||
import com.habitrpg.android.habitica.models.user.User
|
||||
import io.realm.Realm
|
||||
|
|
@ -40,6 +41,9 @@ class RealmUserLocalRepository(realm: Realm) : RealmBaseLocalRepository(realm),
|
|||
if (user.tags != null) {
|
||||
removeOldTags(user.id, user.tags)
|
||||
}
|
||||
if (user.challenges != null) {
|
||||
removeOldChallenges(user.id, user.challenges)
|
||||
}
|
||||
}
|
||||
|
||||
private fun removeOldTags(userId: String, onlineTags: List<Tag>) {
|
||||
|
|
@ -52,6 +56,16 @@ 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 challengesToDelete = challenges.filterNot { onlineChallenges.contains(it) }
|
||||
realm.executeTransaction {
|
||||
for (challenge in challengesToDelete) {
|
||||
challenge.isParticipating = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getSkills(user: User): Observable<RealmResults<Skill>> {
|
||||
val habitClass = if (user.preferences.disableClasses) "none" else user.stats.habitClass
|
||||
return realm.where(Skill::class.java)
|
||||
|
|
|
|||
|
|
@ -33,21 +33,24 @@ class TaskAlarmManager(private var context: Context, private var taskRepository:
|
|||
}
|
||||
|
||||
private fun setAlarmsForTask(task: Task) {
|
||||
val reminders = task.reminders
|
||||
for (reminder in reminders) {
|
||||
var currentReminder = reminder
|
||||
if (task.type == Task.TYPE_DAILY) {
|
||||
//Ensure that we set to the next available time
|
||||
currentReminder = this.setTimeForDailyReminder(currentReminder, task)
|
||||
task.reminders?.let {
|
||||
for (reminder in it) {
|
||||
var currentReminder = reminder
|
||||
if (task.type == Task.TYPE_DAILY) {
|
||||
//Ensure that we set to the next available time
|
||||
currentReminder = this.setTimeForDailyReminder(currentReminder, task)
|
||||
}
|
||||
this.setAlarmForRemindersItem(task, currentReminder)
|
||||
}
|
||||
this.setAlarmForRemindersItem(task, currentReminder)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun removeAlarmsForTask(task: Task) {
|
||||
val reminders = task.reminders
|
||||
for (reminder in reminders) {
|
||||
this.removeAlarmForRemindersItem(reminder)
|
||||
task.reminders?.let {
|
||||
for (reminder in it) {
|
||||
this.removeAlarmForRemindersItem(reminder)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -78,12 +81,12 @@ class TaskAlarmManager(private var context: Context, private var taskRepository:
|
|||
}
|
||||
|
||||
private fun setTimeForDailyReminder(remindersItem: RemindersItem?, task: Task): RemindersItem? {
|
||||
val oldTime = remindersItem!!.time
|
||||
val oldTime = remindersItem?.time
|
||||
val newTime = task.getNextReminderOccurence(oldTime) ?: return null
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.time = newTime
|
||||
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE), oldTime.hours, oldTime.minutes, 0)
|
||||
remindersItem.time = calendar.time
|
||||
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE), oldTime?.hours ?: 0, oldTime?.minutes ?: 0, 0)
|
||||
remindersItem?.time = calendar.time
|
||||
return remindersItem
|
||||
}
|
||||
|
||||
|
|
@ -124,20 +127,18 @@ class TaskAlarmManager(private var context: Context, private var taskRepository:
|
|||
val am = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
sender.cancel()
|
||||
am.cancel(sender)
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
val TASK_ID_INTENT_KEY = "TASK_ID"
|
||||
val TASK_NAME_INTENT_KEY = "TASK_NAME"
|
||||
const val TASK_ID_INTENT_KEY = "TASK_ID"
|
||||
const val TASK_NAME_INTENT_KEY = "TASK_NAME"
|
||||
|
||||
fun scheduleDailyReminder(context: Context?) {
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
if (prefs.getBoolean("use_reminder", false)) {
|
||||
|
||||
val timeval = prefs.getString("reminder_time", "19:00")
|
||||
|
||||
val pieces = timeval!!.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||
val pieces = timeval?.split(":".toRegex())?.dropLastWhile { it.isEmpty() }?.toTypedArray() ?: return
|
||||
val hour = Integer.parseInt(pieces[0])
|
||||
val minute = Integer.parseInt(pieces[1])
|
||||
val cal = Calendar.getInstance()
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ open class Task : RealmObject, Parcelable {
|
|||
@Stats.StatsTypes
|
||||
var attribute: String? = Stats.STRENGTH
|
||||
var value: Double = 0.0
|
||||
var tags: RealmList<Tag> = RealmList()
|
||||
var tags: RealmList<Tag>? = RealmList()
|
||||
var dateCreated: Date? = null
|
||||
var position: Int? = 0
|
||||
var group: TaskGroupPlan? = null
|
||||
|
|
@ -39,8 +39,8 @@ open class Task : RealmObject, Parcelable {
|
|||
var counterDown: Int? = 0
|
||||
//todos/dailies
|
||||
var completed: Boolean = false
|
||||
var checklist: RealmList<ChecklistItem> = RealmList()
|
||||
var reminders: RealmList<RemindersItem> = RealmList()
|
||||
var checklist: RealmList<ChecklistItem>? = RealmList()
|
||||
var reminders: RealmList<RemindersItem>? = RealmList()
|
||||
//dailies
|
||||
var frequency: String? = null
|
||||
var everyX: Int? = 0
|
||||
|
|
@ -83,7 +83,7 @@ open class Task : RealmObject, Parcelable {
|
|||
private var weeksOfMonth: MutableList<Int>? = null
|
||||
|
||||
val completedChecklistCount: Int
|
||||
get() = checklist.count { it.completed }
|
||||
get() = checklist?.count { it.completed } ?: 0
|
||||
|
||||
val lightTaskColor: Int
|
||||
get() {
|
||||
|
|
@ -128,7 +128,7 @@ open class Task : RealmObject, Parcelable {
|
|||
get() = isDue == true && !completed
|
||||
|
||||
val isChecklistDisplayActive: Boolean
|
||||
get() = this.isDisplayedActive && this.checklist.size != this.completedChecklistCount
|
||||
get() = this.isDisplayedActive && this.checklist?.size != this.completedChecklistCount
|
||||
|
||||
val isGroupTask: Boolean
|
||||
get() = group?.approvalApproved == true
|
||||
|
|
@ -140,11 +140,11 @@ open class Task : RealmObject, Parcelable {
|
|||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class TaskTypes
|
||||
|
||||
fun containsAllTagIds(tagIdList: List<String>): Boolean = tags.mapTo(ArrayList()) { it.getId() }.containsAll(tagIdList)
|
||||
fun containsAllTagIds(tagIdList: List<String>): Boolean = tags?.mapTo(ArrayList()) { it.getId() }?.containsAll(tagIdList) ?: false
|
||||
|
||||
fun checkIfDue(): Boolean? = isDue == true
|
||||
|
||||
fun getNextReminderOccurence(oldTime: Date): Date? {
|
||||
fun getNextReminderOccurence(oldTime: Date?): Date? {
|
||||
val today = Calendar.getInstance()
|
||||
|
||||
val newTime = GregorianCalendar()
|
||||
|
|
|
|||
|
|
@ -564,7 +564,7 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
|||
} else {
|
||||
try {
|
||||
super.onBackPressed();
|
||||
} catch (IllegalStateException ignored) {}
|
||||
} catch (Exception ignored) {}
|
||||
if (this.activeFragment != null && activeFragment.get() != null) {
|
||||
this.activeFragment.get().updateUserData(user);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ public class ChallengesListViewAdapter extends RealmRecyclerViewAdapter<Challeng
|
|||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (challenge != null && challenge.isManaged()) {
|
||||
if (challenge != null && challenge.isManaged() && challenge.isManaged()) {
|
||||
if (viewUserChallengesOnly) {
|
||||
EventBus.getDefault().post(new ShowChallengeDetailActivityCommand(challenge.id));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ class NavigationDrawerFragment : DialogFragment() {
|
|||
}
|
||||
|
||||
fun setUsername(name: String?) {
|
||||
if (name?.isNotEmpty() == true) {
|
||||
if (name != null && name.isNotEmpty()) {
|
||||
toolbarTitle.text = name
|
||||
} else {
|
||||
toolbarTitle.text = "Habitica"
|
||||
|
|
|
|||
|
|
@ -53,32 +53,26 @@ public class StableRecyclerFragment extends BaseFragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
boolean setupViews = false;
|
||||
if (view == null) {
|
||||
view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
setupViews = true;
|
||||
}
|
||||
view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
|
||||
if (setupViews) {
|
||||
recyclerView.setEmptyView(emptyView);
|
||||
emptyView.setText(getString(R.string.empty_items, itemTypeText));
|
||||
recyclerView.setEmptyView(emptyView);
|
||||
emptyView.setText(getString(R.string.empty_items, itemTypeText));
|
||||
|
||||
layoutManager = new GridLayoutManager(getActivity(), 2);
|
||||
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
|
||||
@Override
|
||||
public int getSpanSize(int position) {
|
||||
if (adapter.getItemViewType(position) == 0) {
|
||||
return layoutManager.getSpanCount();
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
layoutManager = new GridLayoutManager(getActivity(), 2);
|
||||
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
|
||||
@Override
|
||||
public int getSpanSize(int position) {
|
||||
if (adapter.getItemViewType(position) == 0) {
|
||||
return layoutManager.getSpanCount();
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
recyclerView.addItemDecoration(new MarginDecoration(getActivity()));
|
||||
}
|
||||
}
|
||||
});
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
recyclerView.addItemDecoration(new MarginDecoration(getActivity()));
|
||||
|
||||
|
||||
adapter = (StableRecyclerAdapter) recyclerView.getAdapter();
|
||||
|
|
|
|||
|
|
@ -85,9 +85,7 @@ public class AvatarSetupFragment 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_avatar, container, false);
|
||||
}
|
||||
view = inflater.inflate(R.layout.fragment_setup_avatar, container, false);
|
||||
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
this.adapter = new CustomizationSetupAdapter();
|
||||
|
|
|
|||
|
|
@ -47,19 +47,17 @@ public class PublicGuildsFragment extends BaseMainFragment implements SearchView
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
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);
|
||||
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this.activity));
|
||||
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
|
||||
viewAdapter = new PublicGuildsRecyclerViewAdapter(null, true);
|
||||
viewAdapter.setMemberGuildIDs(this.memberGuildIDs);
|
||||
viewAdapter.apiClient = this.apiClient;
|
||||
recyclerView.setAdapter(viewAdapter);
|
||||
recyclerView.setItemAnimator(new SafeDefaultItemAnimator());
|
||||
this.fetchGuilds();
|
||||
}
|
||||
setUnbinder(ButterKnife.bind(this, view));
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this.activity));
|
||||
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
|
||||
viewAdapter = new PublicGuildsRecyclerViewAdapter(null, true);
|
||||
viewAdapter.setMemberGuildIDs(this.memberGuildIDs);
|
||||
viewAdapter.apiClient = this.apiClient;
|
||||
recyclerView.setAdapter(viewAdapter);
|
||||
recyclerView.setItemAnimator(new SafeDefaultItemAnimator());
|
||||
this.fetchGuilds();
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.habitrpg.android.habitica.ui.fragments.social;
|
|||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.LayoutInflater;
|
||||
|
|
@ -93,7 +94,7 @@ public class QuestDetailFragment extends BaseMainFragment {
|
|||
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +109,7 @@ public class QuestDetailFragment extends BaseMainFragment {
|
|||
|
||||
|
||||
private void updateParty(Group group) {
|
||||
if (questTitleView == null || group.getQuest() == null) {
|
||||
if (questTitleView == null || group == null|| group.getQuest() == null) {
|
||||
return;
|
||||
}
|
||||
party = group;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.ui.fragments.social.challenges;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
|
|
@ -92,7 +93,7 @@ public class ChallengeListFragment extends BaseMainFragment implements SwipeRefr
|
|||
}
|
||||
|
||||
@Override
|
||||
public void injectFragment(AppComponent component) {
|
||||
public void injectFragment(@NonNull AppComponent component) {
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,25 +65,23 @@ public class ChallengeTasksRecyclerViewFragment 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);
|
||||
view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
|
||||
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
|
||||
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
|
||||
|
||||
android.support.v4.app.FragmentActivity context = getActivity();
|
||||
android.support.v4.app.FragmentActivity context = getActivity();
|
||||
|
||||
layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
|
||||
if (layoutManager == null) {
|
||||
layoutManager = new LinearLayoutManager(context);
|
||||
if (layoutManager == null) {
|
||||
layoutManager = new LinearLayoutManager(context);
|
||||
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
}
|
||||
if (recyclerView.getAdapter() == null) {
|
||||
this.setInnerAdapter();
|
||||
}
|
||||
recyclerView.setItemAnimator(new SafeDefaultItemAnimator());
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
}
|
||||
if (recyclerView.getAdapter() == null) {
|
||||
this.setInnerAdapter();
|
||||
}
|
||||
recyclerView.setItemAnimator(new SafeDefaultItemAnimator());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,9 +42,7 @@ public class PartyMemberListFragment 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_refresh_recyclerview, container, false);
|
||||
}
|
||||
view = inflater.inflate(R.layout.fragment_refresh_recyclerview, container, false);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,12 @@ class WorldStateSerialization: JsonDeserializer<WorldState> {
|
|||
if (worldBossObject == null) {
|
||||
return state
|
||||
}
|
||||
state.worldBossActive = worldBossObject["active"].asBoolean
|
||||
state.worldBossKey = worldBossObject["key"].asString
|
||||
if (worldBossObject.has("active") && !worldBossObject["active"].isJsonNull) {
|
||||
state.worldBossActive = worldBossObject["active"].asBoolean
|
||||
}
|
||||
if (worldBossObject.has("key") && !worldBossObject["key"].isJsonNull) {
|
||||
state.worldBossKey = worldBossObject["key"].asString
|
||||
}
|
||||
if (worldBossObject.has("progress")) {
|
||||
val progress = QuestProgress()
|
||||
val progressObj = worldBossObject.getAsJsonObject("progress")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.2.21'
|
||||
ext.kotlin_version = '1.2.30'
|
||||
ext.build_tools_version = '26.0.2'
|
||||
ext.sdk_version = 27
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue