Commit 5c53218e authored by Matyáš Latner's avatar Matyáš Latner

AndroidClient - sync button moved from history screen to preferences screen

parent b93cdd83
......@@ -23,28 +23,28 @@
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="19"/>
<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"
android:supportsRtl="false">
<activity android:name="at.alladin.rmbt.android.main.RMBTMainActivity"
android:label="@string/app_name"
<activity android:name="at.alladin.rmbt.android.main.RMBTMainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustPan"
......@@ -53,7 +53,7 @@
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,24 +61,24 @@
<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="@android:style/Theme.Holo"
android:enabled="true" />
<activity android:label="@string/terms" android:name="at.alladin.rmbt.android.terms.RMBTTermsActivity"
android:theme="@android:style/Theme.Holo"
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.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>
......@@ -25,7 +25,7 @@ buildscript {
}
}
subprojects{
subprojects {
evaluationDependsOn(':RMBTClient')
}
......@@ -49,7 +49,7 @@ dependencies {
task prepareDebugVersion(dependsOn: 'processDebugManifest') {
doLast{
// google maps
File manifest = file("${buildDir}/intermediates/manifests/full/debug/AndroidManifest.xml")
String manifestContent = manifest.getText('UTF-8')
......@@ -91,10 +91,10 @@ task prepareDebugVersion(dependsOn: 'processDebugManifest') {
task prepareReleaseVersion(dependsOn: 'processReleaseManifest') {
doLast{
// google maps
File manifest = file("${buildDir}/intermediates/manifests/full/release/AndroidManifest.xml")
String manifestContent = manifest.getText('UTF-8')
String manifestContent = manifest.getText('UTF-8')
if (project.hasProperty('RMBT_GOOGLEMAPS_APIKEY')) {
manifestContent = manifestContent.replaceAll(/GOOGLEMAPS_APIKEY/, RMBT_GOOGLEMAPS_APIKEY)
}
......@@ -135,7 +135,7 @@ task prepareCrashlyticsDebug(dependsOn: 'processDebugManifest') {
doLast{
// api key
File manifest = file("${buildDir}/intermediates/manifests/full/debug/AndroidManifest.xml")
String manifestContent = manifest.getText('UTF-8')
String manifestContent = manifest.getText('UTF-8')
if (project.hasProperty('RMBT_CRASHLYTICS_APIKEY')) {
manifestContent = manifestContent.replaceAll(/RMBT_CRASHLYTICS_APIKEY/, RMBT_CRASHLYTICS_APIKEY)
}
......@@ -157,7 +157,7 @@ task prepareCrashlyticsRelease(dependsOn: 'processReleaseManifest') {
doLast{
// api key
File manifest = file("${buildDir}/intermediates/manifests/full/release/AndroidManifest.xml")
String manifestContent = manifest.getText('UTF-8')
String manifestContent = manifest.getText('UTF-8')
if (project.hasProperty('RMBT_CRASHLYTICS_APIKEY')) {
manifestContent = manifestContent.replaceAll(/RMBT_CRASHLYTICS_APIKEY/, RMBT_CRASHLYTICS_APIKEY)
}
......@@ -247,7 +247,7 @@ android {
}
buildTypes.all { buildType ->
buildConfigField "String", "CLIENT_SECRET", project.hasProperty('RMBT_CLIENT_SECRET') ? String.format("\"%s\"", RMBT_CLIENT_SECRET) : null
buildConfigField "String", "CLIENT_SECRET", project.hasProperty('RMBT_CLIENT_SECRET') ? String.format("\"%s\"", RMBT_CLIENT_SECRET) : "null"
}
defaultConfig {
......
......@@ -4,12 +4,6 @@
android:icon="@drawable/ic_action_search"
android:title="@string/history_button_filter"
android:showAsAction="ifRoom" />
<item android:id="@+id/action_menu_sync"
android:icon="@drawable/ic_action_refresh"
android:title="@string/history_button_sync"
android:showAsAction="always"
tools:ignore="AlwaysShowAction"/>
<item android:id="@+id/action_menu_share"
android:icon="@drawable/ic_action_share"
......
......@@ -183,7 +183,8 @@
<string name="result_description">POPIS</string>
<string name="result_details">DETAILY</string>
<string name="sync_summary">Synchronizace více zařízení</string>
<string name="sync_info_text">Máte možnost sjednotit výsledky ze dvou různých zařízení. Musíte zadat synchronizační kód z druhého zařízení a nebo si vyžádat kód tohoto zařízení.</string>
<string name="sync_request_code_button">Získat kód</string>
<string name="sync_enter_code_button">Zadat kód</string>
......
......@@ -203,7 +203,8 @@
<string name="result_category_tests">TESTS</string>
<string name="result_description">DESCRIPTION</string>
<string name="sync_summary">Synchronisation of different devices</string>
<string name="sync_info_text">You have the possibility to join the results from two different devices. To do so, you have to enter an already requested synchronisation code or request a new one.</string>
<string name="sync_request_code_button">Request Code</string>
<string name="sync_enter_code_button">Enter Code</string>
......
......@@ -45,6 +45,12 @@
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">
......
......@@ -565,9 +565,6 @@ public class RMBTMainActivity extends Activity implements MapProperties
case R.id.action_menu_filter:
showFilter();
break;
case R.id.action_menu_sync:
showSync();
break;
case R.id.action_menu_help:
showHelp(false);
break;
......@@ -1194,23 +1191,6 @@ public class RMBTMainActivity extends Activity implements MapProperties
refreshActionBar(titleId);
}
/**
*
*/
public void showSync()
{
FragmentTransaction ft;
ft = fm.beginTransaction();
final Fragment fragment = new RMBTSyncFragment();
ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_SYNC);
ft.addToBackStack(AppConstants.PAGE_TITLE_SYNC);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.commit();
refreshActionBar(AppConstants.PAGE_TITLE_SYNC);
}
public void showFilter() {
final FragmentManager fm = getFragmentManager();
FragmentTransaction ft;
......@@ -1888,18 +1868,15 @@ public class RMBTMainActivity extends Activity implements MapProperties
if (actionBarMenu != null) {
if (AppConstants.PAGE_TITLE_HISTORY.equals(name)) {
setVisibleMenuItems(R.id.action_menu_filter, R.id.action_menu_sync);
}
else if (AppConstants.PAGE_TITLE_ABOUT.equals(name)) {
setVisibleMenuItems(R.id.action_menu_filter);
} else if (AppConstants.PAGE_TITLE_ABOUT.equals(name)) {
setVisibleMenuItems(R.id.action_menu_rtr);
}
else if (AppConstants.PAGE_TITLE_HISTORY_PAGER.equals(name)) {
} else if (AppConstants.PAGE_TITLE_HISTORY_PAGER.equals(name)) {
Fragment f = getCurrentFragment();
if (f != null && f instanceof RMBTResultPagerFragment) {
((RMBTResultPagerFragment) f).setActionBarItems();
}
}
else {
} else {
setVisibleMenuItems();
}
}
......
......@@ -27,6 +27,8 @@ import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.view.MenuItem;
import android.widget.ListView;
import at.alladin.rmbt.android.sync.RMBTSyncActivity;
import at.alladin.rmbt.android.terms.RMBTTermsActivity;
import at.alladin.rmbt.android.util.ConfigHelper;
import cz.nic.netmetr.R;
......@@ -148,6 +150,19 @@ public class RMBTPreferenceActivity extends PreferenceActivity
}
});
}
final Preference syncPref = (Preference) findPreference("sync_settings");
if (syncPref != null)
{
syncPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference)
{
startActivity(new Intent(getBaseContext(), RMBTSyncActivity.class));
return true;
}
});
}
// v.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET);
......
package at.alladin.rmbt.android.sync;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import at.alladin.rmbt.android.main.AppConstants;
import cz.nic.netmetr.R;
public class RMBTSyncActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sync);
FragmentTransaction ft;
ft = getFragmentManager().beginTransaction();
final Fragment fragment = new RMBTSyncFragment();
ft.add(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_SYNC);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.commit();
}
}
......@@ -26,7 +26,7 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import at.alladin.rmbt.android.main.RMBTMainActivity;
import cz.nic.netmetr.R;
public class RMBTSyncFragment extends Fragment
......@@ -88,12 +88,7 @@ public class RMBTSyncFragment extends Fragment
populateViewForOrientation(inflater, (ViewGroup) getView());
}
public boolean onBackPressed()
{
((RMBTMainActivity) getActivity()).setHistoryDirty(true);
((RMBTMainActivity) getActivity()).checkSettings(true, null);
((RMBTMainActivity) getActivity()).setSettings(null, null);
// ((RMBTMainActivity) getActivity()).waitForSettings(false, false, true);
public boolean onBackPressed() {
return false;
}
}
......@@ -15,10 +15,6 @@
******************************************************************************/
package at.alladin.rmbt.android.sync;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
......@@ -31,7 +27,11 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import at.alladin.rmbt.android.main.RMBTMainActivity;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import at.alladin.rmbt.android.util.CheckSyncTask;
import at.alladin.rmbt.android.util.EndTaskListener;
import cz.nic.netmetr.R;
......@@ -41,22 +41,12 @@ public class RMBTSyncRequestCodeFragment extends Fragment implements EndTaskList
// private static final String DEBUG_TAG = "RMBTSyncRequestCodeFragment";
private RMBTMainActivity activity;
private CheckSyncTask syncTask;
private View view;
private TextView codeText;
@Override
public void onCreate(final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
activity = (RMBTMainActivity) getActivity();
}
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState)
{
......@@ -66,7 +56,7 @@ public class RMBTSyncRequestCodeFragment extends Fragment implements EndTaskList
if (syncTask == null || syncTask != null || syncTask.isCancelled())
{
syncTask = new CheckSyncTask(activity);
syncTask = new CheckSyncTask(getActivity());
syncTask.setEndTaskListener(this);
syncTask.execute("");
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="at.alladin.rmbt.android.sync.RMBTSyncActivity"
android:id="@+id/fragment_content"
android:background="@drawable/app_bgdn_radiant"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":util:clientSecret" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../../RMBTAndroid" external.system.id="GRADLE" external.system.module.group="Netmetr.util" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":util:clientSecret" />
</configuration>
</facet>
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="true" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="clientSecret.clientSecret" level="project" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":util" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../RMBTAndroid" external.system.id="GRADLE" external.system.module.group="Netmetr" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":util" />
</configuration>
</facet>
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
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