incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [4/10] git commit: Work-around Feature for Classic PhoneGap 320x480 resolution
Date Fri, 06 Jan 2012 23:52:42 GMT
Work-around Feature for Classic PhoneGap 320x480 resolution


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/78404481
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/78404481
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/78404481

Branch: refs/heads/master
Commit: 784044813350fe57464ead0d704fc55ba3920bb4
Parents: e77e552
Author: Joe Bowser <joe.bowser@nitobi.com>
Authored: Fri Nov 25 14:01:50 2011 -0800
Committer: Joe Bowser <joe.bowser@nitobi.com>
Committed: Fri Nov 25 14:38:11 2011 -0800

----------------------------------------------------------------------
 framework/res/xml/phonegap.xml           |    1 +
 framework/src/com/phonegap/DroidGap.java |   22 +++++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/78404481/framework/res/xml/phonegap.xml
----------------------------------------------------------------------
diff --git a/framework/res/xml/phonegap.xml b/framework/res/xml/phonegap.xml
index 97f31ea..f57d9ab 100644
--- a/framework/res/xml/phonegap.xml
+++ b/framework/res/xml/phonegap.xml
@@ -2,4 +2,5 @@
 <phonegap>
     <access origin="http://127.0.0.1*"/>
     <log level="DEBUG"/>
+    <render legacy="true" />
 </phonegap>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/78404481/framework/src/com/phonegap/DroidGap.java
----------------------------------------------------------------------
diff --git a/framework/src/com/phonegap/DroidGap.java b/framework/src/com/phonegap/DroidGap.java
index ae0490d..276ac87 100755
--- a/framework/src/com/phonegap/DroidGap.java
+++ b/framework/src/com/phonegap/DroidGap.java
@@ -219,6 +219,8 @@ public class DroidGap extends PhonegapActivity {
     // when another application (activity) is started.
     protected boolean keepRunning = true;
 
+    private boolean clasicRender;
+
     /** 
      * Called when the activity is first created. 
      * 
@@ -280,7 +282,17 @@ public class DroidGap extends PhonegapActivity {
         this.appView.setWebChromeClient(new GapClient(DroidGap.this));
         this.setWebViewClient(this.appView, new GapViewClient(this));
 
-        this.appView.setInitialScale(100);
+        //14 is Ice Cream Sandwich!
+        if(android.os.Build.VERSION.SDK_INT < 14)
+            this.appView.setInitialScale(100);
+        else if(this.clasicRender)
+        {
+            //This hack fixes legacy PhoneGap apps
+            //We should be using real pixels, not pretend pixels
+            final float scale = getResources().getDisplayMetrics().density;
+            int initialScale = (int) (scale * 100);
+            this.appView.setInitialScale(initialScale);
+        }
         this.appView.setVerticalScrollBarEnabled(false);
         this.appView.requestFocusFromTouch();
 
@@ -1750,6 +1762,14 @@ public class DroidGap extends PhonegapActivity {
                         LOG.setLogLevel(level);
                     }
                 }
+                else if(strNode.equals("render")) {
+                    String enabled = xml.getAttributeValue(null, "enabled");
+                    if(enabled != null)
+                    {
+                        this.clasicRender = enabled.equals("true");
+                    }
+                    
+                }
             }
             try {
                 eventType = xml.next();


Mime
View raw message