Move top right controller to bottom

This commit is contained in:
PavelRatushny 2017-12-04 11:32:36 +02:00
parent a9f6371788
commit 5612786c1d
2 changed files with 34 additions and 28 deletions

View file

@ -71,27 +71,6 @@
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/context_menu_close_btn_layout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="@dimen/context_menu_top_right_button_min_width"
android:orientation="horizontal">
<Button
android:id="@+id/title_button_top_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:text="@string/shared_string_others"
android:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -289,6 +268,34 @@
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_marginBottom="@dimen/context_menu_padding_margin_medium"
android:visibility="gone"
tools:visibility="visible"
android:clickable="true"
android:id="@+id/title_button_bottom_view"
android:background="?attr/ctx_menu_controller_bg"
android:layout_marginLeft="@dimen/context_menu_padding_margin_medium"
android:layout_marginRight="@dimen/context_menu_padding_margin_medium"
android:layout_width="match_parent"
android:layout_height="@dimen/context_menu_controller_height"
android:orientation="horizontal">
<TextView
android:textAllCaps="true"
android:id="@+id/title_button_bottom"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:text="@string/shared_string_others"
android:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/title_progress_container" android:id="@+id/title_progress_container"
android:layout_width="fill_parent" android:layout_width="fill_parent"

View file

@ -50,8 +50,6 @@ import net.osmand.plus.views.controls.HorizontalSwipeConfirm;
import net.osmand.plus.views.controls.SingleTapConfirm; import net.osmand.plus.views.controls.SingleTapConfirm;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import org.w3c.dom.Text;
import static android.util.TypedValue.COMPLEX_UNIT_DIP; import static android.util.TypedValue.COMPLEX_UNIT_DIP;
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP; import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
@ -196,7 +194,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}); });
// Top Right title button // Top Right title button
final Button topRightTitleButton = (Button) view.findViewById(R.id.title_button_top_right); final View topRightTitleButton = view.findViewById(R.id.title_button_bottom_view);
topRightTitleButton.setOnClickListener(new View.OnClickListener() { topRightTitleButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -348,7 +346,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (menuLine2 != null) { if (menuLine2 != null) {
AndroidUtils.setTextSecondaryColor(getMapActivity(), (TextView) menuLine2, nightMode); AndroidUtils.setTextSecondaryColor(getMapActivity(), (TextView) menuLine2, nightMode);
} }
((Button) view.findViewById(R.id.title_button_top_right)) ((TextView) view.findViewById(R.id.title_button_bottom))
.setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) : getResources().getColor(R.color.osmand_orange)); .setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) : getResources().getColor(R.color.osmand_orange));
AndroidUtils.setTextSecondaryColor(getMapActivity(), AndroidUtils.setTextSecondaryColor(getMapActivity(),
(TextView) view.findViewById(R.id.distance), nightMode); (TextView) view.findViewById(R.id.distance), nightMode);
@ -715,16 +713,17 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
} }
// Top Right title button // Top Right title button
final Button topRightTitleButton = (Button) view.findViewById(R.id.title_button_top_right); final View topRightTitleButtonView = view.findViewById(R.id.title_button_bottom_view);
final TextView topRightTitleButton = (TextView) view.findViewById(R.id.title_button_bottom);
if (topRightTitleButtonController != null) { if (topRightTitleButtonController != null) {
topRightTitleButton.setText(topRightTitleButtonController.caption); topRightTitleButton.setText(topRightTitleButtonController.caption);
topRightTitleButton.setVisibility(topRightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE); topRightTitleButtonView.setVisibility(topRightTitleButtonController.visible ? View.VISIBLE : View.GONE);
Drawable leftIcon = topRightTitleButtonController.getLeftIcon(); Drawable leftIcon = topRightTitleButtonController.getLeftIcon();
topRightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null); topRightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
topRightTitleButton.setCompoundDrawablePadding(dpToPx(8f)); topRightTitleButton.setCompoundDrawablePadding(dpToPx(8f));
} else { } else {
topRightTitleButton.setVisibility(View.GONE); topRightTitleButtonView.setVisibility(View.GONE);
} }
// Download buttons // Download buttons