refactored some code
This commit is contained in:
parent
b19a1b4f2d
commit
e3c91c0567
3 changed files with 20 additions and 21 deletions
|
@ -30,7 +30,7 @@
|
||||||
android:layout_height="@dimen/map_marker_title_height">
|
android:layout_height="@dimen/map_marker_title_height">
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatTextView
|
<android.support.v7.widget.AppCompatTextView
|
||||||
android:id="@+id/map_marker_title"
|
android:id="@+id/favourite_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/map_marker_direction_icon"
|
android:id="@+id/favourite_direction_icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/text_margin_small"
|
android:layout_marginEnd="@dimen/text_margin_small"
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
tools:src="@drawable/ic_direction_arrow" />
|
tools:src="@drawable/ic_direction_arrow" />
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatTextView
|
<android.support.v7.widget.AppCompatTextView
|
||||||
android:id="@+id/map_marker_distance"
|
android:id="@+id/favourite_distance"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
@ -62,12 +62,12 @@
|
||||||
tools:text="213 m" />
|
tools:text="213 m" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/map_marker_left_point_space"
|
android:id="@+id/favourite_left_point_space"
|
||||||
android:layout_width="@dimen/text_margin_small"
|
android:layout_width="@dimen/text_margin_small"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatTextView
|
<android.support.v7.widget.AppCompatTextView
|
||||||
android:id="@+id/map_marker_point_text_view"
|
android:id="@+id/favourite_point_text_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="•"
|
android:text="•"
|
||||||
|
@ -76,12 +76,12 @@
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/map_marker_right_point_space"
|
android:id="@+id/favourite_right_point_space"
|
||||||
android:layout_width="@dimen/text_margin_small"
|
android:layout_width="@dimen/text_margin_small"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatTextView
|
<android.support.v7.widget.AppCompatTextView
|
||||||
android:id="@+id/map_marker_description"
|
android:id="@+id/favourite_description"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
|
|
|
@ -43,10 +43,10 @@ public class FavouritesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||||
public FavouritesViewHolder(View itemView) {
|
public FavouritesViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
FavouriteImage = itemView.findViewById(R.id.favourite_icon);
|
FavouriteImage = itemView.findViewById(R.id.favourite_icon);
|
||||||
title = itemView.findViewById(R.id.map_marker_title);
|
title = itemView.findViewById(R.id.favourite_title);
|
||||||
description = itemView.findViewById(R.id.map_marker_description);
|
description = itemView.findViewById(R.id.favourite_description);
|
||||||
distance = itemView.findViewById(R.id.map_marker_distance);
|
distance = itemView.findViewById(R.id.favourite_distance);
|
||||||
arrowImage = itemView.findViewById(R.id.map_marker_direction_icon);
|
arrowImage = itemView.findViewById(R.id.favourite_direction_icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,19 +55,19 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
||||||
|
|
||||||
View titleView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
View titleView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
||||||
R.layout.bottom_sheet_item_favourite_title, null);
|
R.layout.bottom_sheet_item_favourite_title, null);
|
||||||
TextView title = (TextView) titleView.findViewById(R.id.title);
|
View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
||||||
title.setText(R.string.favourites);
|
|
||||||
final ImageView sortIconView = (ImageView) titleView.findViewById(R.id.sort_icon);
|
|
||||||
sortIconView.setImageDrawable(getIcon(R.drawable.ic_action_sort_by_name, nightMode ? R.color.route_info_go_btn_inking_dark : R.color.dash_search_icon_light));
|
|
||||||
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
|
||||||
R.layout.fragment_marker_add_group_bottom_sheet_dialog, null);
|
R.layout.fragment_marker_add_group_bottom_sheet_dialog, null);
|
||||||
|
|
||||||
final RecyclerView recyclerView = (RecyclerView) mainView.findViewById(R.id.groups_recycler_view);
|
TextView title = (TextView) titleView.findViewById(R.id.title);
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
final ImageView sortIconView = (ImageView) titleView.findViewById(R.id.sort_icon);
|
||||||
|
|
||||||
final TextView sortText = (TextView) titleView.findViewById(R.id.sort_text);
|
final TextView sortText = (TextView) titleView.findViewById(R.id.sort_text);
|
||||||
sortText.setText(R.string.sort_by_name);
|
|
||||||
LinearLayout sort = (LinearLayout) titleView.findViewById(R.id.sort_by);
|
LinearLayout sort = (LinearLayout) titleView.findViewById(R.id.sort_by);
|
||||||
|
final RecyclerView recyclerView = (RecyclerView) mainView.findViewById(R.id.groups_recycler_view);
|
||||||
|
|
||||||
|
title.setText(R.string.favourites);
|
||||||
|
sortIconView.setImageDrawable(getIcon(R.drawable.ic_action_sort_by_name, nightMode ? R.color.route_info_go_btn_inking_dark : R.color.dash_search_icon_light));
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
sortText.setText(R.string.sort_by_name);
|
||||||
sort.setOnClickListener(new View.OnClickListener() {
|
sort.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -94,7 +94,6 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
||||||
if (position == RecyclerView.NO_POSITION) {
|
if (position == RecyclerView.NO_POSITION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Toast.makeText(getContext(), "" + position, Toast.LENGTH_LONG).show();
|
|
||||||
selectFavorite(list.get(position));
|
selectFavorite(list.get(position));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue