Skip to content

Commit 592a5ce

Browse files
author
凌炎
committed
init
0 parents  commit 592a5ce

File tree

61 files changed

+1771
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1771
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.externalNativeBuild

.idea/encodings.xml

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

.idea/gradle.xml

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

.idea/markdown-navigator/profiles_settings.xml

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

.idea/misc.xml

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

.idea/modules.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.

.idea/runConfigurations.xml

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

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 27
5+
defaultConfig {
6+
applicationId "android.xrj.opengl"
7+
minSdkVersion 17
8+
targetSdkVersion 26
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
implementation fileTree(include: ['*.jar'], dir: 'libs')
23+
implementation 'com.android.support:appcompat-v7:27.1.1'
24+
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
25+
testImplementation 'junit:junit:4.12'
26+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
27+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28+
implementation project(':support.xrj.opengl')
29+
implementation 'com.android.support:design:27.1.1'
30+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package android.xrj.opengl;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumented test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("android.xrj.opengl", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="android.xrj.opengl">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
<activity android:name=".GLLinearLayoutActivity" />
20+
<activity android:name=".GLWebViewActivity" />
21+
</application>
22+
23+
</manifest>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package android.xrj.opengl;
2+
3+
import android.app.Activity;
4+
import android.opengl.GLSurfaceView;
5+
import android.os.Bundle;
6+
import android.webkit.WebChromeClient;
7+
import android.webkit.WebViewClient;
8+
import android.widget.FrameLayout;
9+
import android.xrj.opengl.support.BaseGLRenderer;
10+
import android.xrj.opengl.support.FooRenderer;
11+
import android.xrj.opengl.support.view.GLWebView;
12+
import android.xrj.opengl.util.DisplayUtil;
13+
import android.xrj.opengl.util.StatusUtil;
14+
15+
/**
16+
* Create by LingYan on 2018-08-27
17+
*/
18+
19+
public class GLLinearLayoutActivity extends Activity {
20+
private static final String TAG = "GLLinearLayoutActivity";
21+
22+
private FrameLayout root;
23+
private GLSurfaceView glSurfaceView;
24+
25+
@Override
26+
protected void onCreate(Bundle savedInstanceState) {
27+
super.onCreate(savedInstanceState);
28+
setContentView(R.layout.activity_gl_line);
29+
root = findViewById(R.id.root);
30+
glSurfaceView = findViewById(R.id.gl_surface_view);
31+
32+
GLWebView webView = new GLWebView(this);
33+
34+
int width = DisplayUtil.getWidth(this);
35+
int height = DisplayUtil.getHeight(this) - StatusUtil.getStatusHeight(this);
36+
37+
final BaseGLRenderer baseGlRenderer = new FooRenderer(this, width, height);
38+
39+
glSurfaceView.setEGLContextClientVersion(2);
40+
glSurfaceView.setRenderer(baseGlRenderer);
41+
webView.setViewToGLRenderer(baseGlRenderer);
42+
43+
webView.setWebViewClient(new WebViewClient());
44+
webView.setWebChromeClient(new WebChromeClient());
45+
webView.loadUrl("https://www.baidu.com");
46+
47+
root.addView(webView);
48+
}
49+
}

0 commit comments

Comments
 (0)