diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..3543521 --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..cbe961a --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,56 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 31 + buildToolsVersion "30.0.3" + + defaultConfig { + applicationId "com.hc.hyycck.bigdatadisplay" + minSdkVersion 19 + targetSdkVersion 31 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + + + + implementation 'androidx.appcompat:appcompat:1.0.2' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + + //头条屏幕适配 + implementation 'me.jessyan:autosize:1.2.1' + + implementation 'xyz.doikki.android.dkplayer:dkplayer-java:3.3.7' + //可选,包含StandardVideoController的实现 + implementation 'xyz.doikki.android.dkplayer:dkplayer-ui:3.3.7' + //可选,使用exoplayer进行解码 +// implementation 'xyz.doikki.android.dkplayer:player-exo:3.3.7' + //可选,使用ijkplayer进行解码 + implementation 'xyz.doikki.android.dkplayer:player-ijk:3.3.7' + + implementation 'com.android.support:appcompat-v7:28.0.0' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..6e7ffa9 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/jjyl/zhencunscreen/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/jjyl/zhencunscreen/ExampleInstrumentedTest.java new file mode 100644 index 0000000..5711f56 --- /dev/null +++ b/app/src/androidTest/java/com/jjyl/zhencunscreen/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package com.jjyl.zhencunscreen; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + + assertEquals("com.jjyl.zhencunscreen", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..25288e9 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/hc/hyycck/bigdatadisplay/BaseActivity.java b/app/src/main/java/com/hc/hyycck/bigdatadisplay/BaseActivity.java new file mode 100644 index 0000000..6ecd705 --- /dev/null +++ b/app/src/main/java/com/hc/hyycck/bigdatadisplay/BaseActivity.java @@ -0,0 +1,41 @@ +package com.hc.hyycck.bigdatadisplay; + +import android.os.Bundle; +import android.view.WindowManager; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import me.jessyan.autosize.internal.CustomAdapt; + +public class BaseActivity extends AppCompatActivity implements CustomAdapt { + + private static final String TAG = "BaseActivity===="; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); + } + + + @Override + protected void onDestroy() { + super.onDestroy(); + } + + @Override + public void onBackPressed() { + super.onBackPressed(); + } + + @Override + public boolean isBaseOnWidth() { + return true; + } + + @Override + public float getSizeInDp() { + return 1920; + } +} diff --git a/app/src/main/java/com/hc/hyycck/bigdatadisplay/Constans.java b/app/src/main/java/com/hc/hyycck/bigdatadisplay/Constans.java new file mode 100644 index 0000000..a244d86 --- /dev/null +++ b/app/src/main/java/com/hc/hyycck/bigdatadisplay/Constans.java @@ -0,0 +1,19 @@ +package com.hc.hyycck.bigdatadisplay; + +public class Constans { + + public static final int KEY_ENTER = 66; //键盘enter + public static final int KEY_OK = 23; //遥控器ok + public static final int KEY_RIGHT = 22; //遥控器右键 + public static final int KEY_UP = 19; //遥控器上键 + public static final int KEY_DOWN = 20; //遥控器下键 + public static final int KEY_LEFT = 21; //遥控器左键 + public static final int KEY_VOLUM_ADD=24; //声音+ + public static final int KEY_VOLUM_SUB=25; //声音- + public static final int KEY_PLAY=1010; //播放 + public static final int KEY_PAUSE=136; //暂停 + public static final int KEY_QUIT_FRO=93; //快进 + public static final int KEY_QUIT_BACK=92; //快退 + public static final int KEY_BACK = 0; //返回键 + +} diff --git a/app/src/main/java/com/hc/hyycck/bigdatadisplay/MainActivity.java b/app/src/main/java/com/hc/hyycck/bigdatadisplay/MainActivity.java new file mode 100644 index 0000000..ae02529 --- /dev/null +++ b/app/src/main/java/com/hc/hyycck/bigdatadisplay/MainActivity.java @@ -0,0 +1,96 @@ +package com.hc.hyycck.bigdatadisplay; + +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.os.Bundle; +import android.view.KeyEvent; +import android.view.View; +import android.widget.TextView; + + +public class MainActivity extends BaseActivity implements View.OnKeyListener { + + private TextView zhenTv,cunTv; + + private String zhenUrl,cunUrl; + private TextView hintTv; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + zhenTv = findViewById(R.id.zhenTv); + cunTv = findViewById(R.id.cunTv); + hintTv = findViewById(R.id.hint); + + zhenTv.setOnFocusChangeListener(new MyFocusListener(1.2f,zhenTv)); + cunTv.setOnFocusChangeListener(new MyFocusListener(1.2f,cunTv)); + + zhenTv.setOnKeyListener(this); + cunTv.setOnKeyListener(this); + + zhenTv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(MainActivity.this, WebActivity.class); + intent.putExtra("url",zhenUrl); + startActivity(intent); + } + }); + + cunTv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(MainActivity.this, WebActivity.class); + intent.putExtra("url",cunUrl); + startActivity(intent); + } + }); +// zhenUrl = "http://60.255.58.172:9001/qfsw/#/"; +// zhenUrl = "http://www.baidu.com"; + zhenUrl = "http://192.168.10.21:8080/#/gaotanTown"; +// zhenUrl = "http://192.168.1.2:8080/#/test"; +// zhenUrl = "http://60.255.58.172:9001/swhtml/html/home.html"; +// zhenUrl = "http://www.baidu.com"; + cunUrl = "http://192.168.1.2:8080/#/taiyangVillage"; + + PackageManager packageManager = getPackageManager(); + +// getPackageName()是你当前类的包名,0代表是获取版本信息 + + PackageInfo packInfo = null; + int version = 0; + try { + packInfo = packageManager.getPackageInfo(getPackageName(),0); + version = Integer.valueOf(android.os.Build.VERSION.SDK); + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + } + hintTv.setText(version+""); + } + + @Override + public boolean onKey(View view, int i, KeyEvent keyEvent) { + if(keyEvent.getAction() == KeyEvent.ACTION_DOWN) { + int keyCode = keyEvent.getKeyCode(); + if (view.getId() == R.id.zhenTv) { + if (keyCode == Constans.KEY_ENTER || keyCode == Constans.KEY_OK) { //确认键 + Intent intent = new Intent(this, WebActivity.class); + intent.putExtra("url",zhenUrl); + startActivity(intent); + + } + else if(view.getId() == R.id.cunTv){ + if (keyCode == Constans.KEY_ENTER || keyCode == Constans.KEY_OK) { //确认键 + Intent intent = new Intent(this, WebActivity.class); + intent.putExtra("url",cunUrl); + startActivity(intent); + } + } + } + } + return false; + } +} diff --git a/app/src/main/java/com/hc/hyycck/bigdatadisplay/MyApplication.java b/app/src/main/java/com/hc/hyycck/bigdatadisplay/MyApplication.java new file mode 100644 index 0000000..7a8e4a5 --- /dev/null +++ b/app/src/main/java/com/hc/hyycck/bigdatadisplay/MyApplication.java @@ -0,0 +1,128 @@ +package com.hc.hyycck.bigdatadisplay; + +import android.app.Activity; +import android.app.Application; + +import me.jessyan.autosize.AutoSize; +import me.jessyan.autosize.AutoSizeConfig; +import me.jessyan.autosize.external.ExternalAdaptManager; +import me.jessyan.autosize.internal.CustomAdapt; +import me.jessyan.autosize.onAdaptListener; +import xyz.doikki.videoplayer.ijk.IjkPlayerFactory; +import xyz.doikki.videoplayer.player.VideoViewConfig; +import xyz.doikki.videoplayer.player.VideoViewManager; + +//import com.squareup.leakcanary.LeakCanary; + + +public class MyApplication extends Application { + @Override + public void onCreate() { + super.onCreate(); + + VideoViewManager.setConfig(VideoViewConfig.newBuilder() + //使用使用IjkPlayer解码 + .setPlayerFactory(IjkPlayerFactory.create()) + //使用ExoPlayer解码 +// .setPlayerFactory(ExoMediaPlayerFactory.create()) +// //使用MediaPlayer解码 +// .setPlayerFactory(AndroidMediaPlayerFactory.create()) + .build()); + + //当 App 中出现多进程, 并且您需要适配所有的进程, 就需要在 App 初始化时调用 initCompatMultiProcess() + //在 Demo 中跳转的三方库中的 DefaultErrorActivity 就是在另外一个进程中, 所以要想适配这个 Activity 就需要调用 initCompatMultiProcess() + AutoSize.initCompatMultiProcess(this); + + //如果在某些特殊情况下出现 InitProvider 未能正常实例化, 导致 AndroidAutoSize 未能完成初始化 + //可以主动调用 AutoSize.checkAndInit(this) 方法, 完成 AndroidAutoSize 的初始化后即可正常使用 + AutoSize.checkAndInit(this); + +// 如何控制 AndroidAutoSize 的初始化,让 AndroidAutoSize 在某些设备上不自动启动?https://github.com/JessYanCoding/AndroidAutoSize/issues/249 + + /** + * 以下是 AndroidAutoSize 可以自定义的参数, {@link AutoSizeConfig} 的每个方法的注释都写的很详细 + * 使用前请一定记得跳进源码,查看方法的注释, 下面的注释只是简单描述!!! + */ + AutoSizeConfig.getInstance() + + //是否让框架支持自定义 Fragment 的适配参数, 由于这个需求是比较少见的, 所以须要使用者手动开启 + //如果没有这个需求建议不开启 + .setCustomFragment(true) + + //是否屏蔽系统字体大小对 AndroidAutoSize 的影响, 如果为 true, App 内的字体的大小将不会跟随系统设置中字体大小的改变 + //如果为 false, 则会跟随系统设置中字体大小的改变, 默认为 false +// .setExcludeFontScale(true) + + //区别于系统字体大小的放大比例, AndroidAutoSize 允许 APP 内部可以独立于系统字体大小之外,独自拥有全局调节 APP 字体大小的能力 + //当然, 在 APP 内您必须使用 sp 来作为字体的单位, 否则此功能无效, 不设置或将此值设为 0 则取消此功能 +// .setPrivateFontScale(0.8f) + + //屏幕适配监听器 + .setOnAdaptListener(new onAdaptListener() { + @Override + public void onAdaptBefore(Object target, Activity activity) { + //使用以下代码, 可以解决横竖屏切换时的屏幕适配问题 + //使用以下代码, 可支持 Android 的分屏或缩放模式, 但前提是在分屏或缩放模式下当用户改变您 App 的窗口大小时 + //系统会重绘当前的页面, 经测试在某些机型, 某些情况下系统不会主动重绘当前页面, 所以这时您需要自行重绘当前页面 + //ScreenUtils.getScreenSize(activity) 的参数一定要不要传 Application!!! +// AutoSizeConfig.getInstance().setScreenWidth(ScreenUtils.getScreenSize(activity)[0]); +// AutoSizeConfig.getInstance().setScreenHeight(ScreenUtils.getScreenSize(activity)[1]); +// AutoSizeLog.d(String.format(Locale.ENGLISH, "%s onAdaptBefore!", target.getClass().getName())); + } + + @Override + public void onAdaptAfter(Object target, Activity activity) { +// AutoSizeLog.d(String.format(Locale.ENGLISH, "%s onAdaptAfter!", target.getClass().getName())); + } + }) + + //是否打印 AutoSize 的内部日志, 默认为 true, 如果您不想 AutoSize 打印日志, 则请设置为 false +// .setLog(false) + + //是否使用设备的实际尺寸做适配, 默认为 false, 如果设置为 false, 在以屏幕高度为基准进行适配时 + //AutoSize 会将屏幕总高度减去状态栏高度来做适配 + //设置为 true 则使用设备的实际屏幕高度, 不会减去状态栏高度 + //在全面屏或刘海屏幕设备中, 获取到的屏幕高度可能不包含状态栏高度, 所以在全面屏设备中不需要减去状态栏高度,所以可以 setUseDeviceSize(true) +// .setUseDeviceSize(true) + + //是否全局按照宽度进行等比例适配, 默认为 true, 如果设置为 false, AutoSize 会全局按照高度进行适配 +// .setBaseOnWidth(false) + + //设置屏幕适配逻辑策略类, 一般不用设置, 使用框架默认的就好 +// .setAutoAdaptStrategy(new AutoAdaptStrategy()) + ; + customAdaptForExternal(); + +// if(LeakCanary.isInAnalyzerProcess(this)){ +// return; +// } +// LeakCanary.install(this); + } + + /** + * 给外部的三方库 {@link Activity} 自定义适配参数, 因为三方库的 {@link Activity} 并不能通过实现 + * {@link CustomAdapt} 接口的方式来提供自定义适配参数 (因为远程依赖改不了源码) + * 所以使用 {@link ExternalAdaptManager} 来替代实现接口的方式, 来提供自定义适配参数 + */ + private void customAdaptForExternal() { + /** + * {@link ExternalAdaptManager} 是一个管理外部三方库的适配信息和状态的管理类, 详细介绍请看 {@link ExternalAdaptManager} 的类注释 + */ + AutoSizeConfig.getInstance().getExternalAdaptManager(); + + //加入的 Activity 将会放弃屏幕适配, 一般用于三方库的 Activity, 详情请看方法注释 + //如果不想放弃三方库页面的适配, 请用 addExternalAdaptInfoOfActivity 方法, 建议对三方库页面进行适配, 让自己的 App 更完美一点 +// .addCancelAdaptOfActivity(DefaultErrorActivity.class) + + //为指定的 Activity 提供自定义适配参数, AndroidAutoSize 将会按照提供的适配参数进行适配, 详情请看方法注释 + //一般用于三方库的 Activity, 因为三方库的设计图尺寸可能和项目自身的设计图尺寸不一致, 所以要想完美适配三方库的页面 + //就需要提供三方库的设计图尺寸, 以及适配的方向 (以宽为基准还是高为基准?) + //三方库页面的设计图尺寸可能无法获知, 所以如果想让三方库的适配效果达到最好, 只有靠不断的尝试 + //由于 AndroidAutoSize 可以让布局在所有设备上都等比例缩放, 所以只要您在一个设备上测试出了一个最完美的设计图尺寸 + //那这个三方库页面在其他设备上也会呈现出同样的适配效果, 等比例缩放, 所以也就完成了三方库页面的屏幕适配 + //即使在不改三方库源码的情况下也可以完美适配三方库的页面, 这就是 AndroidAutoSize 的优势 + //但前提是三方库页面的布局使用的是 dp 和 sp, 如果布局全部使用的 px, 那 AndroidAutoSize 也将无能为力 + //经过测试 DefaultErrorActivity 的设计图宽度在 380dp - 400dp 显示效果都是比较舒服的 +// .addExternalAdaptInfoOfActivity(DefaultErrorActivity.class, new ExternalAdaptInfo(true, 400)); + } +} diff --git a/app/src/main/java/com/hc/hyycck/bigdatadisplay/MyFocusListener.java b/app/src/main/java/com/hc/hyycck/bigdatadisplay/MyFocusListener.java new file mode 100644 index 0000000..29d47a8 --- /dev/null +++ b/app/src/main/java/com/hc/hyycck/bigdatadisplay/MyFocusListener.java @@ -0,0 +1,168 @@ +package com.hc.hyycck.bigdatadisplay; + +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.Animation; +import android.view.animation.AnimationSet; +import android.view.animation.ScaleAnimation; + + +public class MyFocusListener implements View.OnFocusChangeListener { + + private final static String TAG = "MyFocusListener===="; + + private int xF ,yF; //yF:-1 ->向下,0->居中,1->向上,xF :-1 ->向左,0->居中,1->向右 + + private float scaleTime = 1.05f; + + private View view; + + private int zIndex = -1; + + public MyFocusListener(int xF, int yF){ + this.xF = xF; + this.yF = yF; + } + + public MyFocusListener(int xF, int yF, View view){ + this.xF = xF; + this.yF = yF; + this.view = view; + } + + public MyFocusListener(int xF, int yF, float scaleTime){ + this.xF = xF; + this.yF = yF; + this.scaleTime = scaleTime; + } + public MyFocusListener(int xF, int yF, float scaleTime, View view){ + this.xF = xF; + this.yF = yF; + this.scaleTime = scaleTime; + this.view = view; + } + public MyFocusListener(float scaleTime, View view){ + this.scaleTime = scaleTime; + this.view = view; + } + + + public MyFocusListener(){ + + } + @Override + public void onFocusChange(View view, boolean hasFocus) { + if(hasFocus){ +// bringToIndex(view); + AnimationSet animationSet = new AnimationSet(true); + ScaleAnimation animation ; + if(xF == 0 && yF == 0){ //居中放大 + animation = new ScaleAnimation(1.0f, scaleTime, 1.0f, scaleTime, + Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); + } + else if(xF == 0 && yF == -1){ //垂直方向向下,水平方居中 + animation = new ScaleAnimation(1.0f, scaleTime, 1.0f, scaleTime, + Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0f); + } + else if(xF == 0 && yF == 1){ //垂直方向向上,水平方居中 + animation = new ScaleAnimation(1.0f, scaleTime, 1.0f, scaleTime, + Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 1f); + } + else if(xF == -1 && yF == 0 ){ //垂直方向居中,水平方向向左 + animation = new ScaleAnimation(1.0f, scaleTime, 1.0f, scaleTime, + Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f); + } + else if(xF == -1 && yF == -1){ //垂直向下,水平向左 + animation = new ScaleAnimation(1.0f, scaleTime, 1.0f, scaleTime, + Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f); + } + else if(xF == -1 && yF == 1){ //垂直向上,水平向左 + animation = new ScaleAnimation(1.0f, scaleTime, 1.0f, scaleTime, + Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 1f); + } + else if(xF == 1 && yF == 0){//垂直方向居中,水平方向向右 + animation = new ScaleAnimation(1.0f, scaleTime, 1.0f, scaleTime, + Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0.5f); + } + else if(xF == 1 && yF == -1){ //垂直方向向下,水平方向向右 + animation = new ScaleAnimation(1.0f, scaleTime, 1.0f, scaleTime, + Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f); + } + else if(xF == 1 && yF == 1){ //垂直方向向上,水平方向向右 + animation = new ScaleAnimation(1.0f, scaleTime, 1.0f, scaleTime, + Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f); + } + else{ + animation = new ScaleAnimation(1.0f, scaleTime, 1.0f, scaleTime, + Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); + } + animation.setDuration(200); + animation.setFillAfter(true); + animationSet.addAnimation(animation); + animationSet.setFillAfter(true); + view.clearAnimation(); + view.startAnimation(animationSet); + } + else{ + AnimationSet animationSet = new AnimationSet(true); + ScaleAnimation animation; + + if(xF == 0 && yF == 0){ //居中缩小 + animation = new ScaleAnimation(scaleTime, 1.0f, scaleTime, 1.0f, + Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); + } + else if(xF == 0 && yF == -1){ //垂直方向向下,水平方居中 + animation = new ScaleAnimation(scaleTime, 1.0f, scaleTime, 1.0f, + Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0f); + } + else if(xF == 0 && yF == 1){ //垂直方向向上,水平方居中 + animation = new ScaleAnimation(scaleTime, 1.0f, scaleTime, 1.0f, + Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 1f); + } + else if(xF == -1 && yF == 0 ){ //垂直方向居中,水平方向向左 + animation = new ScaleAnimation(scaleTime, 1.0f, scaleTime, 1.0f, + Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f); + } + else if(xF == -1 && yF == -1){ //垂直向下,水平向左 + animation = new ScaleAnimation(scaleTime, 1.0f, scaleTime, 1.0f, + Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f); + } + else if(xF == -1 && yF == 1){ //垂直向上,水平向左 + animation = new ScaleAnimation(scaleTime, 1.0f, scaleTime, 1.0f, + Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 1f); + } + else if(xF == 1 && yF == 0){//垂直方向居中,水平方向向右 + animation = new ScaleAnimation(scaleTime, 1.0f, scaleTime, 1.0f, + Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0.5f); + } + else if(xF == 1 && yF == -1){ //垂直方向向下,水平方向向右 + animation = new ScaleAnimation(scaleTime, 1.0f, scaleTime, 1.0f, + Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f); + } + else if(xF == 1 && yF == 1){ //垂直方向向上,水平方向向右 + animation = new ScaleAnimation(scaleTime, 1.0f, scaleTime, 1.0f, + Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f); + } + else{ + animation = new ScaleAnimation(scaleTime, 1.0f, scaleTime, 1.0f, + Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); + } + animation.setDuration(200); + animation.setFillAfter(true); + animationSet.addAnimation(animation); + animationSet.setFillAfter(true); + view.startAnimation(animationSet); + } + } + + private void bringToIndex(View child){ + ViewGroup mParent = (ViewGroup) child.getParent(); + int childCount = mParent.getChildCount(); + if (childCount > 0) { + mParent.removeView(child); + mParent.addView(child, childCount-1); + mParent.requestLayout(); + mParent.invalidate(); + } + } +} diff --git a/app/src/main/java/com/hc/hyycck/bigdatadisplay/WebActivity.java b/app/src/main/java/com/hc/hyycck/bigdatadisplay/WebActivity.java new file mode 100644 index 0000000..1f20c6e --- /dev/null +++ b/app/src/main/java/com/hc/hyycck/bigdatadisplay/WebActivity.java @@ -0,0 +1,77 @@ +package com.hc.hyycck.bigdatadisplay; + +import android.os.Bundle; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; + + +public class WebActivity extends BaseActivity { + + private WebView webView; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_webpage); + webView = (WebView) findViewById(R.id.vw); + //获取WebSettings类的实例,此类用于对WebView加载的网页进行设置 + WebSettings webSettings = webView.getSettings(); + //使WebView可以使用JavaScript + //设置支持js + webSettings.setJavaScriptEnabled(true); + //设置适应屏幕 + webSettings.setUseWideViewPort(true); //将图片调整到适合webview的大小 + webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小 + webSettings.setPluginState(WebSettings.PluginState.ON);//设置是否支持插件 + webSettings.setSupportZoom(true); //支持缩放 + webSettings.setBuiltInZoomControls(true); + webSettings.setDisplayZoomControls(false); //隐藏原生的缩放控件 + //设置存储模式 + webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); + webSettings.setAllowFileAccess(true); + + //setDomStorageEnabled解决了webview白屏问题 设置支持DomStorage + webSettings.setDomStorageEnabled(true); + + //设置支持本地存储 + webSettings.setDatabaseEnabled(true); + + //设置缓存 + webSettings.setAppCacheEnabled(true); + webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); + webSettings.setJavaScriptCanOpenWindowsAutomatically(true);//支持通过JS打开新窗口 + webSettings.setLoadsImagesAutomatically(true); //支持自动加载图片 + webSettings.setDefaultTextEncodingName("utf-8"); + + //请求加载,并交由Webclient去处理 + String url = "http://60.255.174.144:9010/LinShuiSmartServerWeb/#/Town?name=丰禾镇&areaCode=511623113000&from=TV"; +// String url = "http://60.255.174.144:9010/LinShuiSmartServerWeb/#/Village?name=五华山村&areaCode=wuhuashancun"; +// String url = "http://192.168.10.21:8080/#/Town?name=丰禾镇&areaCode=2021030891230011&from=TV"; + webView.loadUrl(url); + //webView.loadUrl("http://www.baidu.com"); + //使用WebViewClient设置监听并处理WebView的请求事件 + webView.setWebViewClient(new WebViewClient() { + @Override + public boolean shouldOverrideUrlLoading(WebView view, String url) { + //根据url真正去加载网页的操作 + view.loadUrl(url); + //在当前WebView中打开网页,而不在浏览器中 + return true; + } + }); + } + + + @Override + public void onBackPressed() { + if(webView.canGoBack()){ + webView.goBack(); + } + else{ + super.onBackPressed(); + } + } + +} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..cc14f03 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..a4f78de --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..df3b7cb --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,49 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_webpage.xml b/app/src/main/res/layout/activity_webpage.xml new file mode 100644 index 0000000..61d5715 --- /dev/null +++ b/app/src/main/res/layout/activity_webpage.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..a26f6fb --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..a26f6fb --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a571e60 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..61da551 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c41dd28 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..db5080a Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..6dba46d Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..da31a87 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..15ac681 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..b216f2d Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..f25a419 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..e96783c Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..40f1117 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #6200EE + #3700B3 + #03DAC5 + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..327f362 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + ZhenCunScreenAndroid + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..6f19b47 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/test/java/com/jjyl/zhencunscreen/ExampleUnitTest.java b/app/src/test/java/com/jjyl/zhencunscreen/ExampleUnitTest.java new file mode 100644 index 0000000..5583c26 --- /dev/null +++ b/app/src/test/java/com/jjyl/zhencunscreen/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.jjyl.zhencunscreen; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f6b961f Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..1983a3b --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat Oct 22 22:33:18 CST 2022 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip