summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-12 17:20:05 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-12 17:20:05 +0100
commit31430df5989d2b3014633912be5d27485d3e3a25 (patch)
tree20732a211215d6b84152d1183570fb8fcd441902
parentc920569a28504124c860709a08db98a121fa1112 (diff)
main activity tablet/horizontal layout done
-rw-r--r--app/build.gradle.kts10
-rw-r--r--app/src/main/AndroidManifest.xml3
-rw-r--r--app/src/main/java/com/lonkaars/bingo3/DisplayMessageActivity.java22
-rw-r--r--app/src/main/java/com/lonkaars/bingo3/MainActivity.java14
-rw-r--r--app/src/main/res/drawable/menu.xml1
-rw-r--r--app/src/main/res/drawable/roman_numeral_1.xml1
-rw-r--r--app/src/main/res/drawable/roman_numeral_2.xml1
-rw-r--r--app/src/main/res/drawable/roman_numeral_3.xml1
-rw-r--r--app/src/main/res/drawable/roman_numeral_4.xml1
-rw-r--r--app/src/main/res/drawable/roman_numeral_5.xml1
-rw-r--r--app/src/main/res/drawable/roman_numeral_6.xml1
-rw-r--r--app/src/main/res/drawable/roman_numeral_7.xml1
-rw-r--r--app/src/main/res/drawable/roman_numeral_8.xml1
-rw-r--r--app/src/main/res/drawable/roman_numeral_9.xml1
-rw-r--r--app/src/main/res/layout/activity_display_message.xml12
-rw-r--r--app/src/main/res/layout/activity_main.xml64
-rw-r--r--app/src/main/res/layout/header_navigation_drawer.xml26
-rw-r--r--app/src/main/res/menu/navigation_drawer.xml40
-rw-r--r--app/src/main/res/values-night/themes.xml7
-rw-r--r--app/src/main/res/values/strings.xml11
-rw-r--r--app/src/main/res/values/themes.xml9
21 files changed, 158 insertions, 70 deletions
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 17e3326..788eafb 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -26,13 +26,21 @@ android {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
+ buildFeatures {
+ viewBinding = true
+ }
}
dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
- implementation("com.google.android.material:material:1.9.0")
+ implementation("com.google.android.material:material:1.11.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
+ implementation("androidx.drawerlayout:drawerlayout:1.2.0")
+ implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")
+ implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
+ implementation("androidx.navigation:navigation-fragment:2.7.7")
+ implementation("androidx.navigation:navigation-ui:2.7.7")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8f8a7c3..08e7139 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -13,9 +13,6 @@
android:theme="@style/Theme.Bingo3"
tools:targetApi="31">
<activity
- android:name=".DisplayMessageActivity"
- android:exported="false" />
- <activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
diff --git a/app/src/main/java/com/lonkaars/bingo3/DisplayMessageActivity.java b/app/src/main/java/com/lonkaars/bingo3/DisplayMessageActivity.java
deleted file mode 100644
index d2c12f1..0000000
--- a/app/src/main/java/com/lonkaars/bingo3/DisplayMessageActivity.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.lonkaars.bingo3;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.widget.TextView;
-
-public class DisplayMessageActivity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_display_message);
-
- Intent intent = getIntent();
- String message = intent.getStringExtra(Intent.EXTRA_TEXT);
-
- TextView textView = findViewById(R.id.textView);
- textView.setText(message);
- }
-}
diff --git a/app/src/main/java/com/lonkaars/bingo3/MainActivity.java b/app/src/main/java/com/lonkaars/bingo3/MainActivity.java
index 5e75ecd..495811d 100644
--- a/app/src/main/java/com/lonkaars/bingo3/MainActivity.java
+++ b/app/src/main/java/com/lonkaars/bingo3/MainActivity.java
@@ -5,22 +5,16 @@ import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
import android.widget.EditText;
+import android.widget.ListView;
+import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
-
- public void send(View view) {
- EditText editText = findViewById(R.id.edit_message);
- String message = editText.getText().toString();
-
- Intent intent = new Intent(this, DisplayMessageActivity.class);
- intent.putExtra(Intent.EXTRA_TEXT, message);
- startActivity(intent);
- }
}
diff --git a/app/src/main/res/drawable/menu.xml b/app/src/main/res/drawable/menu.xml
new file mode 100644
index 0000000..2623a2b
--- /dev/null
+++ b/app/src/main/res/drawable/menu.xml
@@ -0,0 +1 @@
+<!-- drawable/menu.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?attr/colorControlNormal"><path android:fillColor="#000000" android:pathData="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" /></vector> \ No newline at end of file
diff --git a/app/src/main/res/drawable/roman_numeral_1.xml b/app/src/main/res/drawable/roman_numeral_1.xml
new file mode 100644
index 0000000..4476568
--- /dev/null
+++ b/app/src/main/res/drawable/roman_numeral_1.xml
@@ -0,0 +1 @@
+<!-- drawable/roman_numeral_1.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M14 7V9H13V15H14V17H10V15H11V9H10V7H14Z" /></vector> \ No newline at end of file
diff --git a/app/src/main/res/drawable/roman_numeral_2.xml b/app/src/main/res/drawable/roman_numeral_2.xml
new file mode 100644
index 0000000..15bb3dc
--- /dev/null
+++ b/app/src/main/res/drawable/roman_numeral_2.xml
@@ -0,0 +1 @@
+<!-- drawable/roman_numeral_2.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M11 7V9H10V15H11V17H7V15H8V9H7V7H11M17 7V9H16V15H17V17H13V15H14V9H13V7H17Z" /></vector> \ No newline at end of file
diff --git a/app/src/main/res/drawable/roman_numeral_3.xml b/app/src/main/res/drawable/roman_numeral_3.xml
new file mode 100644
index 0000000..f8a7934
--- /dev/null
+++ b/app/src/main/res/drawable/roman_numeral_3.xml
@@ -0,0 +1 @@
+<!-- drawable/roman_numeral_3.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M9 7V9H8V15H9V17H5V15H6V9H5V7H9M14 7V9H13V15H14V17H10V15H11V9H10V7H14M19 7V9H18V15H19V17H15V15H16V9H15V7H19Z" /></vector> \ No newline at end of file
diff --git a/app/src/main/res/drawable/roman_numeral_4.xml b/app/src/main/res/drawable/roman_numeral_4.xml
new file mode 100644
index 0000000..c620710
--- /dev/null
+++ b/app/src/main/res/drawable/roman_numeral_4.xml
@@ -0,0 +1 @@
+<!-- drawable/roman_numeral_4.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M12 7L14 17H16L18 7H16L15 12L14 7H12M11 7V9H10V15H11V17H7V15H8V9H7V7H11Z" /></vector> \ No newline at end of file
diff --git a/app/src/main/res/drawable/roman_numeral_5.xml b/app/src/main/res/drawable/roman_numeral_5.xml
new file mode 100644
index 0000000..93f876c
--- /dev/null
+++ b/app/src/main/res/drawable/roman_numeral_5.xml
@@ -0,0 +1 @@
+<!-- drawable/roman_numeral_5.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M9 7L11 17H13L15 7H13L12 12L11 7H9Z" /></vector> \ No newline at end of file
diff --git a/app/src/main/res/drawable/roman_numeral_6.xml b/app/src/main/res/drawable/roman_numeral_6.xml
new file mode 100644
index 0000000..22ce4de
--- /dev/null
+++ b/app/src/main/res/drawable/roman_numeral_6.xml
@@ -0,0 +1 @@
+<!-- drawable/roman_numeral_6.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M6 7L8 17H10L12 7H10L9 12L8 7H6M17 7V9H16V15H17V17H13V15H14V9H13V7H17Z" /></vector> \ No newline at end of file
diff --git a/app/src/main/res/drawable/roman_numeral_7.xml b/app/src/main/res/drawable/roman_numeral_7.xml
new file mode 100644
index 0000000..68768cf
--- /dev/null
+++ b/app/src/main/res/drawable/roman_numeral_7.xml
@@ -0,0 +1 @@
+<!-- drawable/roman_numeral_7.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M4 7L6 17H8L10 7H8L7 12L6 7H4M15 7V9H14V15H15V17H11V15H12V9H11V7H15M20 7V9H19V15H20V17H16V15H17V9H16V7H20Z" /></vector> \ No newline at end of file
diff --git a/app/src/main/res/drawable/roman_numeral_8.xml b/app/src/main/res/drawable/roman_numeral_8.xml
new file mode 100644
index 0000000..e0c4104
--- /dev/null
+++ b/app/src/main/res/drawable/roman_numeral_8.xml
@@ -0,0 +1 @@
+<!-- drawable/roman_numeral_8.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M1 7L3 17H5L7 7H5L4 12L3 7H1M12 7V9H11V15H12V17H8V15H9V9H8V7H12M17 7V9H16V15H17V17H13V15H14V9H13V7H17M22 7V9H21V15H22V17H18V15H19V9H18V7H22Z" /></vector> \ No newline at end of file
diff --git a/app/src/main/res/drawable/roman_numeral_9.xml b/app/src/main/res/drawable/roman_numeral_9.xml
new file mode 100644
index 0000000..2cc5736
--- /dev/null
+++ b/app/src/main/res/drawable/roman_numeral_9.xml
@@ -0,0 +1 @@
+<!-- drawable/roman_numeral_9.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M11 7V9H10V15H11V17H7V15H8V9H7V7H11M12 7L14 12L12 17H14L15 14.5L16 17H18L16 12L18 7H16L15 9.5L14 7H12Z" /></vector> \ No newline at end of file
diff --git a/app/src/main/res/layout/activity_display_message.xml b/app/src/main/res/layout/activity_display_message.xml
deleted file mode 100644
index c44487f..0000000
--- a/app/src/main/res/layout/activity_display_message.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?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/textView"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center"
- android:textSize="32sp"/>
-</LinearLayout>
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index fe42b62..d740acb 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,20 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.constraintlayout.widget.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:id="@+id/linearLayout"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
- <EditText
- android:id="@+id/edit_message"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:ems="10"
- android:hint="Your message here"
- android:inputType="textPersonName"/>
+ android:layout_height="match_parent">
- <Button
- android:id="@+id/button"
+ <com.google.android.material.navigation.NavigationView
+ android:id="@+id/navigationView"
android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ app:headerLayout="@layout/header_navigation_drawer"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.0"
+ app:menu="@menu/navigation_drawer">
+
+ </com.google.android.material.navigation.NavigationView>
+
+ <com.google.android.material.appbar.AppBarLayout
+ android:id="@+id/appBarLayout2"
+ style="@style/Widget.MaterialComponents.AppBarLayout.Primary"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
- android:onClick="send"
- android:text="Send"/>
-</LinearLayout>
+ android:fitsSystemWindows="true"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/navigationView"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <com.google.android.material.appbar.MaterialToolbar
+ android:id="@+id/topAppBar"
+ style="@style/Widget.MaterialComponents.Toolbar.Primary"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@android:color/transparent"
+ android:elevation="0dp"
+ android:keyboardNavigationCluster="true"
+ app:navigationIcon="@drawable/menu"
+ app:title="@string/nav_header_title" />
+
+ </com.google.android.material.appbar.AppBarLayout>
+
+ <ListView
+ android:id="@+id/listView"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/navigationView"
+ app:layout_constraintTop_toBottomOf="@+id/appBarLayout2" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/layout/header_navigation_drawer.xml b/app/src/main/res/layout/header_navigation_drawer.xml
new file mode 100644
index 0000000..ad01e59
--- /dev/null
+++ b/app/src/main/res/layout/header_navigation_drawer.xml
@@ -0,0 +1,26 @@
+<?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="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="24dp"
+ android:layout_marginTop="24dp"
+ android:layout_marginEnd="24dp"
+ android:text="@string/nav_header_title"
+ android:textAppearance="?attr/textAppearanceHeadlineSmall"
+ android:textColor="?attr/colorOnSurface" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="24dp"
+ android:layout_marginEnd="24dp"
+ android:layout_marginBottom="24dp"
+ android:text="@string/nav_header_subtitle"
+ android:textAppearance="?attr/textAppearanceTitleSmall"
+ android:textColor="?attr/colorOnSurfaceVariant" />
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/menu/navigation_drawer.xml b/app/src/main/res/menu/navigation_drawer.xml
new file mode 100644
index 0000000..facc196
--- /dev/null
+++ b/app/src/main/res/menu/navigation_drawer.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:checkable="true"
+ android:icon="@drawable/roman_numeral_1"
+ android:title="@string/gen_1_name" />
+ <item
+ android:checkable="true"
+ android:icon="@drawable/roman_numeral_2"
+ android:title="@string/gen_2_name" />
+ <item
+ android:checkable="true"
+ android:icon="@drawable/roman_numeral_3"
+ android:title="@string/gen_3_name" />
+ <item
+ android:checkable="true"
+ android:icon="@drawable/roman_numeral_4"
+ android:title="@string/gen_4_name" />
+ <item
+ android:checkable="true"
+ android:icon="@drawable/roman_numeral_5"
+ android:title="@string/gen_5_name" />
+ <item
+ android:checkable="true"
+ android:icon="@drawable/roman_numeral_6"
+ android:title="@string/gen_6_name" />
+ <item
+ android:checkable="true"
+ android:icon="@drawable/roman_numeral_7"
+ android:title="@string/gen_7_name" />
+ <item
+ android:checkable="true"
+ android:icon="@drawable/roman_numeral_8"
+ android:title="@string/gen_8_name" />
+ <item
+ android:checkable="true"
+ android:icon="@drawable/roman_numeral_9"
+ android:title="@string/gen_9_name" />
+</menu>
+
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
deleted file mode 100644
index 32771d5..0000000
--- a/app/src/main/res/values-night/themes.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<resources xmlns:tools="http://schemas.android.com/tools">
- <!-- Base application theme. -->
- <style name="Base.Theme.Bingo3" parent="Theme.Material3.DayNight.NoActionBar">
- <!-- Customize your dark theme here. -->
- <!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
- </style>
-</resources> \ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1fc888c..15dc34c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,3 +1,14 @@
<resources>
<string name="app_name">bingo3</string>
+ <string name="nav_header_title">Pokédex</string>
+ <string name="nav_header_subtitle">Select a generation to display entries from</string>
+ <string name="gen_1_name">Red/Green</string>
+ <string name="gen_2_name">Gold/Silver</string>
+ <string name="gen_3_name">Ruby/Sapphire</string>
+ <string name="gen_4_name">Diamond/Pearl</string>
+ <string name="gen_5_name">Black/White</string>
+ <string name="gen_6_name">X/Y</string>
+ <string name="gen_7_name">Sun/Moon</string>
+ <string name="gen_8_name">Sword/Shield</string>
+ <string name="gen_9_name">Scarlet/Violet</string>
</resources> \ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 63c444d..db21362 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -6,4 +6,13 @@
</style>
<style name="Theme.Bingo3" parent="Base.Theme.Bingo3" />
+
+ <style name="Theme.Bingo3.NoActionBar">
+ <item name="windowActionBar">false</item>
+ <item name="windowNoTitle">true</item>
+ </style>
+
+ <style name="Theme.Bingo3.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
+
+ <style name="Theme.Bingo3.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources> \ No newline at end of file