Delete an unnecessary fragment

This commit is contained in:
Alexander Sytnyk 2017-06-30 11:48:13 +03:00
parent ceff91fb31
commit e4f38598a1
5 changed files with 398 additions and 418 deletions

View file

@ -1,5 +1,17 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/shadow_on_map"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/bg_shadow_onmap" />
<LinearLayout
android:id="@+id/mapillary_filters_linear_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -411,4 +423,6 @@
android:layout_height="18dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -1,6 +0,0 @@
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/shadow_on_map"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/bg_shadow_onmap" />

View file

@ -77,7 +77,6 @@ import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu;
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu.LocalRoutingParameter;
import net.osmand.plus.mapillary.MapillaryFiltersFragment;
import net.osmand.plus.mapillary.MapillaryFiltersMapShadowFragment;
import net.osmand.plus.mapillary.MapillaryPlugin.MapillaryFirstDialogFragment;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.routing.RoutingHelper;
@ -824,8 +823,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
addOrUpdateDashboardFragments();
} else {
mapActivity.getSupportFragmentManager().beginTransaction()
.replace(R.id.content, new MapillaryFiltersMapShadowFragment(), MapillaryFiltersMapShadowFragment.TAG)
.add(R.id.content, new MapillaryFiltersFragment(), MapillaryFiltersFragment.TAG)
.replace(R.id.content, new MapillaryFiltersFragment(), MapillaryFiltersFragment.TAG)
.commit();
}
scrollView.setVisibility(View.VISIBLE);
@ -1253,13 +1251,11 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
private void removeMapillaryFiltersFragment() {
FragmentManager manager = mapActivity.getSupportFragmentManager();
Fragment mapillaryFragment = manager.findFragmentByTag(MapillaryFiltersFragment.TAG);
Fragment shadowOnMap = manager.findFragmentByTag(MapillaryFiltersMapShadowFragment.TAG);
if (mapillaryFragment != null && shadowOnMap != null) {
if (mapillaryFragment != null) {
OsmandSettings settings = getMyApplication().getSettings();
TransactionBuilder builder = new TransactionBuilder(manager, settings, mapActivity);
builder.getFragmentTransaction()
.remove(mapillaryFragment)
.remove(shadowOnMap)
.commit();
}
}

View file

@ -60,7 +60,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
final DateFormat dateFormat = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM);
final View view = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_mapillary_filters, null);
view.setBackgroundColor(backgroundColor);
view.findViewById(R.id.mapillary_filters_linear_layout).setBackgroundColor(backgroundColor);
final View toggleRow = view.findViewById(R.id.toggle_row);
@ -78,7 +78,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
((AppCompatTextView) toggleRow.findViewById(R.id.toggle_row_title)).setText(toggleActionStringId);
final Drawable drawable = getIcon(toggleIconId, toggleIconColorId);
((AppCompatImageView) toggleRow.findViewById(R.id.toggle_row_icon)).setImageDrawable(drawable);
final CompoundButton toggle = (CompoundButton) toggleRow.findViewById(R.id.toggle_row_toggle);
final CompoundButton toggle = toggleRow.findViewById(R.id.toggle_row_toggle);
toggle.setChecked(selected);
toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@ -96,7 +96,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
});
final Button reloadTile = (Button) view.findViewById(R.id.button_reload_tile);
final Button reloadTile = view.findViewById(R.id.button_reload_tile);
reloadTile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -114,7 +114,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
((AppCompatImageView) view.findViewById(R.id.mapillary_filters_tile_cache_icon)).setImageDrawable(getIcon(R.drawable.ic_layer_top_dark, colorRes));
final DelayAutoCompleteTextView textView = (DelayAutoCompleteTextView) view.findViewById(R.id.auto_complete_text_view);
final DelayAutoCompleteTextView textView = view.findViewById(R.id.auto_complete_text_view);
textView.setAdapter(new MapillaryAutoCompleteAdapter(getContext(), R.layout.auto_complete_suggestion, getMyApplication()));
String selectedUsername = settings.MAPILLARY_FILTER_USERNAME.get();
if (!selectedUsername.equals("") && settings.USE_MAPILLARY_FILTER.get()) {
@ -162,12 +162,12 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
}
});
ImageView imageView = (ImageView) view.findViewById(R.id.warning_image_view);
ImageView imageView = view.findViewById(R.id.warning_image_view);
imageView.setImageDrawable(getPaintedContentIcon(R.drawable.ic_small_warning,
getResources().getColor(R.color.color_warning)));
final EditText dateFromEt = (EditText) view.findViewById(R.id.date_from_edit_text);
final EditText dateFromEt = view.findViewById(R.id.date_from_edit_text);
final DatePickerDialog.OnDateSetListener dateFromDialog = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker v, int year, int monthOfYear, int dayOfMonth) {
@ -194,7 +194,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
dateFromEt.setCompoundDrawablesWithIntrinsicBounds(null, null, getContentIcon(R.drawable.ic_action_arrow_drop_down), null);
final EditText dateToEt = (EditText) view.findViewById(R.id.date_to_edit_text);
final EditText dateToEt = view.findViewById(R.id.date_to_edit_text);
final DatePickerDialog.OnDateSetListener dateToDialog = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker v, int year, int monthOfYear, int dayOfMonth) {
@ -232,7 +232,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
}
final Button apply = (Button) view.findViewById(R.id.button_apply);
final Button apply = view.findViewById(R.id.button_apply);
changeButtonState(apply, .5f, false);
apply.setOnClickListener(new View.OnClickListener() {
@Override
@ -263,7 +263,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
});
final Button clear = (Button) view.findViewById(R.id.button_clear);
final Button clear = view.findViewById(R.id.button_clear);
clear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

View file

@ -1,24 +0,0 @@
package net.osmand.plus.mapillary;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.R;
public class MapillaryFiltersMapShadowFragment extends Fragment {
public static final String TAG = "MAPILLARY_FILTERS_MAP_SHADOW_FRAGMENT";
public MapillaryFiltersMapShadowFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.shadow_on_map, null);
}
}