// Path: Susurrus/app/src/main/java/rocks/susurrus/susurrus/utils/RandomName.java
// public class RandomName {
// 
//     private final String logIndicator = "utils/RandomName";
// 
//     /**
//      * Lists
//      */
//     private List<String> nouns = new ArrayList<String>();
//     private List<String> adjectives = new ArrayList<String>();
//     private int nounsCount;
//     private int adjectivesCount;
// 
//     /**
//      * Class constructor.
//      * Initiates word-lists
//      * @param context Activity-context from which the object is created.
//      */
//     public RandomName(Context context) {
//         Log.d(logIndicator, "RandomName()");
// 
//         AssetManager aManager = context.getAssets();
// 
//         // load available dictionaries
//         try {
//             loadDict("adjectives.txt", this.adjectives, aManager);
//             loadDict("nouns.txt", this.nouns, aManager);
//         } catch(IOException e) {
//             e.printStackTrace();
//             throw new Error(e);
//         }
// 
//         // get size of word-lists
//         this.nounsCount = this.nouns.size();
//         this.adjectivesCount = this.adjectives.size();
//     }
// 
//     /**
//      * Picks random words form the dictionaries and builds a unique
//      * name.
//      * @return Generated username
//      */
//     public String generate() {
//         Random rand = new Random();
//         // pick random words
//         String randNoun = this.nouns.get(rand.nextInt(this.nounsCount + 1));
//         String randAdjective = this.adjectives.get(rand.nextInt(this.adjectivesCount + 1));
// 
//         // random adjective + noun-uppercase first letter + noun + random number
//         String randName = randAdjective + randNoun.substring(0,1).toUpperCase() +
//                 randNoun.substring(1) + rand.nextInt(100 + 1);
// 
//         return randName;
//     }
// 
//     /**
//      * Parse a dictionary-file and adds every line to the handed List.
//      * @param dictName Name of the dictionary in the assets-folder
//      * @param list ArrayList for insertion
//      * @param aManager Reference to the android-assetManager
//      */
//     private void loadDict(String dictName, List<String> list, AssetManager aManager) throws IOException {
//         BufferedReader reader =
//                 new BufferedReader(new InputStreamReader(aManager.open("dict/" + dictName)));
//         try {
//             String line;
//             while((line = reader.readLine()) != null) {
//                 list.add(line);
//             }
//         } finally {
//             reader.close();
//         }
//     }
// }


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import rocks.susurrus.susurrus.R;
import rocks.susurrus.susurrus.utils.RandomName;
package rocks.susurrus.susurrus.fragments;





/**
 * A simple {@link Fragment} subclass.
 */
public class IntroPageThreeFragment extends Fragment {

    /**
     * Views
     */
    EditText inputName;
    ImageButton buttonRandomName;


    public IntroPageThreeFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_intro_page_three, container, false);

        setView(view);
        insertRandomName();

        return view;
    }

    /**
     * Set all view elements.
     * @param _view Fragment view.
     */
    private void setView(View _view) {
        // get views
        this.inputName = (EditText) _view.findViewById(R.id.username_input_name);
        this.buttonRandomName = (ImageButton) _view.findViewById(R.id.username_refresh_button);

        // set listeners
        this.buttonRandomName.setOnClickListener(this.randomListener);
    }

    /**
     * Helper method for inserting a random name into username input-field.
     */
    private void insertRandomName() {
        // get a random name & set it
// Path: Susurrus/app/src/main/java/rocks/susurrus/susurrus/utils/RandomName.java
// public class RandomName {
// 
//     private final String logIndicator = "utils/RandomName";
// 
//     /**
//      * Lists
//      */
//     private List<String> nouns = new ArrayList<String>();
//     private List<String> adjectives = new ArrayList<String>();
//     private int nounsCount;
//     private int adjectivesCount;
// 
//     /**
//      * Class constructor.
//      * Initiates word-lists
//      * @param context Activity-context from which the object is created.
//      */
//     public RandomName(Context context) {
//         Log.d(logIndicator, "RandomName()");
// 
//         AssetManager aManager = context.getAssets();
// 
//         // load available dictionaries
//         try {
//             loadDict("adjectives.txt", this.adjectives, aManager);
//             loadDict("nouns.txt", this.nouns, aManager);
//         } catch(IOException e) {
//             e.printStackTrace();
//             throw new Error(e);
//         }
// 
//         // get size of word-lists
//         this.nounsCount = this.nouns.size();
//         this.adjectivesCount = this.adjectives.size();
//     }
// 
//     /**
//      * Picks random words form the dictionaries and builds a unique
//      * name.
//      * @return Generated username
//      */
//     public String generate() {
//         Random rand = new Random();
//         // pick random words
//         String randNoun = this.nouns.get(rand.nextInt(this.nounsCount + 1));
//         String randAdjective = this.adjectives.get(rand.nextInt(this.adjectivesCount + 1));
// 
//         // random adjective + noun-uppercase first letter + noun + random number
//         String randName = randAdjective + randNoun.substring(0,1).toUpperCase() +
//                 randNoun.substring(1) + rand.nextInt(100 + 1);
// 
//         return randName;
//     }
// 
//     /**
//      * Parse a dictionary-file and adds every line to the handed List.
//      * @param dictName Name of the dictionary in the assets-folder
//      * @param list ArrayList for insertion
//      * @param aManager Reference to the android-assetManager
//      */
//     private void loadDict(String dictName, List<String> list, AssetManager aManager) throws IOException {
//         BufferedReader reader =
//                 new BufferedReader(new InputStreamReader(aManager.open("dict/" + dictName)));
//         try {
//             String line;
//             while((line = reader.readLine()) != null) {
//                 list.add(line);
//             }
//         } finally {
//             reader.close();
//         }
//     }
// }


// Path: Susurrus/app/src/main/java/rocks/susurrus/susurrus/fragments/IntroPageThreeFragment.java
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import rocks.susurrus.susurrus.R;
import rocks.susurrus.susurrus.utils.RandomName;

package rocks.susurrus.susurrus.fragments;





/**
 * A simple {@link Fragment} subclass.
 */
public class IntroPageThreeFragment extends Fragment {

    /**
     * Views
     */
    EditText inputName;
    ImageButton buttonRandomName;


    public IntroPageThreeFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_intro_page_three, container, false);

        setView(view);
        insertRandomName();

        return view;
    }

    /**
     * Set all view elements.
     * @param _view Fragment view.
     */
    private void setView(View _view) {
        // get views
        this.inputName = (EditText) _view.findViewById(R.id.username_input_name);
        this.buttonRandomName = (ImageButton) _view.findViewById(R.id.username_refresh_button);

        // set listeners
        this.buttonRandomName.setOnClickListener(this.randomListener);
    }

    /**
     * Helper method for inserting a random name into username input-field.
     */
    private void insertRandomName() {
        // get a random name & set it
        RandomName randName = new RandomName(getActivity());