| @@ -47,8 +47,8 @@ public class FullscreenActivity extends AppCompatActivity { | |||||
| .setPositiveButton("确定", (dialogInterface, i) -> mWebView.loadUrl("http://"+textView.getText().toString())) | .setPositiveButton("确定", (dialogInterface, i) -> mWebView.loadUrl("http://"+textView.getText().toString())) | ||||
| .create(); | .create(); | ||||
| mWebView.loadUrl("http://www.baidu.com"); | mWebView.loadUrl("http://www.baidu.com"); | ||||
| sensorManagerHelper = new SensorManagerHelper(this); | sensorManagerHelper = new SensorManagerHelper(this); | ||||
| sensorManagerHelper.setOnShakeListener(alertDialog::show); | sensorManagerHelper.setOnShakeListener(alertDialog::show); | ||||
| } | } | ||||
| @@ -1,15 +1,22 @@ | |||||
| package com.nsgk.ruralWeb; | package com.nsgk.ruralWeb; | ||||
| import android.animation.Animator; | |||||
| import android.animation.AnimatorListenerAdapter; | |||||
| import android.annotation.SuppressLint; | import android.annotation.SuppressLint; | ||||
| import android.content.Intent; | import android.content.Intent; | ||||
| import android.os.Bundle; | import android.os.Bundle; | ||||
| import android.os.Handler; | import android.os.Handler; | ||||
| import android.os.Message; | import android.os.Message; | ||||
| import android.view.animation.Animation; | |||||
| import android.view.animation.AnimationUtils; | |||||
| import android.view.animation.AnticipateInterpolator; | |||||
| import android.widget.ImageView; | |||||
| import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
| import androidx.appcompat.app.AppCompatActivity; | import androidx.appcompat.app.AppCompatActivity; | ||||
| public class WelcomeActivity extends AppCompatActivity { | public class WelcomeActivity extends AppCompatActivity { | ||||
| private ImageView imageView; | |||||
| private Handler handler = new Handler() { | private Handler handler = new Handler() { | ||||
| @SuppressLint("HandlerLeak") | @SuppressLint("HandlerLeak") | ||||
| @@ -22,7 +29,10 @@ public class WelcomeActivity extends AppCompatActivity { | |||||
| Intent intent = new Intent(WelcomeActivity.this, FullscreenActivity.class); | Intent intent = new Intent(WelcomeActivity.this, FullscreenActivity.class); | ||||
| intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | ||||
| startActivity(intent); | startActivity(intent); | ||||
| overridePendingTransition(R.anim.activity_in, R.anim.activity_out); | |||||
| break; | break; | ||||
| default: | |||||
| throw new IllegalStateException("Unexpected value: " + msg.what); | |||||
| } | } | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -31,13 +41,19 @@ public class WelcomeActivity extends AppCompatActivity { | |||||
| protected void onCreate(Bundle savedInstanceState) { | protected void onCreate(Bundle savedInstanceState) { | ||||
| super.onCreate(savedInstanceState); | super.onCreate(savedInstanceState); | ||||
| this.setContentView(R.layout.activity_welcome); | this.setContentView(R.layout.activity_welcome); | ||||
| handler.postDelayed(new Runnable() { | |||||
| @Override | |||||
| public void run() { | |||||
| handler.sendEmptyMessage(1); | |||||
| } | |||||
| }, 3000); | |||||
| imageView = findViewById(R.id.imageView); | |||||
| Animation animation = AnimationUtils.loadAnimation(this, R.anim.img_anim); | |||||
| animation.start(); | |||||
| imageView.animate() | |||||
| .scaleXBy(1.5f) | |||||
| .scaleYBy(1.5f) | |||||
| .setInterpolator(new AnticipateInterpolator()) | |||||
| .setDuration(2000) | |||||
| .setListener(new AnimatorListenerAdapter() { | |||||
| @Override | |||||
| public void onAnimationEnd(Animator animation) { | |||||
| handler.sendEmptyMessage(1); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,8 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| android:duration="100"> | |||||
| <alpha | |||||
| android:fromAlpha="0" | |||||
| android:toAlpha="100" /> | |||||
| </set> | |||||
| @@ -0,0 +1,7 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <set xmlns:android="http://schemas.android.com/apk/res/android"> | |||||
| <alpha | |||||
| android:fromAlpha="100" | |||||
| android:toAlpha="0" /> | |||||
| </set> | |||||
| @@ -0,0 +1,11 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <set xmlns:android="http://schemas.android.com/apk/res/android"> | |||||
| <scale | |||||
| android:fromXScale="50%" | |||||
| android:fromYScale="50%" | |||||
| android:pivotX="0" | |||||
| android:pivotY="0" | |||||
| android:toXScale="100%" | |||||
| android:toYScale="100%" /> | |||||
| </set> | |||||
| @@ -0,0 +1,5 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <set> | |||||
| </set> | |||||
| @@ -1,5 +1,5 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
| <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| xmlns:tools="http://schemas.android.com/tools" | xmlns:tools="http://schemas.android.com/tools" | ||||
| android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
| android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
| @@ -10,6 +10,7 @@ | |||||
| <WebView | <WebView | ||||
| android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
| android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
| android:id="@+id/mWebView"/> | |||||
| android:id="@+id/mWebView" /> | |||||
| </FrameLayout> | |||||
| </RelativeLayout> | |||||
| @@ -1,9 +1,15 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| android:orientation="vertical" | android:orientation="vertical" | ||||
| android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
| android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
| android:background="@color/white" | android:background="@color/white" | ||||
| android:theme="@style/ThemeOverlay.Nsgk_rural_web.FullscreenContainer"> | android:theme="@style/ThemeOverlay.Nsgk_rural_web.FullscreenContainer"> | ||||
| </LinearLayout> | |||||
| <ImageView | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_centerInParent="true" | |||||
| android:id="@+id/imageView" | |||||
| android:src="@mipmap/ic_launcher" /> | |||||
| </RelativeLayout> | |||||