Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
meikpiep committed Jan 11, 2025
1 parent 32c9f31 commit a46d8f3
Show file tree
Hide file tree
Showing 16 changed files with 76 additions and 25 deletions.
3 changes: 2 additions & 1 deletion gauguin-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
defaultConfig {
applicationId = "org.piepmeyer.gauguin"
minSdk = 24
targetSdk = 34
targetSdk = 35
}

if (keystoreExists) {
Expand Down Expand Up @@ -147,6 +147,7 @@ dependencies {
implementation(libs.android.material)

implementation(libs.androidx.ktx)
implementation(libs.androidx.activity)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.drawerlayout)
implementation(libs.androidx.fragment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.piepmeyer.gauguin.ui

import android.content.Intent
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import org.koin.android.ext.android.inject
import org.piepmeyer.gauguin.R
Expand All @@ -16,6 +17,7 @@ class AboutActivity : AppCompatActivity() {
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState)
binding = ActivityAboutBinding.inflate(layoutInflater)
enableEdgeToEdge()
setContentView(binding.root)

activityUtils.configureFullscreen(this)
Expand All @@ -26,7 +28,9 @@ class AboutActivity : AppCompatActivity() {

binding.aboutShareApplicationLog.setOnClickListener {
val reversedLines =
Runtime.getRuntime().exec("logcat -d")
Runtime
.getRuntime()
.exec("logcat -d")
.inputStream
.bufferedReader()
.readLines()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.DialogInterface
import android.os.Bundle
import android.view.MenuItem
import android.view.View
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
Expand All @@ -26,6 +27,7 @@ class LoadGameListActivity : AppCompatActivity() {
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState)

enableEdgeToEdge()
setContentView(R.layout.activity_savegame)

val recyclerView = findViewById<RecyclerView>(android.R.id.list)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.piepmeyer.gauguin.ui

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.commit
import androidx.preference.ListPreference
Expand All @@ -17,7 +18,9 @@ class SettingsActivity : AppCompatActivity() {
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState)

enableEdgeToEdge()
setContentView(R.layout.activity_settings)

if (savedInstanceState == null) {
val settings = SettingsFragment()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import android.os.Bundle
import android.view.KeyEvent
import android.view.View
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.fragment.app.commit
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
Expand Down Expand Up @@ -40,8 +43,11 @@ class MainActivity : AppCompatActivity() {
private lateinit var bottomAppBarService: MainBottomAppBarService

public override fun onCreate(savedInstanceState: Bundle?) {
// configureActivity()
enableEdgeToEdge()
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)

setContentView(binding.root)

PreferenceManager.setDefaultValues(this, R.xml.root_preferences, false)
Expand Down Expand Up @@ -70,8 +76,6 @@ class MainActivity : AppCompatActivity() {
val navigationViewService = MainNavigationViewService(this, binding)
navigationViewService.initialize()

configureActivity()

FerrisWheelConfigurer(binding.ferrisWheelView).configure()

val specialListener =
Expand All @@ -88,6 +92,40 @@ class MainActivity : AppCompatActivity() {

navigationViewService.updateMainBottomBarMargins()

ViewCompat.setOnApplyWindowInsetsListener(
binding.gameTopFrame,
) { v, insets ->
val innerPadding =
insets.getInsets(
WindowInsetsCompat.Type.systemBars()
or WindowInsetsCompat.Type.displayCutout(),
)
v.setPadding(
innerPadding.left,
innerPadding.top,
innerPadding.right,
0,
)
insets
}

ViewCompat.setOnApplyWindowInsetsListener(
binding.mainBottomAppBar,
) { v, insets ->
val innerPadding =
insets.getInsets(
WindowInsetsCompat.Type.systemBars()
or WindowInsetsCompat.Type.displayCutout(),
)
v.setPadding(
innerPadding.left,
0,
innerPadding.right,
innerPadding.bottom,
)
insets
}

val viewModel: MainViewModel by viewModels()

lifecycleScope.launch {
Expand Down Expand Up @@ -179,7 +217,7 @@ class MainActivity : AppCompatActivity() {
public override fun onResume() {
gameLifecycle.setCoroutineScope(this.lifecycleScope)

configureActivity()
// configureActivity()

binding.konfettiView.reset()

Expand Down Expand Up @@ -210,7 +248,7 @@ class MainActivity : AppCompatActivity() {
activityUtils.configureKeepScreenOn(this)
activityUtils.configureFullscreen(this)

binding.gridview.updateTheme()
// binding.gridview.updateTheme()
}

fun showNewGameDialog() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ package org.piepmeyer.gauguin.ui.main
import android.content.Intent
import android.net.Uri
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.view.marginStart
import androidx.core.view.updateLayoutParams
import androidx.drawerlayout.widget.DrawerLayout
import androidx.fragment.app.commit
import com.mikepenz.materialdrawer.holder.StringHolder
Expand Down Expand Up @@ -177,7 +174,7 @@ class MainNavigationViewService(
}

private fun updateMainBottomBarMargins(right: Int) {
mainActivity.runOnUiThread {
/*mainActivity.runOnUiThread {
if (binding.mainBottomAppBar.marginStart != 0 && right > 0 && binding.mainBottomAppBar.marginStart != right) {
val marginParams =
binding.mainBottomAppBar.layoutParams as ViewGroup.MarginLayoutParams
Expand All @@ -186,7 +183,7 @@ class MainNavigationViewService(
binding.mainBottomAppBar.updateLayoutParams<ViewGroup.MarginLayoutParams> { }
binding.mainBottomAppBar.invalidate()
}
}
}*/
}

private fun createDrawerClickListener(): (v: View?, item: IDrawerItem<*>, position: Int) -> Boolean =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.piepmeyer.gauguin.ui.newgame

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.commit
import androidx.lifecycle.ViewModelProvider
Expand All @@ -20,6 +21,7 @@ class NewGameActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)

val binding = ActivityNewgameBinding.inflate(layoutInflater)
enableEdgeToEdge()
setContentView(binding.root)

activityUtils.configureTheme(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.piepmeyer.gauguin.ui.statistics
import android.content.DialogInterface
import android.os.Bundle
import android.view.View
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat.getString
import androidx.fragment.app.commit
Expand Down Expand Up @@ -38,6 +39,7 @@ class StatisticsActivity : AppCompatActivity() {
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState)
binding = ActivityStatisticsBinding.inflate(layoutInflater)
enableEdgeToEdge()
setContentView(binding.root)

binding.clearstats.setOnClickListener { _: View? ->
Expand Down
4 changes: 2 additions & 2 deletions gauguin-app/src/main/res/layout-land/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
android:layout_height="fill_parent"
android:orientation="horizontal"
tools:context=".ui.main.MainActivity"
android:fitsSystemWindows="true">
>

<nl.dionsegijn.konfetti.xml.KonfettiView
android:id="@+id/konfettiView"
Expand All @@ -19,7 +19,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mainConstraintLayout"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
android:layout_height="fill_parent"
android:orientation="horizontal"
tools:context=".ui.main.MainActivity"
android:fitsSystemWindows="true">
>

<nl.dionsegijn.konfetti.xml.KonfettiView
android:id="@+id/konfettiView"
Expand All @@ -19,7 +19,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mainConstraintLayout"
Expand Down
3 changes: 1 addition & 2 deletions gauguin-app/src/main/res/layout-sw600dp/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
android:layout_height="fill_parent"
android:orientation="vertical"
tools:context=".ui.main.MainActivity"
android:fitsSystemWindows="false"
>

<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false">
>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mainConstraintLayout"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
android:layout_height="fill_parent"
android:orientation="horizontal"
tools:context=".ui.main.MainActivity"
android:fitsSystemWindows="true">
>

<nl.dionsegijn.konfetti.xml.KonfettiView
android:id="@+id/konfettiView"
Expand All @@ -19,7 +19,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mainConstraintLayout"
Expand Down
4 changes: 2 additions & 2 deletions gauguin-app/src/main/res/layout-sw840dp/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:orientation="horizontal"
tools:context=".ui.main.MainActivity"
app:layout_collapseMode="none"
android:fitsSystemWindows="true">
>

<nl.dionsegijn.konfetti.xml.KonfettiView
android:id="@+id/konfettiView"
Expand All @@ -20,7 +20,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mainConstraintLayout"
Expand Down
3 changes: 1 addition & 2 deletions gauguin-app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
android:layout_height="fill_parent"
android:orientation="vertical"
tools:context=".ui.main.MainActivity"
android:fitsSystemWindows="false"
>

<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false">
>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mainConstraintLayout"
Expand Down
7 changes: 5 additions & 2 deletions gauguin-app/src/main/res/layout/activity_savegame.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<androidx.recyclerview.widget.RecyclerView android:id="@android:id/list"
<androidx.recyclerview.widget.RecyclerView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:clipToPadding="false"
/>

<TextView android:id="@android:id/empty"
android:layout_width="fill_parent"
Expand Down
1 change: 1 addition & 0 deletions libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ android-material = { group = "com.google.android.material", name = "material", v

androidx-annotation = { group = "androidx.annotation", name = "annotation", version = "1.9.1" }
androidx-ktx = { group = "androidx.core", name = "core-ktx", version = "1.15.0" }
androidx-activity = { group = "androidx.activity", name = "activity-ktx", version = "1.9.3" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version = "2.2.0" }
androidx-drawerlayout = { group = "androidx.drawerlayout", name = "drawerlayout", version = "1.2.0" }
androidx-fragment = { group = "androidx.fragment", name = "fragment-ktx", version = "1.8.5" }
Expand Down

0 comments on commit a46d8f3

Please sign in to comment.