SherVegas 3 лет назад
Родитель
Сommit
6884242024
8 измененных файлов: 68 добавлений и 14 удалений
  1. +1
    -1
      app/src/main/java/com/nsgk/ruralWeb/FullscreenActivity.java
  2. +24
    -8
      app/src/main/java/com/nsgk/ruralWeb/WelcomeActivity.java
  3. +8
    -0
      app/src/main/res/anim/activity_in.xml
  4. +7
    -0
      app/src/main/res/anim/activity_out.xml
  5. +11
    -0
      app/src/main/res/anim/img_anim.xml
  6. +5
    -0
      app/src/main/res/animator/img_aminator.xml
  7. +4
    -3
      app/src/main/res/layout/activity_fullscreen.xml
  8. +8
    -2
      app/src/main/res/layout/activity_welcome.xml

+ 1
- 1
app/src/main/java/com/nsgk/ruralWeb/FullscreenActivity.java Просмотреть файл

@@ -47,8 +47,8 @@ public class FullscreenActivity extends AppCompatActivity {
.setPositiveButton("确定", (dialogInterface, i) -> mWebView.loadUrl("http://"+textView.getText().toString()))
.create();


mWebView.loadUrl("http://www.baidu.com");

sensorManagerHelper = new SensorManagerHelper(this);
sensorManagerHelper.setOnShakeListener(alertDialog::show);
}


+ 24
- 8
app/src/main/java/com/nsgk/ruralWeb/WelcomeActivity.java Просмотреть файл

@@ -1,15 +1,22 @@
package com.nsgk.ruralWeb;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
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.appcompat.app.AppCompatActivity;

public class WelcomeActivity extends AppCompatActivity {
private ImageView imageView;

private Handler handler = new Handler() {
@SuppressLint("HandlerLeak")
@@ -22,7 +29,10 @@ public class WelcomeActivity extends AppCompatActivity {
Intent intent = new Intent(WelcomeActivity.this, FullscreenActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
break;
default:
throw new IllegalStateException("Unexpected value: " + msg.what);
}
}
};
@@ -31,13 +41,19 @@ public class WelcomeActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
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);
}
});
}
}

+ 8
- 0
app/src/main/res/anim/activity_in.xml Просмотреть файл

@@ -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>

+ 7
- 0
app/src/main/res/anim/activity_out.xml Просмотреть файл

@@ -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>

+ 11
- 0
app/src/main/res/anim/img_anim.xml Просмотреть файл

@@ -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>

+ 5
- 0
app/src/main/res/animator/img_aminator.xml Просмотреть файл

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<set>


</set>

+ 4
- 3
app/src/main/res/layout/activity_fullscreen.xml Просмотреть файл

@@ -1,5 +1,5 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -10,6 +10,7 @@
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mWebView"/>
android:id="@+id/mWebView" />

</FrameLayout>

</RelativeLayout>

+ 8
- 2
app/src/main/res/layout/activity_welcome.xml Просмотреть файл

@@ -1,9 +1,15 @@
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
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>

Загрузка…
Отмена
Сохранить