Browse Source

提交

Signed-off-by: zhangpeng <573671341@qq.com>
master
zhangpeng 3 years ago
parent
commit
79320ce155
  1. 1
      app/.gitignore
  2. 56
      app/build.gradle
  3. 21
      app/proguard-rules.pro
  4. 27
      app/src/androidTest/java/com/jjyl/zhencunscreen/ExampleInstrumentedTest.java
  5. 36
      app/src/main/AndroidManifest.xml
  6. 41
      app/src/main/java/com/hc/hyycck/bigdatadisplay/BaseActivity.java
  7. 19
      app/src/main/java/com/hc/hyycck/bigdatadisplay/Constans.java
  8. 96
      app/src/main/java/com/hc/hyycck/bigdatadisplay/MainActivity.java
  9. 128
      app/src/main/java/com/hc/hyycck/bigdatadisplay/MyApplication.java
  10. 168
      app/src/main/java/com/hc/hyycck/bigdatadisplay/MyFocusListener.java
  11. 77
      app/src/main/java/com/hc/hyycck/bigdatadisplay/WebActivity.java
  12. 30
      app/src/main/res/drawable-v24/ic_launcher_foreground.xml
  13. 170
      app/src/main/res/drawable/ic_launcher_background.xml
  14. 49
      app/src/main/res/layout/activity_main.xml
  15. 9
      app/src/main/res/layout/activity_webpage.xml
  16. 5
      app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  17. 5
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
  18. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.png
  19. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  20. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.png
  21. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_round.png
  22. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher.png
  23. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
  24. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  25. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
  26. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  27. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
  28. 6
      app/src/main/res/values/colors.xml
  29. 3
      app/src/main/res/values/strings.xml
  30. 11
      app/src/main/res/values/styles.xml
  31. 17
      app/src/test/java/com/jjyl/zhencunscreen/ExampleUnitTest.java
  32. BIN
      gradle/wrapper/gradle-wrapper.jar
  33. 6
      gradle/wrapper/gradle-wrapper.properties

1
app/.gitignore

@ -0,0 +1 @@
/build

56
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'
}

21
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

27
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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@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());
}
}

36
app/src/main/AndroidManifest.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hc.hyycck.bigdatadisplay">
<application
android:usesCleartextTraffic="true"
android:allowBackup="true"
android:name=".MyApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.NoActionBar">
<activity android:name=".WebActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity"/>
<meta-data
android:name="design_width_in_dp"
android:value="1920" />
<meta-data
android:name="design_height_in_dp"
android:value="1080" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>

41
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;
}
}

19
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; //返回键
}

96
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;
}
}

128
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));
}
}

168
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();
}
}
}

77
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();
}
}
}

30
app/src/main/res/drawable-v24/ic_launcher_foreground.xml

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

170
app/src/main/res/drawable/ic_launcher_background.xml

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

49
app/src/main/res/layout/activity_main.xml

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/zhenTv"
android:layout_width="match_parent"
android:gravity="center"
android:focusable="true"
android:focusableInTouchMode="false"
android:layout_centerInParent="true"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:textSize="32sp"
android:text="镇级"
android:background="#0000ff"
/>
<TextView
android:id="@+id/cunTv"
android:text="村级"
android:layout_margin="20dp"
android:focusable="true"
android:focusableInTouchMode="false"
android:gravity="center"
android:layout_centerInParent="true"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_below="@id/zhenTv"
android:layout_width="match_parent"
android:textColor="#ffffff"
android:background="#0000ff"
android:textSize="32sp"
android:layout_height="wrap_content"/>
<TextView
android:layout_below="@id/cunTv"
android:layout_centerHorizontal="true"
android:textSize="32sp"
android:id="@+id/hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>

9
app/src/main/res/layout/activity_webpage.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<WebView
android:id="@+id/vw"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>

5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

6
app/src/main/res/values/colors.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
</resources>

3
app/src/main/res/values/strings.xml

@ -0,0 +1,3 @@
<resources>
<string name="app_name">ZhenCunScreenAndroid</string>
</resources>

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

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

17
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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

BIN
gradle/wrapper/gradle-wrapper.jar

Binary file not shown.

6
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
Loading…
Cancel
Save