Fix error 100 - display dialog on map screen as well

This commit is contained in:
Victor Shcherb 2015-06-11 01:47:57 +02:00
parent 801e901d5e
commit 23c8da8308
3 changed files with 24 additions and 15 deletions

View file

@ -63,7 +63,7 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
launchOsMoGroupsActivity();
}
});
plugin.setGroupsActivity(getActivity());
setupHader(view);
return view;
}
@ -75,6 +75,19 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
plugin.getGroups().addUiListeners(this);
}
setupOsMoView();
plugin.setGroupsActivity(getActivity());
}
@Override
public void onDetach() {
super.onDetach();
plugin.setGroupsActivity(null);
}
@Override
public void onDestroy() {
super.onDestroy();
plugin.setGroupsActivity(null);
}
private void setupOsMoView() {

View file

@ -53,7 +53,7 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
private TextInfoWidget osmoControl;
private OsMoPositionLayer olayer;
protected MapActivity mapActivity;
protected OsMoGroupsActivity groupsActivity;
protected Activity groupsActivity;
protected OsMoControlDevice deviceControl;
private final static Log log = PlatformUtil.getLog(OsMoPlugin.class);
@ -86,11 +86,11 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
}
public OsMoGroupsActivity getGroupsActivity() {
public Activity getGroupsActivity() {
return groupsActivity;
}
public void setGroupsActivity(OsMoGroupsActivity groupsActivity) {
public void setGroupsActivity(Activity groupsActivity) {
this.groupsActivity = groupsActivity;
}
@ -483,15 +483,15 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
@Override
public void onConnected() {
if (groupsActivity != null) {
groupsActivity.handleConnect();
if (groupsActivity instanceof OsMoGroupsActivity) {
((OsMoGroupsActivity) groupsActivity).handleConnect();
}
}
@Override
public void onDisconnected(String msg) {
if (groupsActivity != null) {
groupsActivity.handleDisconnect(msg);
if (groupsActivity instanceof OsMoGroupsActivity) {
((OsMoGroupsActivity) groupsActivity).handleDisconnect(msg);
}
}

View file

@ -27,6 +27,7 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Notification;
@ -332,7 +333,7 @@ public class OsMoService implements OsMoReactor {
}
private void runNotification(final String error) {
final OsMoGroupsActivity ga = plugin.getGroupsActivity();
final Activity ga = plugin.getGroupsActivity();
if(ga != null) {
app.runInUIThread(new Runnable() {
@ -360,7 +361,7 @@ public class OsMoService implements OsMoReactor {
}
protected void showRegisterAgain(OsMoGroupsActivity ga, String msg) {
protected void showRegisterAgain(Activity ga, String msg) {
Builder bld = new AlertDialog.Builder(ga);
bld.setMessage(msg);
bld.setPositiveButton(R.string.shared_string_ok, new OnClickListener() {
@ -374,11 +375,6 @@ public class OsMoService implements OsMoReactor {
}
private void showDialogAskToReregister(String error) {
// Builder bld = new AlertDialog.Builder(this);
// bld.setMessage(app.getString(R.string.osmo_io_error) + error);
// bld.show();
}
public void showErrorMessage(String string) {
app.showToastMessage(app.getString(R.string.osmo_io_error) + string);