mirror of
https://github.com/cmclark00/mintris.git
synced 2025-05-18 10:25:19 +01:00
Fix menu shifting issue and code cleanup. Fix menu shifting by adding fillViewport and padding to ScrollView. Added missing getLastClearedLines method. Improved code quality with proper logging constants and removed unused imports.
This commit is contained in:
parent
8661fd8a80
commit
9ab9b53407
5 changed files with 119 additions and 73 deletions
|
@ -1,26 +1,18 @@
|
|||
package com.mintris
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.VibrationEffect
|
||||
import android.os.Vibrator
|
||||
import android.os.VibratorManager
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import android.view.HapticFeedbackConstants
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mintris.databinding.ActivityMainBinding
|
||||
import com.mintris.game.GameHaptics
|
||||
import com.mintris.game.GameView
|
||||
import com.mintris.game.NextPieceView
|
||||
import com.mintris.game.TitleScreen
|
||||
import android.view.HapticFeedbackConstants
|
||||
import com.mintris.model.GameBoard
|
||||
import com.mintris.audio.GameMusic
|
||||
import com.mintris.model.HighScoreManager
|
||||
|
@ -33,10 +25,15 @@ import android.graphics.Color
|
|||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import android.graphics.Rect
|
||||
import android.util.Log
|
||||
import android.view.KeyEvent
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MainActivity"
|
||||
}
|
||||
|
||||
// UI components
|
||||
private lateinit var binding: ActivityMainBinding
|
||||
private lateinit var gameView: GameView
|
||||
|
@ -165,18 +162,18 @@ class MainActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
gameView.onLineClear = { lineCount ->
|
||||
android.util.Log.d("MainActivity", "Received line clear callback: $lineCount lines")
|
||||
Log.d(TAG, "Received line clear callback: $lineCount lines")
|
||||
// Use enhanced haptic feedback for line clears
|
||||
if (isSoundEnabled) {
|
||||
android.util.Log.d("MainActivity", "Sound is enabled, triggering haptic feedback")
|
||||
Log.d(TAG, "Sound is enabled, triggering haptic feedback")
|
||||
try {
|
||||
gameHaptics.vibrateForLineClear(lineCount)
|
||||
android.util.Log.d("MainActivity", "Haptic feedback triggered successfully")
|
||||
Log.d(TAG, "Haptic feedback triggered successfully")
|
||||
} catch (e: Exception) {
|
||||
android.util.Log.e("MainActivity", "Error triggering haptic feedback", e)
|
||||
Log.e(TAG, "Error triggering haptic feedback", e)
|
||||
}
|
||||
} else {
|
||||
android.util.Log.d("MainActivity", "Sound is disabled, skipping haptic feedback")
|
||||
Log.d(TAG, "Sound is disabled, skipping haptic feedback")
|
||||
}
|
||||
// Record line clear in stats
|
||||
statsManager.recordLineClear(lineCount)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue