添加引导页

This commit is contained in:
wangdongsheng 2021-08-23 18:26:42 +08:00
parent 7a68019c7f
commit 70485e5823
8 changed files with 139 additions and 27 deletions

View File

@ -95,7 +95,9 @@
<activity
android:name=".activity.UserActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.GuidanceActivity"
android:screenOrientation="portrait" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.navinfo.outdoor.fileprovider"

View File

@ -0,0 +1,68 @@
package com.navinfo.outdoor.activity;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.base.BaseActivity;
/**
* 引导页
*/
public class GuidanceActivity extends BaseActivity {
private FrameLayout frameLayout;
@Override
protected int getLayout() {
return R.layout.activity_guidance;
}
@Override
protected void initView() {
super.initView();
frameLayout = findViewById(R.id.layout_frame);
}
@Override
protected void initData() {
super.initData();
View firstItem = LayoutInflater.from(this).inflate(R.layout.guidance_first_item, null);
View secondItem = LayoutInflater.from(this).inflate(R.layout.guidance_second_item, null);
View thirdItem = LayoutInflater.from(this).inflate(R.layout.guidance_third_item, null);
frameLayout.addView(firstItem);
firstItem.findViewById(R.id.btn_icon).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
frameLayout.removeView(firstItem);
frameLayout.addView(secondItem);
}
});
secondItem.findViewById(R.id.btn_icon).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
frameLayout.removeView(secondItem);
frameLayout.addView(thirdItem);
}
});
thirdItem.findViewById(R.id.btn_icon).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(GuidanceActivity.this, HomeActivity.class);
startActivity(intent);
finish();
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
frameLayout.removeAllViews();
}
}

View File

@ -239,7 +239,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
}
navInfoEditor.commit();
}
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
Intent intent = new Intent(LoginActivity.this, GuidanceActivity.class);
startActivity(intent);
finish();
}else {

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:paddingTop="20dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/ic_baseline_arrow"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="15dp"
android:id="@+id/activity_area_finish"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="任务说明"
android:textSize="16sp"
android:textColor="@color/colorBack"
app:layout_constraintTop_toTopOf="@id/activity_area_finish"
app:layout_constraintBottom_toBottomOf="@id/activity_area_finish"
app:layout_constraintLeft_toRightOf="@id/activity_area_finish"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/layout_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="@drawable/bg"
android:layout_height="match_parent">
<Button
android:id="@+id/btn_icon"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="第一页"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="@color/dialogBkgDark"
android:layout_height="match_parent">
<Button
android:id="@+id/btn_icon"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="第二页"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="@color/bgColor_overlay"
android:layout_height="match_parent">
<Button
android:id="@+id/btn_icon"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="最后一页"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>