mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-22 21:57:11 +00:00
display list of guilds the user is a member of
This commit is contained in:
parent
8067b6bcd3
commit
467c314896
9 changed files with 167 additions and 14 deletions
|
|
@ -2,8 +2,8 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.habitrpg.android.habitica"
|
||||
android:versionCode="38"
|
||||
android:versionName="0.0.26.1"
|
||||
android:versionCode="39"
|
||||
android:versionName="0.0.26.2"
|
||||
android:screenOrientation="portrait"
|
||||
android:installLocation="auto" >
|
||||
|
||||
|
|
|
|||
51
Habitica/res/layout/fragment_guilds_overview.xml
Normal file
51
Habitica/res/layout/fragment_guilds_overview.xml
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:bind="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
<import type="com.magicmicky.habitrpgwrapper.lib.models.Preferences" />
|
||||
<import type="android.view.View" />
|
||||
|
||||
|
||||
</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:layout_margin="5dp"
|
||||
android:text="@string/my_guilds"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/card_horizontal_padding">
|
||||
<LinearLayout
|
||||
android:id="@+id/my_guilds_listview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:text="@string/public_guilds" />
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</layout>
|
||||
|
|
@ -3,8 +3,7 @@
|
|||
android:id="@+id/linearLayout"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:background="@drawable/btn_habit_background">
|
||||
android:clickable="true">
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -213,4 +213,6 @@ To start, which parts of your life do you want to improve?</string>
|
|||
<string name="setup_task_creativity_3">Finish creative project</string>
|
||||
|
||||
<string name="gem.purchase.support">Want to help us keep Habitica running? You can support the developers by buying gems!\n\nGems allow you to buy fun extras for your account, including: \n\n - Cool costumes for your avatar\n - Awesome backgrounds\n - Fun quests that reward you with pet eggs\n - The ability to change your class before level 100\n\nThank you so much for helping us make Habitica the best it can be. Your support means a lot to us!</string>
|
||||
<string name="my_guilds">My Guilds</string>
|
||||
<string name="public_guilds">Public Guilds</string>
|
||||
</resources>
|
||||
|
|
@ -13,6 +13,7 @@ import com.habitrpg.android.habitica.ui.fragments.inventory.customization.Avatar
|
|||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.faq.FAQOverviewFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.GemsPurchaseFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.social.GuildsOverviewFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.social.party.PartyFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.SkillsFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.tasks.TasksFragment;
|
||||
|
|
@ -35,13 +36,14 @@ public class MainDrawerBuilder {
|
|||
public static final int SIDEBAR_SKILLS = 1;
|
||||
public static final int SIDEBAR_TAVERN = 3;
|
||||
public static final int SIDEBAR_PARTY = 4;
|
||||
public static final int SIDEBAR_AVATAR = 5;
|
||||
public static final int SIDEBAR_EQUIPMENT = 6;
|
||||
public static final int SIDEBAR_STABLE = 7;
|
||||
public static final int SIDEBAR_PURCHASE = 8;
|
||||
public static final int SIDEBAR_SETTINGS = 9;
|
||||
public static final int SIDEBAR_HELP = 10;
|
||||
public static final int SIDEBAR_ABOUT = 11;
|
||||
public static final int SIDEBAR_GUILDS = 5;
|
||||
public static final int SIDEBAR_AVATAR = 6;
|
||||
public static final int SIDEBAR_EQUIPMENT = 7;
|
||||
public static final int SIDEBAR_STABLE = 8;
|
||||
public static final int SIDEBAR_PURCHASE = 9;
|
||||
public static final int SIDEBAR_SETTINGS = 10;
|
||||
public static final int SIDEBAR_HELP = 11;
|
||||
public static final int SIDEBAR_ABOUT = 12;
|
||||
|
||||
|
||||
|
||||
|
|
@ -79,8 +81,8 @@ public class MainDrawerBuilder {
|
|||
new SectionDrawerItem().withName(activity.getString(R.string.sidebar_section_social)),
|
||||
new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_tavern)).withIdentifier(SIDEBAR_TAVERN),
|
||||
new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_party)).withIdentifier(SIDEBAR_PARTY),
|
||||
/*new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_guilds)),
|
||||
new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_challenges)),*/
|
||||
new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_guilds)).withIdentifier(SIDEBAR_GUILDS),
|
||||
//new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_challenges)),
|
||||
|
||||
new SectionDrawerItem().withName(activity.getString(R.string.sidebar_section_inventory)),
|
||||
new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_avatar)).withIdentifier(SIDEBAR_AVATAR),
|
||||
|
|
@ -115,6 +117,10 @@ public class MainDrawerBuilder {
|
|||
fragment = new PartyFragment();
|
||||
break;
|
||||
}
|
||||
case SIDEBAR_GUILDS: {
|
||||
fragment = new GuildsOverviewFragment();
|
||||
break;
|
||||
}
|
||||
case SIDEBAR_TAVERN: {
|
||||
fragment = new TavernFragment();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class FAQOverviewRecyclerAdapter extends RecyclerView.Adapter<FAQOvervie
|
|||
@Override
|
||||
public FAQArticleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.faq_overview_item, parent, false);
|
||||
.inflate(R.layout.plain_list_item, parent, false);
|
||||
|
||||
return new FAQArticleViewHolder(view);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments.social;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.Customization;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.Group;
|
||||
import com.raizlabs.android.dbflow.sql.builder.Condition;
|
||||
import com.raizlabs.android.dbflow.sql.language.OrderBy;
|
||||
import com.raizlabs.android.dbflow.sql.language.Select;
|
||||
import com.raizlabs.android.dbflow.sql.language.Where;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.Bind;
|
||||
import butterknife.ButterKnife;
|
||||
import retrofit.Callback;
|
||||
import retrofit.RetrofitError;
|
||||
import retrofit.client.Response;
|
||||
|
||||
public class GuildsOverviewFragment extends BaseMainFragment implements Callback<ArrayList<Group>> {
|
||||
|
||||
@Bind(R.id.my_guilds_listview)
|
||||
LinearLayout guildsListView;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View v = inflater.inflate(R.layout.fragment_guilds_overview, container, false);
|
||||
ButterKnife.bind(this, v);
|
||||
this.fetchGuilds();
|
||||
return v;
|
||||
}
|
||||
|
||||
private void fetchGuilds() {
|
||||
this.mAPIHelper.apiService.listGroups("guilds", this);
|
||||
}
|
||||
|
||||
private void loadGuilds() {
|
||||
if(user == null){
|
||||
return;
|
||||
}
|
||||
|
||||
Where<Group> select = new Select()
|
||||
.from(Group.class)
|
||||
.where(Condition.column("type").eq("guild"));
|
||||
|
||||
List<Group> guilds = select.queryList();
|
||||
}
|
||||
|
||||
private void setGuildsOnListView(List<Group> guilds) {
|
||||
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
for (Group guild : guilds) {
|
||||
LinearLayout entry = (LinearLayout) inflater.inflate(R.layout.plain_list_item, null);
|
||||
TextView textView = (TextView) entry.findViewById(R.id.textView);
|
||||
textView.setText(guild.name);
|
||||
this.guildsListView.addView(entry);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void success(ArrayList<Group> groups, Response response) {
|
||||
this.setGuildsOnListView(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(RetrofitError error) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -25,6 +25,8 @@ public class Group extends BaseModel {
|
|||
|
||||
public int memberCount;
|
||||
|
||||
public Boolean isMember;
|
||||
|
||||
public String type;
|
||||
|
||||
public String logo;
|
||||
|
|
|
|||
12
store_strings.xml
Normal file
12
store_strings.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="store_short_description">Treat your life like a game to stay motivated and organized!</string>
|
||||
<string name="store_description">The NEW app from HabitRPG! Rewritten from the ground up for a smoother experience and more features.
|
||||
|
||||
Treat your life like a game to stay motivated and organized! Habitica makes it simple to have fun while accomplishing goals.
|
||||
|
||||
Input your Habits, your Daily goals, and your To-Do list, and then create a custom avatar. Check off tasks to level up your avatar and unlock features such as armor, pets, skills, and even quests! Fight monsters with friends to keep each other accountable, and use your gold on in-game rewards, like equipment, or custom awards, like watching an episode of your favorite TV show. Flexible, social, and fun, Habitica is the perfect way to motivate yourself to accomplish anything.
|
||||
|
||||
We are currently in beta, so please, feel free to send feedback to mobile@habitica.com! And if you enjoy our app, we would really appreciate it if you would leave us a review.</string>
|
||||
</resources>
|
||||
|
||||
Loading…
Reference in a new issue