新增地图展示功能

master
FinalJcsp 2 years ago
parent 6ec43d1783
commit 43f22d2784

@ -46,6 +46,9 @@
<activity <activity
android:name="com.example.androidtermwork.video.PersonActivity" android:name="com.example.androidtermwork.video.PersonActivity"
android:exported="false" /> android:exported="false" />
<activity
android:name="com.example.androidtermwork.video.MapActivity"
android:exported="false" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:theme="@style/RedTheme" /> android:theme="@style/RedTheme" />

@ -35,6 +35,7 @@ import android.widget.Toast;
import com.example.androidtermwork.util.StatusBarUtil; import com.example.androidtermwork.util.StatusBarUtil;
import com.example.androidtermwork.video.MainActivityVideo; import com.example.androidtermwork.video.MainActivityVideo;
import com.example.androidtermwork.video.MapActivity;
@RequiresApi(api = Build.VERSION_CODES.M) @RequiresApi(api = Build.VERSION_CODES.M)
public class LoginPage extends AppCompatActivity { public class LoginPage extends AppCompatActivity {
@ -74,6 +75,7 @@ public class LoginPage extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_page); setContentView(R.layout.activity_login_page);
OnButtonToStory();
//登录 //登录
OnButtonToLogin(); OnButtonToLogin();
//注册 //注册
@ -230,6 +232,17 @@ public class LoginPage extends AppCompatActivity {
}); });
} }
public void OnButtonToStory() {
Button regis = findViewById(R.id.story);
regis.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(LoginPage.this, MapActivity.class);
startActivity(intent);
}
});
}
//初始化页面底部可点击文本 //初始化页面底部可点击文本
public void initView() { public void initView() {

@ -0,0 +1,48 @@
package com.example.androidtermwork.video;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.ViewStub;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.LinearLayout;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import com.example.androidtermwork.LoginPage;
import com.example.androidtermwork.R;
import com.example.androidtermwork.RegisterFirstPage;
public class MapActivity extends AppCompatActivity {
private WebView webView;
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
webView = findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://www.amap.com/");
OnButtonToStory();
}
public void OnButtonToStory() {
Button regis = findViewById(R.id.story);
regis.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LinearLayout container = findViewById(R.id.rightLayout);
ViewStub stub = findViewById(R.id.stub);
stub.inflate();
regis.setVisibility(View.INVISIBLE);
}
});
}
}

@ -97,6 +97,12 @@
android:layout_below="@id/register" android:layout_below="@id/register"
android:text="免登录学习" /> android:text="免登录学习" />
<Button
android:id="@+id/story"
style="@style/button_register"
android:layout_below="@id/video"
android:text="获取当地红色故事" />
</RelativeLayout> </RelativeLayout>
<LinearLayout <LinearLayout

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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">
<LinearLayout
android:id="@+id/rightLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:gravity="center"
android:orientation="vertical"
tools:ignore="MissingConstraints,WebViewLayout">
<WebView
android:id="@+id/webview"
android:layout_width="450dp"
android:layout_height="400dp" />
<ViewStub
android:id="@+id/stub"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout="@layout/activity_map_bottom" />
<Button
android:id="@+id/story"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:text="点击获取当地红色故事">
</Button>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,51 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:id="@+id/article_card_1"
app:cardCornerRadius="8dp"
app:cardElevation="4dp"
app:cardMaxElevation="8dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
app:contentPadding="8dp"
tools:ignore="ExtraText,MissingConstraints"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/article_title_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="你当前定位在湖南常德"
android:textColor="@color/title_text"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/article_content_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="1927年11月中旬共产党员徐才益、周维城等人在县境栖凤乡杀掉当地税吏首举武装起义大旗。同时张褀等人在中和乡青龙寺宣布举兵。接着两支队伍汇聚在中和乡青龙寺点燃了青龙寺起义的烽火。革命的旗帜在青龙寺高高飘扬。"
android:textColor="@color/content_text" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -25,7 +25,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="50dp" android:layout_marginStart="50dp"
android:textSize="30dp" android:textSize="30dp"
android:text="广告位招租" android:text="划过头了"
android:textColor="#000000" android:textColor="#000000"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
</LinearLayout> </LinearLayout>

Loading…
Cancel
Save