From 3592a91e519da5bd455e4ae13b93835b5099d885 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Tue, 30 Jul 2013 15:21:51 +0200 Subject: [PATCH 1/4] temporarily removed sync plugin from mobile build --- build.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index f3ae396a..984b7c8e 100755 --- a/build.py +++ b/build.py @@ -258,7 +258,8 @@ if buildMobile: # do not include desktop-only plugins to mobile assets ignore=shutil.ignore_patterns('*.meta.js', 'force-https*', 'privacy-view*', 'speech-search*', - 'basemap-cloudmade*', 'scroll-wheel-zoom-disable*')) + 'basemap-cloudmade*', 'scroll-wheel-zoom-disable*', + 'sync*')) if buildMobile != 'copyonly': From 63474d4c40241b12cb648dd0d34972c24877a58f Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Tue, 30 Jul 2013 22:23:01 +0200 Subject: [PATCH 2/4] added query to geo intent to get a marker on the map --- mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java index 8f9ff784..114ebe26 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java +++ b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java @@ -46,7 +46,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList intent.putExtra(Intent.EXTRA_SUBJECT, mTitle); addTab(intent, R.string.tab_share, R.drawable.share); - String geoUri = "geo:" + mLl; + String geoUri = "geo:" + mLl + "?q=" + mLl; intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(geoUri)); addTab(intent, R.string.tab_map, R.drawable.location_map); @@ -55,6 +55,8 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList } @Override + + protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_share); From 88d87f177675df8abd6851be84a68e6d037e3f85 Mon Sep 17 00:00:00 2001 From: fkloft Date: Tue, 30 Jul 2013 23:13:24 +0200 Subject: [PATCH 3/4] Remember last selected tab in share dialog --- .../com/cradle/iitc_mobile/IITC_Mobile.java | 2 +- .../iitc_mobile/share/ShareActivity.java | 29 +++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 11251010..e61faf7b 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -107,7 +107,7 @@ public class IITC_Mobile extends Activity { return; } // no reload needed - if (key.equals("pref_press_twice_to_exit")) + if (key.equals("pref_press_twice_to_exit") || key.equals("pref_share_selected_tab")) return; reload_needed = true; diff --git a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java index 114ebe26..c3898d01 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java +++ b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java @@ -3,8 +3,10 @@ package com.cradle.iitc_mobile.share; import android.app.ActionBar; import android.app.FragmentTransaction; import android.content.Intent; +import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; +import android.preference.PreferenceManager; import android.support.v4.app.FragmentActivity; import android.support.v4.app.NavUtils; import android.support.v4.view.ViewPager; @@ -15,6 +17,7 @@ import com.cradle.iitc_mobile.R; public class ShareActivity extends FragmentActivity implements ActionBar.TabListener { private boolean mIsPortal; private String mLl; + private SharedPreferences mSharedPrefs = null; private String mTitle; private int mZoom; IntentFragmentAdapter mFragmentAdapter; @@ -38,6 +41,17 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList return url; } + private void setSelected(int position) { + // Activity not fully loaded yet (may occur during tab creation) + if (mSharedPrefs == null) + return; + + mSharedPrefs + .edit() + .putInt("pref_share_selected_tab", position) + .apply(); + } + private void setupIntents() { Intent intent = new Intent(Intent.ACTION_SEND); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); @@ -55,8 +69,6 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList } @Override - - protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_share); @@ -81,6 +93,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); + setSelected(position); } }); @@ -93,6 +106,14 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList .setIcon(fragment.getIcon()) .setTabListener(this)); } + + mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); + int selected = mSharedPrefs.getInt("pref_share_selected_tab", 0); + if (selected < mFragmentAdapter.getCount()) + { + mViewPager.setCurrentItem(selected); + actionBar.setSelectedNavigationItem(selected); + } } @Override @@ -111,7 +132,9 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList @Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - mViewPager.setCurrentItem(tab.getPosition()); + int position = tab.getPosition(); + mViewPager.setCurrentItem(position); + setSelected(position); } @Override From 77bc7911314086d79175127262cb298fbfa4276b Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 31 Jul 2013 16:16:44 +0200 Subject: [PATCH 4/4] added back named google maps marker...seems to work for other geo intent apps too...(needs testing for more apps) --- mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java index c3898d01..494e9c82 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java +++ b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java @@ -60,7 +60,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList intent.putExtra(Intent.EXTRA_SUBJECT, mTitle); addTab(intent, R.string.tab_share, R.drawable.share); - String geoUri = "geo:" + mLl + "?q=" + mLl; + String geoUri = "http://maps.google.com/maps?q=loc:" + mLl + " (" + mTitle + ")"; intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(geoUri)); addTab(intent, R.string.tab_map, R.drawable.location_map);