1
0
mirror of https://gitlab.com/openlp/android.git synced 2024-10-31 16:54:41 +00:00

Update files

This commit is contained in:
Tim Bentley 2016-06-13 21:43:28 +01:00
parent da8a6cbb2b
commit 26cd14c2b5
8 changed files with 10 additions and 100 deletions

View File

@ -64,14 +64,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
@ -80,6 +72,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />

View File

@ -35,7 +35,6 @@ import android.view.WindowManager;
import org.openlp.android2.activities.SettingsActivity; import org.openlp.android2.activities.SettingsActivity;
import org.openlp.android2.common.NavigationOptions; import org.openlp.android2.common.NavigationOptions;
import org.openlp.android2.common.NukeSSLCerts;
import org.openlp.android2.dialogs.AlertDisplayDialog; import org.openlp.android2.dialogs.AlertDisplayDialog;
import org.openlp.android2.dialogs.BlankDisplayDialog; import org.openlp.android2.dialogs.BlankDisplayDialog;
import org.openlp.android2.fragments.AboutFragment; import org.openlp.android2.fragments.AboutFragment;
@ -66,7 +65,6 @@ public class OpenLP extends ActionBarActivity
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
new NukeSSLCerts().nuke();
doPreferenceCheck(); doPreferenceCheck();

View File

@ -1,77 +0,0 @@
/******************************************************************************
* OpenLP - Open Source Lyrics Projection *
* --------------------------------------------------------------------------- *
* Copyright (c) 2011-2016 OpenLP Android Developers *
* --------------------------------------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the Free *
* Software Foundation; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
* more details. *
* *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., 59 *
* Temple Place, Suite 330, Boston, MA 02111-1307 USA *
*******************************************************************************/
package org.openlp.android2.common;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class NukeSSLCerts {
protected static final String TAG = "NukeSSLCerts";
public static void nuke() {
try {
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
X509Certificate[] myTrustedAnchors = new X509Certificate[0];
return myTrustedAnchors;
}
@Override
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}
};
SSLContext sc = null;
try {
sc = SSLContext.getInstance("TLS");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
try {
sc.init(null, trustAllCerts, new java.security.SecureRandom());
} catch (KeyManagementException e) {
e.printStackTrace();
}
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
// Create all-trusting host name verifier
HostnameVerifier allHostsValid = new HostnameVerifier() {
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
// Install the all-trusting host verifier
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
} catch (Exception e) {
}
}
}

View File

@ -67,12 +67,11 @@ public class OpenLPURLBuilder {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
Boolean useSSL = sharedPrefs.getBoolean(context.getString(R.string.key_ssl_use), false);
String host = sharedPrefs.getString(context.getString(R.string.key_host), String host = sharedPrefs.getString(context.getString(R.string.key_host),
context.getString(R.string.host_default_value)); context.getString(R.string.host_default_value));
String port = sharedPrefs.getString(context.getString(R.string.key_port), "4316"); String port = sharedPrefs.getString(context.getString(R.string.key_port), "4316");
return String.format("http%s://%s:%s", useSSL ? "s" : "", host, port); return String.format("http://%s:%s", host, port);
} }
} }

View File

@ -19,12 +19,10 @@
package org.openlp.android2.fragments; package org.openlp.android2.fragments;
import android.app.Fragment; import android.app.Fragment;
import android.net.http.SslError;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.SslErrorHandler;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import org.openlp.android2.R; import org.openlp.android2.R;
@ -75,9 +73,5 @@ public class WebFragment extends Fragment {
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false; return false;
} }
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed(); // Ignore SSL certificate errors
}
} }
} }

View File

@ -8,6 +8,4 @@
<string name="key_userid">key_userid</string> <string name="key_userid">key_userid</string>
<string name="key_password">key_password</string> <string name="key_password">key_password</string>
<string name="key_shared_preferences">key_shared_preferences</string> <string name="key_shared_preferences">key_shared_preferences</string>
<string name="key_ssl_use">key_ssl_use</string>
</resources> </resources>

View File

@ -20,8 +20,6 @@
<string name="connection_configuration">Configure Network</string> <string name="connection_configuration">Configure Network</string>
<string name="connection_password">Password</string> <string name="connection_password">Password</string>
<string name="connection_profile">Server Details</string> <string name="connection_profile">Server Details</string>
<string name="connection_profile_ssl_use">Use HTTPS</string>
<string name="connection_profile_ssl_summary">Specify whether HTTPS should be used</string>
<string name="connection_timeout">Connection Timeout</string> <string name="connection_timeout">Connection Timeout</string>
<string name="connection_timeout_summary">Select a value (milliseconds)</string> <string name="connection_timeout_summary">Select a value (milliseconds)</string>
<string name="connection_userid">Username</string> <string name="connection_userid">Username</string>

View File

@ -5,7 +5,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.1.0' classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files