Update osmo plugin

This commit is contained in:
Victor Shcherb 2014-07-03 02:13:16 +02:00
parent 73d7be61aa
commit 143e602c79
11 changed files with 161 additions and 45 deletions

View file

@ -5,16 +5,9 @@
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:orientation="vertical" > android:orientation="vertical" >
<TextView
android:id="@+id/motd"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dip"
android:gravity="center"
android:textSize="18sp" />
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -30,12 +23,28 @@
android:src="@drawable/mon_osmo_conn_small" /> android:src="@drawable/mon_osmo_conn_small" />
<Switch <Switch
android:id="@+id/enable_tracker" android:id="@+id/enable_service"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:focusable="false" android:focusable="false"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/osmo_enable_tracker" /> android:text="@string/osmo_start_service" />
</LinearLayout> </LinearLayout>
<Switch
android:id="@+id/enable_tracker"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:gravity="center_vertical"
android:text="@string/osmo_enable_tracker" />
<TextView
android:id="@+id/motd"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dip"
android:gravity="center"
android:textSize="18sp" />
</LinearLayout> </LinearLayout>

View file

@ -4,17 +4,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:orientation="vertical" > android:orientation="vertical" >
<TextView
android:id="@+id/motd"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dip"
android:gravity="center"
android:textSize="18sp" />
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -30,12 +23,28 @@
android:src="@drawable/mon_osmo_conn_small" /> android:src="@drawable/mon_osmo_conn_small" />
<CheckBox <CheckBox
android:id="@+id/enable_tracker" android:id="@+id/enable_service"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:focusable="false" android:focusable="false"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/osmo_enable_tracker" /> android:text="@string/osmo_start_service" />
</LinearLayout> </LinearLayout>
<CheckBox
android:id="@+id/enable_tracker"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:gravity="center_vertical"
android:text="@string/osmo_enable_tracker" />
<TextView
android:id="@+id/motd"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dip"
android:gravity="center"
android:textSize="18sp" />
</LinearLayout> </LinearLayout>

View file

@ -1689,7 +1689,7 @@ OsmAnd - открытый источник и активно развается.
<string name="osmo_group_policy">Политика</string> <string name="osmo_group_policy">Политика</string>
<string name="osmo_control">Быстрый доступ к OsMo</string> <string name="osmo_control">Быстрый доступ к OsMo</string>
<string name="osmo_cancel_moving_target">Отменить движущуюся цель</string> <string name="osmo_cancel_moving_target">Отменить движущуюся цель</string>
<string name="osmo_set_moving_target">Установить как движущуюся цель</string> <string name="osmo_set_moving_target">Движущаяся цель</string>
<string name="osmo_center_location">Центр на экране</string> <string name="osmo_center_location">Центр на экране</string>
<string name="gpx_selection_segment_title">Сегмент</string> <string name="gpx_selection_segment_title">Сегмент</string>
<string name="gpx_info_distance">Расстояние: %1$s (%2$s точек) </string> <string name="gpx_info_distance">Расстояние: %1$s (%2$s точек) </string>

View file

@ -9,6 +9,9 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="osmo_auto_connect_descr">Automatically connect to the service after application startup</string>
<string name="osmo_auto_connect">Auto-connect</string>
<string name="osmo_start_service">OsMo service</string>
<string name="osmo_gpx_track_downloaded">OsMo track %1$s downloaded.</string> <string name="osmo_gpx_track_downloaded">OsMo track %1$s downloaded.</string>
<string name="no_index_file_to_download">Nothing to download, please check internet connection.</string> <string name="no_index_file_to_download">Nothing to download, please check internet connection.</string>
<string name="select_index_file_to_download">Nothing was found. If you can\'t find your region, you can make it yourself (see http://osmand.net).</string> <string name="select_index_file_to_download">Nothing was found. If you can\'t find your region, you can make it yourself (see http://osmand.net).</string>

View file

@ -847,6 +847,10 @@ public class OsmandSettings {
public final OsmandPreference<String> OSMO_USER_PWD = new StringPreference("osmo_user_pwd", null).makeGlobal(); public final OsmandPreference<String> OSMO_USER_PWD = new StringPreference("osmo_user_pwd", null).makeGlobal();
public final OsmandPreference<Boolean> OSMO_AUTO_CONNECT = new BooleanPreference("osmo_automatically_connect", false).makeGlobal();
public final OsmandPreference<Long> OSMO_LAST_PING = new LongPreference("osmo_last_ping", 0).makeGlobal().cache();
public final OsmandPreference<Boolean> OSMO_AUTO_SEND_LOCATIONS = new BooleanPreference("osmo_automatically_send_locations", false).makeGlobal(); public final OsmandPreference<Boolean> OSMO_AUTO_SEND_LOCATIONS = new BooleanPreference("osmo_automatically_send_locations", false).makeGlobal();
public final OsmandPreference<Boolean> OSMO_SHOW_GROUP_NOTIFICATIONS = new BooleanPreference("osmo_show_toast_notifications", true).makeGlobal(); public final OsmandPreference<Boolean> OSMO_SHOW_GROUP_NOTIFICATIONS = new BooleanPreference("osmo_show_toast_notifications", true).makeGlobal();

View file

@ -243,7 +243,7 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
gr.description = obj.getString(DESCRIPTION); gr.description = obj.getString(DESCRIPTION);
} }
if(obj.has(POLICY)) { if(obj.has(POLICY)) {
gr.description = obj.getString(POLICY); gr.policy = obj.getString(POLICY);
} }
if(obj.has(EXPIRE_TIME)) { if(obj.has(EXPIRE_TIME)) {
gr.expireTime = obj.getLong(EXPIRE_TIME); gr.expireTime = obj.getLong(EXPIRE_TIME);

View file

@ -118,6 +118,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
private Object selectedObject = null; private Object selectedObject = null;
private String operation; private String operation;
private Paint white; private Paint white;
private View header;
@Override @Override
@ -134,9 +135,10 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
new OsMoIntentHandler(app, osMoPlugin).execute(getIntent()); new OsMoIntentHandler(app, osMoPlugin).execute(getIntent());
} }
} }
setContentView(R.layout.osmo_groups_list); setContentView(R.layout.expandable_list);
getSupportActionBar().setTitle(R.string.osmo_activity); getSupportActionBar().setTitle(R.string.osmo_activity);
setSupportProgressBarIndeterminateVisibility(false); setSupportProgressBarIndeterminateVisibility(false);
setupHeader();
// getSupportActionBar().setIcon(R.drawable.tab_search_favorites_icon); // getSupportActionBar().setIcon(R.drawable.tab_search_favorites_icon);
@ -147,7 +149,19 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
uiHandler = new Handler(); uiHandler = new Handler();
directionPath = createDirectionPath(); directionPath = createDirectionPath();
CompoundButton trackr = (CompoundButton) findViewById(R.id.enable_tracker);
white = new Paint();
white.setStyle(Style.FILL_AND_STROKE);
white.setColor(getResources().getColor(R.color.color_unknown));
white.setAntiAlias(true);
updateStatus();
}
private void setupHeader() {
header = getLayoutInflater().inflate(R.layout.osmo_groups_list_header, null);
getExpandableListView().addHeaderView(header);
CompoundButton trackr = (CompoundButton) header.findViewById(R.id.enable_tracker);
trackr.setChecked(osMoPlugin.getTracker().isEnabledTracker()); trackr.setChecked(osMoPlugin.getTracker().isEnabledTracker());
trackr.setOnCheckedChangeListener(new OnCheckedChangeListener() { trackr.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@ -166,20 +180,48 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
updateStatus(); updateStatus();
} }
}); });
TextView mtd = (TextView) findViewById(R.id.motd);
CompoundButton srvc = (CompoundButton) header.findViewById(R.id.enable_service);
srvc.setChecked(osMoPlugin.getService().isEnabled());
srvc.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
osMoPlugin.getService().connect(true);
} else {
osMoPlugin.getTracker().disableTracker();
osMoPlugin.getService().disconnect();
if (app.getNavigationService() != null) {
app.getNavigationService().stopIfNeeded(app, NavigationService.USED_BY_LIVE);
}
}
setSupportProgressBarIndeterminateVisibility(true);
header.postDelayed(new Runnable() {
@Override
public void run() {
updateStatus();
if (osMoPlugin.getService().isConnected()) {
adapter.synchronizeGroups();
} else {
adapter.clear();
}
setSupportProgressBarIndeterminateVisibility(false);
}
}, 3000);
}
});
TextView mtd = (TextView) header.findViewById(R.id.motd);
SessionInfo si = osMoPlugin.getService().getCurrentSessionInfo(); SessionInfo si = osMoPlugin.getService().getCurrentSessionInfo();
boolean visible = si != null && si.motd != null && si.motd.length() > 0; boolean visible = si != null && si.motd != null && si.motd.length() > 0;
mtd.setVisibility(visible? View.VISIBLE:View.GONE); mtd.setVisibility(visible? View.VISIBLE:View.GONE);
if(visible) { if(visible) {
mtd.setText(si.motd); mtd.setText(si.motd);
} }
white = new Paint();
white.setStyle(Style.FILL_AND_STROKE);
white.setColor(getResources().getColor(R.color.color_unknown));
white.setAntiAlias(true);
updateStatus();
} }
long lastUpdateTime; long lastUpdateTime;
@ -199,7 +241,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
} }
private void updateStatus() { private void updateStatus() {
ImageView status = (ImageView) findViewById(R.id.osmo_status); ImageView status = (ImageView) header.findViewById(R.id.osmo_status);
final Drawable srcSmall = getResources().getDrawable(R.drawable.mon_osmo_conn_small); final Drawable srcSmall = getResources().getDrawable(R.drawable.mon_osmo_conn_small);
final Drawable srcSignalSmall = getResources().getDrawable(R.drawable.mon_osmo_conn_signal_small); final Drawable srcSignalSmall = getResources().getDrawable(R.drawable.mon_osmo_conn_signal_small);
final Drawable srcBig = getResources().getDrawable(R.drawable.mon_osmo_conn_big); final Drawable srcBig = getResources().getDrawable(R.drawable.mon_osmo_conn_big);
@ -221,6 +263,13 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
lastUpdateTime = last; lastUpdateTime = last;
blink(status, big, small); blink(status, big, small);
} }
if(service.isConnected()) {
header.findViewById(R.id.motd).setVisibility(View.VISIBLE);
header.findViewById(R.id.enable_tracker).setVisibility(View.VISIBLE);
} else {
header.findViewById(R.id.motd).setVisibility(View.GONE);
header.findViewById(R.id.enable_tracker).setVisibility(View.GONE);
}
} }
private Path createDirectionPath() { private Path createDirectionPath() {
@ -262,7 +311,9 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
app.getLocationProvider().addLocationListener(this); app.getLocationProvider().addLocationListener(this);
app.getLocationProvider().resumeAllUpdates(); app.getLocationProvider().resumeAllUpdates();
osMoPlugin.getGroups().setUiListener(this); osMoPlugin.getGroups().setUiListener(this);
adapter.synchronizeGroups(); if(osMoPlugin.getService().isConnected()) {
adapter.synchronizeGroups();
}
} }
@Override @Override
@ -297,15 +348,18 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
MenuItem.SHOW_AS_ACTION_IF_ROOM); MenuItem.SHOW_AS_ACTION_IF_ROOM);
} }
createMenuItem(menu, SHARE_ID, R.string.share_fav, R.drawable.ic_action_gshare_light, R.drawable.ic_action_gshare_dark, createMenuItem(menu, SHARE_ID, R.string.share_fav, R.drawable.ic_action_gshare_light, R.drawable.ic_action_gshare_dark,
MenuItem.SHOW_AS_ACTION_IF_ROOM); // there is a bug in Android 4.2 layout
device != null && device.getLastLocation() != null ? MenuItem.SHOW_AS_ACTION_NEVER : MenuItem.SHOW_AS_ACTION_IF_ROOM);
/// ///
if(device != null) { if(device != null) {
createMenuItem(menu, SETTINGS_DEV_ID, R.string.settings, R.drawable.ic_action_settings_light, R.drawable.ic_action_settings_dark, createMenuItem(menu, SETTINGS_DEV_ID, R.string.settings, R.drawable.ic_action_settings_light, R.drawable.ic_action_settings_dark,
MenuItem.SHOW_AS_ACTION_IF_ROOM); // there is a bug in Android 4.2 layout
device.getLastLocation() != null ? MenuItem.SHOW_AS_ACTION_NEVER : MenuItem.SHOW_AS_ACTION_IF_ROOM);
} }
if(device != null && device.getLastLocation() != null) { if(device != null && device.getLastLocation() != null) {
MenuItem menuItem = createMenuItem(menu, TRACK_DEV_ID, R.string.osmo_set_moving_target, R.drawable.ic_action_flage_light, R.drawable.ic_action_flage_dark, MenuItem menuItem = createMenuItem(menu, TRACK_DEV_ID, R.string.osmo_set_moving_target, R.drawable.ic_action_flage_light, R.drawable.ic_action_flage_dark,
MenuItem.SHOW_AS_ACTION_IF_ROOM ); // there is a bug in Android 4.2 layout
device.getLastLocation() != null ? MenuItem.SHOW_AS_ACTION_NEVER : MenuItem.SHOW_AS_ACTION_IF_ROOM);
menuItem.setTitleCondensed(getString(R.string.osmo_follow)); menuItem.setTitleCondensed(getString(R.string.osmo_follow));
} }
if(group != null) { if(group != null) {
@ -344,6 +398,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
@Override @Override
public void onDestroyActionMode(ActionMode mode) { public void onDestroyActionMode(ActionMode mode) {
selectedObject = null; selectedObject = null;
refreshList();
} }
@Override @Override
@ -768,7 +823,9 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
this.grs = grs; this.grs = grs;
this.tracker = tracker; this.tracker = tracker;
this.srv = srv; this.srv = srv;
synchronizeGroups(); if(srv.isConnected()) {
synchronizeGroups();
}
} }
public void update(OsMoGroup group) { public void update(OsMoGroup group) {
@ -793,6 +850,11 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
} }
} }
public void clear() {
users.clear();
sortedGroups.clear();
notifyDataSetChanged();
}
public void synchronizeGroups() { public void synchronizeGroups() {

View file

@ -71,7 +71,10 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
@Override @Override
public boolean init(final OsmandApplication app) { public boolean init(final OsmandApplication app) {
service.connect(true); if(app.getSettings().OSMO_AUTO_CONNECT.get() ||
(System.currentTimeMillis() - app.getSettings().OSMO_LAST_PING.get() < 5 * 60 * 1000 )) {
service.connect(true);
}
return true; return true;
} }
@ -190,6 +193,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
* creates (if it wasn't created previously) the control to be added on a MapInfoLayer that shows a monitoring state (recorded/stopped) * creates (if it wasn't created previously) the control to be added on a MapInfoLayer that shows a monitoring state (recorded/stopped)
*/ */
private BaseMapWidget createOsMoControl(final MapActivity map, Paint paintText, Paint paintSubText) { private BaseMapWidget createOsMoControl(final MapActivity map, Paint paintText, Paint paintSubText) {
final Drawable srcSmall = map.getResources().getDrawable(R.drawable.mon_osmo_conn_small); final Drawable srcSmall = map.getResources().getDrawable(R.drawable.mon_osmo_conn_small);
final Drawable srcSignalSmall = map.getResources().getDrawable(R.drawable.mon_osmo_conn_signal_small); final Drawable srcSignalSmall = map.getResources().getDrawable(R.drawable.mon_osmo_conn_signal_small);
final Drawable srcBig = map.getResources().getDrawable(R.drawable.mon_osmo_conn_big); final Drawable srcBig = map.getResources().getDrawable(R.drawable.mon_osmo_conn_big);

View file

@ -10,7 +10,6 @@ import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.Version; import net.osmand.plus.Version;
@ -45,6 +44,7 @@ public class OsMoService implements OsMoReactor {
public static final String TRACK_URL = "http://osmo.mobi/u/"; public static final String TRACK_URL = "http://osmo.mobi/u/";
private String lastRegistrationError = null; private String lastRegistrationError = null;
private OsMoPlugin plugin; private OsMoPlugin plugin;
private boolean enabled = false;
@ -95,16 +95,22 @@ public class OsMoService implements OsMoReactor {
thread.stopConnection(); thread.stopConnection();
} }
thread = new OsMoThread(this, listReactors); thread = new OsMoThread(this, listReactors);
enabled = true;
return true; return true;
} }
public boolean isEnabled() {
return enabled;
}
public void disconnect() { public void disconnect() {
if(thread != null) { if(thread != null) {
enabled = false;
thread.stopConnection(); thread.stopConnection();
app.getSettings().OSMO_LAST_PING.set(0l);
} }
} }
public void registerReactor(OsMoReactor reactor) { public void registerReactor(OsMoReactor reactor) {
if(!listReactors.contains(reactor)) { if(!listReactors.contains(reactor)) {
listReactors.add(reactor); listReactors.add(reactor);
@ -202,6 +208,9 @@ public class OsMoService implements OsMoReactor {
// Add your data // Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("key", deviceKey)); nameValuePairs.add(new BasicNameValuePair("key", deviceKey));
if(app.getSettings().OSMO_USER_PWD.get() != null) {
nameValuePairs.add(new BasicNameValuePair("auth", app.getSettings().OSMO_USER_PWD.get()));
}
nameValuePairs.add(new BasicNameValuePair("protocol", "1")); nameValuePairs.add(new BasicNameValuePair("protocol", "1"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
@ -253,6 +262,9 @@ public class OsMoService implements OsMoReactor {
@Override @Override
public String nextSendCommand(OsMoThread tracker) { public String nextSendCommand(OsMoThread tracker) {
if(System.currentTimeMillis() - app.getSettings().OSMO_LAST_PING.get() > 30000) {
app.getSettings().OSMO_LAST_PING.set(System.currentTimeMillis());
}
if(!commands.isEmpty()) { if(!commands.isEmpty()) {
return commands.poll(); return commands.poll();
} }

View file

@ -214,7 +214,7 @@ public class OsMoTracker implements OsMoReactor {
@Override @Override
public void reconnect() { public void reconnect() {
if(autoStart.get()) { if(autoStart.get() || startSendingLocations) {
enableTracker(); enableTracker();
} }
} }

View file

@ -29,6 +29,7 @@ public class SettingsOsMoActivity extends SettingsBaseActivity {
private Preference debugPref; private Preference debugPref;
private Preference trackerId; private Preference trackerId;
private CheckBoxPreference sendLocationsref;
public static final int[] SECONDS = new int[] {0, 1, 2, 3, 5, 10, 15, 30, 60, 90}; public static final int[] SECONDS = new int[] {0, 1, 2, 3, 5, 10, 15, 30, 60, 90};
public static final int[] MINUTES = new int[] {2, 3, 5}; public static final int[] MINUTES = new int[] {2, 3, 5};
@ -48,9 +49,15 @@ public class SettingsOsMoActivity extends SettingsBaseActivity {
trackerId.setOnPreferenceClickListener(this); trackerId.setOnPreferenceClickListener(this);
grp.addPreference(trackerId); grp.addPreference(trackerId);
CheckBoxPreference sendLocationsref = createCheckBoxPreference(settings.OSMO_AUTO_SEND_LOCATIONS); CheckBoxPreference autoConnectref = createCheckBoxPreference(settings.OSMO_AUTO_CONNECT);
autoConnectref.setTitle(R.string.osmo_auto_connect);
autoConnectref.setSummary(R.string.osmo_auto_connect_descr);
grp.addPreference(autoConnectref);
sendLocationsref = createCheckBoxPreference(settings.OSMO_AUTO_SEND_LOCATIONS);
sendLocationsref.setTitle(R.string.osmo_auto_send_locations); sendLocationsref.setTitle(R.string.osmo_auto_send_locations);
sendLocationsref.setSummary(R.string.osmo_auto_send_locations_descr); sendLocationsref.setSummary(R.string.osmo_auto_send_locations_descr);
sendLocationsref.setEnabled(settings.OSMO_AUTO_CONNECT.get());
grp.addPreference(sendLocationsref); grp.addPreference(sendLocationsref);
grp.addPreference(createTimeListPreference(settings.OSMO_SAVE_TRACK_INTERVAL, SECONDS, grp.addPreference(createTimeListPreference(settings.OSMO_SAVE_TRACK_INTERVAL, SECONDS,
@ -171,6 +178,12 @@ public class SettingsOsMoActivity extends SettingsBaseActivity {
final OsMoPlugin plugin = OsMoPlugin.getEnabledPlugin(OsMoPlugin.class); final OsMoPlugin plugin = OsMoPlugin.getEnabledPlugin(OsMoPlugin.class);
plugin.getTracker().enableTracker(); plugin.getTracker().enableTracker();
} }
} else if (id.equals(settings.OSMO_AUTO_CONNECT.getId())) {
if ((Boolean) newValue) {
final OsMoPlugin plugin = OsMoPlugin.getEnabledPlugin(OsMoPlugin.class);
plugin.getService().connect(false);
}
sendLocationsref.setEnabled(settings.OSMO_AUTO_CONNECT.get());
} }
return p; return p;
} }