Skip to content

Commit

Permalink
change welcome
Browse files Browse the repository at this point in the history
  • Loading branch information
YanInfo committed Apr 28, 2019
1 parent 6dfd62d commit 31311ba
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
31 changes: 19 additions & 12 deletions app/src/main/java/com/example/xie/ui/WelcomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.xie.R;

import java.util.ArrayList;

import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;

/**
* 欢迎页面
*/
public class WelcomeActivity extends Activity {

private static boolean isPermissionRequested = false;
Expand All @@ -31,11 +27,15 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
requestPermission();
final LinearLayout tv_lin = (LinearLayout) findViewById(R.id.text_lin);//要显示的字体
final LinearLayout tv_hide_lin = (LinearLayout) findViewById(R.id.text_hide_lin);//所谓的布
ImageView logo = (ImageView) findViewById(R.id.image);//图片
// 要显示的字体
final LinearLayout tv_lin = findViewById(R.id.text_lin);
// 所谓的布
final LinearLayout tv_hide_lin = findViewById(R.id.text_hide_lin);
// 图片
ImageView logo = findViewById(R.id.image);
Animation animation = AnimationUtils.loadAnimation(this, R.anim.splash);
logo.startAnimation(animation);//开始执行动画
logo.startAnimation(animation);
// 动画监听
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
Expand All @@ -44,7 +44,7 @@ public void onAnimationStart(Animation animation) {

@Override
public void onAnimationEnd(Animation animation) {
//第一个动画执行完后执行第二个动画就是那个字体显示那部分
//第一个动画执行完后执行,第二个动画对应那个字体显示那部分
animation = AnimationUtils.loadAnimation(WelcomeActivity.this, R.anim.text_splash_position);
tv_lin.startAnimation(animation);
animation = AnimationUtils.loadAnimation(WelcomeActivity.this, R.anim.text_canvas);
Expand All @@ -55,6 +55,10 @@ public void onAnimationStart(Animation animation) {

}

/**
* 两个动画都完成时,跳转到起始页面
* @param animation
*/
@Override
public void onAnimationEnd(Animation animation) {
Intent intent = new Intent(WelcomeActivity.this, IndexActivity.class);
Expand All @@ -81,6 +85,9 @@ protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}

/**
* 请求权限
*/
private void requestPermission() {
if (Build.VERSION.SDK_INT >= 23 && !isPermissionRequested) {

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_welcome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/main_color"
android:orientation="vertical">

<LinearLayout
android:id="@+id/text_lin"
android:layout_width="wrap_content"
Expand Down Expand Up @@ -67,5 +68,5 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="@mipmap/map_icon" />
android:src="@mipmap/launcher" />
</RelativeLayout>
Binary file removed app/src/main/res/mipmap-xhdpi/map_icon.png
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<resources>
<string name="app_name">掌上地图</string>
<string name="app_name">地图</string>
<string name="introduce">Based on BaiduMap</string>
<string name="skip">秒跳转</string>
<string name="cancel">跳过</string>
Expand Down

0 comments on commit 31311ba

Please sign in to comment.