存档
This commit is contained in:
@@ -108,7 +108,7 @@ public class MainActivity extends AppCompatActivity implements ImagePickerListen
|
||||
// Passing each menu ID as a set of Ids because each
|
||||
// menu should be considered as top level destinations.
|
||||
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)
|
||||
.build();
|
||||
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 false;
|
||||
}
|
||||
private LatLng selectedLatLng = null;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,7 @@
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/switchBeta1"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/textcolorPrimary"
|
||||
@@ -107,6 +108,8 @@
|
||||
android:layout_marginTop="16dp"/>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:visibility="gone"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
@@ -124,6 +127,8 @@
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:visibility="gone"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
@@ -138,6 +143,8 @@
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:visibility="gone"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
@@ -263,6 +270,7 @@
|
||||
<TextView android:layout_width="wrap_content" android:textColor="@color/textcolorPrimary"
|
||||
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"
|
||||
android:visibility="gone"
|
||||
tools:ignore="WebViewLayout"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
11
app/src/main/res/layout/fragment_webview.xml
Normal file
11
app/src/main/res/layout/fragment_webview.xml
Normal 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>
|
||||
@@ -19,5 +19,8 @@
|
||||
<item
|
||||
android:id="@+id/nav_slideshow"
|
||||
android:title="@string/menu_slideshow"/>
|
||||
<item
|
||||
android:id="@+id/nav_earth"
|
||||
android:title="@string/menu_earth"/>
|
||||
</group>
|
||||
</menu>
|
||||
@@ -21,14 +21,19 @@
|
||||
android:name="org.astral.findmaimaiultra.ui.music.MusicFragment"
|
||||
android:label="@string/menu_music"
|
||||
tools:layout="@layout/fragment_music"/>
|
||||
<fragment
|
||||
android:id="@+id/nav_pixiv"
|
||||
android:name="org.astral.findmaimaiultra.ui.pixiv.PixivFragment"
|
||||
android:label="@string/menu_pixiv"
|
||||
tools:layout="@layout/fragment_pixiv"/>
|
||||
<!-- <fragment-->
|
||||
<!-- android:id="@+id/nav_pixiv"-->
|
||||
<!-- android:name="org.astral.findmaimaiultra.ui.pixiv.PixivFragment"-->
|
||||
<!-- android:label="@string/menu_pixiv"-->
|
||||
<!-- tools:layout="@layout/fragment_pixiv"/>-->
|
||||
<fragment
|
||||
android:id="@+id/nav_slideshow"
|
||||
android:name="org.astral.findmaimaiultra.ui.slideshow.SlideshowFragment"
|
||||
android:label="@string/menu_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>
|
||||
@@ -40,6 +40,7 @@
|
||||
<string name="nav_header_subtitle">Reisa</string>
|
||||
<string name="action_settings">设置</string>
|
||||
<string name="menu_pixiv">Engine</string>
|
||||
<string name="menu_earth">全球地图</string>
|
||||
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user