commit
003ecf879e
|
|
@ -10,7 +10,7 @@
|
||||||
<component name="VisualizationToolProject">
|
<component name="VisualizationToolProject">
|
||||||
<option name="state">
|
<option name="state">
|
||||||
<ProjectState>
|
<ProjectState>
|
||||||
<option name="scale" value="0.22" />
|
<option name="scale" value="0.045764362220058426" />
|
||||||
</ProjectState>
|
</ProjectState>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:label="@string/title_activity_notes"/>
|
android:label="@string/title_activity_notes"/>
|
||||||
<activity android:name=".main.MainActivity"/>
|
<activity android:name=".main.MainActivity"/>
|
||||||
|
|
||||||
<activity android:name=".quiz.QuizActivity"/>
|
<activity android:name=".quiz.QuizActivity"/>
|
||||||
|
<activity android:name=".dice.DiceActivity"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".login.LoginActivity"
|
android:name=".login.LoginActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,7 @@ public enum BtnID {
|
||||||
DELETE_BUTTON,
|
DELETE_BUTTON,
|
||||||
NOTES_BUTTON,
|
NOTES_BUTTON,
|
||||||
QUIZ_BUTTON,
|
QUIZ_BUTTON,
|
||||||
|
DICE_BUTTON,
|
||||||
BACKGROUND_BUTTON
|
BACKGROUND_BUTTON
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package xyz.r0r5chach.cpsAssist.dice;
|
||||||
|
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import xyz.r0r5chach.cpsAssist.R;
|
||||||
|
|
||||||
|
public class BtnOnClickListener implements View.OnClickListener{
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
LinearLayout l = (LinearLayout) v.getParent();
|
||||||
|
Random rand = new Random();
|
||||||
|
TextView output = l.findViewById(R.id.dice_output);
|
||||||
|
EditText input = l.findViewById(R.id.dice_input);
|
||||||
|
output.setText(String.valueOf(rand.nextInt(Integer.parseInt(input.getText().toString()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package xyz.r0r5chach.cpsAssist.dice;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import xyz.r0r5chach.cpsAssist.R;
|
||||||
|
import xyz.r0r5chach.cpsAssist.dice.BtnOnClickListener;
|
||||||
|
|
||||||
|
public class DiceActivity extends AppCompatActivity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_dice);
|
||||||
|
findViewById(R.id.dice_roll_button).setOnClickListener(new BtnOnClickListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -10,6 +10,7 @@ import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import xyz.r0r5chach.cpsAssist.BtnID;
|
import xyz.r0r5chach.cpsAssist.BtnID;
|
||||||
|
import xyz.r0r5chach.cpsAssist.dice.DiceActivity;
|
||||||
import xyz.r0r5chach.cpsAssist.R;
|
import xyz.r0r5chach.cpsAssist.R;
|
||||||
import xyz.r0r5chach.cpsAssist.quiz.QuizActivity;
|
import xyz.r0r5chach.cpsAssist.quiz.QuizActivity;
|
||||||
import xyz.r0r5chach.cpsAssist.notes.NotesActivity;
|
import xyz.r0r5chach.cpsAssist.notes.NotesActivity;
|
||||||
|
|
@ -33,6 +34,8 @@ public class BtnOnClickListener implements View.OnClickListener{
|
||||||
case QUIZ_BUTTON:
|
case QUIZ_BUTTON:
|
||||||
intent = new Intent(v.getContext(), QuizActivity.class);
|
intent = new Intent(v.getContext(), QuizActivity.class);
|
||||||
break;
|
break;
|
||||||
|
case DICE_BUTTON:
|
||||||
|
intent = new Intent(v.getContext(), DiceActivity.class);
|
||||||
case BACKGROUND_BUTTON:
|
case BACKGROUND_BUTTON:
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
backgroundColor = String.format("#%06x", rand.nextInt(0xffffff + 1));
|
backgroundColor = String.format("#%06x", rand.nextInt(0xffffff + 1));
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,6 @@ public class MainActivity extends AppCompatActivity {
|
||||||
findViewById(R.id.notes_button).setOnClickListener(lstn);
|
findViewById(R.id.notes_button).setOnClickListener(lstn);
|
||||||
findViewById(R.id.quiz_button).setOnClickListener(lstn);
|
findViewById(R.id.quiz_button).setOnClickListener(lstn);
|
||||||
findViewById(R.id.background_button).setOnClickListener(lstn);
|
findViewById(R.id.background_button).setOnClickListener(lstn);
|
||||||
|
findViewById(R.id.dice_button).setOnClickListener(lstn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?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">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/dice_output"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/dice_input"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="@string/dice_hint"
|
||||||
|
android:inputType="number"
|
||||||
|
android:minHeight="48dp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/dice_roll_button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/dice_button_text" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -22,4 +22,9 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/change_background_button_text" />
|
android:text="@string/change_background_button_text" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/dice_button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/dice_roller_button_text"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
@ -17,5 +17,8 @@
|
||||||
<string name="saveButtonText">Save</string>
|
<string name="saveButtonText">Save</string>
|
||||||
<string name="quiz_button_text">Quiz</string>
|
<string name="quiz_button_text">Quiz</string>
|
||||||
<string name="submit_button_text">Submit</string>
|
<string name="submit_button_text">Submit</string>
|
||||||
|
<string name="dice_hint">How many sides do you want the dice to have?</string>
|
||||||
|
<string name="dice_button_text">Roll</string>
|
||||||
|
<string name="dice_roller_button_text">Dice Roller</string>
|
||||||
<string name="change_background_button_text">Change Background</string>
|
<string name="change_background_button_text">Change Background</string>
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue