Merge branch 'development'
Conflicts: mobile/res/xml/preferences.xml mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
This commit is contained in:
commit
796f693370
2
build.py
2
build.py
@ -263,7 +263,7 @@ if buildMobile:
|
|||||||
|
|
||||||
if buildMobile != 'copyonly':
|
if buildMobile != 'copyonly':
|
||||||
# now launch 'ant' to build the mobile project
|
# now launch 'ant' to build the mobile project
|
||||||
retcode = os.system("ant %s -buildfile mobile/build.xml %s" % (antOptions, buildMobile))
|
retcode = os.system("ant clean %s -buildfile mobile/build.xml %s" % (antOptions, buildMobile))
|
||||||
|
|
||||||
if retcode != 0:
|
if retcode != 0:
|
||||||
print ("Error: mobile app failed to build. ant returned %d" % retcode)
|
print ("Error: mobile app failed to build. ant returned %d" % retcode)
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# reverse of mobile-test-setup - reverts the changes made to AndroidManifest.xml and any resource files
|
|
||||||
|
|
||||||
mv mobile/res/values/strings.xml~ mobile/res/values/strings.xml
|
|
||||||
mv mobile/res/xml/preferences.xml~ mobile/res/xml/preferences.xml
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# quick-n-dirty script to rename the mobile build for tests
|
|
||||||
|
|
||||||
# rename the app title
|
|
||||||
test -f mobile/res/values/strings.xml~ || cp mobile/res/values/strings.xml mobile/res/values/strings.xml~
|
|
||||||
test -f mobile/res/xml/preferences.xml~ || cp mobile/res/xml/preferences.xml mobile/res/xml/preferences.xml~
|
|
||||||
sed -e 's/IITC Mobile/IITCm Test/' mobile/res/values/strings.xml~ > mobile/res/values/strings.xml
|
|
||||||
sed -e 's/targetPackage="com.cradle.iitc_mobile/targetPackage="com.cradle.iitc_mobile.test/' mobile/res/xml/preferences.xml~ > mobile/res/xml/preferences.xml
|
|
||||||
|
|
||||||
|
|
||||||
# also, you'll need to build with
|
|
||||||
# ant -Doverride.package.name=com.cradle.iitc_mobile.test ...
|
|
||||||
# or similar
|
|
@ -14,8 +14,10 @@
|
|||||||
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
|
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
|
||||||
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
|
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
android:name=".IITC_Application"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_iitcm"
|
android:icon="@drawable/ic_iitcm"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
205
mobile/build-test.xml
Normal file
205
mobile/build-test.xml
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project name="IITC_Mobile" default="help">
|
||||||
|
|
||||||
|
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||||
|
It contains the path to the SDK. It should *NOT* be checked into
|
||||||
|
Version Control Systems. -->
|
||||||
|
<property file="local.properties" />
|
||||||
|
|
||||||
|
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||||
|
'android' tool to add properties to it.
|
||||||
|
This is the place to change some Ant specific build properties.
|
||||||
|
Here are some properties you may want to change/update:
|
||||||
|
|
||||||
|
source.dir
|
||||||
|
The name of the source directory. Default is 'src'.
|
||||||
|
out.dir
|
||||||
|
The name of the output directory. Default is 'bin'.
|
||||||
|
|
||||||
|
For other overridable properties, look at the beginning of the rules
|
||||||
|
files in the SDK, at tools/ant/build.xml
|
||||||
|
|
||||||
|
Properties related to the SDK location or the project target should
|
||||||
|
be updated using the 'android' tool with the 'update' action.
|
||||||
|
|
||||||
|
This file is an integral part of the build system for your
|
||||||
|
application and should be checked into Version Control Systems.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<property file="ant.properties" />
|
||||||
|
|
||||||
|
<!-- if sdk.dir was not set from one of the property file, then
|
||||||
|
get it from the ANDROID_HOME env var.
|
||||||
|
This must be done before we load project.properties since
|
||||||
|
the proguard config can use sdk.dir -->
|
||||||
|
<property environment="env" />
|
||||||
|
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||||
|
<isset property="env.ANDROID_HOME" />
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<!-- The project.properties file is created and updated by the 'android'
|
||||||
|
tool, as well as ADT.
|
||||||
|
|
||||||
|
This contains project specific properties such as project target, and library
|
||||||
|
dependencies. Lower level build properties are stored in ant.properties
|
||||||
|
(or in .classpath for Eclipse projects).
|
||||||
|
|
||||||
|
This file is an integral part of the build system for your
|
||||||
|
application and should be checked into Version Control Systems. -->
|
||||||
|
<loadproperties srcFile="project.properties" />
|
||||||
|
|
||||||
|
<!-- quick check on sdk.dir -->
|
||||||
|
<fail
|
||||||
|
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||||
|
unless="sdk.dir"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Import per project custom build rules if present at the root of the project.
|
||||||
|
This is the place to put custom intermediary targets such as:
|
||||||
|
-pre-build
|
||||||
|
-pre-compile
|
||||||
|
-post-compile (This is typically used for code obfuscation.
|
||||||
|
Compiled code location: ${out.classes.absolute.dir}
|
||||||
|
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||||
|
-post-package
|
||||||
|
-post-build
|
||||||
|
-pre-clean
|
||||||
|
-->
|
||||||
|
<import file="custom_rules.xml" optional="true" />
|
||||||
|
|
||||||
|
<!-- Import the actual build file.
|
||||||
|
|
||||||
|
To customize existing targets, there are two options:
|
||||||
|
- Customize only one target:
|
||||||
|
- copy/paste the target into this file, *before* the
|
||||||
|
<import> task.
|
||||||
|
- customize it to your needs.
|
||||||
|
- Customize the whole content of build.xml
|
||||||
|
- copy/paste the content of the rules files (minus the top node)
|
||||||
|
into this file, replacing the <import> task.
|
||||||
|
- customize to your needs.
|
||||||
|
|
||||||
|
***********************
|
||||||
|
****** IMPORTANT ******
|
||||||
|
***********************
|
||||||
|
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||||
|
in order to avoid having your file be overridden by tools such as "android update project"
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- allow the package name to be overridden when building -->
|
||||||
|
<property name="override.package.name" value="com.cradle.iitc_mobile.test"/>
|
||||||
|
|
||||||
|
<!-- Puts the project's resources into the output package file
|
||||||
|
This actually can create multiple resource package in case
|
||||||
|
Some custom apk with specific configuration have been
|
||||||
|
declared in default.properties.
|
||||||
|
-->
|
||||||
|
<target name="-package-resources" depends="-crunch">
|
||||||
|
<!-- only package resources if *not* a library project -->
|
||||||
|
<do-only-if-not-library elseText="Library project: do not package resources..." >
|
||||||
|
<aapt executable="${aapt}"
|
||||||
|
command="package"
|
||||||
|
versioncode="${version.code}"
|
||||||
|
versionname="${version.name}"
|
||||||
|
debug="${build.is.packaging.debug}"
|
||||||
|
manifest="${out.manifest.abs.file}"
|
||||||
|
manifestpackage="${override.package.name}"
|
||||||
|
assets="${asset.absolute.dir}"
|
||||||
|
androidjar="${project.target.android.jar}"
|
||||||
|
apkfolder="${out.absolute.dir}"
|
||||||
|
nocrunch="${build.packaging.nocrunch}"
|
||||||
|
resourcefilename="${resource.package.file.name}"
|
||||||
|
resourcefilter="${aapt.resource.filter}"
|
||||||
|
libraryResFolderPathRefid="project.library.res.folder.path"
|
||||||
|
libraryPackagesRefid="project.library.packages"
|
||||||
|
libraryRFileRefid="project.library.bin.r.file.path"
|
||||||
|
previousBuildType="${build.last.target}"
|
||||||
|
buildType="${build.target}"
|
||||||
|
ignoreAssets="${aapt.ignore.assets}">
|
||||||
|
<res path="${out.res.absolute.dir}" />
|
||||||
|
<res path="${resource.absolute.dir}" />
|
||||||
|
<!-- <nocompress /> forces no compression on any files in assets or res/raw -->
|
||||||
|
<!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
|
||||||
|
</aapt>
|
||||||
|
</do-only-if-not-library>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
<target name="-pre-build" depends="-custom-git-version,-custom-manifest-version,-test-setup">
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- Packages the application. -->
|
||||||
|
<target name="-post-build">
|
||||||
|
<antcall target="-custom-restore-manifest"/>
|
||||||
|
<antcall target="-test-revert"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- Custom targets -->
|
||||||
|
<target name="-custom-git-version">
|
||||||
|
<exec executable="sh" outputproperty="git.commits">
|
||||||
|
<arg value="-c" />
|
||||||
|
<arg value="git log --pretty=format:'' | wc -l" />
|
||||||
|
</exec>
|
||||||
|
<echo>git.commits: ${git.commits}</echo>
|
||||||
|
<exec executable="git" outputproperty="git.version">
|
||||||
|
<arg value="rev-parse" />
|
||||||
|
<arg value="--short" />
|
||||||
|
<arg value="HEAD" />
|
||||||
|
</exec>
|
||||||
|
<echo>git.version: ${git.version}</echo>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-custom-manifest-version">
|
||||||
|
<echo>Creating backup of AndroidManifest.xml</echo>
|
||||||
|
<copy file="AndroidManifest.xml" tofile="AndroidManifest.xml.antbak" preservelastmodified="true" />
|
||||||
|
|
||||||
|
<replaceregexp
|
||||||
|
file="AndroidManifest.xml"
|
||||||
|
match='android:versionCode="(\d+)"'
|
||||||
|
replace='android:versionCode="${git.commits}"' />
|
||||||
|
|
||||||
|
<replaceregexp
|
||||||
|
file="AndroidManifest.xml"
|
||||||
|
match='android:versionName="(\d+\.\d+\.\d+)"'
|
||||||
|
replace='android:versionName="\1.${git.version}"' />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-custom-restore-manifest">
|
||||||
|
<echo>Restoring backup of AndroidManifest.xml</echo>
|
||||||
|
<move file="AndroidManifest.xml.antbak"
|
||||||
|
tofile="AndroidManifest.xml"
|
||||||
|
preservelastmodified="true"
|
||||||
|
overwrite="true" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-test-setup">
|
||||||
|
<echo>Creating backup of strings.xml and preferences.xml</echo>
|
||||||
|
<copy file="res/values/strings.xml" tofile="strings.xml.antbak" preservelastmodified="true" />
|
||||||
|
<copy file="res/xml/preferences.xml" tofile="preferences.xml.antbak" preservelastmodified="true" />
|
||||||
|
<replaceregexp
|
||||||
|
file="res/values/strings.xml"
|
||||||
|
match='IITC Mobile'
|
||||||
|
replace='IITCm Test'/>
|
||||||
|
<replaceregexp
|
||||||
|
file="res/xml/preferences.xml"
|
||||||
|
match='targetPackage="com.cradle.iitc_mobile"'
|
||||||
|
replace='targetPackage="com.cradle.iitc_mobile.test"'/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-test-revert">
|
||||||
|
<echo>Restoring backup of strings.xml and preferences.xml</echo>
|
||||||
|
<move file="strings.xml.antbak"
|
||||||
|
tofile="res/values/strings.xml"
|
||||||
|
preservelastmodified="true"
|
||||||
|
overwrite="true" />
|
||||||
|
<move file="preferences.xml.antbak"
|
||||||
|
tofile="res/xml/preferences.xml"
|
||||||
|
preservelastmodified="true"
|
||||||
|
overwrite="true" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- version-tag: 1 -->
|
||||||
|
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||||
|
|
||||||
|
</project>
|
@ -87,44 +87,6 @@
|
|||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
in order to avoid having your file be overridden by tools such as "android update project"
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- allow the package name to be overridden when building -->
|
|
||||||
<property name="override.package.name" value="com.cradle.iitc_mobile"/>
|
|
||||||
|
|
||||||
<!-- Puts the project's resources into the output package file
|
|
||||||
This actually can create multiple resource package in case
|
|
||||||
Some custom apk with specific configuration have been
|
|
||||||
declared in default.properties.
|
|
||||||
-->
|
|
||||||
<target name="-package-resources" depends="-crunch">
|
|
||||||
<!-- only package resources if *not* a library project -->
|
|
||||||
<do-only-if-not-library elseText="Library project: do not package resources..." >
|
|
||||||
<aapt executable="${aapt}"
|
|
||||||
command="package"
|
|
||||||
versioncode="${version.code}"
|
|
||||||
versionname="${version.name}"
|
|
||||||
debug="${build.is.packaging.debug}"
|
|
||||||
manifest="${out.manifest.abs.file}"
|
|
||||||
manifestpackage="${override.package.name}"
|
|
||||||
assets="${asset.absolute.dir}"
|
|
||||||
androidjar="${project.target.android.jar}"
|
|
||||||
apkfolder="${out.absolute.dir}"
|
|
||||||
nocrunch="${build.packaging.nocrunch}"
|
|
||||||
resourcefilename="${resource.package.file.name}"
|
|
||||||
resourcefilter="${aapt.resource.filter}"
|
|
||||||
libraryResFolderPathRefid="project.library.res.folder.path"
|
|
||||||
libraryPackagesRefid="project.library.packages"
|
|
||||||
libraryRFileRefid="project.library.bin.r.file.path"
|
|
||||||
previousBuildType="${build.last.target}"
|
|
||||||
buildType="${build.target}"
|
|
||||||
ignoreAssets="${aapt.ignore.assets}">
|
|
||||||
<res path="${out.res.absolute.dir}" />
|
|
||||||
<res path="${resource.absolute.dir}" />
|
|
||||||
<!-- <nocompress /> forces no compression on any files in assets or res/raw -->
|
|
||||||
<!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
|
|
||||||
</aapt>
|
|
||||||
</do-only-if-not-library>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- version-tag: 1 -->
|
<!-- version-tag: 1 -->
|
||||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||||
|
|
||||||
|
@ -85,6 +85,8 @@
|
|||||||
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
||||||
<string name="pref_force_https">Force https</string>
|
<string name="pref_force_https">Force https</string>
|
||||||
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
||||||
|
<string name="pref_external_storage">Move cache to external storage</string>
|
||||||
|
<string name="pref_external_storage_sum">Restart required! Write cache to sdCard. Saves internal storage. External storage has to be mounted.</string>
|
||||||
<string name="pref_press_twice_to_exit">Press back button twice to exit</string>
|
<string name="pref_press_twice_to_exit">Press back button twice to exit</string>
|
||||||
<string name="pref_press_twice_to_exit_sum">Avoids accidental exits</string>
|
<string name="pref_press_twice_to_exit_sum">Avoids accidental exits</string>
|
||||||
<string name="pref_advanced_options">Advanced settings</string>
|
<string name="pref_advanced_options">Advanced settings</string>
|
||||||
|
@ -61,10 +61,15 @@
|
|||||||
android:summary="@string/pref_force_https_sum"
|
android:summary="@string/pref_force_https_sum"
|
||||||
android:title="@string/pref_force_https"/>
|
android:title="@string/pref_force_https"/>
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:key="pref_external_storage"
|
||||||
android:key="pref_press_twice_to_exit"
|
android:title="@string/pref_external_storage"
|
||||||
android:summary="@string/pref_press_twice_to_exit_sum"
|
android:summary="@string/pref_external_storage_sum"
|
||||||
android:title="@string/pref_press_twice_to_exit"/>
|
android:defaultValue="false" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_press_twice_to_exit"
|
||||||
|
android:title="@string/pref_press_twice_to_exit"
|
||||||
|
android:summary="@string/pref_press_twice_to_exit_sum"
|
||||||
|
android:defaultValue="false" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="pref_developer_options"
|
android:key="pref_developer_options"
|
||||||
@ -112,4 +117,4 @@
|
|||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
17
mobile/src/com/cradle/iitc_mobile/IITC_Application.java
Normal file
17
mobile/src/com/cradle/iitc_mobile/IITC_Application.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.cradle.iitc_mobile;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class IITC_Application extends Application {
|
||||||
|
@Override
|
||||||
|
public File getCacheDir() {
|
||||||
|
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("pref_external_storage", false)) {
|
||||||
|
return (getExternalCacheDir() != null) ? getExternalCacheDir() : super.getCacheDir();
|
||||||
|
} else {
|
||||||
|
return super.getCacheDir();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -128,10 +128,12 @@ public class IITC_DeviceAccountLogin implements AccountManagerCallback<Bundle> {
|
|||||||
*/
|
*/
|
||||||
public void onActivityResult(int resultCode, Intent data) {
|
public void onActivityResult(int resultCode, Intent data) {
|
||||||
if (resultCode == Activity.RESULT_OK)
|
if (resultCode == Activity.RESULT_OK)
|
||||||
// authentication activity succeeded, request token again
|
// authentication activity succeeded, request token again
|
||||||
|
{
|
||||||
startAuthentication();
|
startAuthentication();
|
||||||
else
|
} else {
|
||||||
onLoginFailed();
|
onLoginFailed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,12 +47,13 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
|
|||||||
@Override
|
@Override
|
||||||
public int compare(String lhs, String rhs) {
|
public int compare(String lhs, String rhs) {
|
||||||
// Move "No Highlights" on top. Sort the rest alphabetically
|
// Move "No Highlights" on top. Sort the rest alphabetically
|
||||||
if (lhs.equals("No Highlights"))
|
if (lhs.equals("No Highlights")) {
|
||||||
return -1000;
|
return -1000;
|
||||||
else if (rhs.equals("No Highlights"))
|
} else if (rhs.equals("No Highlights")) {
|
||||||
return 1000;
|
return 1000;
|
||||||
else
|
} else {
|
||||||
return lhs.compareTo(rhs);
|
return lhs.compareTo(rhs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,8 +78,9 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
|
|||||||
Layer item = getItem(position);
|
Layer item = getItem(position);
|
||||||
View view = (TextView) super.getView(position, convertView, parent);
|
View view = (TextView) super.getView(position, convertView, parent);
|
||||||
|
|
||||||
if (view instanceof CheckedTextView)
|
if (view instanceof CheckedTextView) {
|
||||||
((CheckedTextView) view).setChecked(item.active);
|
((CheckedTextView) view).setChecked(item.active);
|
||||||
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,9 +130,10 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setLayer(Layer layer) {
|
private void setLayer(Layer layer) {
|
||||||
if (!mLoading)
|
if (!mLoading) {
|
||||||
mIitc.getWebView().loadUrl(
|
mIitc.getWebView().loadUrl(
|
||||||
"javascript: window.layerChooser.showLayer(" + layer.id + "," + layer.active + ");");
|
"javascript: window.layerChooser.showLayer(" + layer.id + "," + layer.active + ");");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPortalHighlighter(String name) {
|
public void addPortalHighlighter(String name) {
|
||||||
@ -208,8 +211,9 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
|
|||||||
mActiveHighlighter = name;
|
mActiveHighlighter = name;
|
||||||
|
|
||||||
int position = mHighlighters.getPosition(mActiveHighlighter);
|
int position = mHighlighters.getPosition(mActiveHighlighter);
|
||||||
if (position >= 0 && position < mHighlighters.getCount())
|
if (position >= 0 && position < mHighlighters.getCount()) {
|
||||||
mSpinnerHighlighter.setSelection(position);
|
mSpinnerHighlighter.setSelection(position);
|
||||||
|
}
|
||||||
|
|
||||||
mIitc.getNavigationHelper().setHighlighter(name);
|
mIitc.getNavigationHelper().setHighlighter(name);
|
||||||
}
|
}
|
||||||
@ -245,8 +249,10 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
|
|||||||
layer.active = layerObj.getBoolean("active");
|
layer.active = layerObj.getBoolean("active");
|
||||||
|
|
||||||
if (layer.active)
|
if (layer.active)
|
||||||
// getCount() will be the index of the layer we are about to add
|
// getCount() will be the index of the layer we are about to add
|
||||||
|
{
|
||||||
mActiveLayer = mBaseLayers.getCount();
|
mActiveLayer = mBaseLayers.getCount();
|
||||||
|
}
|
||||||
|
|
||||||
mBaseLayers.add(layer);
|
mBaseLayers.add(layer);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
@ -276,7 +282,8 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateLayers() {
|
public void updateLayers() {
|
||||||
if (!mLoading)
|
if (!mLoading) {
|
||||||
mIitc.getWebView().loadUrl("javascript: window.layerChooser.getLayers()");
|
mIitc.getWebView().loadUrl("javascript: window.layerChooser.getLayers()");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.cradle.iitc_mobile.IITC_NavigationHelper.Pane;
|
import com.cradle.iitc_mobile.IITC_NavigationHelper.Pane;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -130,9 +131,12 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
mIitcWebView.updateCaching(false);
|
mIitcWebView.updateCaching(false);
|
||||||
} else if (key.equals("pref_press_twice_to_exit")
|
} else if (key.equals("pref_press_twice_to_exit")
|
||||||
|| key.equals("pref_share_selected_tab")
|
|| key.equals("pref_share_selected_tab")
|
||||||
|| key.equals("pref_messages"))
|
|| key.equals("pref_messages")
|
||||||
// no reload needed
|
|| key.equals("pref_external_storage"))
|
||||||
|
// no reload needed
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mReloadNeeded = true;
|
mReloadNeeded = true;
|
||||||
}
|
}
|
||||||
@ -231,8 +235,9 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
|
|
||||||
// parts[0] may contain an 'uncertainty' parameter, delimited by a semicolon
|
// parts[0] may contain an 'uncertainty' parameter, delimited by a semicolon
|
||||||
String[] pos = parts[0].split(";", 2)[0].split(",", 2);
|
String[] pos = parts[0].split(";", 2)[0].split(",", 2);
|
||||||
if (pos.length != 2)
|
if (pos.length != 2) {
|
||||||
throw new URISyntaxException(uri.toString(), "URI does not contain a valid position");
|
throw new URISyntaxException(uri.toString(), "URI does not contain a valid position");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
lat = Double.valueOf(pos[0]);
|
lat = Double.valueOf(pos[0]);
|
||||||
@ -260,8 +265,9 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
String url = "http://www.ingress.com/intel?ll=" + lat + "," + lon;
|
String url = "http://www.ingress.com/intel?ll=" + lat + "," + lon;
|
||||||
if (z != null)
|
if (z != null) {
|
||||||
url += "&z=" + z;
|
url += "&z=" + z;
|
||||||
|
}
|
||||||
this.loadUrl(url);
|
this.loadUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,8 +302,9 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
Log.d("iitcm", "stopping iitcm");
|
Log.d("iitcm", "stopping iitcm");
|
||||||
mIitcWebView.loadUrl("javascript: window.idleSet();");
|
mIitcWebView.loadUrl("javascript: window.idleSet();");
|
||||||
|
|
||||||
if (mIsLocEnabled)
|
if (mIsLocEnabled) {
|
||||||
mLocMngr.removeUpdates(this);
|
mLocMngr.removeUpdates(this);
|
||||||
|
}
|
||||||
|
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
@ -381,10 +388,11 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
// ensure no double adds
|
// ensure no double adds
|
||||||
if (pane == mCurrentPane) return;
|
if (pane == mCurrentPane) return;
|
||||||
|
|
||||||
if (mBackStackPush)
|
if (mBackStackPush) {
|
||||||
mBackStack.push(mCurrentPane);
|
mBackStack.push(mCurrentPane);
|
||||||
else
|
} else {
|
||||||
mBackStackPush = true;
|
mBackStackPush = true;
|
||||||
|
}
|
||||||
|
|
||||||
mCurrentPane = pane;
|
mCurrentPane = pane;
|
||||||
mNavigationHelper.switchTo(pane);
|
mNavigationHelper.switchTo(pane);
|
||||||
@ -431,8 +439,9 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (mNavigationHelper.onOptionsItemSelected(item))
|
if (mNavigationHelper.onOptionsItemSelected(item)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle item selection
|
// Handle item selection
|
||||||
final int itemId = item.getItemId();
|
final int itemId = item.getItemId();
|
||||||
@ -460,10 +469,11 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
"window.map.locate({setView : true, maxZoom: 15});");
|
"window.map.locate({setView : true, maxZoom: 15});");
|
||||||
// if gps location is displayed we can use a better location without any costs
|
// if gps location is displayed we can use a better location without any costs
|
||||||
} else {
|
} else {
|
||||||
if (mLastLocation != null)
|
if (mLastLocation != null) {
|
||||||
mIitcWebView.loadUrl("javascript: window.map.setView(new L.LatLng(" +
|
mIitcWebView.loadUrl("javascript: window.map.setView(new L.LatLng(" +
|
||||||
mLastLocation.getLatitude() + "," +
|
mLastLocation.getLatitude() + "," +
|
||||||
mLastLocation.getLongitude() + "), 15);");
|
mLastLocation.getLongitude() + "), 15);");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_settings: // start settings activity
|
case R.id.action_settings: // start settings activity
|
||||||
@ -481,6 +491,11 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getCacheDir() {
|
||||||
|
return getApplicationContext().getCacheDir();
|
||||||
|
}
|
||||||
|
|
||||||
public void reloadIITC() {
|
public void reloadIITC() {
|
||||||
mNavigationHelper.reset();
|
mNavigationHelper.reset();
|
||||||
mMapSettings.reset();
|
mMapSettings.reset();
|
||||||
@ -504,10 +519,11 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
|
|
||||||
// vp=f enables mDesktopMode mode...vp=m is the defaul mobile view
|
// vp=f enables mDesktopMode mode...vp=m is the defaul mobile view
|
||||||
private String addUrlParam(String url) {
|
private String addUrlParam(String url) {
|
||||||
if (mDesktopMode)
|
if (mDesktopMode) {
|
||||||
return (url + "?vp=f");
|
return (url + "?vp=f");
|
||||||
else
|
} else {
|
||||||
return (url + "?vp=m");
|
return (url + "?vp=m");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// inject the iitc-script and load the intel url
|
// inject the iitc-script and load the intel url
|
||||||
|
@ -46,18 +46,20 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
add(Pane.PUBLIC);
|
add(Pane.PUBLIC);
|
||||||
add(Pane.FACTION);
|
add(Pane.FACTION);
|
||||||
|
|
||||||
if (mPrefs.getBoolean("pref_advanced_menu", false))
|
if (mPrefs.getBoolean("pref_advanced_menu", false)) {
|
||||||
add(Pane.DEBUG);
|
add(Pane.DEBUG);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
TextView view = (TextView) super.getView(position, convertView, parent);
|
TextView view = (TextView) super.getView(position, convertView, parent);
|
||||||
Pane item = getItem(position);
|
Pane item = getItem(position);
|
||||||
if (item == Pane.MAP)
|
if (item == Pane.MAP) {
|
||||||
view.setText("Map");
|
view.setText("Map");
|
||||||
else
|
} else {
|
||||||
view.setText(getPaneTitle(item));
|
view.setText(getPaneTitle(item));
|
||||||
|
}
|
||||||
|
|
||||||
int icon = 0;
|
int icon = 0;
|
||||||
switch (item) {
|
switch (item) {
|
||||||
@ -84,8 +86,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon != 0)
|
if (icon != 0) {
|
||||||
view.setCompoundDrawablesWithIntrinsicBounds(icon, 0, 0, 0);
|
view.setCompoundDrawablesWithIntrinsicBounds(icon, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@ -140,8 +143,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showNotice(final int which) {
|
private void showNotice(final int which) {
|
||||||
if ((mPrefs.getInt("pref_messages", 0) & which) != 0)
|
if ((mPrefs.getInt("pref_messages", 0) & which) != 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String text;
|
String text;
|
||||||
switch (which) {
|
switch (which) {
|
||||||
@ -186,8 +190,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
|
|
||||||
private void updateActionBar() {
|
private void updateActionBar() {
|
||||||
int position = mNavigationAdapter.getPosition(mPane);
|
int position = mNavigationAdapter.getPosition(mPane);
|
||||||
if (position >= 0 && position < mNavigationAdapter.getCount())
|
if (position >= 0 && position < mNavigationAdapter.getCount()) {
|
||||||
mDrawerLeft.setItemChecked(position, true);
|
mDrawerLeft.setItemChecked(position, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (mDesktopMode) {
|
if (mDesktopMode) {
|
||||||
mActionBar.setDisplayHomeAsUpEnabled(false); // Hide "up" indicator
|
mActionBar.setDisplayHomeAsUpEnabled(false); // Hide "up" indicator
|
||||||
@ -207,28 +212,32 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
mActionBar.setHomeButtonEnabled(true);// Make icon clickable
|
mActionBar.setHomeButtonEnabled(true);// Make icon clickable
|
||||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
||||||
|
|
||||||
if (mPane == Pane.MAP || mDrawerLayout.isDrawerOpen(mDrawerLeft))
|
if (mPane == Pane.MAP || mDrawerLayout.isDrawerOpen(mDrawerLeft)) {
|
||||||
setDrawerIndicatorEnabled(true);
|
setDrawerIndicatorEnabled(true);
|
||||||
else
|
} else {
|
||||||
setDrawerIndicatorEnabled(false);
|
setDrawerIndicatorEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDrawerLayout.isDrawerOpen(mDrawerLeft))
|
if (mDrawerLayout.isDrawerOpen(mDrawerLeft)) {
|
||||||
mActionBar.setTitle(mIitc.getString(R.string.app_name));
|
mActionBar.setTitle(mIitc.getString(R.string.app_name));
|
||||||
else
|
} else {
|
||||||
mActionBar.setTitle(getPaneTitle(mPane));
|
mActionBar.setTitle(getPaneTitle(mPane));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean mapVisible = mDesktopMode || mPane == Pane.MAP;
|
boolean mapVisible = mDesktopMode || mPane == Pane.MAP;
|
||||||
if ("No Highlights".equals(mHighlighter) || isDrawerOpened() || mIsLoading || !mapVisible)
|
if ("No Highlights".equals(mHighlighter) || isDrawerOpened() || mIsLoading || !mapVisible) {
|
||||||
mActionBar.setSubtitle(null);
|
mActionBar.setSubtitle(null);
|
||||||
else
|
} else {
|
||||||
mActionBar.setSubtitle(mHighlighter);
|
mActionBar.setSubtitle(mHighlighter);
|
||||||
|
}
|
||||||
|
|
||||||
if (mFullscreen && mHideInFullscreen)
|
if (mFullscreen && mHideInFullscreen) {
|
||||||
mActionBar.hide();
|
mActionBar.hide();
|
||||||
else
|
} else {
|
||||||
mActionBar.show();
|
mActionBar.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeDrawers() {
|
public void closeDrawers() {
|
||||||
@ -289,16 +298,18 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
Pane item = mNavigationAdapter.getItem(position);
|
Pane item = mNavigationAdapter.getItem(position);
|
||||||
mIitc.switchToPane(item);
|
mIitc.switchToPane(item);
|
||||||
|
|
||||||
if (item == Pane.INFO)
|
if (item == Pane.INFO) {
|
||||||
showNotice(NOTICE_INFO);
|
showNotice(NOTICE_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
mDrawerLayout.closeDrawer(mDrawerLeft);
|
mDrawerLayout.closeDrawer(mDrawerLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == android.R.id.home)
|
if (item.getItemId() == android.R.id.home) {
|
||||||
mDrawerLayout.closeDrawer(mDrawerRight);
|
mDrawerLayout.closeDrawer(mDrawerRight);
|
||||||
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
@ -315,8 +326,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void openRightDrawer() {
|
public void openRightDrawer() {
|
||||||
if (mDrawerLayout.getDrawerLockMode(mDrawerRight) == DrawerLayout.LOCK_MODE_UNLOCKED)
|
if (mDrawerLayout.getDrawerLockMode(mDrawerRight) == DrawerLayout.LOCK_MODE_UNLOCKED) {
|
||||||
mDrawerLayout.openDrawer(mDrawerRight);
|
mDrawerLayout.openDrawer(mDrawerRight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
@ -326,8 +338,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
|
|
||||||
public void setDebugMode(boolean enabled) {
|
public void setDebugMode(boolean enabled) {
|
||||||
mNavigationAdapter.remove(Pane.DEBUG); // avoid duplicates
|
mNavigationAdapter.remove(Pane.DEBUG); // avoid duplicates
|
||||||
if (enabled)
|
if (enabled) {
|
||||||
mNavigationAdapter.add(Pane.DEBUG);
|
mNavigationAdapter.add(Pane.DEBUG);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFullscreen(boolean fullscreen) {
|
public void setFullscreen(boolean fullscreen) {
|
||||||
|
@ -62,8 +62,10 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
if (onIsMultiPane()) getIntent()
|
if (onIsMultiPane()) {
|
||||||
.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, PluginsFragment.class.getName());
|
getIntent()
|
||||||
|
.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, PluginsFragment.class.getName());
|
||||||
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,8 +164,9 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
}
|
}
|
||||||
if (s != null)
|
if (s != null) {
|
||||||
src = s.hasNext() ? s.next() : "";
|
src = s.hasNext() ? s.next() : "";
|
||||||
|
}
|
||||||
// now we have all stuff together and can build the pref screen
|
// now we have all stuff together and can build the pref screen
|
||||||
addPluginPreference(src, anAsset_array, false);
|
addPluginPreference(src, anAsset_array, false);
|
||||||
}
|
}
|
||||||
@ -179,8 +182,9 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Log.d("iitcm", "failed to parse file " + file);
|
Log.d("iitcm", "failed to parse file " + file);
|
||||||
}
|
}
|
||||||
if (s != null)
|
if (s != null) {
|
||||||
src = s.hasNext() ? s.next() : "";
|
src = s.hasNext() ? s.next() : "";
|
||||||
|
}
|
||||||
|
|
||||||
// now we have all stuff together and can build the pref screen
|
// now we have all stuff together and can build the pref screen
|
||||||
addPluginPreference(src, file.toString(), true);
|
addPluginPreference(src, file.toString(), true);
|
||||||
@ -202,12 +206,15 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
String plugin_cat = "Misc";
|
String plugin_cat = "Misc";
|
||||||
for (int j = 0; j < attributes.length; j++) {
|
for (int j = 0; j < attributes.length; j++) {
|
||||||
// search for name and use the value
|
// search for name and use the value
|
||||||
if (attributes[j].equals("@name"))
|
if (attributes[j].equals("@name")) {
|
||||||
plugin_name = attributes[j + 1];
|
plugin_name = attributes[j + 1];
|
||||||
if (attributes[j].equals("@description"))
|
}
|
||||||
|
if (attributes[j].equals("@description")) {
|
||||||
plugin_desc = attributes[j + 1];
|
plugin_desc = attributes[j + 1];
|
||||||
if (attributes[j].equals("@category"))
|
}
|
||||||
|
if (attributes[j].equals("@category")) {
|
||||||
plugin_cat = attributes[j + 1];
|
plugin_cat = attributes[j + 1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove IITC plugin prefix from plugin_name
|
// remove IITC plugin prefix from plugin_name
|
||||||
|
@ -33,7 +33,6 @@ public class IITC_WebView extends WebView {
|
|||||||
" Gecko/20130810 Firefox/17.0 Iceweasel/17.0.8";
|
" Gecko/20130810 Firefox/17.0 Iceweasel/17.0.8";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// init web view
|
// init web view
|
||||||
private void iitc_init(Context c) {
|
private void iitc_init(Context c) {
|
||||||
if (isInEditMode()) return;
|
if (isInEditMode()) return;
|
||||||
@ -44,10 +43,8 @@ public class IITC_WebView extends WebView {
|
|||||||
mSettings.setAllowFileAccess(true);
|
mSettings.setAllowFileAccess(true);
|
||||||
mSettings.setGeolocationEnabled(true);
|
mSettings.setGeolocationEnabled(true);
|
||||||
mSettings.setAppCacheEnabled(true);
|
mSettings.setAppCacheEnabled(true);
|
||||||
mSettings.setDatabasePath(getContext().getApplicationInfo().dataDir
|
mSettings.setDatabasePath(getContext().getApplicationInfo().dataDir + "/databases/");
|
||||||
+ "/databases/");
|
mSettings.setAppCachePath(getContext().getCacheDir().getAbsolutePath());
|
||||||
mSettings.setAppCachePath(getContext().getCacheDir()
|
|
||||||
.getAbsolutePath());
|
|
||||||
mJsInterface = new IITC_JSInterface((IITC_Mobile) mContext);
|
mJsInterface = new IITC_JSInterface((IITC_Mobile) mContext);
|
||||||
addJavascriptInterface(mJsInterface, "android");
|
addJavascriptInterface(mJsInterface, "android");
|
||||||
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
|
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||||
@ -138,10 +135,11 @@ public class IITC_WebView extends WebView {
|
|||||||
// force https if enabled in settings
|
// force https if enabled in settings
|
||||||
SharedPreferences sharedPref = PreferenceManager
|
SharedPreferences sharedPref = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getContext());
|
.getDefaultSharedPreferences(getContext());
|
||||||
if (sharedPref.getBoolean("pref_force_https", true))
|
if (sharedPref.getBoolean("pref_force_https", true)) {
|
||||||
url = url.replace("http://", "https://");
|
url = url.replace("http://", "https://");
|
||||||
else
|
} else {
|
||||||
url = url.replace("https://", "http://");
|
url = url.replace("https://", "http://");
|
||||||
|
}
|
||||||
|
|
||||||
// disable splash screen if a http error code is responded
|
// disable splash screen if a http error code is responded
|
||||||
new CheckHttpResponse(mJsInterface, mContext).execute(url);
|
new CheckHttpResponse(mJsInterface, mContext).execute(url);
|
||||||
@ -159,7 +157,7 @@ public class IITC_WebView extends WebView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateCaching(boolean login) {
|
public void updateCaching(boolean login) {
|
||||||
switch(Integer.parseInt(mSharedPrefs.getString("pref_caching", "1"))) {
|
switch (Integer.parseInt(mSharedPrefs.getString("pref_caching", "1"))) {
|
||||||
case 0:
|
case 0:
|
||||||
mSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
mSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
||||||
break;
|
break;
|
||||||
@ -175,8 +173,11 @@ public class IITC_WebView extends WebView {
|
|||||||
Log.d("iitcm", "not connected to wifi...load tiles from cache");
|
Log.d("iitcm", "not connected to wifi...load tiles from cache");
|
||||||
mSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
mSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
||||||
} else {
|
} else {
|
||||||
if (login) Log.d("iitcm", "login...load tiles from network");
|
if (login) {
|
||||||
else Log.d("iitcm", "connected to wifi...load tiles from network");
|
Log.d("iitcm", "login...load tiles from network");
|
||||||
|
} else {
|
||||||
|
Log.d("iitcm", "connected to wifi...load tiles from network");
|
||||||
|
}
|
||||||
mSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
|
mSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -49,9 +49,10 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
|
|
||||||
public String getIITCVersion() {
|
public String getIITCVersion() {
|
||||||
String header = "";
|
String header = "";
|
||||||
if (mIitcScript != null)
|
if (mIitcScript != null) {
|
||||||
header = mIitcScript.substring(mIitcScript.indexOf("==UserScript=="),
|
header = mIitcScript.substring(mIitcScript.indexOf("==UserScript=="),
|
||||||
mIitcScript.indexOf("==/UserScript=="));
|
mIitcScript.indexOf("==/UserScript=="));
|
||||||
|
}
|
||||||
// remove new line comments
|
// remove new line comments
|
||||||
header = header.replace("\n//", "");
|
header = header.replace("\n//", "");
|
||||||
// get a list of key-value
|
// get a list of key-value
|
||||||
@ -59,8 +60,9 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
String iitc_version = "not found";
|
String iitc_version = "not found";
|
||||||
for (int i = 0; i < attributes.length; i++) {
|
for (int i = 0; i < attributes.length; i++) {
|
||||||
// search for version and use the value
|
// search for version and use the value
|
||||||
if (attributes[i].equals("@version"))
|
if (attributes[i].equals("@version")) {
|
||||||
iitc_version = attributes[i + 1];
|
iitc_version = attributes[i + 1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return iitc_version;
|
return iitc_version;
|
||||||
}
|
}
|
||||||
@ -200,10 +202,11 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
// load it as javascript
|
// load it as javascript
|
||||||
public boolean loadJS(String file, boolean asset, WebView view) {
|
public boolean loadJS(String file, boolean asset, WebView view) {
|
||||||
String js = fileToString(file, asset);
|
String js = fileToString(file, asset);
|
||||||
if (js.equals("false"))
|
if (js.equals("false")) {
|
||||||
return false;
|
return false;
|
||||||
else
|
} else {
|
||||||
view.loadUrl("javascript:" + js);
|
view.loadUrl("javascript:" + js);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,8 +237,9 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s != null)
|
if (s != null) {
|
||||||
src = s.hasNext() ? s.next() : "";
|
src = s.hasNext() ? s.next() : "";
|
||||||
|
}
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,8 +63,9 @@ public class MainSettings extends PreferenceFragment {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
||||||
if (preference.getTitle().toString().equals(getString(R.string.pref_advanced_options))
|
if (preference.getTitle().toString().equals(getString(R.string.pref_advanced_options))
|
||||||
|| preference.getTitle().toString().equals(getString(R.string.pref_about_title)))
|
|| preference.getTitle().toString().equals(getString(R.string.pref_about_title))) {
|
||||||
initializeActionBar((PreferenceScreen) preference);
|
initializeActionBar((PreferenceScreen) preference);
|
||||||
|
}
|
||||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,9 @@ public class IntentFragment extends Fragment implements OnScrollListener, OnItem
|
|||||||
mIntents = args.getParcelableArrayList("intents");
|
mIntents = args.getParcelableArrayList("intents");
|
||||||
mListView = new IntentListView(getActivity());
|
mListView = new IntentListView(getActivity());
|
||||||
mListView.setIntents(mIntents);
|
mListView.setIntents(mIntents);
|
||||||
if (mScrollIndex != -1 && mScrollTop != -1)
|
if (mScrollIndex != -1 && mScrollTop != -1) {
|
||||||
mListView.setSelectionFromTop(mScrollIndex, mScrollTop);
|
mListView.setSelectionFromTop(mScrollIndex, mScrollTop);
|
||||||
|
}
|
||||||
mListView.setOnScrollListener(this);
|
mListView.setOnScrollListener(this);
|
||||||
mListView.setOnItemClickListener(this);
|
mListView.setOnItemClickListener(this);
|
||||||
|
|
||||||
|
@ -60,8 +60,9 @@ public class IntentListView extends ListView {
|
|||||||
private static final HashSet<CopyHandler> KNOWN_COPY_HANDLERS = new HashSet<CopyHandler>();
|
private static final HashSet<CopyHandler> KNOWN_COPY_HANDLERS = new HashSet<CopyHandler>();
|
||||||
|
|
||||||
private static void setupKnownCopyHandlers() {
|
private static void setupKnownCopyHandlers() {
|
||||||
if (!KNOWN_COPY_HANDLERS.isEmpty())
|
if (!KNOWN_COPY_HANDLERS.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
KNOWN_COPY_HANDLERS.add(new CopyHandler(
|
KNOWN_COPY_HANDLERS.add(new CopyHandler(
|
||||||
"com.google.android.apps.docs",
|
"com.google.android.apps.docs",
|
||||||
@ -141,8 +142,9 @@ public class IntentListView extends ListView {
|
|||||||
for (ResolveInfo resolveInfo : activityList) { // search for "Copy to clipboard" handler
|
for (ResolveInfo resolveInfo : activityList) { // search for "Copy to clipboard" handler
|
||||||
CopyHandler handler = new CopyHandler(resolveInfo);
|
CopyHandler handler = new CopyHandler(resolveInfo);
|
||||||
|
|
||||||
if (KNOWN_COPY_HANDLERS.contains(handler))
|
if (KNOWN_COPY_HANDLERS.contains(handler)) {
|
||||||
hasCopyIntent = true;
|
hasCopyIntent = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// use traditional loop since list may change during iteration
|
// use traditional loop since list may change during iteration
|
||||||
|
@ -45,15 +45,17 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
|||||||
|
|
||||||
private String getUrl() {
|
private String getUrl() {
|
||||||
String url = "http://www.ingress.com/intel?ll=" + mLl + "&z=" + mZoom;
|
String url = "http://www.ingress.com/intel?ll=" + mLl + "&z=" + mZoom;
|
||||||
if (mIsPortal)
|
if (mIsPortal) {
|
||||||
url += "&pll=" + mLl;
|
url += "&pll=" + mLl;
|
||||||
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSelected(int position) {
|
private void setSelected(int position) {
|
||||||
// Activity not fully loaded yet (may occur during tab creation)
|
// Activity not fully loaded yet (may occur during tab creation)
|
||||||
if (mSharedPrefs == null)
|
if (mSharedPrefs == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mSharedPrefs
|
mSharedPrefs
|
||||||
.edit()
|
.edit()
|
||||||
@ -125,8 +127,9 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
|||||||
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD)
|
if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD) {
|
||||||
actionBar.setSelectedNavigationItem(position);
|
actionBar.setSelectedNavigationItem(position);
|
||||||
|
}
|
||||||
setSelected(position);
|
setSelected(position);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -141,15 +144,17 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
|||||||
.setTabListener(this));
|
.setTabListener(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mFragmentAdapter.getCount() > 1)
|
if (mFragmentAdapter.getCount() > 1) {
|
||||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||||
|
}
|
||||||
|
|
||||||
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
int selected = mSharedPrefs.getInt("pref_share_selected_tab", 0);
|
int selected = mSharedPrefs.getInt("pref_share_selected_tab", 0);
|
||||||
if (selected < mFragmentAdapter.getCount()) {
|
if (selected < mFragmentAdapter.getCount()) {
|
||||||
mViewPager.setCurrentItem(selected);
|
mViewPager.setCurrentItem(selected);
|
||||||
if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD)
|
if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD) {
|
||||||
actionBar.setSelectedNavigationItem(selected);
|
actionBar.setSelectedNavigationItem(selected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user