Commit f134e20b authored by Kevin Whitaker's avatar Kevin Whitaker

CharacterNames now also contains the graphic icon for the character....

CharacterNames now also contains the graphic icon for the character. Implemented character icons and chat depicting game players. Lots of cleanup on UI for spacing. Clearer page names.
parent f2cc55ca
......@@ -22,7 +22,7 @@ public class CampaignActivity extends RecyclerViewActivity {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.mipmap.ic_launcher);
getSupportActionBar().setDisplayShowTitleEnabled(false);
setTitle("Campaigns");
setLayoutManager(new LinearLayoutManager(this));
setAdapter(new CampaignAdapter());
}
......
......@@ -24,7 +24,7 @@ public class CampaignDetailsActivity extends RecyclerViewActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(getIntent().getStringExtra("campaignName"));
setTitle("Game Details");
campaign = MiceAndMysticsApplication.getRealmInstance().where(Campaign.class).equalTo("campaignName",getIntent().getStringExtra("campaignName")).findFirst();
setLayoutManager(new LinearLayoutManager(this));
setAdapter(new CampaignDetailsAdapter(campaign));
......
package com.eyecreate.miceandmystics.miceandmystics.model.Enums;
import com.eyecreate.miceandmystics.miceandmystics.R;
public enum CharacterNames {
Collin(new CharacterType[]{CharacterType.Warrior,CharacterType.Leader}),
Filch(new CharacterType[]{CharacterType.Scamp}),
Lily(new CharacterType[]{CharacterType.Archer}),
Maginos(new CharacterType[]{CharacterType.Mystic,CharacterType.Maginos}),
Nez(new CharacterType[]{CharacterType.Tinkerer,CharacterType.Warrior}),
Tilda(new CharacterType[]{CharacterType.Healer});
Collin(new CharacterType[]{CharacterType.Warrior,CharacterType.Leader}, R.mipmap.collin),
Filch(new CharacterType[]{CharacterType.Scamp},R.mipmap.filch),
Lily(new CharacterType[]{CharacterType.Archer},R.mipmap.lily),
Maginos(new CharacterType[]{CharacterType.Mystic,CharacterType.Maginos},R.mipmap.maginos),
Nez(new CharacterType[]{CharacterType.Tinkerer,CharacterType.Warrior},R.mipmap.nez),
Tilda(new CharacterType[]{CharacterType.Healer},R.mipmap.tilda);
private CharacterType[] types;
private int drawableIcon;
CharacterNames(CharacterType[] types) {
CharacterNames(CharacterType[] types,int drawableIcon) {
this.types = types;
this.drawableIcon = drawableIcon;
}
public CharacterType[] characterTypes() { return types; }
public int getDrawableRes() {return drawableIcon;}
}
......@@ -9,6 +9,7 @@ import android.widget.TextView;
import com.eyecreate.miceandmystics.miceandmystics.R;
import com.eyecreate.miceandmystics.miceandmystics.adapters.CampaignDetailsAdapter;
import com.eyecreate.miceandmystics.miceandmystics.model.Character;
import com.eyecreate.miceandmystics.miceandmystics.model.Enums.CharacterNames;
public class CampaignDetailsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,View.OnLongClickListener {
......@@ -31,7 +32,7 @@ public class CampaignDetailsViewHolder extends RecyclerView.ViewHolder implement
boundCharacter = character;
characterName.setText(character.getCharacterName());
playerName.setText(character.getControllingPlayer().getPlayerName());
//TODO:implement character icons one in project.
characterIcon.setImageResource(CharacterNames.valueOf(character.getCharacterName()).getDrawableRes());
}
@Override
......
......@@ -10,9 +10,11 @@ import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;
import com.echo.holographlibrary.PieGraph;
import com.echo.holographlibrary.PieSlice;
import com.eyecreate.miceandmystics.miceandmystics.CampaignDetailsActivity;
import com.eyecreate.miceandmystics.miceandmystics.R;
import com.eyecreate.miceandmystics.miceandmystics.adapters.CampaignAdapter;
import com.eyecreate.miceandmystics.miceandmystics.model.Enums.CharacterNames;
public class CampaignViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,View.OnLongClickListener {
......@@ -52,6 +54,36 @@ public class CampaignViewHolder extends RecyclerView.ViewHolder implements View.
public void bindModel(com.eyecreate.miceandmystics.miceandmystics.model.Campaign campaign) {
campaignName.setText(campaign.getCampaignName());
characterGraph.setInnerCircleRatio(200);
characterGraph.removeSlices();
for(com.eyecreate.miceandmystics.miceandmystics.model.Character character:campaign.getCurrentCharacters()){
PieSlice slice = new PieSlice();
if(CharacterNames.valueOf(character.getCharacterName()).equals(CharacterNames.Collin)){
slice.setColor(campaignName.getContext().getResources().getColor(R.color.collin));
slice.setValue(1);
} else if (CharacterNames.valueOf(character.getCharacterName()).equals(CharacterNames.Filch)) {
slice.setColor(campaignName.getContext().getResources().getColor(R.color.filch));
slice.setValue(1);
} else if (CharacterNames.valueOf(character.getCharacterName()).equals(CharacterNames.Lily)) {
slice.setColor(campaignName.getContext().getResources().getColor(R.color.lily));
slice.setValue(1);
} else if (CharacterNames.valueOf(character.getCharacterName()).equals(CharacterNames.Maginos)) {
slice.setColor(campaignName.getContext().getResources().getColor(R.color.maginos));
slice.setValue(1);
} else if (CharacterNames.valueOf(character.getCharacterName()).equals(CharacterNames.Nez)) {
slice.setColor(campaignName.getContext().getResources().getColor(R.color.nez));
slice.setValue(1);
} else if (CharacterNames.valueOf(character.getCharacterName()).equals(CharacterNames.Tilda)) {
slice.setColor(campaignName.getContext().getResources().getColor(R.color.tilda));
slice.setValue(1);
}
characterGraph.addSlice(slice);
}
if(characterGraph.getSlices().size()>1) {
characterGraph.setPadding(10);
} else {
characterGraph.setPadding(1);//seems it won't draw 1 without some sort of padding.
}
}
@Override
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="7dp"
android:padding="12dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="7dp"
android:padding="12dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="7dp"
android:padding="12dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
......
......@@ -16,10 +16,12 @@
<com.echo.holographlibrary.PieGraph
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="5dp"
android:id="@+id/campaign_characters_graph"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="@android:color/black"
android:layout_gravity="center_vertical"
android:id="@+id/campagin_name"/>
......
......@@ -16,11 +16,13 @@
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="5dp"
android:id="@+id/character_icon"/>
<LinearLayout
android:orientation="vertical"
android:gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
......
......@@ -5,4 +5,5 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:padding="10dp"
android:textAlignment="inherit"/>
\ No newline at end of file
......@@ -4,4 +4,12 @@
<color name="dark_red">#630808</color>
<color name="wood_brown">#663300</color>
<color name="parchment_yellow">#FBEDBE</color>
<!-- Character colors -->
<color name="collin">#C00000</color>
<color name="lily">#008000</color>
<color name="nez">#FF8000</color>
<color name="filch">#585858</color>
<color name="tilda">#500280</color>
<color name="maginos">#C0AA00</color>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment