mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-19 20:29:02 +00:00
fix minor issues
This commit is contained in:
parent
a760c0052a
commit
188d1d65c8
7 changed files with 40 additions and 6 deletions
|
|
@ -24,8 +24,8 @@
|
|||
android:layout_width="@dimen/avatar_header_width"
|
||||
android:layout_height="@dimen/avatar_header_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginRight="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
app:showBackground="true"
|
||||
app:showMount="true"
|
||||
app:showPet="true" />
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_marginBottom="@dimen/bar_padding"
|
||||
android:orientation="horizontal"
|
||||
android:id="@+id/value_bar_layout">
|
||||
|
|
@ -48,13 +49,15 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
tools:text="50/50"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/descriptionLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center|right"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1"
|
||||
tools:text="Health"/>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<string name="SP_APIToken" translatable="false">APIToken</string>
|
||||
<string name="SP_username" translatable="false">Username</string>
|
||||
<string name="SP_email" translatable="false">E-mail</string>
|
||||
<string name="base_url" translatable="false">https://habitrpg-beta.herokuapp.com</string>
|
||||
<string name="base_url" translatable="false">https://habitica.com</string>
|
||||
|
||||
<!-- Local notification actions -->
|
||||
<string name="accept_party_invite" translatable="false">ACCEPT_PARTY_INVITE</string>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.habitrpg.android.habitica.events;
|
||||
|
||||
import com.habitrpg.android.habitica.ui.helpers.UiUtils;
|
||||
|
||||
/**
|
||||
* Created by phillip on 26.06.17.
|
||||
*/
|
||||
|
||||
public class ShowSnackbarEvent {
|
||||
|
||||
public String text;
|
||||
public UiUtils.SnackbarDisplayType type;
|
||||
}
|
||||
|
|
@ -17,10 +17,14 @@ import com.google.repacked.kotlin.Unit;
|
|||
import com.habitrpg.android.habitica.HabiticaApplication;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.data.ApiClient;
|
||||
import com.habitrpg.android.habitica.events.ShowSnackbarEvent;
|
||||
import com.habitrpg.android.habitica.models.Notification;
|
||||
import com.habitrpg.android.habitica.models.notifications.Reward;
|
||||
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
|
||||
import com.habitrpg.android.habitica.ui.helpers.UiUtils;
|
||||
import com.mikepenz.aboutlibraries.util.UIUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -105,7 +109,10 @@ public class PopupNotificationsManager {
|
|||
final AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
} else {
|
||||
UiUtils.showSnackbar(context, null, context.getString(R.string.nextPrizeUnlocks, notification.data.nextRewardAt), UiUtils.SnackbarDisplayType.BLUE);
|
||||
ShowSnackbarEvent event = new ShowSnackbarEvent();
|
||||
event.text = context.getString(R.string.nextPrizeUnlocks, notification.data.nextRewardAt);
|
||||
event.type = UiUtils.SnackbarDisplayType.BLUE;
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ import com.habitrpg.android.habitica.events.OpenMysteryItemEvent;
|
|||
import com.habitrpg.android.habitica.events.OpenedMysteryItemEvent;
|
||||
import com.habitrpg.android.habitica.events.SelectClassEvent;
|
||||
import com.habitrpg.android.habitica.events.ShareEvent;
|
||||
import com.habitrpg.android.habitica.events.ShowSnackbarEvent;
|
||||
import com.habitrpg.android.habitica.events.commands.BuyGemItemCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.BuyRewardCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.ChecklistCheckedCommand;
|
||||
|
|
@ -982,6 +983,11 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
|||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void showSnackBarEvent(ShowSnackbarEvent event) {
|
||||
showSnackbar(this, floatingMenuWrapper, event.text, event.type);
|
||||
}
|
||||
|
||||
public boolean isAppBarExpanded() {
|
||||
return (appBar.getHeight() - appBar.getBottom()) == 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ public class UserDeserializer implements JsonDeserializer<User> {
|
|||
public User deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
User user = new User();
|
||||
JsonObject obj = json.getAsJsonObject();
|
||||
|
||||
boolean isMember = !obj.has("tasksOrder");
|
||||
|
||||
if (obj.has("_id")) {
|
||||
user.setId(obj.get("_id").getAsString());
|
||||
}
|
||||
|
|
@ -67,7 +70,9 @@ public class UserDeserializer implements JsonDeserializer<User> {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (obj.has("items")) {
|
||||
|
||||
//Only load items for authenticated user, since it otherwise messes up item ownership
|
||||
if (obj.has("items") && !isMember) {
|
||||
user.setItems(context.deserialize(obj.get("items"), Items.class));
|
||||
}
|
||||
if (obj.has("auth")) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue