Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Bug fix for fixed navbar (1.5.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
indywidualny committed Apr 28, 2015
1 parent e19de27 commit f5d17b7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
Binary file modified app/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "org.indywidualni.fblite"
minSdkVersion 14
targetSdkVersion 22
versionCode 4
versionName "1.5.0"
versionCode 5
versionName "1.5.1"
}
buildTypes {
release {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.indywidualni.fblite"
android:versionCode="4"
android:versionName="1.5.0" >
android:versionCode="5"
android:versionName="1.5.1" >

<uses-sdk
android:minSdkVersion="14"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ public class MyAppWebViewClient extends WebViewClient {
// get shared preferences
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);

// get window's needed height
private static final float density = context.getResources().getDisplayMetrics().density;
private static final float height = (context.getResources().getDisplayMetrics().heightPixels - 48) / density - 44;

// convert css file to string only one time
private static String cssFile;
private static final String cssFixed = "#header{ position: fixed !important; z-index: 500; top: 0px; } #root{ padding-top: 44px; }";
private static final String cssFixed = "#header{ position: fixed; z-index: 11; top: 0px; } #root{ padding-top: 44px; } .flyout{ max-height: " + height + "px; overflow-y: scroll; }";

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Expand Down Expand Up @@ -57,14 +61,14 @@ public void onPageFinished(WebView view, String url) {
cssFile = readRawTextFile(context, R.raw.black);
view.loadUrl("javascript:function addStyleString(str) { var node = document.createElement('style'); node.innerHTML = str; document.body.appendChild(node); } addStyleString('" + cssFile + "');");
}
// apply extra bottom padding for transparent navigation
if (preferences.getBoolean("transparent_nav", false)) {
view.loadUrl("javascript:function addStyleString(str) { var node = document.createElement('style'); node.innerHTML = str; document.body.appendChild(node); } addStyleString('body{ padding-bottom: 48px; }');");
}
// blue navigation bar always on top
if (preferences.getBoolean("fixed_nav", false)) {
view.loadUrl("javascript:function addStyleString(str) { var node = document.createElement('style'); node.innerHTML = str; document.body.appendChild(node); } addStyleString('" + cssFixed + "');");
}
// apply extra bottom padding for transparent navigation
if (preferences.getBoolean("transparent_nav", false)) {
view.loadUrl("javascript:function addStyleString(str) { var node = document.createElement('style'); node.innerHTML = str; document.body.appendChild(node); } addStyleString('body{ padding-bottom: 48px; }');");
}
}

// read raw files to string (for css files)
Expand Down

0 comments on commit f5d17b7

Please sign in to comment.