mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
feat(navigation): integrate capgo capacitor navigation bar plugin
This commit is contained in:
@@ -22,6 +22,7 @@ dependencies {
|
||||
implementation project(':capacitor-share')
|
||||
implementation project(':capacitor-splash-screen')
|
||||
implementation project(':capacitor-status-bar')
|
||||
implementation project(':capgo-capacitor-navigation-bar')
|
||||
implementation project(':send-intent')
|
||||
implementation project(':jcesarmobile-ssl-skip')
|
||||
|
||||
|
||||
@@ -51,6 +51,10 @@
|
||||
"pkg": "@capacitor/status-bar",
|
||||
"classpath": "com.capacitorjs.plugins.statusbar.StatusBarPlugin"
|
||||
},
|
||||
{
|
||||
"pkg": "@capgo/capacitor-navigation-bar",
|
||||
"classpath": "ee.forgr.capacitor_navigation_bar.NavigationBarPlugin"
|
||||
},
|
||||
{
|
||||
"pkg": "send-intent",
|
||||
"classpath": "de.mindlib.sendIntent.SendIntent"
|
||||
|
||||
@@ -8,12 +8,15 @@ import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.getcapacitor.PluginCall;
|
||||
import com.getcapacitor.JSObject;
|
||||
import com.getcapacitor.BridgeActivity;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import ee.forgr.capacitor_navigation_bar.NavigationBarPlugin;
|
||||
|
||||
public class MainActivity extends BridgeActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -26,7 +29,7 @@ public class MainActivity extends BridgeActivity {
|
||||
webView.getSettings().setUseWideViewPort(true);
|
||||
webView.getSettings().setLoadWithOverviewMode(true);
|
||||
|
||||
setNavigationBarColorBasedOnTheme();
|
||||
// initNavigationBarBgColor();
|
||||
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
@@ -41,6 +44,15 @@ public class MainActivity extends BridgeActivity {
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
public void initNavigationBarBgColor() {
|
||||
NavigationBarPlugin navigationBarPlugin = new NavigationBarPlugin();
|
||||
JSObject data = new JSObject();
|
||||
data.put("color", "transparent");
|
||||
|
||||
PluginCall call = new PluginCall(null, null, null, "t", data);
|
||||
navigationBarPlugin.setNavigationBarColor(call);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
overridePendingTransition(0, R.anim.byebye);
|
||||
@@ -62,22 +74,4 @@ public class MainActivity extends BridgeActivity {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void setNavigationBarColorBasedOnTheme() {
|
||||
Window window = getWindow();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // API 26及以上支持
|
||||
// 根据主题选择颜色
|
||||
int navBarColor = isDarkMode()
|
||||
? getResources().getColor(R.color.colorPrimaryDark, getTheme())
|
||||
: getResources().getColor(R.color.colorPrimary, getTheme());
|
||||
|
||||
// 设置导航栏颜色
|
||||
window.setNavigationBarColor(navBarColor);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDarkMode() {
|
||||
int nightModeFlags = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
return nightModeFlags == Configuration.UI_MODE_NIGHT_YES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capa
|
||||
include ':capacitor-status-bar'
|
||||
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android')
|
||||
|
||||
include ':capgo-capacitor-navigation-bar'
|
||||
project(':capgo-capacitor-navigation-bar').projectDir = new File('../node_modules/@capgo/capacitor-navigation-bar/android')
|
||||
|
||||
include ':send-intent'
|
||||
project(':send-intent').projectDir = new File('../node_modules/send-intent/android')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user