diff --git a/README.md b/README.md index d9d7ab59d..3478e7244 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,32 @@ One thing to note is that all image resources reference to **native** resource b You may have noticed that ThemedBrowser added an optional menu as well as custom buttons, which you can utilize to respond to some simple user actions. +Import Native Images +-------------------- + +If you are a native developer and are already aware how to import native image resources, feel free to skip this section. Otherwise, here are some tips. First of all, your native iOS and Android projects are located at: + + /platforms/ios + /platforms/android + +Let's start with Android, which is quite straightforward. Prepare your images for all of the pixel densities that you'd like to support. [Here is a documentation](http://developer.android.com/guide/practices/screens_support.html) that explains this concept. The gist is that on higher pixel density screens, your images will have to have higher resolution in order to look sharp on an actual device, so you want to prepare multiple files for the same image at different resolutions for their respective pixel density. In Android, there are a lot of densities due to diversity of devices, so you have to decide which ones you want to support. Fortunately if you don't have an image for a particular pixel density, Android will automatically pick up the closest one and try to down scale or up scale it. Of course this process is not very efficient, so you have to make your decisions. The directory where you want to place your images are under + + /platforms/android/res + +Notice how there are multiple folders named `drawble-.*`. Each file for the same image should be named the same, but it will need to be moved under the correct directory with respect to its target density. eg. If `icon.png` is intended for xhdpi, then it needs to go under `drawable-xhdpi` directory. In your JavaScript config, you can then reference to this iamge without extension. eg. With the previous example, simply `icon` will suffice. + +To import image resources for iOS, it is slightly trickier, because you **have** to register your file in Xcode project file with help from Xcode, and there are two ways of doing this. Let's start with the old school way. iOS also shares similar concept with Android in terms of pixel density. iPhone to iPhone 3GS uses 1x the resolution, iPhone 4 to iPhone 6 uses 2x the resolution while iPhone 6 Plus and above uses 3x the resolution (even though it's actually down scaled, but that's a different discussion). In the old school way, you have to name your images with `@1x`, `@2x`, and `@3x` suffix with respect to their target density. eg. `icon@2x.png`. [Here is a documentation](https://developer.apple.com/library/ios/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/SupportingHiResScreensInViews/SupportingHiResScreensInViews.html) that explains this concept. You then have to move it under + + /platforms/ios//Resources + +Then open your native iOS project with Xcode by double clicking on + + /platforms/ios/.xcodeproj + +In the left hand side panel, make sure you are in Project navigator tab. Then you can see a list of directories under your project. One of them being `Resources`, but you don't see your newly added images there. Now you need to drag your images fron Finder to Xcode and drop it under `Resource` folder. In your JavaScript config, you can then reference to them without suffix or extension. eg. With the previous example, simply `icon` will suffice. + +The new school way is to use [Asset Catalog](https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/Recipe.html). This is the recommended technique from Xcode 5+ and iOS 7+. It gives you better management of all of your image resources. ie. No more suffix, and you can see all your images for different densities in one table etc. However there are more steps involved to set it up. Please reference to [this guide](http://www.intertech.com/Blog/xcode-assets-xcassets/) for a step by step walkthrough. + FAQ --- diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 6ced110a8..56c57b1d2 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -21,6 +21,11 @@ Release Notes ============= +0.2.1 +===== + +Debug and stablization. + 0.2.0 ===== diff --git a/package.json b/package.json index 891eb8761..5c6d80841 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-themeablebrowser", - "version": "0.2.0", + "version": "0.2.1", "description": "Cordova ThemeableBrowser Plugin", "cordova": { "id": "com.initialxy.cordova.themeablebrowser", diff --git a/plugin.xml b/plugin.xml index 25ce83fce..c5efd22a1 100644 --- a/plugin.xml +++ b/plugin.xml @@ -20,7 +20,7 @@ + version="0.2.1"> ThemeableBrowser Cordova ThemeableBrowser Plugin diff --git a/src/ios/CDVThemeableBrowser.m b/src/ios/CDVThemeableBrowser.m index cbb565d01..fbe68f6f4 100644 --- a/src/ios/CDVThemeableBrowser.m +++ b/src/ios/CDVThemeableBrowser.m @@ -1184,10 +1184,14 @@ - (void)webViewDidStartLoad:(UIWebView*)theWebView // loading url, start spinner, update back/forward self.addressLabel.text = NSLocalizedString(@"Loading...", nil); - if (!_browserOptions.backButtonCanClose && self.backButton) { - self.backButton.enabled = theWebView.canGoBack; + if (self.backButton) { + self.backButton.enabled + = _browserOptions.backButtonCanClose || theWebView.canGoBack; } - self.forwardButton.enabled = theWebView.canGoForward; + + if (self.forwardButton) { + self.forwardButton.enabled = theWebView.canGoForward; + } [self.spinner startAnimating]; @@ -1209,10 +1213,15 @@ - (void)webViewDidFinishLoad:(UIWebView*)theWebView // update url, stop spinner, update back/forward self.addressLabel.text = [self.currentURL absoluteString]; - if (!_browserOptions.backButtonCanClose && self.backButton) { - self.backButton.enabled = theWebView.canGoBack; + if (self.backButton) { + self.backButton.enabled + = _browserOptions.backButtonCanClose || theWebView.canGoBack; } - self.forwardButton.enabled = theWebView.canGoForward; + + if (self.forwardButton) { + self.forwardButton.enabled = theWebView.canGoForward; + } + if (self.titleLabel && _browserOptions.title && !_browserOptions.title[kThemeableBrowserPropStaticText] && [self getBoolFromDict:_browserOptions.title withKey:kThemeableBrowserPropShowPageTitle]) { @@ -1247,10 +1256,15 @@ - (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error // log fail message, stop spinner, update back/forward NSLog(@"webView:didFailLoadWithError - %ld: %@", (long)error.code, [error localizedDescription]); - if (!_browserOptions.backButtonCanClose && self.backButton) { - self.backButton.enabled = theWebView.canGoBack; + if (self.backButton) { + self.backButton.enabled + = _browserOptions.backButtonCanClose || theWebView.canGoBack; } - self.forwardButton.enabled = theWebView.canGoForward; + + if (self.forwardButton) { + self.forwardButton.enabled = theWebView.canGoForward; + } + [self.spinner stopAnimating]; self.addressLabel.text = NSLocalizedString(@"Load Error", nil);