How to port Iphone style app into Android? - iphone

first, please see the blog as the link showed below:
http://blogs.nitobi.com/joe/2008/10/17/phonegap-now-for-android/comment-page-1/#comment-12918
the author made iPhone Style app in Android emulator, the pic showed below:
http: blogs.nitobi.com/joe/wp-content/uploads/2008/10/droidgap.png
if anyone knows, Would you please tell me how to make the iphone sytle app in android, as the pic shows?
I checked the phonegap demo in the github, it's not the same as the picture showed in the blog.
I am so curious about how can make iphone style app in Android? Since it need the Iphone OS to display such effect. Would anyone please tell me how to make it?
so pity that the link doesn't work now: https: github.com/bowserj/gap/
your reply will be great appriciated.
the same question i asked can be found with link:
http: stackoverflow.com/questions/2786787/how-to-implement-iphone-titlebar-in-android
only to synic:
hi, synic, thanks to your great reply.
to your second note, because i find i didn't add a picture in my first question thread, but your suggestion is great.
to your example titlebar, the code is great, but i'd like to use opensource webapp-ui-framework like Phonegap, iqtouch, iui, which is more powerful and reusable, don't think so?
i can use iui or jqtouch, to make a fancy UI, by combining html into android's WebView api, but the problem is, i need use Safari to display the html, otherwise, it will not have the iPhone fancy tiltebar and the beautiful iPhone style, Safari has a engine to display such effect, which android OS may not have. So how can i find a library or jar file, which can subtitute this Safari engine and can be used in Android OS, Android emulator?
If there's no way, It's very pitiful and poor that Android UI developer had to create html with the standard iPhone style manualy , comparing to iPhone developer which can use existing iWebKit/iUi/jqtouch Webapp-UI-FrameWork, only to type simple tag such as titlebar leftnav, then the framework will to do the work to display the iPhone Style titlebar... OMG, too unfair.
If you suggest me to develop UI with Android API as you metioned above, yeah, it's ok to me, but it will make me uncomfortable that the Android api is so poor and inconvinient, leading much trouble, comparing with webapp-UI-framework i mentioned

The Android UI is very customizable.. it's kind of like HTML and CSS.
You can set a background image for every view, override the default images for every view, etc. He's probably just set custom background images for the layout at the top, and the buttons. It'd be pretty easy to do something like this.
An example titlebar, assuming you have the images:
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/iphone_titlebar">
<Button android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Main"
android:textColor="#fff"
android:background="#drawable/iphone_back" />
<TextView android:id="#+id/title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:textColor="#fff"
android:textStyle="bold"
android:text="Geo Location"/>
</LinearLayout>
Relevant links:
https://developer.android.com/guide/topics/ui/themes.html
https://developer.android.com/studio/write/draw9patch.html
On another note, it really just looks like he took a screenshot of something, and pasted it over a screenshot of the Android emulator. That whole image is weird as hell.
An another another note, if you already asked this question, why are you asking it again? It looks like someone already answered it. Did you not like his answer?

Related

Unity WebGL Mobile browser workaround and keyboard input fix?

Hey everyone so I read that unity doesn't really support mobile browsers for WebGL games. im using 2020.1.4.And sure enough, the game gets a bit distorted by not being scaled properly. it's like the camera is bigger so it shows on the screen that blue color. I tried some things, setting width and height to auto or removing config.devicePixelRatio = 1; as suggested by a friend but nope! still looks horrible! And if that wasn't enough the keyboard doesn't show up when clicking on form fields. i tried this one
https://github.com/eforerog/keyboardMobileWebGLUnity
which displayed an error when pressed on and this one
https://github.com/dantasulisses/WebMobileInputFix which just didn't even compile!
Any ideas, please?
I did my research and tried every plugin I could find. I used Unity 2020.3.28f1 and tested both on Android-phone and iPhone.Here is my report.
These plugins don't work:
https://unitylist.com/p/f58/Unity-webgl-inputfield
https://github.com/eforerog/keyboardMobileWebGLUnity
https://github.com/dantasulisses/WebMobileInputFix
This plugin works, but you should use different settings for IOS and Android on same input field game object. If you use "prompt", it works for IOS only, and "overlay" works for Android only. Look for documentation in page:
https://github.com/unity3d-jp/WebGLNativeInputField
And this plugin works best at the moment. Yes, it is a bit ugly though, but it works.
https://github.com/kou-yeung/WebGLInput
And there is a fix for Unity 2021 for it:
https://github.com/kou-yeung/WebGLInput/releases/tag/1.0
There's a keyboard that overlays, when using it you just need to tap the notification to access it and then click the "back" button to hide it https://play.google.com/store/apps/details?id=com.fishstix.gameboard
I made this project that simply recreates a keyboard using buttons in unity.
I implemented it in a WebGL build successfully.
https://github.com/thetimeste/WebGL-Build-Keyboard-Unity.git
I would recommend using the native js window.prompt() fields as of writing. They have great cross-platform support, allow for extra features like special characters, emojis, copy and paste etc. and are pretty easy to set up. Once (or honestly if ever) Unity adds their own reliable implementation you can easily remove this lightweight implementation.
Create a .jslib file that has a function opening a window.prompt(description, currentText)
Return the result at the end of that function back to a unity object with a recipient script
Make a derivation from Unity's event system overwriting the OnApplicationFocus(bool focus) function (leaving it empty), to fix a sneaky Chrome Android bug.
That's it. The result should look something like in this demo: https://pop.demo.neoludic.games
If you want to save some development time on a feature that really should just be native in Unity, you can also check out my plugin based on the method above. https://neoludic-games.itch.io/pop-input
I also need to enable mobile virtual keyboard for running webgl on mobile device.
I've tried the code from your mentioned url. It gives you some idea on how to do
it, but the code are totally buggy and unusable. Now I am trying to implement it
by myself.

How to add a TabbarController using phone gap for iPhone App

I am making a iPhone app using phone gap in that I want to add a tab bar Controller either using HTML or by using native components to it. Can anyone suggest to me how to do that.
If you are using phonegap/cordova versions 1.5+ you can create a native tabbar with this plugin: https://github.com/AndiDog/phonegap-ios-tabbar-plugin
Other phonegap/cordova plugins can be found here: https://github.com/phonegap/phonegap-plugins/tree/master/iOS
Here's a tutorial how to implement this: http://zsprawl.com/iOS/2012/03/using-the-native-tabbar-plugin-in-cordova/
This is of course the best approach. Other one would be to use a jQuery Mobile and create a HTML tabbar. This is a harder way because it will take time to style it properly and even then it would not fully act as a native tabbar.

phonegap ipad/iphone, have a single app on both devices

So I've been doing phonegap development for a while and have made a couple apps in the app store. I have made iphone and ipad apps and make them completely separate. I know apple allows for the submission of a single app that can be formatted for both devices, my question is how is this done with phonegap? I know I can edit the project settings and select ipad/iphone for the target device. But what do I do in my code to get it to work correctly?
Since it's html, I control sizing in html (and jquery). For example in my iphone app, I might have:
<img src="asdf.jpg" width="480">
And then that same ipad app would be:
<img src="asdf.jpg" width="1024">
It would be really awesome if I can just have two html files in my www folder, say, index.html and index-ipad.html, and then they share common img, css, and js folders. Is this possible?
I've checked the docs on phonegap extensively and couldn't find anything. Can somebody point me to a tutorial to do this? I really hate having multiple apps in the app store for the same content.
EDIT PER COMMENT BELOW
Maybe I wouldn't use the width attribute in html, maybe I would do this:
<img src="asdf_ipad.jpg">
and:
<img src="asdf_iphone.jpg">
where the two images have been sized for the two devices. In any event, I can handle the html/js/css, I just need to know how to implement a "switch" such that the ipad renders different from the iphone.
You can specify what file PhoneGap opens initially. Have a look at application:didFinishLaunchingWithOptions from AppDelegate.m
Do something like this to open a different index page for iPad:
if ([[[UIDevice currentDevice] model] containsString:#"iPad"]) {
...
self.viewController = [[[MainViewController alloc] init] autorelease];
self.viewController.wwwFolderName = #"www-ipad";
self.viewController.startPage = #"index.html";
...
}
why not use CSS media queries to identify your target device and update the images as appropriate? JqueryMobile for example does this to provide high-resolution icons to Retina devices...
Here's an article on how to use those to apply different stylesheets to iPhone vs iPad.
Hope this helps!
One option:
<img src="asdf.png" class="asdf"/>
.ipad .asdf {
width: 1024px;
}
.iphone .asdf {
width: 480px;
}
$(function() {
var deviceType = (device.platform=='iPhone' && screen.width==768) ? 'ipad' : 'iphone';
$('body').addClass(deviceType);
});
Note the deviceType logic is pretty simple (i.e. iPad locked in portrait), you will need to expand the logic to handle orientations and potentially add even further logic to detect Retina devices and in the future higher resolution iPads.
Well, I found a solution, I just use javascript to forward the page to my other html page like this:
if(screen.width==768)
window.location='index-ipad.html';
So I just have that code in my index.html file, and then, of course, I have a different index-ipad.html file. This gives me the freedom to do whatever I want and not limit me to just minor style changes. Note, this didn't work inside the jquery onload stuff $(function() {}); go figure.
I would have preferred to solve this with a "server side" approach, meaning the objective c layer that this resides upon. But, unfortunately, my skills in objective c aren't quite up to par. If anybody can give me that solution, I would greatly appreciate it!

iPhone Not Sizing My Page Correctly

So my website sizes correctly on a laptop PC running Windows 7. Howevever, when run on a iPhone or iPad, a couple things happen. Here's a link to my site to see www.mazzoreporting.com
First, the video in the right column extends beyond the main content box. I don't want to change the width because it makes it smaller on laptop pcs. I believe there is some kind of code I can write in my CSS to fix this?
That's it for now. Any help would be greatly appreciated.
Thanks
Chris
you need to make an separate css and load it in case you detect an ipod/iphone/ipad/ other mobile device or better if you can do an excluve mobile version of you page
There is a "secret" HTML incantation that you need to add to the web page to get WebView to resize it. I think that it is:
<meta name="viewport" content="width=device-width,height=device-height, user-scalable=yes" />
(Within the <head> section.)

SplitView like Facebook app on iPhone

I want to create an iPhone app that uses a navigation scene similar to the one pictured in the link
Please note I do not want this to only work for iPad, I want it to work for iPhone exactly as pictured, when you click on a tableview item it hides the tableview and makes that view full screen. I want ideas on how to do this because I cannot figure it out myself.
Thanks
Facebook guys have done brilliant job in the new version of the app. The similar open source code can be found from here - JTRevealSidebarDemo. Please note that as of June 2014, this project has been discontinued, so you'll probably have better luck with a project from the list below.
It reveals technique behind doing split view for iPhone.
Some other open source code:
JWSlideMenu
DDMenuController
PKRevealController
ViewDeck
ECSlidingViewController
MWFSlideNavigationViewController
MFSideMenu
SASlideMenu
HHTabListController
MTSlideViewController
MTStackViewController
MMDrawerController
DMSideMenuController
JVFloatingDrawer
How about projects with storyboard compatibility?
I found 1 more slide menu which is compatible with storyboards:
SASlideMenu
Another storyboard-compatible menu is
ECSlidingViewController
and
ViewDeck
from Sagar's answer. They both have storyboard examples (for the last one link is ViewDeckStoryboardExample)
For anyone else looking for an Android version, take a look at:
android fb like slideout navigation
emerging ui pattern side navigation
I realize you asked about facebook, but now that ios7 is out, and this is the defacto thread i thought id post here.
For an effect similar to the kindle app on ios7 you can use:
https://github.com/romaonthego/REFrostedViewController
If anyone else is looking for a way to implement this in MonoTouch now known as Xamarin.ios, take a look at this article I just found. monotouch slide out navigation
EDIT
I just found that they have a free component for this!
flyoutnavigation
I noticed no one listed this wonderful class... SWRevealController.
I use it with my project apps all the time. It's Easy to use and heavily documented... There are also a few examples John gives to the user to understand how it works or if you'd like to derive your project from... Hope this helps
SHSidebarControllerwith filder effect.
This might be helpful to you.. try this :)
This looks to be the best match for me.
PKRevealController
It has nice scroll effect with finger and moves back on partial drag.
https://github.com/pkluz/PKRevealController
MMDrawerController is very good option.
You can configure many things. try it once
https://github.com/mutualmobile/MMDrawerController
I've been working on a floating-style navigation drawer that I hope people will like. It's on GitHub, take a look.