Skip to content

Commit 3f5fa38

Browse files
committed
updated to api 35 and android 15 layout.
1 parent 2edf7e6 commit 3f5fa38

20 files changed

+348
-197
lines changed

HelloOpenGLES20/.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HelloOpenGLES20/.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HelloOpenGLES20/.idea/deploymentTargetSelector.xml

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HelloOpenGLES20/.idea/gradle.xml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HelloOpenGLES20/.idea/migrations.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HelloOpenGLES20/.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HelloOpenGLES20/.idea/runConfigurations.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HelloOpenGLES20/app/build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 33
4+
compileSdk 35
55

66
defaultConfig {
77
applicationId "com.example.android.opengl"
8-
minSdkVersion 26
9-
targetSdkVersion 33
8+
minSdkVersion 29
9+
targetSdk 35
1010
versionCode 1
1111
versionName "1.0"
1212
}
@@ -17,8 +17,12 @@ android {
1717
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
1818
}
1919
}
20+
namespace 'com.example.android.opengl'
2021
}
2122

2223
dependencies {
2324
implementation fileTree(dir: 'libs', include: ['*.jar'])
25+
implementation("androidx.appcompat:appcompat:1.7.0")
26+
implementation("com.google.android.material:material:1.12.0")
27+
implementation("androidx.activity:activity:1.9.3")
2428
}

HelloOpenGLES20/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.example.android.opengl">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43

54
<application
65
android:allowBackup="true"
76
android:icon="@drawable/ic_launcher"
87
android:label="@string/app_name"
98
android:theme="@style/AppTheme">
109
<activity
11-
android:name=".OpenGLES20Activity"
10+
android:name=".MainActivity"
1211
android:exported="true">
1312
<intent-filter>
1413
<action android:name="android.intent.action.MAIN" />

HelloOpenGLES20/app/src/main/java/com/example/android/opengl/OpenGLES20Activity.java renamed to HelloOpenGLES20/app/src/main/java/com/example/android/opengl/MainActivity.java

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,39 @@
1515
*/
1616
package com.example.android.opengl;
1717

18-
import android.app.Activity;
1918
import android.opengl.GLSurfaceView;
2019
import android.os.Bundle;
21-
import android.view.View;
20+
import android.widget.LinearLayout;
21+
22+
import androidx.appcompat.app.AppCompatActivity;
23+
import androidx.core.graphics.Insets;
24+
import androidx.core.view.ViewCompat;
25+
import androidx.core.view.WindowInsetsCompat;
2226

2327
/*
24-
* There is not much here, but at the bottom, it setups immersive Mode, so that only the app
25-
* shows, and the use needs to swipe up from the bottom to get the navigation buttons to appear.
28+
* There is not much here, it setups the activity and all the insets, then adds
29+
* the opengl to the layout, so it will display.
2630
*/
2731

28-
public class OpenGLES20Activity extends Activity {
32+
public class MainActivity extends AppCompatActivity {
2933

3034
private GLSurfaceView mGLView;
3135

3236
@Override
3337
public void onCreate(Bundle savedInstanceState) {
3438
super.onCreate(savedInstanceState);
3539

40+
setContentView(R.layout.activity_main);
41+
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
42+
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
43+
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
44+
return WindowInsetsCompat.CONSUMED;
45+
});
3646
// Create a GLSurfaceView instance and set it
3747
// as the ContentView for this Activity
48+
LinearLayout myLayout = findViewById(R.id.main);
3849
mGLView = new MyGLSurfaceView(this);
39-
setContentView(mGLView);
50+
myLayout.addView(mGLView);
4051
}
4152

4253
@Override
@@ -57,17 +68,4 @@ protected void onResume() {
5768
// this is a good place to re-allocate them.
5869
mGLView.onResume();
5970
}
60-
61-
@Override
62-
public void onWindowFocusChanged(boolean hasFocus) {
63-
super.onWindowFocusChanged(hasFocus);
64-
if (hasFocus) {
65-
getWindow().getDecorView().setSystemUiVisibility(
66-
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
67-
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
68-
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
69-
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
70-
| View.SYSTEM_UI_FLAG_FULLSCREEN);
71-
}
72-
}
7371
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:id="@+id/main"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:orientation="vertical">
7+
</LinearLayout>

HelloOpenGLES20/app/src/main/res/menu/open_gles20.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<menu xmlns:android="http://schemas.android.com/apk/res/android"
22
xmlns:tools="http://schemas.android.com/tools"
3-
tools:context="com.example.android.opengl.OpenGLES20Activity" >
3+
tools:context="com.example.android.opengl.MainActivity" >
44

55
<item
66
android:id="@+id/action_settings"

HelloOpenGLES20/app/src/main/res/values/dimens.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.

HelloOpenGLES20/app/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22

33
<!-- Base Application theme. -->
4-
<style name="AppTheme" parent="android:Theme.Light.NoTitleBar.Fullscreen">
4+
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
55
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
66
</style>
77

HelloOpenGLES20/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
google()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:7.4.0'
8+
classpath 'com.android.tools.build:gradle:8.7.2'
99
}
1010
}
1111

HelloOpenGLES20/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
android.nonFinalResIds=false
2+
android.nonTransitiveRClass=true
3+
android.useAndroidX=true
-6.24 KB
Binary file not shown.

HelloOpenGLES20/gradle/wrapper/gradle-wrapper.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#Mon Feb 08 15:01:31 MST 2021
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

0 commit comments

Comments
 (0)