Feat: Bloquage orientation et plein écran

This commit is contained in:
Augustin ROUX 2025-04-04 11:24:15 +02:00
parent 344db1e4ae
commit a5cf3509d8
5 changed files with 30 additions and 12 deletions

View File

@ -32,7 +32,7 @@ android {
} }
dependencies { dependencies {
implementation(libs.activity.v190)
implementation(libs.appcompat) implementation(libs.appcompat)
implementation(libs.material) implementation(libs.material)
implementation(libs.activity) implementation(libs.activity)

View File

@ -10,14 +10,13 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.Best2048" android:theme="@style/Theme.Best2048">
tools:targetApi="31">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true"> android:exported="true"
android:screenOrientation="portrait">
<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>

View File

@ -5,10 +5,15 @@ import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.animation.AnimationUtils; // Ajout pour Animation import android.view.animation.AnimationUtils; // Ajout pour Animation
import android.widget.TextView; import android.widget.TextView;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.gridlayout.widget.GridLayout; import androidx.gridlayout.widget.GridLayout;
import android.widget.Button; // Ajout pour Button import android.widget.Button; // Ajout pour Button
import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.core.view.WindowInsetsControllerCompat;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
@ -20,6 +25,8 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
EdgeToEdge.enable(this);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);

View File

@ -5,15 +5,19 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/background_color" android:background="@color/background_color"
android:fitsSystemWindows="false"
tools:context=".MainActivity"> tools:context=".MainActivity">
<LinearLayout <LinearLayout
android:id="@+id/northPanel" android:id="@+id/northPanel"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="28dp"
android:baselineAligned="false"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="@dimen/padding_general" android:padding="@dimen/padding_general"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
@ -53,11 +57,14 @@
<TextView <TextView
android:id="@+id/scoreLabel" android:id="@+id/scoreLabel"
style="@style/ScoreLabelStyle" style="@style/ScoreLabelStyle"
android:text="@string/score" /> <TextView android:text="@string/score" />
android:id="@+id/highScoreLabel"
style="@style/ScoreLabelStyle" <TextView
android:layout_marginTop="@dimen/margin_between_elements" android:id="@+id/highScoreLabel"
android:text="@string/high_score" /> </LinearLayout> style="@style/ScoreLabelStyle"
android:layout_marginTop="@dimen/margin_between_elements"
android:text="@string/high_score" />
</LinearLayout>
</LinearLayout> </LinearLayout>
@ -105,7 +112,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent" />
/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +1,7 @@
[versions] [versions]
activityVersion = "26"
agp = "8.9.1" agp = "8.9.1"
androidxActivity = "1.9.0"
junit = "4.13.2" junit = "4.13.2"
junitVersion = "1.1.5" junitVersion = "1.1.5"
espressoCore = "3.5.1" espressoCore = "3.5.1"
@ -7,8 +9,11 @@ appcompat = "1.6.1"
material = "1.10.0" material = "1.10.0"
activity = "1.8.0" activity = "1.8.0"
constraintlayout = "2.1.4" constraintlayout = "2.1.4"
gridlayout = "1.0.0"
[libraries] [libraries]
activity-v190 = { module = "androidx.activity:activity", version.ref = "androidxActivity" }
activity-v26 = { module = "androidx.activity:activity", version.ref = "activityVersion" }
junit = { group = "junit", name = "junit", version.ref = "junit" } junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
@ -16,6 +21,7 @@ appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "a
material = { group = "com.google.android.material", name = "material", version.ref = "material" } material = { group = "com.google.android.material", name = "material", version.ref = "material" }
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" } activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" } constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
gridlayout = { group = "androidx.gridlayout", name = "gridlayout", version.ref = "gridlayout" }
[plugins] [plugins]
android-application = { id = "com.android.application", version.ref = "agp" } android-application = { id = "com.android.application", version.ref = "agp" }