package com.averi.worldscribe.activities;

import android.content.res.Resources;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.widget.EditText;
import android.widget.ImageView;

import com.averi.worldscribe.utilities.ExternalReader;
import com.averi.worldscribe.views.BottomBar;
import com.averi.worldscribe.R;

public class PersonActivity extends ArticleActivity {

    private EditText aliasesField;
    private EditText ageField;
    private EditText biographyField;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        aliasesField = (EditText) findViewById(R.id.editAliases);
        ageField = (EditText) findViewById(R.id.editAge);
        biographyField = (EditText) findViewById(R.id.editBio);
    }

    @Override
    protected void onResume() {
        super.onResume();
        loadTextFieldsData();
    }

    @Override
    protected int getLayoutResourceID() {
        return R.layout.activity_person;
    }

    @Override
    protected ImageView getImageView() { return (ImageView) findViewById(R.id.imagePerson); }

    @Override
    protected BottomBar getBottomBar() {
        return (BottomBar) findViewById(R.id.bottomBar);
    }

    @Override
    protected RecyclerView getConnectionsRecycler() {
        return (RecyclerView) findViewById(R.id.recyclerConnections);
    }

    /**
     * Retrieve this Person's aliases, age, biography data and display them in the corresponding
     * text fields.
     */
    private void loadTextFieldsData() {
        Resources resources = getResources();

        aliasesField.setText(ExternalReader.getArticleTextFieldData(this, super.getWorldName(),
                super.getCategory(), super.getArticleName(),
                resources.getString(R.string.aliasesField)));
        ageField.setText(ExternalReader.getArticleTextFieldData(this, super.getWorldName(),
                super.getCategory(), super.getArticleName(),
                resources.getString(R.string.ageField)));
        biographyField.setText(ExternalReader.getArticleTextFieldData(this, super.getWorldName(),
                super.getCategory(), super.getArticleName(),
                resources.getString(R.string.biographyField)));
    }

}

@@ -211,16 +211,50 @@
 ageView;
+%0Aimport android.widget.RadioGroup;
 %0A%0Aimport
@@ -538,16 +538,52 @@
 hyField;
+%0A    private RadioGroup genderGroup;
 %0A%0A    @O
@@ -880,16 +880,88 @@
 itBio);%0A
+        genderGroup = (RadioGroup) findViewById(R.id.radioGroupGender);%0A
     %7D%0A%0A 
@@ -1057,24 +1057,46 @@
 eldsData();%0A
+        loadGender();%0A
     %7D%0A%0A    @
@@ -2368,32 +2368,32 @@
 tArticleName(),%0A
-
                 
@@ -2447,10 +2447,732 @@
 %0A    %7D%0A%0A
+    /**%0A     * Load this Person's gender and display it.%0A     */%0A    private void loadGender() %7B%0A        Resources resources = getResources();%0A        String genderString = ExternalReader.getArticleTextFieldData(this, super.getWorldName(),%0A                super.getCategory(), super.getArticleName(),%0A                resources.getString(R.string.genderText));%0A%0A        if (genderString.equals(resources.getString(R.string.maleText))) %7B%0A            genderGroup.check(R.id.radioButtonMale);%0A        %7D else if (genderString.equals(resources.getString(R.string.femaleText))) %7B%0A            genderGroup.check(R.id.radioButtonFemale);%0A        %7D else %7B%0A            genderGroup.check(R.id.radioButtonOtherGender);%0A        %7D%0A    %7D%0A%0A
 %7D%0A

Add loading of gender in PersonActivity