Commit 18621d5c authored by Kevin Whitaker's avatar Kevin Whitaker

campaign types now use localized strings.

parent 2322ddc2
......@@ -63,7 +63,7 @@ public class CampaignActivity extends RecyclerViewActivity {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if(((EditText) dialogView.findViewById(R.id.campaign_name)).getText().length()>0) {
((CampaignAdapter) getAdapter()).addItem(((EditText) dialogView.findViewById(R.id.campaign_name)).getText().toString(), CampaignType.valueOfDisplayName(typeSpinner.getSelectedItem().toString()));
((CampaignAdapter) getAdapter()).addItem(((EditText) dialogView.findViewById(R.id.campaign_name)).getText().toString(), CampaignType.valueOf(((CampaignType)typeSpinner.getSelectedItem()).name()));
} else {
Toast.makeText(CampaignActivity.this,"Can not have blank name!",Toast.LENGTH_LONG).show();
}
......
......@@ -39,7 +39,7 @@ public class CampaignAdapter extends RecyclerView.Adapter<CampaignViewHolder> {
MiceAndMysticsApplication.getRealmInstance().beginTransaction();
com.eyecreate.miceandmystics.miceandmystics.model.Campaign campaign = new com.eyecreate.miceandmystics.miceandmystics.model.Campaign();
campaign.setCampaignName(campaignName);
campaign.setCampaignType(type.displayName());
campaign.setCampaignType(type.name());
MiceAndMysticsApplication.getRealmInstance().copyToRealm(campaign);
MiceAndMysticsApplication.getRealmInstance().commitTransaction();
fullRefresh();
......
package com.eyecreate.miceandmystics.miceandmystics.model.Enums;
import com.eyecreate.miceandmystics.miceandmystics.MiceAndMysticsApplication;
import com.eyecreate.miceandmystics.miceandmystics.R;
public enum CampaignType {
Sorrow_and_Remembrance("Sorrow and Remembrance");
Sorrow_and_Remembrance(R.string.campaign_name_s_a_r);
private String displayName;
private int displayName;
CampaignType(String name) {
CampaignType(int name) {
this.displayName = name;
}
public String displayName() { return displayName; }
public String displayName() { return MiceAndMysticsApplication.getInstance().getString(displayName); }
@Override public String toString() { return displayName; }
public static CampaignType valueOfDisplayName(String valuedDisplayName) {return CampaignType.valueOf(valuedDisplayName.replace(" ","_"));}
@Override public String toString() { return displayName(); }
}
......@@ -5,6 +5,7 @@ import android.view.View;
import android.widget.TextView;
import com.eyecreate.miceandmystics.miceandmystics.R;
import com.eyecreate.miceandmystics.miceandmystics.model.Campaign;
import com.eyecreate.miceandmystics.miceandmystics.model.Enums.CampaignType;
public class CampaignHeaderViewHolder extends RecyclerView.ViewHolder {
......@@ -18,6 +19,6 @@ public class CampaignHeaderViewHolder extends RecyclerView.ViewHolder {
public void bindModel(Campaign campaign) {
campaignName.setText(campaign.getCampaignName());
campaignType.setText(campaign.getCampaignType());
campaignType.setText(CampaignType.valueOf(campaign.getCampaignType()).displayName());
}
}
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