mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-19 12:18:59 +00:00
Party information / ContentCache /
This commit is contained in:
parent
40e606d377
commit
c47031a60b
14 changed files with 499 additions and 46 deletions
|
|
@ -4,7 +4,7 @@
|
|||
"items":[
|
||||
{
|
||||
"type": "F",
|
||||
"title": "Party :)"
|
||||
"title": "Party Information / Chat / Members"
|
||||
},
|
||||
{
|
||||
"type": "B",
|
||||
|
|
|
|||
|
|
@ -18,12 +18,11 @@
|
|||
tools:context=".MainActivity">
|
||||
|
||||
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
|
|
|
|||
168
Habitica/res/layout/fragment_party_info.xml
Normal file
168
Habitica/res/layout/fragment_party_info.xml
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layout xmlns:bind="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:app="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
<import type="com.magicmicky.habitrpgwrapper.lib.models.Group" />
|
||||
<import type="com.magicmicky.habitrpgwrapper.lib.models.QuestContent" />
|
||||
<import type="android.view.View" />
|
||||
|
||||
<variable
|
||||
name="party"
|
||||
type="Group" />
|
||||
|
||||
<variable
|
||||
name="quest"
|
||||
type="QuestContent" />
|
||||
</data>
|
||||
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
|
||||
android:scrollbars="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!--
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Invitations" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="list of invitations" />
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
-->
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:text="@{party.name}"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp">
|
||||
|
||||
<TextView android:layout_margin="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{party.description}" />
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Quest"
|
||||
android:layout_margin="5dp"
|
||||
android:visibility="@{quest != null ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:visibility="@{quest != null ? View.VISIBLE : View.GONE}">
|
||||
|
||||
<GridLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:alignmentMode="alignBounds"
|
||||
android:columnCount="2"
|
||||
android:columnOrderPreserved="false"
|
||||
android:padding="5dp"
|
||||
android:rowCount="3">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_columnSpan="2"
|
||||
android:text="@{quest.text}" />
|
||||
|
||||
<ImageView
|
||||
android:layout_column="0"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_row="1"
|
||||
bind:imageName='@{"quest_"+ quest.key}'
|
||||
android:src="@drawable/ic_action_chat"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_column="1"
|
||||
android:layout_columnWeight="4"
|
||||
android:layout_row="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:text='@{"HP: "+ quest.boss.hp}' />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:text='@{"Str: "+ quest.boss.str}' />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:layout_column="0"
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_row="2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView android:layout_margin="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{quest.notes}" />
|
||||
</LinearLayout>
|
||||
|
||||
<!--<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Reward List"
|
||||
android:layout_column="0"
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_row="2" /> -->
|
||||
</GridLayout>
|
||||
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text='@{party.memberCount+" Members"}'
|
||||
app:backgroundColor="@{@color/brand}"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Chat"
|
||||
app:backgroundColor="@{@color/brand}"/>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</layout>
|
||||
77
Habitica/src/com/habitrpg/android/habitica/ContentCache.java
Normal file
77
Habitica/src/com/habitrpg/android/habitica/ContentCache.java
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
package com.habitrpg.android.habitica;
|
||||
|
||||
import com.magicmicky.habitrpgwrapper.lib.api.ApiService;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.ContentResult;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.QuestBoss;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.QuestContent;
|
||||
import com.raizlabs.android.dbflow.sql.SqlUtils;
|
||||
import com.raizlabs.android.dbflow.sql.builder.Condition;
|
||||
import com.raizlabs.android.dbflow.sql.language.Insert;
|
||||
import com.raizlabs.android.dbflow.sql.language.Select;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import retrofit.Callback;
|
||||
import retrofit.RetrofitError;
|
||||
import retrofit.client.Response;
|
||||
|
||||
/**
|
||||
* Created by Negue on 29.09.2015.
|
||||
*/
|
||||
public class ContentCache {
|
||||
public interface QuestContentCallback{
|
||||
void GotQuest(QuestContent content);
|
||||
}
|
||||
|
||||
|
||||
private ApiService apiService;
|
||||
|
||||
public ContentCache(ApiService apiService){
|
||||
|
||||
this.apiService = apiService;
|
||||
}
|
||||
|
||||
public void GetQuestContent(final String key, final QuestContentCallback cb){
|
||||
final QuestContent quest = new Select().from(QuestContent.class).where(Condition.column("key").eq(key)).querySingle();
|
||||
|
||||
if(quest != null){
|
||||
QuestBoss boss = new Select().from(QuestBoss.class).where(Condition.column("key").eq(key)).querySingle();
|
||||
quest.boss = boss;
|
||||
|
||||
cb.GotQuest(quest);
|
||||
}
|
||||
else
|
||||
{
|
||||
// load from api and save to db
|
||||
|
||||
apiService.getContent(new Callback<ContentResult>() {
|
||||
@Override
|
||||
public void success(ContentResult contentResult, Response response) {
|
||||
|
||||
QuestContent searchedQuest = null;
|
||||
|
||||
for (QuestContent quest : contentResult.quests.values()) {
|
||||
quest.save();
|
||||
|
||||
if(quest.boss != null) {
|
||||
quest.boss.key = quest.key;
|
||||
quest.boss.save();
|
||||
}
|
||||
|
||||
if(quest.key.equals(key)){
|
||||
searchedQuest = quest;
|
||||
}
|
||||
}
|
||||
|
||||
cb.GotQuest(searchedQuest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(RetrofitError error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,10 +13,10 @@ import com.habitrpg.android.habitica.ui.fragments.PartyInformationFragment;
|
|||
import com.habitrpg.android.habitica.ui.fragments.PartyMemberListFragment;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.Group;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.QuestContent;
|
||||
import com.raizlabs.android.dbflow.sql.builder.Condition;
|
||||
import com.raizlabs.android.dbflow.sql.language.Select;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import butterknife.InjectView;
|
||||
|
|
@ -31,6 +31,8 @@ public class PartyActivity extends AvatarActivityBase implements AppBarLayout.On
|
|||
|
||||
private APIHelper mAPIHelper;
|
||||
|
||||
private Group group;
|
||||
|
||||
@Override
|
||||
protected int getLayoutRes() {
|
||||
return R.layout.activity_party;
|
||||
|
|
@ -53,6 +55,38 @@ public class PartyActivity extends AvatarActivityBase implements AppBarLayout.On
|
|||
|
||||
updateUserAvatars();
|
||||
|
||||
final ContentCache contentCache = new ContentCache(mAPIHelper.apiService);
|
||||
|
||||
|
||||
// Get the full group data
|
||||
mAPIHelper.apiService.getGroup("party", new Callback<Group>() {
|
||||
@Override
|
||||
public void success(Group group, Response response) {
|
||||
PartyActivity.this.group = group;
|
||||
|
||||
if (partyMemberListFragment != null) {
|
||||
partyMemberListFragment.setMemberList(group.members);
|
||||
}
|
||||
|
||||
if (partyInformationFragment != null) {
|
||||
partyInformationFragment.setGroup(group);
|
||||
}
|
||||
|
||||
if (group.quest != null && !group.quest.key.isEmpty()) {
|
||||
contentCache.GetQuestContent(group.quest.key, new ContentCache.QuestContentCallback() {
|
||||
@Override
|
||||
public void GotQuest(QuestContent content) {
|
||||
partyInformationFragment.setQuestContent(content);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(RetrofitError error) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +104,9 @@ public class PartyActivity extends AvatarActivityBase implements AppBarLayout.On
|
|||
|
||||
private HashMap<Integer, Fragment> fragmentDictionary = new HashMap<>();
|
||||
|
||||
private PartyMemberListFragment partyMemberListFragment;
|
||||
private PartyInformationFragment partyInformationFragment;
|
||||
|
||||
|
||||
public void setViewPagerAdapter() {
|
||||
android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
|
|
@ -83,7 +120,7 @@ public class PartyActivity extends AvatarActivityBase implements AppBarLayout.On
|
|||
|
||||
switch (position) {
|
||||
case 0: {
|
||||
fragment = new PartyInformationFragment();
|
||||
fragment = partyInformationFragment = new PartyInformationFragment(group);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
|
|
@ -91,7 +128,7 @@ public class PartyActivity extends AvatarActivityBase implements AppBarLayout.On
|
|||
break;
|
||||
}
|
||||
case 2: {
|
||||
fragment = new PartyMemberListFragment(PartyActivity.this, mAPIHelper.apiService);
|
||||
fragment = partyMemberListFragment = new PartyMemberListFragment(PartyActivity.this, group);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -61,16 +61,12 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if(!isTavern){
|
||||
return TYPE_MESSAGE;
|
||||
}
|
||||
|
||||
switch (position) {
|
||||
case 0: {
|
||||
return TYPE_DANIEL;
|
||||
return isTavern ? TYPE_DANIEL : TYPE_NEW_MESSAGE;
|
||||
}
|
||||
case 1: {
|
||||
return TYPE_NEW_MESSAGE;
|
||||
return isTavern ? TYPE_NEW_MESSAGE : TYPE_MESSAGE;
|
||||
}
|
||||
default: {
|
||||
return TYPE_MESSAGE;
|
||||
|
|
@ -102,8 +98,8 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(ChatRecyclerViewHolder holder, int position) {
|
||||
if(!isTavern){
|
||||
holder.bind(messages.get(position));
|
||||
if(!isTavern && position > 0){
|
||||
holder.bind(messages.get(position - 1));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +110,7 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return messages.size() + (isTavern ? 2 : 0);
|
||||
return messages.size() + (isTavern ? 2 : 1);
|
||||
}
|
||||
|
||||
public class ChatRecyclerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, PopupMenu.OnMenuItemClickListener {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,58 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments;
|
||||
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.databinding.FragmentPartyInfoBinding;
|
||||
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.Group;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.QuestContent;
|
||||
|
||||
/**
|
||||
* Created by Negue on 16.09.2015.
|
||||
*/
|
||||
public class PartyInformationFragment extends Fragment {
|
||||
|
||||
|
||||
private View view;
|
||||
FragmentPartyInfoBinding viewBinding;
|
||||
private Group group;
|
||||
|
||||
public PartyInformationFragment(Group group) {
|
||||
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
if (view == null)
|
||||
view = inflater.inflate(R.layout.fragment_party_info, container, false);
|
||||
|
||||
viewBinding = DataBindingUtil.bind(view);
|
||||
|
||||
if(group != null){
|
||||
setGroup(group);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setGroup(Group group){
|
||||
if (viewBinding != null) {
|
||||
viewBinding.setParty(group);
|
||||
}
|
||||
}
|
||||
|
||||
public void setQuestContent(QuestContent quest){
|
||||
if (viewBinding != null) {
|
||||
viewBinding.setQuest(quest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,14 +12,13 @@ import android.view.ViewGroup;
|
|||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.ui.adapter.PartyMemberRecyclerViewAdapter;
|
||||
import com.magicmicky.habitrpgwrapper.lib.api.ApiService;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.Group;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.InjectView;
|
||||
import retrofit.Callback;
|
||||
import retrofit.RetrofitError;
|
||||
import retrofit.client.Response;
|
||||
|
||||
/**
|
||||
* Created by Negue on 15.09.2015.
|
||||
|
|
@ -27,14 +26,13 @@ import retrofit.client.Response;
|
|||
public class PartyMemberListFragment extends Fragment {
|
||||
|
||||
private Context ctx;
|
||||
private ApiService apiService;
|
||||
private Group group;
|
||||
|
||||
private PartyMemberRecyclerViewAdapter viewAdapter;
|
||||
|
||||
public PartyMemberListFragment(Context ctx, ApiService apiService){
|
||||
public PartyMemberListFragment(Context ctx, Group group){
|
||||
this.ctx = ctx;
|
||||
|
||||
this.apiService = apiService;
|
||||
this.group = group;
|
||||
|
||||
viewAdapter = new PartyMemberRecyclerViewAdapter();
|
||||
}
|
||||
|
|
@ -62,19 +60,12 @@ public class PartyMemberListFragment extends Fragment {
|
|||
mRecyclerView.setLayoutManager(new LinearLayoutManager(ctx));
|
||||
mRecyclerView.setAdapter(viewAdapter);
|
||||
|
||||
// Get the full group data
|
||||
apiService.getGroup("party", new Callback<Group>() {
|
||||
@Override
|
||||
public void success(Group group, Response response) {
|
||||
viewAdapter.setMemberList(group.members);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(RetrofitError error) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if(group != null){
|
||||
setMemberList(group.members);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMemberList(ArrayList<HabitRPGUser> members){
|
||||
viewAdapter.setMemberList(members);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class DataBindingUtils {
|
|||
|
||||
@BindingAdapter("bind:imageName")
|
||||
public static void loadImage(ImageView view, String imageName) {
|
||||
Picasso.with(view.getContext()).load("https://habitica-assets.s3.amazonaws.com/mobileApp/images/shop_"+ imageName +".png").into(view);
|
||||
Picasso.with(view.getContext()).load("https://habitica-assets.s3.amazonaws.com/mobileApp/images/"+ imageName +".png").into(view);
|
||||
}
|
||||
|
||||
@BindingAdapter("bind:cardColor")
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ public interface ApiService {
|
|||
@GET("/status")
|
||||
void getStatus(Callback<Status> statusCallback);
|
||||
|
||||
@GET("/content")
|
||||
void getContent(Callback<ContentResult> contentResultCallback);
|
||||
|
||||
/* User API */
|
||||
|
||||
@GET("/user/")
|
||||
void getUser(Callback<HabitRPGUser> habitRPGUserCallback);
|
||||
|
|
@ -39,9 +43,6 @@ public interface ApiService {
|
|||
@GET("/user/inventory/buy")
|
||||
void getInventoryBuyableGear(Callback<List<ItemData>> buyableGearCallback);
|
||||
|
||||
@GET("/content")
|
||||
void getContent(Callback<ContentResult> contentResultCallback);
|
||||
|
||||
@POST("/user/inventory/buy/{key}")
|
||||
void buyItem(@Path("key") String itemKey, Callback<Void> voidCallback);
|
||||
|
||||
|
|
@ -114,8 +115,7 @@ public interface ApiService {
|
|||
void seenMessage(@Path("gid") String groupId, Callback<Void> cb);
|
||||
|
||||
/*
|
||||
@GET("/content")
|
||||
void getContent();//Check Callback
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.magicmicky.habitrpgwrapper.lib.models;
|
|||
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.ItemData;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Created by Negue on 15.07.2015.
|
||||
*/
|
||||
|
|
@ -12,5 +14,8 @@ public class ContentResult {
|
|||
public ItemData armoire;
|
||||
|
||||
public ContentGear gear;
|
||||
|
||||
|
||||
public HashMap<String, QuestContent> quests;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import com.raizlabs.android.dbflow.annotation.PrimaryKey;
|
|||
import com.raizlabs.android.dbflow.annotation.Table;
|
||||
import com.raizlabs.android.dbflow.structure.BaseModel;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Created by viirus on 06/07/15.
|
||||
*/
|
||||
|
|
@ -18,6 +20,13 @@ public class Quest extends BaseModel {
|
|||
public String key;
|
||||
|
||||
@Column
|
||||
public boolean active;
|
||||
|
||||
@Column
|
||||
public String leader;
|
||||
|
||||
public HashMap<String, Boolean> members;
|
||||
|
||||
@ForeignKey(references = {@ForeignKeyReference(columnName = "progress_id",
|
||||
columnType = Long.class,
|
||||
foreignColumnName = "id")})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
package com.magicmicky.habitrpgwrapper.lib.models;
|
||||
|
||||
import com.habitrpg.android.habitica.HabitDatabase;
|
||||
import com.raizlabs.android.dbflow.annotation.Column;
|
||||
import com.raizlabs.android.dbflow.annotation.PrimaryKey;
|
||||
import com.raizlabs.android.dbflow.annotation.Table;
|
||||
import com.raizlabs.android.dbflow.structure.BaseModel;
|
||||
|
||||
@Table(databaseName = HabitDatabase.NAME)
|
||||
public class QuestBoss extends BaseModel {
|
||||
|
||||
@PrimaryKey
|
||||
@Column
|
||||
public String key;
|
||||
|
||||
@Column
|
||||
public String name;
|
||||
|
||||
@Column
|
||||
public double hp;
|
||||
|
||||
@Column
|
||||
public double str;
|
||||
|
||||
@Column
|
||||
public double def;
|
||||
|
||||
/* Boss Columns */
|
||||
|
||||
@Column
|
||||
public String rage_title;
|
||||
|
||||
@Column
|
||||
public String rage_description;
|
||||
|
||||
@Column
|
||||
public double rage_value;
|
||||
|
||||
@Column
|
||||
public String rage_tavern;
|
||||
|
||||
@Column
|
||||
public String rage_stables;
|
||||
|
||||
@Column
|
||||
public String rage_market;
|
||||
|
||||
public class QuestBossRage {
|
||||
public String title;
|
||||
|
||||
public String description;
|
||||
|
||||
public double value;
|
||||
|
||||
public String tavern;
|
||||
|
||||
public String stables;
|
||||
|
||||
public String market;
|
||||
}
|
||||
|
||||
public QuestBossRage rage;
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
// Just to save the Json-Object as DB-Columns
|
||||
|
||||
if(rage != null && rage.title != null && !rage.title.isEmpty()){
|
||||
rage_title = rage.title;
|
||||
rage_description = rage.description;
|
||||
rage_value = rage.value;
|
||||
rage_tavern = rage.tavern;
|
||||
rage_stables = rage.stables;
|
||||
rage_market = rage.market;
|
||||
}
|
||||
|
||||
super.save();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.magicmicky.habitrpgwrapper.lib.models;
|
||||
|
||||
import com.habitrpg.android.habitica.HabitDatabase;
|
||||
import com.raizlabs.android.dbflow.annotation.Column;
|
||||
import com.raizlabs.android.dbflow.annotation.PrimaryKey;
|
||||
import com.raizlabs.android.dbflow.annotation.Table;
|
||||
import com.raizlabs.android.dbflow.structure.BaseModel;
|
||||
|
||||
/**
|
||||
* Created by Negue on 29.09.2015.
|
||||
*/
|
||||
@Table(databaseName = HabitDatabase.NAME)
|
||||
public class QuestContent extends BaseModel {
|
||||
@PrimaryKey
|
||||
@Column
|
||||
public String key;
|
||||
|
||||
@Column
|
||||
public String text;
|
||||
|
||||
@Column
|
||||
public String notes;
|
||||
|
||||
@Column
|
||||
public double value;
|
||||
|
||||
@Column
|
||||
public String previous;
|
||||
|
||||
@Column
|
||||
public int lvl;
|
||||
|
||||
@Column
|
||||
public boolean canBuy;
|
||||
|
||||
@Column
|
||||
public String category;
|
||||
|
||||
public QuestBoss boss;
|
||||
|
||||
// todo drops
|
||||
}
|
||||
|
||||
Loading…
Reference in a new issue