[android] "Add business" button in PP. Hidden "report a problem", too.

This commit is contained in:
Dmitry Yunitsky 2016-04-07 15:16:12 +03:00 committed by Alex Zolotarev
parent 99a510e45e
commit cb1afadb7a
5 changed files with 16 additions and 31 deletions

View file

@ -56,7 +56,7 @@
<include layout="@layout/place_page_editor"/>
<include layout="@layout/place_page_report_problem"/>
<include layout="@layout/place_page_add_business"/>
</LinearLayout>
<LinearLayout

View file

@ -2,20 +2,20 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ll__report_problem"
android:id="@+id/ll__add_organisation"
style="@style/PlacePageItemFrame"
android:visibility="visible"
tools:visibility="visible">
<ImageView
style="@style/PlacePageMetadataIcon"
android:src="@drawable/ic_report_problem"
android:src="@drawable/ic_add_place"
android:tint="?colorAccent"/>
<TextView
android:id="@+id/tv__editor"
style="@style/PlacePageMetadataText"
android:text="@string/placepage_report_problem_button"
android:text="@string/placepage_add_business_button"
android:textAppearance="@style/MwmTextAppearance.PlacePage.Accent"/>
</LinearLayout>

View file

@ -53,7 +53,7 @@
<include layout="@layout/place_page_editor"/>
<include layout="@layout/place_page_report_problem"/>
<include layout="@layout/place_page_add_business"/>
<Space
android:layout_width="match_parent"

View file

@ -48,7 +48,6 @@ import com.mapswithme.maps.editor.Editor;
import com.mapswithme.maps.editor.EditorActivity;
import com.mapswithme.maps.editor.EditorHostFragment;
import com.mapswithme.maps.editor.FeatureCategoryActivity;
import com.mapswithme.maps.editor.ReportActivity;
import com.mapswithme.maps.editor.ReportFragment;
import com.mapswithme.maps.editor.ViralFragment;
import com.mapswithme.maps.location.LocationHelper;
@ -276,21 +275,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
EditorActivity.start(this);
}
public void showReportForm(MapObject point)
{
Statistics.INSTANCE.trackEvent(Statistics.EventName.EDITOR_REPORT);
if (mIsFragmentContainer)
{
Bundle args = new Bundle(2);
args.putDouble(ReportFragment.EXTRA_LAT, point.getLat());
args.putDouble(ReportFragment.EXTRA_LON, point.getLon());
replaceFragment(ReportFragment.class, args, null);
}
else
ReportActivity.start(this, point);
}
private void shareMyLocation()
{
final Location loc = LocationHelper.INSTANCE.getSavedLocation();
@ -412,7 +396,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
UiUtils.hide(mPositionChooser);
}
private void showPositionChooser(boolean show)
public void showPositionChooser(boolean show)
{
Statistics.INSTANCE.trackEditorLaunch(true);
UiUtils.showIf(show, mPositionChooser);

View file

@ -113,7 +113,7 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
private View mEntrance;
private TextView mTvEntrance;
private View mEditor;
private View mReport;
private View mAddOrganisation;
// Bookmark
private ImageView mIvColor;
private EditText mEtBookmarkName;
@ -206,8 +206,8 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
mTvEntrance = (TextView) mEntrance.findViewById(R.id.tv__place_entrance);
mEditor = mDetails.findViewById(R.id.ll__place_editor);
mEditor.setOnClickListener(this);
mReport = mDetails.findViewById(R.id.ll__report_problem);
mReport.setOnClickListener(this);
mAddOrganisation = mDetails.findViewById(R.id.ll__add_organisation);
mAddOrganisation.setOnClickListener(this);
latlon.setOnLongClickListener(this);
address.setOnLongClickListener(this);
mPhone.setOnLongClickListener(this);
@ -443,8 +443,9 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
!RoutingController.get().isNavigating() && !MapManager.nativeIsLegacyMode(),
mEditor);
UiUtils.showIf(!RoutingController.get().isNavigating() && !MapManager.nativeIsLegacyMode() &&
!MapObject.isOfType(MapObject.MY_POSITION, mMapObject),
mReport);
!MapObject.isOfType(MapObject.MY_POSITION, mMapObject) &&
Framework.nativeIsActiveObjectABuilding(),
mAddOrganisation);
}
private void refreshOpeningHours()
@ -674,9 +675,9 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
((MwmActivity) getContext()).showEditor();
}
private void showReportForm(MapObject point)
private void addOrganisation()
{
((MwmActivity) getContext()).showReportForm(point);
((MwmActivity) getContext()).showPositionChooser(true);
}
@Override
@ -687,8 +688,8 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
case R.id.ll__place_editor:
showEditor();
break;
case R.id.ll__report_problem:
showReportForm(mMapObject);
case R.id.ll__add_organisation:
addOrganisation();
break;
case R.id.iv__bookmark_color:
saveBookmarkTitle();