Commit 74362264 authored by Lukasz Budryk's avatar Lukasz Budryk

finish merge of android app

parent 7bf07fb7
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2013-2014 alladin-IT GmbH
Copyright 2013-2015 alladin-IT GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......@@ -15,45 +15,46 @@
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.nic.netmetr"
android:versionCode="20041"
android:versionName="2.0.41"
package="at.alladin.openrmbt.android"
android:versionCode="100"
android:versionName="1.0.0"
android:installLocation="auto" >
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="19"/>
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="22"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<uses-feature android:name="android.hardware.location" android:required="false"/>
<uses-feature android:name="android.hardware.location.network" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.wifi" android:required="false"/>
<application android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:allowBackup="true"
<application
android:icon="@drawable/app_logo"
android:logo="@android:color/transparent"
android:label="@string/app_name" android:allowBackup="true"
android:supportsRtl="false">
<activity android:name="at.alladin.rmbt.android.main.RMBTMainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo"
<activity android:name="at.alladin.rmbt.android.main.RMBTMainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize|keyboardHidden">
<!--
in most cases
android:configChanges="orientation|screenSize|keyboardHidden"
is a bad choice. don't use it! -->
<!-- android:screenOrientation="portrait" -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -61,28 +62,22 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="@string/preferences"
<activity android:label="@string/preferences"
android:name="at.alladin.rmbt.android.preferences.RMBTPreferenceActivity"
android:theme="@android:style/Theme.Holo"
android:theme="@style/AppTheme"
android:enabled="true" />
<activity android:label="@string/terms" android:name="at.alladin.rmbt.android.terms.RMBTTermsActivity"
android:theme="@android:style/Theme.Holo"
android:theme="@style/AppTheme"
android:enabled="true" />
<activity android:label="@string/history_button_sync" android:name="at.alladin.rmbt.android.sync.RMBTSyncActivity"
android:theme="@android:style/Theme.Holo"
android:enabled="true" />
<service android:enabled="true" android:name="at.alladin.rmbt.android.test.RMBTService" android:exported="false" />
<service android:enabled="true" android:name="at.alladin.rmbt.android.test.RMBTLoopService" android:exported="false" />
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="GOOGLEMAPS_APIKEY"/>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value=""/>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<meta-data android:name="com.crashlytics.ApiKey" android:value="RMBT_CRASHLYTICS_APIKEY"/>
<meta-data android:name="cz.nic.labs.rmbt.android.test.RMBTBugReport" android:value="RMBT_USE_BUGREPORT"/>
</application>
</manifest>
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2013-2014 alladin-IT GmbH
Copyright 2013-2015 alladin-IT GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......@@ -16,7 +16,7 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/preferences_category_test" android:layout="@layout/preferences_category">
<PreferenceCategory android:key="preference_category_test" android:title="@string/preferences_category_test" android:layout="@layout/preferences_category">
<CheckBoxPreference
android:key="ndt"
......@@ -24,6 +24,12 @@
android:summary="@string/preferences_ndt_sum"
android:defaultValue="false"
android:layout="@layout/preferences_item"/>
<CheckBoxPreference
android:key="information_commissioner"
android:title="@string/preferences_ic"
android:defaultValue="false"
android:layout="@layout/preferences_item"/>
<CheckBoxPreference
android:key="ipv4_only"
......@@ -45,15 +51,15 @@
android:summary="@string/preferences_dont_show_menu_on_exit_sum"
android:defaultValue="false"
android:layout="@layout/preferences_item"/>
<Preference
android:key="sync_settings"
android:title="@string/history_button_sync"
android:summary="@string/sync_summary"
android:layout="@layout/preferences_item"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences_category_loop_mode" android:layout="@layout/preferences_category">
<PreferenceCategory android:title="@string/preferences_category_loop_mode" android:layout="@layout/preferences_category">
<CheckBoxPreference
android:key="loop_mode"
......
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2013-2014 alladin-IT GmbH
Copyright 2013-2015 alladin-IT GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......@@ -31,6 +31,60 @@
android:layout="@layout/preferences_item"
/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences_category_loop_mode" android:layout="@layout/preferences_category">
<CheckBoxPreference
android:key="loop_mode"
android:title="@string/preferences_loop_mode"
android:summary="@string/preferences_loop_mode_sum"
android:layout="@layout/preferences_item"/>
<EditTextPreference
android:key="loop_mode_max_tests"
android:title="@string/preferences_loop_mode_max_tests"
android:summary="@string/preferences_loop_mode_max_tests_sum"
android:layout="@layout/preferences_item"
android:inputType="number"
android:defaultValue="@integer/default_loop_max_tests"
/>
<EditTextPreference
android:key="loop_mode_min_delay"
android:title="@string/preferences_loop_mode_min_delay"
android:summary="@string/preferences_loop_mode_min_delay_sum"
android:layout="@layout/preferences_item"
android:inputType="number"
android:defaultValue="@integer/default_loop_min_delay"
/>
<EditTextPreference
android:key="loop_mode_max_delay"
android:title="@string/preferences_loop_mode_max_delay"
android:summary="@string/preferences_loop_mode_max_delay_sum"
android:layout="@layout/preferences_item"
android:inputType="number"
android:defaultValue="@integer/default_loop_max_delay"
/>
<EditTextPreference
android:key="loop_mode_movement"
android:title="@string/preferences_loop_mode_movement"
android:summary="@string/preferences_loop_mode_movement_sum"
android:layout="@layout/preferences_item"
android:inputType="number"
android:defaultValue="@integer/default_loop_max_movement"
/>
<CheckBoxPreference
android:key="loop_mode_gps"
android:title="@string/preferences_loop_mode_gps"
android:summary="@string/preferences_loop_mode_gps_sum"
android:defaultValue="true"
android:layout="@layout/preferences_item"
/>
</PreferenceCategory>
<!--
......
/*******************************************************************************
* Copyright 2013-2014 alladin-IT GmbH
* Copyright 2013-2015 alladin-IT GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -25,17 +25,21 @@ import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.view.MenuItem;
import android.widget.ListView;
import at.alladin.openrmbt.android.R;
import at.alladin.rmbt.android.main.FeatureConfig;
import at.alladin.rmbt.android.sync.RMBTSyncActivity;
import at.alladin.rmbt.android.terms.RMBTCheckFragment.CheckType;
import at.alladin.rmbt.android.terms.RMBTTermsActivity;
import at.alladin.rmbt.android.util.ConfigHelper;
import cz.nic.netmetr.R;
public class RMBTPreferenceActivity extends PreferenceActivity
{
protected static final int REQUEST_NDT_CHECK = 1;
protected static final int REQUEST_IC_CHECK = 2;
protected Method mLoadHeaders = null;
protected Method mHasHeaders = null;
......@@ -112,7 +116,7 @@ public class RMBTPreferenceActivity extends PreferenceActivity
//final int paddingTopBottom = Helperfunctions.dpToPx(3, scale);
//final int paddingLeftRight = Helperfunctions.dpToPx(10, scale);
//v.setBackgroundResource(R.drawable.box_large);
v.setBackgroundResource(R.drawable.app_bgdn_radiant);
//v.setBackgroundResource(R.drawable.app_bgdn_radiant);
//v.setPadding(paddingLeftRight, paddingTopBottom, paddingLeftRight, paddingTopBottom);
final Preference ndtPref = (Preference) findPreference("ndt");
......@@ -130,6 +134,7 @@ public class RMBTPreferenceActivity extends PreferenceActivity
{
cbp.setChecked(false);
final Intent intent = new Intent(getBaseContext(), RMBTTermsActivity.class);
intent.putExtra(RMBTTermsActivity.EXTRA_KEY_CHECK_TYPE, CheckType.NDT.name());
startActivityForResult(intent, REQUEST_NDT_CHECK);
}
}
......@@ -138,6 +143,36 @@ public class RMBTPreferenceActivity extends PreferenceActivity
});
}
final Preference icPref = (Preference) findPreference("information_commissioner");
if (icPref != null)
{
if (FeatureConfig.TEST_USE_PERSONAL_DATA_FUZZING) {
icPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference)
{
if (preference instanceof CheckBoxPreference)
{
final CheckBoxPreference cbp = (CheckBoxPreference) preference;
if (cbp.isChecked())
{
cbp.setChecked(false);
final Intent intent = new Intent(getBaseContext(), RMBTTermsActivity.class);
intent.putExtra(RMBTTermsActivity.EXTRA_KEY_CHECK_TYPE, CheckType.INFORMATION_COMMISSIONER.name());
startActivityForResult(intent, REQUEST_IC_CHECK);
}
}
return true;
}
});
}
else {
final PreferenceCategory cat = (PreferenceCategory) findPreference("preference_category_test");
cat.removePreference(icPref);
}
}
final Preference gpsPref = (Preference) findPreference("location_settings");
if (gpsPref != null)
{
......@@ -150,7 +185,7 @@ public class RMBTPreferenceActivity extends PreferenceActivity
}
});
}
final Preference syncPref = (Preference) findPreference("sync_settings");
if (syncPref != null)
{
......@@ -162,7 +197,7 @@ public class RMBTPreferenceActivity extends PreferenceActivity
return true;
}
});
}
}
// v.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET);
......@@ -177,6 +212,9 @@ public class RMBTPreferenceActivity extends PreferenceActivity
{
((CheckBoxPreference) findPreference("ndt")).setChecked(ConfigHelper.isNDT(this));
}
else if (requestCode == REQUEST_IC_CHECK) {
((CheckBoxPreference) findPreference("information_commissioner")).setChecked(ConfigHelper.isInformationCommissioner(this));
}
}
......
......@@ -249,4 +249,8 @@ public class CheckSettingsTask extends AsyncTask<Void, Void, JSONArray>
{
return hasError;
}
public String getErrorMessage() {
return serverConn.getErrorMsg();
}
}
/*******************************************************************************
* Copyright 2013-2014 alladin-IT GmbH
* Copyright 2013-2015 alladin-IT GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -15,15 +15,6 @@
******************************************************************************/
package at.alladin.rmbt.android.util;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
......@@ -32,45 +23,51 @@ import java.util.ArrayList;
import java.util.Locale;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.util.Log;
import at.alladin.openrmbt.android.R;
import at.alladin.rmbt.android.map.MapProperties;
import at.alladin.rmbt.client.helper.Config;
import at.alladin.rmbt.client.helper.JSONParser;
import cz.nic.netmetr.BuildConfig;
import cz.nic.netmetr.R;
import cz.nic.netmetr.clientSecret.ClientSecretHelper;
public class ControlServerConnection
{
public static enum UriType {
DEFAULT_HOSTNAME,
HOSTNAME_IPV4,
HOSTNAME_IPV6
}
private static final String DEBUG_TAG = "ControlServerConnection";
private static String hostname;
private static String hostname4;
private static String hostname6;
private static int port;
private boolean encryption;
private JSONParser jParser;
private Context context;
@SuppressWarnings("unused")
private String errorMsg = "";
private boolean hasError = false;
private boolean useMapServerPath = false;
private String getUUID()
{
return ConfigHelper.getUUID(context.getApplicationContext());
......@@ -139,15 +136,14 @@ public class ControlServerConnection
}
private void setupServer(final Context context, final boolean useMapServerPath)
{
// Creating JSON Parser instance
{
jParser = new JSONParser();
hasError = false;
this.context = context;
this.useMapServerPath = useMapServerPath;
hostname4 = ConfigHelper.getCachedControlServerNameIpv4(context);
hostname6 = ConfigHelper.getCachedControlServerNameIpv6(context);
......@@ -175,7 +171,7 @@ public class ControlServerConnection
private JSONArray sendRequest(final URI hostUrl, final JSONObject requestData, final String fieldName)
{
// getting JSON string from URL
//Log.d(DEBUG_TAG, "request to "+ hostUrl);
//Log.d(DEBUG_TAG, "request to "+ hostUrl);
final JSONObject response = jParser.sendJSONToUrl(hostUrl, requestData);
if (response != null)
......@@ -183,27 +179,13 @@ public class ControlServerConnection
{
final JSONArray errorList = response.optJSONArray("error");
//System.out.println(requestData.toString(4));
//System.out.println(response.toString(4));
if (errorList == null || errorList.length() == 0)
{
if (fieldName != null) {
return response.getJSONArray(fieldName);
}
else {
JSONArray array = new JSONArray();
array.put(response);
return array;
}
return getResponseField(response, fieldName);
}
else
{
//hasError = true;
hasError = true;
for (int i = 0; i < errorList.length(); i++)
{
......@@ -211,6 +193,10 @@ public class ControlServerConnection
errorMsg += "\n";
errorMsg += errorList.getString(i);
}
System.out.println(errorMsg);
//return getResponseField(response, fieldName);
}
// }
......@@ -230,7 +216,7 @@ public class ControlServerConnection
return null;
}
public Long requestTime() {
hasError = false;
......@@ -264,6 +250,17 @@ public class ControlServerConnection
return null;
}
private static JSONArray getResponseField(JSONObject response, String fieldName) throws JSONException {
if (fieldName != null) {
return response.getJSONArray(fieldName);
}
else {
JSONArray array = new JSONArray();
array.put(response);
return array;
}
}
public JSONArray requestNews(final long lastNewsUid)
{
......@@ -292,6 +289,26 @@ public class ControlServerConnection
}
public JSONArray sendLogReport(final JSONObject requestData) {
final URI hostUrl = getUri(Config.RMBT_LOG_HOST_URL);
try
{
Log.i(DEBUG_TAG,"LOG request to " + hostUrl);
InformationCollector.fillBasicInfo(requestData, context);
requestData.put("uuid", getUUID());
}
catch (final Exception e)
{
hasError = true;
errorMsg = "Error gernerating request";
}
return sendRequest(hostUrl, requestData, null);
}
public JSONArray requestIp(boolean isIpv6)
{
......@@ -305,7 +322,7 @@ public class ControlServerConnection
{
hostUrl = isIpv6 ? new URL(ConfigHelper.getCachedIpv6CheckUrl(context)).toURI() : new URL(ConfigHelper.getCachedIpv4CheckUrl(context)).toURI();
Log.i(DEBUG_TAG, "IP request to " + hostUrl);
Log.i(DEBUG_TAG,"IP request to " + hostUrl);
InformationCollector.fillBasicInfo(requestData, context);
......@@ -516,6 +533,7 @@ public class ControlServerConnection
public JSONArray requestSettings()
{
hasError = false;
Long time = requestTime();
......@@ -525,7 +543,7 @@ public class ControlServerConnection
errorMsg = "Cannot obtain time from server!";
return null;
}
final URI hostUrl = getUri(Config.RMBT_SETTINGS_HOST_URL);
PackageInfo pInfo;
......@@ -544,11 +562,11 @@ public class ControlServerConnection
// e1.printStackTrace();
Log.e(DEBUG_TAG, "version of the application cannot be found", e);
}
Log.i(DEBUG_TAG,"Settings request to " + hostUrl);
final JSONObject requestData = new JSONObject();
try
{
InformationCollector.fillBasicInfo(requestData, context);
......@@ -557,7 +575,7 @@ public class ControlServerConnection
requestData.put("version_name", clientVersionName);
requestData.put("version_code", clientVersionCode);
requestData.put("time", time);
requestData.put("client_secret", ClientSecretHelper.prepareClientSecret(getUUID(), clientName, clientVersionName, clientVersionCode, time, BuildConfig.CLIENT_SECRET));
requestData.put("client_secret", ClientSecretHelper.prepareClientSecret(getUUID(), clientName, clientVersionName, clientVersionCode, time, null));//BuildConfig.CLIENT_SECRET));
final int tcAcceptedVersion = ConfigHelper.getTCAcceptedVersion(context);
requestData.put("terms_and_conditions_accepted_version", tcAcceptedVersion);
......@@ -652,11 +670,11 @@ public class ControlServerConnection
return sendRequest(hostUrl, requestData, "measurements");
}
public String getErrorMsg() {
return errorMsg;
}
public boolean hasError()
{
return hasError;
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.gms">
<uses-sdk android:minSdkVersion="9"/>
<application>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
This diff is collapsed.
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment