capacitor-navigationbar's People
capacitor-navigationbar's Issues
Plugin not installed by itself
Maybe I misunderstood this plugin, but after following all the installations steps from the README, I got an error from Android Studio stating that com.nikosdouvlis.navigationbar was missing. In fact after searching in java/main/
directory I was not able to see any tracks of the NavigationBar.java
class myself like if it was not copied anywhere in the project.
So far I created my own NavigationBar.java
class manually and imported it in my MainActivity.java
file and it works fine.
Maybe there are other steps to follow for the relevant class to be copied automatically ?
Full screen mode
Does this plugin allow to use the space around status bar to allow app to span behind the status bar? Currently status bar section in capacitor is just black making the app look weird compared to iOS which leverages navigation bar and status bar.
Capacitor 3 Support
The Capacitor 3 RC is out! ๐ This library should support the new version
Follow the plugin upgrade guide here: https://capacitorjs.com/docs/v3/updating/plugins/3-0
Consider setting the system UI visibility as well
Since the window.setNavigationBarColor
only sets the background color of the navigation bar, the navigation buttons will be hard to see if the background color is close to white. Consider setting the View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
flag to make the buttons visible when the background color is light.
@NativePlugin()
public class NavigationBar extends com.nikosdouvlis.navigationbar.NavigationBar {
@Override
@PluginMethod()
public void setBackgroundColor(PluginCall call) {
String color = call.getString("color");
try {
final int parsedColor = Color.parseColor(color);
final Window window = ((Activity) getContext()).getWindow();
final boolean isLight = ColorUtils.calculateLuminance(parsedColor) > 0.5;
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
View decorView = window.getDecorView();
int visibilityFlags = decorView.getSystemUiVisibility();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
if (isLight) {
decorView.setSystemUiVisibility(visibilityFlags | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
} else {
decorView.setSystemUiVisibility(visibilityFlags & ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
}
}
}
});
} catch (Exception e) {
call.error(e.toString());
}
super.setBackgroundColor(call);
}
}
You may refer to this post on how to check a color is light:
https://stackoverflow.com/questions/24260853/check-if-color-is-dark-or-light-in-android
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.