add appBar and menu
This commit is contained in:
parent
a02c1aa23c
commit
92303438ed
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -37,7 +37,7 @@
|
|||||||
<ConfirmationsSetting value="0" id="Add" />
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -40,5 +40,6 @@ dependencies {
|
|||||||
})
|
})
|
||||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||||
compile 'com.android.support.constraint:constraint-layout:1.0.2'
|
compile 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||||
|
compile 'com.android.support:design:25.3.1'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
}
|
}
|
||||||
|
@ -8,14 +8,19 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name=".MainActivity">
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:label="@string/title"
|
||||||
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".ChoiceActivity" />
|
<activity
|
||||||
|
android:name=".ChoiceActivity"
|
||||||
|
android:theme="@style/AppTheme.NoActionBar" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -5,7 +5,11 @@ import android.content.Intent;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
@ -24,11 +28,13 @@ public class ChoiceActivity extends AppCompatActivity {
|
|||||||
private ArrayList<String> ScriptQuestion;
|
private ArrayList<String> ScriptQuestion;
|
||||||
private RadioGroup group;
|
private RadioGroup group;
|
||||||
private SharedPreferences sharedPref;
|
private SharedPreferences sharedPref;
|
||||||
private Boolean clear = false;
|
private Boolean clear;
|
||||||
|
private Boolean fail;
|
||||||
private Integer current;
|
private Integer current;
|
||||||
|
|
||||||
public ChoiceActivity() {
|
public ChoiceActivity() {
|
||||||
script = new ArrayList<>();
|
script = new ArrayList<>();
|
||||||
|
fail = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -36,29 +42,33 @@ public class ChoiceActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_choice);
|
setContentView(R.layout.activity_choice);
|
||||||
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
group = (RadioGroup) findViewById(R.id.radioGroup1);
|
group = (RadioGroup) findViewById(R.id.radioGroup1);
|
||||||
ScriptQuestion = intent.getStringArrayListExtra("Questions");
|
ScriptQuestion = intent.getStringArrayListExtra("Questions");
|
||||||
current = intent.getIntExtra("Next", 0);
|
current = intent.getIntExtra("Next", 0);
|
||||||
clear = intent.getBooleanExtra("Clear", false);
|
clear = intent.getBooleanExtra("Clear", false);
|
||||||
|
|
||||||
Integer i = 0;
|
Integer i = 0;
|
||||||
Integer size = intent.getIntExtra("Size", 0);
|
Integer size = intent.getIntExtra("Size", 0);
|
||||||
((TextView) findViewById(R.id.textView)).setText(ScriptQuestion.get(current));
|
((TextView) findViewById(R.id.question)).setText(ScriptQuestion.get(current));
|
||||||
while (i < size) {
|
while (i < size) {
|
||||||
HashMap<String, List> tmp1 = new HashMap<>();
|
HashMap<String, List> tmp1 = new HashMap<>();
|
||||||
tmp1.putAll((HashMap<String,List>) intent.getSerializableExtra("Opts" + i.toString()));
|
tmp1.putAll((HashMap<String, List>) intent.getSerializableExtra("Opts" + i.toString()));
|
||||||
script.add(tmp1);
|
script.add(tmp1);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
Log.d("D", size.toString());
|
Log.d("D", "script size: " + size.toString());
|
||||||
Log.d("D", script.toString());
|
Log.d("D", "script: " + script.toString());
|
||||||
Log.d("D", current.toString());
|
Log.d("D", "current: " + current.toString());
|
||||||
Log.d("D", ScriptQuestion.toString());
|
Log.d("D", "questions: " + ScriptQuestion.toString());
|
||||||
Iterator iter1 = script.get(current).get("Text").iterator();
|
Iterator iter1 = script.get(current).get("Text").iterator();
|
||||||
RadioButton button;
|
RadioButton button;
|
||||||
while (iter1.hasNext()) {
|
while (iter1.hasNext()) {
|
||||||
button = new RadioButton(this);
|
button = new RadioButton(this);
|
||||||
|
Log.d("D", "Radiobutton");
|
||||||
button.setText((String) iter1.next());
|
button.setText((String) iter1.next());
|
||||||
group.addView(button);
|
group.addView(button);
|
||||||
}
|
}
|
||||||
@ -74,22 +84,57 @@ public class ChoiceActivity extends AppCompatActivity {
|
|||||||
Total = 0;
|
Total = 0;
|
||||||
SharedPreferences.Editor editor = sharedPref.edit();
|
SharedPreferences.Editor editor = sharedPref.edit();
|
||||||
editor.putInt(getString(R.string.Total), 0);
|
editor.putInt(getString(R.string.Total), 0);
|
||||||
|
if (clear) {
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
editor.commit();
|
editor.commit();
|
||||||
} else {
|
} else {
|
||||||
Total = sharedPref.getInt(getString(R.string.Total), 0);
|
Total = sharedPref.getInt(getString(R.string.Total), 0);
|
||||||
}
|
}
|
||||||
((TextView) findViewById(R.id.textView_choice_total)).setText(Total.toString());
|
((TextView) findViewById(R.id.choice_textView_total)).setText(Total.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
MenuInflater inflater = getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.main, menu);
|
||||||
|
inflater.inflate(R.menu.choice, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle item selection
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.clearMenu:
|
||||||
|
Clear();
|
||||||
|
return true;
|
||||||
|
case R.id.FailMenu:
|
||||||
|
fail = true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClickDone(View v) {
|
public void ClickDone(View v) {
|
||||||
Integer totalDone = sharedPref.getInt(getString(R.string.Total), 0) + 1;
|
Integer totalDone;
|
||||||
|
|
||||||
|
totalDone = sharedPref.getInt(getString(R.string.Total), 0);
|
||||||
|
Log.d("D", fail.toString());
|
||||||
|
if (!fail) {
|
||||||
|
totalDone = sharedPref.getInt(getString(R.string.Total), 0) + 1;
|
||||||
SharedPreferences.Editor editor = sharedPref.edit();
|
SharedPreferences.Editor editor = sharedPref.edit();
|
||||||
editor.putInt(getString(R.string.Total), totalDone);
|
editor.putInt(getString(R.string.Total), totalDone);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
|
intent.putExtra("Clear", clear);
|
||||||
intent.putExtra(getString(R.string.Total), totalDone);
|
intent.putExtra(getString(R.string.Total), totalDone);
|
||||||
editor.apply();
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
clear = false;
|
||||||
|
fail = false;
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
@ -101,7 +146,10 @@ public class ChoiceActivity extends AppCompatActivity {
|
|||||||
Intent intent = new Intent(this, ChoiceActivity.class);
|
Intent intent = new Intent(this, ChoiceActivity.class);
|
||||||
intent.putStringArrayListExtra("Questions", ScriptQuestion);
|
intent.putStringArrayListExtra("Questions", ScriptQuestion);
|
||||||
intent.putExtra("Size", script.size());
|
intent.putExtra("Size", script.size());
|
||||||
Log.d("D", "Sel button: " + ( (Integer) group.indexOfChild(findViewById(group.getCheckedRadioButtonId())) ).toString() );
|
intent.putExtra("Clear", clear);
|
||||||
|
clear = false;
|
||||||
|
fail = false;
|
||||||
|
Log.d("D", "Sel button: " + ((Integer) group.indexOfChild(findViewById(group.getCheckedRadioButtonId()))).toString());
|
||||||
|
|
||||||
intent.putExtra("Next", (Integer) script.get(current).get("Destination").get(group.indexOfChild(findViewById(group.getCheckedRadioButtonId()))));
|
intent.putExtra("Next", (Integer) script.get(current).get("Destination").get(group.indexOfChild(findViewById(group.getCheckedRadioButtonId()))));
|
||||||
|
|
||||||
@ -115,4 +163,13 @@ public class ChoiceActivity extends AppCompatActivity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Clear() {
|
||||||
|
clear = true;
|
||||||
|
((TextView) findViewById(R.id.choice_textView_total)).setText("0");
|
||||||
|
|
||||||
|
SharedPreferences.Editor editor = sharedPref.edit();
|
||||||
|
editor.putInt(getString(R.string.Total), 0);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,11 @@ import android.content.Intent;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -41,6 +45,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String str = convertStreamToString(getResources().openRawResource(R.raw.script));
|
String str = convertStreamToString(getResources().openRawResource(R.raw.script));
|
||||||
@ -66,10 +72,33 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
editor.putInt(getString(R.string.Total), count);
|
editor.putInt(getString(R.string.Total), count);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
if (intent.getBooleanExtra("Clear", false)) {
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
clear = false;
|
||||||
|
|
||||||
|
|
||||||
Integer Total = sharedPref.getInt(getString(R.string.Total), 0);
|
Integer Total = sharedPref.getInt(getString(R.string.Total), 0);
|
||||||
((TextView) findViewById(R.id.textView_Total)).setText(Total.toString());
|
((TextView) findViewById(R.id.main_textView_Total)).setText(Total.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
MenuInflater inflater = getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.main, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle item selection
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.clearMenu:
|
||||||
|
Clear();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readJson(JSONArray ScriptObject) throws JSONException {
|
public void readJson(JSONArray ScriptObject) throws JSONException {
|
||||||
@ -125,8 +154,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ClickClear(View v) {
|
public void ClickClear(View v) {
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear() {
|
||||||
clear = true;
|
clear = true;
|
||||||
((TextView) findViewById(R.id.textView_Total)).setText("0");
|
((TextView) findViewById(R.id.main_textView_Total)).setText("0");
|
||||||
SharedPreferences sharedPref = MainActivity.this.getPreferences(Context.MODE_PRIVATE);
|
SharedPreferences sharedPref = MainActivity.this.getPreferences(Context.MODE_PRIVATE);
|
||||||
|
|
||||||
SharedPreferences.Editor editor = sharedPref.edit();
|
SharedPreferences.Editor editor = sharedPref.edit();
|
||||||
@ -141,13 +174,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
intent.putExtra("Next", 0);
|
intent.putExtra("Next", 0);
|
||||||
intent.putExtra("Clear", clear);
|
intent.putExtra("Clear", clear);
|
||||||
|
|
||||||
Integer length = script.size();
|
Iterator<HashMap<String, List>> iter1 = script.iterator();
|
||||||
Integer i;
|
Integer i = 0;
|
||||||
for (i = 0; i < length; i++) {
|
while (iter1.hasNext()) {
|
||||||
String nameOpts = "Opts" + i.toString();
|
String nameOpts = "Opts" + i.toString();
|
||||||
HashMap<String, List> tempHash = script.get(i);
|
intent.putExtra(nameOpts, iter1.next());
|
||||||
Log.d("D", "temp hash: " + tempHash.toString());
|
i++;
|
||||||
intent.putExtra(nameOpts, tempHash);
|
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
||||||
|
@ -1,67 +1,25 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
tools:context="com.welchsoftwaredevelopers.myapplication.ChoiceActivity">
|
||||||
android:paddingLeft="16dp"
|
|
||||||
android:paddingRight="16dp">
|
|
||||||
|
|
||||||
<TextView
|
<android.support.design.widget.AppBarLayout
|
||||||
android:id="@+id/textView_choice_total"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="TextView"
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
android:textAlignment="viewEnd" />
|
|
||||||
|
|
||||||
<TextView
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/textView"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:layout_weight="1"
|
android:background="?attr/colorPrimary"
|
||||||
android:text="hi"
|
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||||
android:textColor="@android:color/black" />
|
|
||||||
|
|
||||||
<ScrollView
|
</android.support.design.widget.AppBarLayout>
|
||||||
android:id="@+id/scrollView2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
|
<include layout="@layout/content_choice" />
|
||||||
|
|
||||||
<RadioGroup
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
android:id="@+id/radioGroup1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginTop="0dp">
|
|
||||||
|
|
||||||
</RadioGroup>
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button2"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:onClick="ClickDone"
|
|
||||||
android:text="Done" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button3"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:onClick="ClickChoice"
|
|
||||||
android:text="Continue" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
@ -1,55 +1,25 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="com.welchsoftwaredevelopers.myapplication.MainActivity"
|
tools:context="com.welchsoftwaredevelopers.myapplication.MainActivity">
|
||||||
tools:layout_editor_absoluteY="81dp"
|
|
||||||
tools:layout_editor_absoluteX="0dp">
|
|
||||||
|
|
||||||
<Button
|
<android.support.design.widget.AppBarLayout
|
||||||
android:id="@+id/button"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="200dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:onClick="Click"
|
|
||||||
android:text="Start"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
android:layout_marginTop="100dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView_Total"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginEnd="8dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView_Total"
|
|
||||||
android:layout_width="368dp"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="hello"
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
android:textAlignment="viewEnd"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent" />
|
|
||||||
|
|
||||||
<Button
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/button4"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:onClick="ClickClear"
|
android:background="?attr/colorPrimary"
|
||||||
android:text="Button"
|
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||||
android:layout_marginTop="301dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView_Total"
|
</android.support.design.widget.AppBarLayout>
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
<include layout="@layout/content_main" />
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginEnd="8dp" />
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
|
||||||
|
70
app/src/main/res/layout/content_choice.xml
Normal file
70
app/src/main/res/layout/content_choice.xml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/choice_textView_total"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="64dp"
|
||||||
|
android:textAlignment="viewEnd" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/question"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="nothing"
|
||||||
|
android:textColor="@android:color/black" />
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/scrollView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/radioGroup1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="0dp">
|
||||||
|
|
||||||
|
</RadioGroup>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
style="?android:buttonBarButtonStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_Done"
|
||||||
|
style="?android:buttonBarButtonStyle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="ClickDone"
|
||||||
|
android:text="@string/DoneButton" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_Continue"
|
||||||
|
style="?android:buttonBarButtonStyle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="ClickChoice"
|
||||||
|
android:text="@string/ContinueButton" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
54
app/src/main/res/layout/content_main.xml
Normal file
54
app/src/main/res/layout/content_main.xml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="com.welchsoftwaredevelopers.myapplication.MainActivity"
|
||||||
|
tools:showIn="@layout/activity_main">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="100dp"
|
||||||
|
android:onClick="Click"
|
||||||
|
android:text="@string/StartButton"
|
||||||
|
android:textSize="30sp"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/main_textView_Total" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/main_textView_Total"
|
||||||
|
android:layout_width="368dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_marginTop="64dp"
|
||||||
|
android:textAlignment="viewEnd"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="301dp"
|
||||||
|
android:onClick="ClickClear"
|
||||||
|
android:text="@string/ClearButton"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/main_textView_Total" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
7
app/src/main/res/menu/choice.xml
Normal file
7
app/src/main/res/menu/choice.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:id="@+id/FailMenu"
|
||||||
|
android:title="@string/FailMenu" />
|
||||||
|
|
||||||
|
</menu>
|
6
app/src/main/res/menu/main.xml
Normal file
6
app/src/main/res/menu/main.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:id="@+id/clearMenu"
|
||||||
|
android:title="@string/ClearButton" />
|
||||||
|
</menu>
|
@ -1,4 +1,10 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">My Application</string>
|
<string name="app_name">My Application</string>
|
||||||
<string name="Total">Total</string>
|
<string name="Total">Total</string>
|
||||||
|
<string name="title">Phonathon</string>
|
||||||
|
<string name="StartButton">Start</string>
|
||||||
|
<string name="ClearButton">Clear</string>
|
||||||
|
<string name="DoneButton">Done</string>
|
||||||
|
<string name="ContinueButton">Continue</string>
|
||||||
|
<string name="FailMenu">Fail</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -8,4 +8,13 @@
|
|||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme.NoActionBar">
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||||
|
|
||||||
|
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Reference in New Issue
Block a user