Merge pull request #40 from infil00p/master

Clean Merge of Classic Render Mode
This commit is contained in:
Joe Bowser 2012-01-06 15:48:59 -08:00
commit 9078fe17b5
2 changed files with 24 additions and 1 deletions

View File

@ -2,4 +2,5 @@
<phonegap> <phonegap>
<access origin="http://127.0.0.1*"/> <access origin="http://127.0.0.1*"/>
<log level="DEBUG"/> <log level="DEBUG"/>
<render legacy="true" />
</phonegap> </phonegap>

View File

@ -215,6 +215,8 @@ public class DroidGap extends PhonegapActivity {
// when another application (activity) is started. // when another application (activity) is started.
protected boolean keepRunning = true; protected boolean keepRunning = true;
private boolean classicRender;
/** /**
* Called when the activity is first created. * Called when the activity is first created.
* *
@ -274,7 +276,19 @@ public class DroidGap extends PhonegapActivity {
this.appView.setWebChromeClient(new GapClient(DroidGap.this)); this.appView.setWebChromeClient(new GapClient(DroidGap.this));
this.setWebViewClient(this.appView, new GapViewClient(this)); this.setWebViewClient(this.appView, new GapViewClient(this));
//14 is Ice Cream Sandwich!
if(android.os.Build.VERSION.SDK_INT < 14 && this.classicRender)
{
//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);
}
else
{
this.appView.setInitialScale(0); this.appView.setInitialScale(0);
}
this.appView.setVerticalScrollBarEnabled(false); this.appView.setVerticalScrollBarEnabled(false);
this.appView.requestFocusFromTouch(); this.appView.requestFocusFromTouch();
@ -1747,6 +1761,14 @@ public class DroidGap extends PhonegapActivity {
LOG.setLogLevel(level); LOG.setLogLevel(level);
} }
} }
else if(strNode.equals("render")) {
String enabled = xml.getAttributeValue(null, "enabled");
if(enabled != null)
{
this.classicRender = enabled.equals("true");
}
}
} }
try { try {
eventType = xml.next(); eventType = xml.next();