updated to SDK v19. still work in progreses...

This commit is contained in:
Philipp Schaefer 2013-11-06 00:34:25 +01:00
parent 9c1449fc7d
commit e0a4eb4313
6 changed files with 51 additions and 42 deletions

18
mobile/.idea/misc.xml generated
View File

@ -10,24 +10,8 @@
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="Android 4.3 Platform" project-jdk-type="Android SDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="Android 4.4 Platform" project-jdk-type="Android SDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>Android 4.3 Platform</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@ -7,7 +7,7 @@
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18"/>
android:targetSdkVersion="19"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

View File

@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-18
target=android-19

View File

@ -104,6 +104,11 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
}
}
@Override
protected boolean isValidFragment(String s) {
return true;
}
// called by Plugins Fragment
public static ArrayList<IITC_PluginPreference> getPluginPreference(String key) {
return sPlugins.get(key);

View File

@ -16,6 +16,7 @@ import android.view.View;
import android.view.WindowManager;
import android.webkit.ConsoleMessage;
import android.webkit.GeolocationPermissions;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
@ -138,24 +139,9 @@ public class IITC_WebView extends WebView {
@Override
public void loadUrl(String url) {
// if in edit text mode, don't load javascript otherwise the keyboard closes.
HitTestResult testResult = getHitTestResult();
if (url.startsWith("javascript:") && testResult != null &&
testResult.getType() == HitTestResult.EDIT_TEXT_TYPE) {
// let window.show(...) interupt input
// window.show(...) is called if one of the action bar buttons
// is clicked
if (!url.startsWith("javascript: window.show(")) {
Log.d("iitcm", "in insert mode. do not load script.");
return;
}
}
// do nothing if script is enabled;
if (mDisableJs) {
Log.d("iitcm", "javascript injection disabled...return");
return;
}
if (!url.startsWith("javascript:")) {
if (url.startsWith("javascript:")) {
loadJS(url.substring("javascript:".length()));
} else {
// force https if enabled in settings
SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(getContext());
@ -168,9 +154,39 @@ public class IITC_WebView extends WebView {
// disable splash screen if a http error code is responded
new CheckHttpResponse(mJsInterface, mIitc).execute(url);
Log.d("iitcm", "loading url: " + url);
}
super.loadUrl(url);
}
}
public void loadJS(String js) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
evaluateJavascript(js, new ValueCallback<String>() {
@Override
public void onReceiveValue(String value) {
// maybe we want to add stuff here
return;
}
});
} else {
// if in edit text mode, don't load javascript otherwise the keyboard closes.
HitTestResult testResult = getHitTestResult();
if (testResult != null && testResult.getType() == HitTestResult.EDIT_TEXT_TYPE) {
// let window.show(...) interupt input
// window.show(...) is called if one of the action bar buttons
// is clicked
if (!js.startsWith("window.show(")) {
Log.d("iitcm", "in insert mode. do not load script.");
return;
}
}
// do nothing if script is enabled;
if (mDisableJs) {
Log.d("iitcm", "javascript injection disabled...return");
return;
}
super.loadUrl("javascript:" + js);
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {

View File

@ -329,11 +329,15 @@ window.plugin.playerTracker.drawData = function() {
// marker itself
var icon = playerData.team === 'RESISTANCE' ? new plugin.playerTracker.iconRes() : new plugin.playerTracker.iconEnl();
var m = L.marker(gllfe(last), {title: title, icon: icon, referenceToPortal: closestPortal, opacity: absOpacity});
if (typeof android !== 'undefined' && android)
var m;
if (typeof android !== 'undefined' && android) {
m = L.marker(gllfe(last), {icon: icon, referenceToPortal: closestPortal, opacity: absOpacity});
m.bindPopup(title);
} else {
m = L.marker(gllfe(last), {title: title, icon: icon, referenceToPortal: closestPortal, opacity: absOpacity});
// ensure tooltips are closed, sometimes they linger
m.on('mouseout', function() { $(this._icon).tooltip('close'); });
}
m.addTo(playerData.team === 'RESISTANCE' ? plugin.playerTracker.drawnTracesRes : plugin.playerTracker.drawnTracesEnl);
plugin.playerTracker.oms.addMarker(m);
// jQueryUI doesnt automatically notice the new markers