Dark theme for EditPoi
This commit is contained in:
parent
43437abfb0
commit
f034c3fa4f
4 changed files with 22 additions and 42 deletions
|
@ -64,8 +64,6 @@ import net.osmand.plus.base.FailSafeFuntions;
|
|||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.helpers.GpxImportHelper;
|
||||
import net.osmand.plus.helpers.OnBackPressedListener;
|
||||
import net.osmand.plus.helpers.OnBackPressedProvider;
|
||||
import net.osmand.plus.helpers.WakeLockHelper;
|
||||
import net.osmand.plus.render.RendererRegistry;
|
||||
import net.osmand.plus.resources.ResourceManager;
|
||||
|
@ -89,7 +87,7 @@ import java.util.Map;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class MapActivity extends AccessibleActivity implements OnBackPressedProvider {
|
||||
public class MapActivity extends AccessibleActivity {
|
||||
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
|
||||
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
|
||||
private static final int LONG_KEYPRESS_DELAY = 500;
|
||||
|
@ -130,8 +128,6 @@ public class MapActivity extends AccessibleActivity implements OnBackPressedProv
|
|||
private IMapDownloaderCallback downloaderCallback;
|
||||
private DrawerLayout drawerLayout;
|
||||
|
||||
private OnBackPressedListener mOnBackPressedListener;
|
||||
|
||||
public static final String SHOULD_SHOW_DASHBOARD_ON_START = "should_show_dashboard_on_start";
|
||||
|
||||
private Notification getNotification() {
|
||||
|
@ -378,10 +374,6 @@ public class MapActivity extends AccessibleActivity implements OnBackPressedProv
|
|||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (mOnBackPressedListener != null) {
|
||||
mOnBackPressedListener.onBackPressed();
|
||||
return;
|
||||
}
|
||||
if (dashboardOnMap.onBackPressed()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1001,9 +993,4 @@ public class MapActivity extends AccessibleActivity implements OnBackPressedProv
|
|||
openDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setmOnBackPressedListener(OnBackPressedListener listener) {
|
||||
mOnBackPressedListener = listener;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package net.osmand.plus.helpers;
|
||||
|
||||
public interface OnBackPressedListener {
|
||||
void onBackPressed();
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package net.osmand.plus.helpers;
|
||||
|
||||
public interface OnBackPressedProvider {
|
||||
void setmOnBackPressedListener(OnBackPressedListener listener);
|
||||
}
|
|
@ -25,6 +25,7 @@ import android.support.v7.widget.Toolbar;
|
|||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -48,8 +49,6 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.OnBackPressedListener;
|
||||
import net.osmand.plus.helpers.OnBackPressedProvider;
|
||||
import net.osmand.plus.osmedit.data.EditPoiData;
|
||||
import net.osmand.plus.osmedit.data.Tag;
|
||||
import net.osmand.plus.osmedit.dialogs.DeletePoiDialogFragment;
|
||||
|
@ -64,7 +63,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
|
||||
public class EditPoiFragment extends DialogFragment implements OnBackPressedListener {
|
||||
public class EditPoiFragment extends DialogFragment {
|
||||
public static final String TAG = "EditPoiFragment";
|
||||
private static final Log LOG = PlatformUtil.getLog(EditPoiFragment.class);
|
||||
|
||||
|
@ -346,20 +345,29 @@ public class EditPoiFragment extends DialogFragment implements OnBackPressedList
|
|||
}
|
||||
});
|
||||
updateType(editPoiData.amenity);
|
||||
setCancelable(false);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// Do not forget to unregister
|
||||
((OnBackPressedProvider) getActivity()).setmOnBackPressedListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
((OnBackPressedProvider) getActivity()).setmOnBackPressedListener(null);
|
||||
getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() {
|
||||
@Override
|
||||
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
|
||||
if (keyCode == android.view.KeyEvent.KEYCODE_BACK) {
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
return true;
|
||||
} else {
|
||||
new AreYouSureDialogFrgament().show(getChildFragmentManager(),
|
||||
"AreYouSureDialogFrgament");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -368,11 +376,6 @@ public class EditPoiFragment extends DialogFragment implements OnBackPressedList
|
|||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
new AreYouSureDialogFrgament().show(getChildFragmentManager(), "AreYouSureDialogFrgament");
|
||||
}
|
||||
|
||||
private void tryAddTag(String key, String value) {
|
||||
if (!Algorithms.isEmpty(value)) {
|
||||
editPoiData.tags.add(new Tag(key, value));
|
||||
|
@ -579,7 +582,7 @@ public class EditPoiFragment extends DialogFragment implements OnBackPressedList
|
|||
protected Node doInBackground(Amenity[] params) {
|
||||
return openstreetmapUtil.loadNode(params[0]);
|
||||
}
|
||||
|
||||
|
||||
protected void onPostExecute(Node n) {
|
||||
if (n == null) {
|
||||
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.poi_error_poi_not_found), Toast.LENGTH_LONG).show();
|
||||
|
@ -604,7 +607,7 @@ public class EditPoiFragment extends DialogFragment implements OnBackPressedList
|
|||
}
|
||||
})
|
||||
.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
return super.onCreateDialog(savedInstanceState);
|
||||
return builder.create();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue