This commit is contained in:
2025-07-29 14:54:53 +08:00
parent ea70700f44
commit c22fccc96e
7 changed files with 87 additions and 6 deletions

View File

@@ -108,7 +108,7 @@ public class MainActivity extends AppCompatActivity implements ImagePickerListen
// Passing each menu ID as a set of Ids because each // Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations. // menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder( mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_gallery, R.id.nav_music,R.id.nav_pixiv, R.id.nav_slideshow) R.id.nav_home, R.id.nav_gallery, R.id.nav_music,R.id.nav_pixiv, R.id.nav_slideshow,R.id.nav_earth)
.setOpenableLayout(drawer) .setOpenableLayout(drawer)
.build(); .build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main); NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
@@ -257,6 +257,7 @@ public class MainActivity extends AppCompatActivity implements ImagePickerListen
return true; return true;
}); });
return false; return false;
} }
private LatLng selectedLatLng = null; private LatLng selectedLatLng = null;

View File

@@ -0,0 +1,52 @@
package org.astral.findmaimaiultra.ui.earth;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import org.astral.findmaimaiultra.databinding.FragmentWebviewBinding;
public class EarthFragment extends Fragment {
private FragmentWebviewBinding binding;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 获取 SharedPreferences 实例
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
binding = FragmentWebviewBinding.inflate(inflater, container, false);
View root = binding.getRoot();
WebView webView = binding.webView;
WebSettings webSettings = webView.getSettings();
webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
webSettings.setDatabaseEnabled(true);
String databasePath = requireContext().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
webSettings.setDatabasePath(databasePath);
webSettings.setDomStorageEnabled(true);
webSettings.setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
// 页面加载完成后执行某些操作
super.onPageFinished(view, url);
}
});
webView.loadUrl("https://www.godserver.cn/earth?lo=116.404&la=39.915");
return root;
}
}

View File

@@ -57,6 +57,7 @@
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchBeta1" android:id="@+id/switchBeta1"
android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/textcolorPrimary" android:textColor="@color/textcolorPrimary"
@@ -107,6 +108,8 @@
android:layout_marginTop="16dp"/> android:layout_marginTop="16dp"/>
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="16dp" android:paddingTop="16dp"
@@ -124,6 +127,8 @@
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="16dp" android:paddingTop="16dp"
@@ -138,6 +143,8 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="16dp" android:paddingTop="16dp"
@@ -263,6 +270,7 @@
<TextView android:layout_width="wrap_content" android:textColor="@color/textcolorPrimary" <TextView android:layout_width="wrap_content" android:textColor="@color/textcolorPrimary"
android:layout_height="wrap_content" android:textSize="16dp" android:id="@+id/vits" /> android:layout_height="wrap_content" android:textSize="16dp" android:id="@+id/vits" />
<WebView android:layout_width="match_parent" android:layout_height="600dp" android:id="@+id/develop" <WebView android:layout_width="match_parent" android:layout_height="600dp" android:id="@+id/develop"
android:visibility="gone"
tools:ignore="WebViewLayout"/> tools:ignore="WebViewLayout"/>
</LinearLayout> </LinearLayout>

View File

@@ -0,0 +1,11 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.earth.EarthFragment">
<WebView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/webView"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -19,5 +19,8 @@
<item <item
android:id="@+id/nav_slideshow" android:id="@+id/nav_slideshow"
android:title="@string/menu_slideshow"/> android:title="@string/menu_slideshow"/>
<item
android:id="@+id/nav_earth"
android:title="@string/menu_earth"/>
</group> </group>
</menu> </menu>

View File

@@ -21,14 +21,19 @@
android:name="org.astral.findmaimaiultra.ui.music.MusicFragment" android:name="org.astral.findmaimaiultra.ui.music.MusicFragment"
android:label="@string/menu_music" android:label="@string/menu_music"
tools:layout="@layout/fragment_music"/> tools:layout="@layout/fragment_music"/>
<fragment <!-- <fragment-->
android:id="@+id/nav_pixiv" <!-- android:id="@+id/nav_pixiv"-->
android:name="org.astral.findmaimaiultra.ui.pixiv.PixivFragment" <!-- android:name="org.astral.findmaimaiultra.ui.pixiv.PixivFragment"-->
android:label="@string/menu_pixiv" <!-- android:label="@string/menu_pixiv"-->
tools:layout="@layout/fragment_pixiv"/> <!-- tools:layout="@layout/fragment_pixiv"/>-->
<fragment <fragment
android:id="@+id/nav_slideshow" android:id="@+id/nav_slideshow"
android:name="org.astral.findmaimaiultra.ui.slideshow.SlideshowFragment" android:name="org.astral.findmaimaiultra.ui.slideshow.SlideshowFragment"
android:label="@string/menu_slideshow" android:label="@string/menu_slideshow"
tools:layout="@layout/fragment_slideshow"/> tools:layout="@layout/fragment_slideshow"/>
<fragment
android:id="@+id/nav_earth"
android:name="org.astral.findmaimaiultra.ui.earth.EarthFragment"
android:label="@string/menu_earth"
tools:layout="@layout/fragment_webview"/>
</navigation> </navigation>

View File

@@ -40,6 +40,7 @@
<string name="nav_header_subtitle">Reisa</string> <string name="nav_header_subtitle">Reisa</string>
<string name="action_settings">设置</string> <string name="action_settings">设置</string>
<string name="menu_pixiv">Engine</string> <string name="menu_pixiv">Engine</string>
<string name="menu_earth">全球地图</string>
</resources> </resources>