Merge pull request #6959 from brainbeanapps/LibraryCompilationFixes

Library compilation fixes
This commit is contained in:
vshcherb 2019-05-20 21:55:44 +02:00 committed by GitHub
commit 5578f07c35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 236 additions and 256 deletions

View file

@ -393,13 +393,11 @@ public class TrackActivity extends TabActivity {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int position = -1;
switch (item.getItemId()) {
case R.id.action_track:
int i = item.getItemId();
if (i == R.id.action_track) {
position = 0;
break;
case R.id.action_points:
} else if (i == R.id.action_points) {
position = 1;
break;
}
if (position != -1 && position != viewPager.getCurrentItem()) {
viewPager.setCurrentItem(position);

View file

@ -465,11 +465,9 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
if (focusedView != null && focusedView instanceof EditText) {
EditText focusedEditText = (EditText) focusedView;
int id = v.getId();
switch (id) {
case R.id.keyboard_item_clear:
if (id == R.id.keyboard_item_clear) {
focusedEditText.setText("");
break;
case R.id.keyboard_item_backspace:
} else if (id == R.id.keyboard_item_backspace) {
String str = focusedEditText.getText().toString();
if (str.length() > 0) {
str = str.substring(0, str.length() - 1);
@ -478,14 +476,11 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
} else {
switchEditText(focusedEditText.getId(), false);
}
break;
case R.id.keyboard_item_next_field:
} else if (id == R.id.keyboard_item_next_field) {
switchEditText(focusedEditText.getId(), true);
break;
case R.id.keyboard_item_hide:
} else if (id == R.id.keyboard_item_hide) {
changeOsmandKeyboardVisibility(false);
break;
default:
} else {
focusedEditText.setText(focusedEditText.getText().toString() + getItemObjectById(id));
focusedEditText.setSelection(focusedEditText.getText().length());
}
@ -653,34 +648,33 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
}
private Object getItemObjectById(@IdRes int id) {
switch (id) {
case R.id.keyboard_item_0:
if (id == R.id.keyboard_item_0) {
return "0";
case R.id.keyboard_item_1:
} else if (id == R.id.keyboard_item_1) {
return "1";
case R.id.keyboard_item_2:
} else if (id == R.id.keyboard_item_2) {
return "2";
case R.id.keyboard_item_3:
} else if (id == R.id.keyboard_item_3) {
return "3";
case R.id.keyboard_item_4:
} else if (id == R.id.keyboard_item_4) {
return "4";
case R.id.keyboard_item_5:
} else if (id == R.id.keyboard_item_5) {
return "5";
case R.id.keyboard_item_6:
} else if (id == R.id.keyboard_item_6) {
return "6";
case R.id.keyboard_item_7:
} else if (id == R.id.keyboard_item_7) {
return "7";
case R.id.keyboard_item_8:
} else if (id == R.id.keyboard_item_8) {
return "8";
case R.id.keyboard_item_9:
} else if (id == R.id.keyboard_item_9) {
return "9";
case R.id.keyboard_item_clear:
} else if (id == R.id.keyboard_item_clear) {
return getString(R.string.shared_string_clear);
case R.id.keyboard_item_next_field:
} else if (id == R.id.keyboard_item_next_field) {
return R.drawable.ic_keyboard_next_field;
case R.id.keyboard_item_backspace:
} else if (id == R.id.keyboard_item_backspace) {
return R.drawable.ic_keyboard_backspace;
case R.id.keyboard_item_hide:
} else if (id == R.id.keyboard_item_hide) {
return R.drawable.ic_action_keyboard_hide;
}
return -1;
@ -887,12 +881,12 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_copy:
int i = item.getItemId();
if (i == R.id.action_copy) {
ClipData clip = ClipData.newPlainText("", inputEditText.getText().toString());
clipboardManager.setPrimaryClip(clip);
return true;
case R.id.action_paste:
} else if (i == R.id.action_paste) {
ClipData.Item pasteItem = clipboardManager.getPrimaryClip().getItemAt(0);
CharSequence pasteData = pasteItem.getText();
if (pasteData != null) {
@ -901,9 +895,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
inputEditText.setSelection(inputEditText.getText().length());
}
return true;
default:
return false;
}
return false;
}
});
popupMenu.show();

View file

@ -180,20 +180,20 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
bottomNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.action_active:
int i = menuItem.getItemId();
if (i == R.id.action_active) {
setupLocationUpdate(true, false);
setupActiveFragment(ACTIVE_MARKERS_POSITION);
return true;
case R.id.action_groups:
} else if (i == R.id.action_groups) {
setupLocationUpdate(false, true);
setupActiveFragment(GROUPS_POSITION);
return true;
case R.id.action_history:
} else if (i == R.id.action_history) {
setupLocationUpdate(false, false);
setupActiveFragment(HISTORY_MARKERS_POSITION);
return true;
case R.id.action_more:
} else if (i == R.id.action_more) {
showOptionsMenuFragment();
return true;
}

View file

@ -853,12 +853,11 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
private View.OnClickListener onFabClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.overlay_view:
int i = view.getId();
if (i == R.id.overlay_view) {
hideTransparentOverlay();
closeFabMenu(view.getContext());
break;
case R.id.menu_fab:
} else if (i == R.id.menu_fab) {
if (fabMenuOpened) {
hideTransparentOverlay();
closeFabMenu(view.getContext());
@ -866,21 +865,14 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
showTransparentOverlay();
openFabMenu(view.getContext());
}
break;
case R.id.waypoint_text_layout:
case R.id.waypoint_fab:
} else if (i == R.id.waypoint_text_layout || i == R.id.waypoint_fab) {
PointDescription pointWptDescription =
new PointDescription(PointDescription.POINT_TYPE_WPT, app.getString(R.string.add_waypoint));
addPoint(pointWptDescription);
break;
case R.id.route_text_layout:
case R.id.route_fab:
} else if (i == R.id.route_text_layout || i == R.id.route_fab) {
addNewGpxData(NewGpxData.ActionType.ADD_ROUTE_POINTS);
break;
case R.id.line_text_layout:
case R.id.line_fab:
} else if (i == R.id.line_text_layout || i == R.id.line_fab) {
addNewGpxData(NewGpxData.ActionType.ADD_SEGMENT);
break;
}
}
};

View file

@ -758,14 +758,14 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
generalPopupMenu.setOnMenuItemClickListener(new IconPopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_edit:
int i = item.getItemId();
if (i == R.id.action_edit) {
TrkSegment segment = getTrkSegment();
if (segment != null && fragmentAdapter != null) {
fragmentAdapter.addNewGpxData(NewGpxData.ActionType.EDIT_SEGMENT, segment);
}
return true;
case R.id.action_delete:
} else if (i == R.id.action_delete) {
TrackActivity activity = getTrackActivity();
if (activity != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
@ -870,14 +870,14 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
altitudePopupMenu.setOnMenuItemClickListener(new IconPopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_edit:
int i = item.getItemId();
if (i == R.id.action_edit) {
TrkSegment segment = getTrkSegment();
if (segment != null && fragmentAdapter != null) {
fragmentAdapter.addNewGpxData(NewGpxData.ActionType.EDIT_SEGMENT, segment);
}
return true;
case R.id.action_delete:
} else if (i == R.id.action_delete) {
TrackActivity trackActivity = getTrackActivity();
if (trackActivity != null && deleteSegment()) {
GPXFile gpx = getGpx();
@ -969,14 +969,14 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
popupMenu.setOnMenuItemClickListener(new IconPopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_edit:
int i = item.getItemId();
if (i == R.id.action_edit) {
TrkSegment segment = getTrkSegment();
if (segment != null && fragmentAdapter != null) {
fragmentAdapter.addNewGpxData(NewGpxData.ActionType.EDIT_SEGMENT, segment);
}
return true;
case R.id.action_delete:
} else if (i == R.id.action_delete) {
TrackActivity trackActivity = getTrackActivity();
if (trackActivity != null && deleteSegment()) {
GPXFile gpx = getGpx();

View file

@ -272,8 +272,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int pos, boolean isChecked, int[] viewCoordinates) {
final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
switch (itemId) {
case R.string.layer_overlay:
if (itemId == R.string.layer_overlay) {
toggleUnderlayState(mapActivity, RasterMapType.OVERLAY,
new OnMapSelectedCallback() {
@Override
@ -293,7 +292,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
}
});
return false;
case R.string.layer_underlay:
} else if (itemId == R.string.layer_underlay) {
toggleUnderlayState(mapActivity, RasterMapType.UNDERLAY,
new OnMapSelectedCallback() {
@Override
@ -312,7 +311,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
adapter.notifyDataSetChanged();
final OsmandSettings.CommonPreference<Boolean> hidePolygonsPref =
final CommonPreference<Boolean> hidePolygonsPref =
mapActivity.getMyApplication().getSettings().getCustomRenderBooleanProperty("noPolygons");
hidePolygonsPref.set(hasUnderlayDescription);
RasterMapMenu.refreshMapComplete(mapActivity);

View file

@ -519,17 +519,17 @@ public class MapWidgetRegistry {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.action_show:
int i = menuItem.getItemId();
if (i == R.id.action_show) {
setVisibility(adapter, pos, true, false);
return true;
case R.id.action_hide:
} else if (i == R.id.action_hide) {
setVisibility(adapter, pos, false, false);
return true;
case R.id.action_collapse:
} else if (i == R.id.action_collapse) {
setVisibility(adapter, pos, true, true);
return true;
default:
} else {
if (menuItemIds != null) {
for (int menuItemId : menuItemIds) {
if (menuItem.getItemId() == menuItemId) {

View file

@ -135,13 +135,11 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int position = -1;
switch (item.getItemId()) {
case R.id.action_explore:
int i = item.getItemId();
if (i == R.id.action_explore) {
position = EXPLORE_POSITION;
break;
case R.id.action_saved_articles:
} else if (i == R.id.action_saved_articles) {
position = SAVED_ARTICLES_POSITION;
break;
}
if (position != -1 && position != viewPager.getCurrentItem()) {
viewPager.setCurrentItem(position);