package com.papier.jurani;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

/**
 * Created by Angellica on 3/23/2016.
 */
public class RandomDareActivity extends AppCompatActivity {

    private int i = 0;
    private String [] player;
    private String [] dare = {"Impersonate...", "Tembak...", "Putusin..."};
    private String chosenPlayer;
    private String chosenDare;
    private TextView randDare;
    private Button stop;
    private Thread runThread;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_random_dare);
        Toolbar toolbar = (Toolbar) findViewById(R.id.random_dare_toolbar);
        setSupportActionBar(toolbar);

        player = getIntent().getStringArrayExtra("player");

        chosenPlayer = getIntent().getExtras().getString("chosen");

        randDare = (TextView) findViewById(R.id.random_dare);
        Runnable runName = new Runnable() {
            @Override
            public void run() {
                while (i < dare.length) {
                    try {
                        Thread.sleep(150);
                        randDare.post(new Runnable() {
                            @Override
                            public void run() {
                                randDare.setText(dare[i]);
                                if (i == dare.length-1) {
                                    i = 0;
                                } else {
                                    i += 1;
                                }
                            }
                        });
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }

                }
            }
        };

        runThread = new Thread(runName);
        runThread.start();

        stop = (Button) findViewById(R.id.stop_button_random_dare);
        stop.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runThread.interrupt();
                chosenDare = randDare.getText().toString();
                Intent goChoose = new Intent(getApplicationContext(), RandomTargetActivity.class);
                goChoose.putExtra("player", player);
                goChoose.putExtra("chosen", chosenPlayer);
                goChoose.putExtra("task", chosenDare);
                startActivity(goChoose);
                finish();
            }
        });


    }
}

@@ -169,16 +169,72 @@
 oolbar;%0A
+import android.view.Menu;%0Aimport android.view.MenuItem;%0A
 import a
@@ -2752,17 +2752,1140 @@
     %7D);%0A
-%0A
+    %7D%0A%0A    @Override%0A    public boolean onCreateOptionsMenu(Menu menu) %7B%0A        // Inflate the menu; this adds items to the action bar if it is present.%0A        getMenuInflater().inflate(R.menu.menu_main, menu);%0A        return true;%0A    %7D%0A%0A    @Override%0A    public boolean onOptionsItemSelected(MenuItem item) %7B%0A        // Handle action bar item clicks here. The action bar will%0A        // automatically handle clicks on the Home/Up button, so long%0A        // as you specify a parent activity in AndroidManifest.xml.%0A        int id = item.getItemId();%0A%0A        //noinspection SimplifiableIfStatement%0A        if (id == R.id.action_help) %7B%0A            Intent goToHelp = new Intent (getApplicationContext(), HelpActivity.class);%0A            startActivity(goToHelp);%0A            return true;%0A        %7D else if (id == R.id.action_developer) %7B%0A            Intent goToDev = new Intent (getApplicationContext(), PengembangActivity.class);%0A            startActivity(goToDev);%0A            return true;%0A        %7D else if (id == R.id.action_reset) %7B%0A            return true;%0A        %7D%0A%0A        return super.onOptionsItemSelected(item);
 %0A    %7D%0A%7D

Add some features.