refactored some code

This commit is contained in:
Chumva 2018-03-13 17:32:05 +02:00
parent b19a1b4f2d
commit e3c91c0567
3 changed files with 20 additions and 21 deletions

View file

@ -30,7 +30,7 @@
android:layout_height="@dimen/map_marker_title_height">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_title"
android:id="@+id/favourite_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
@ -46,7 +46,7 @@
android:gravity="center_vertical">
<ImageView
android:id="@+id/map_marker_direction_icon"
android:id="@+id/favourite_direction_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/text_margin_small"
@ -54,7 +54,7 @@
tools:src="@drawable/ic_direction_arrow" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_distance"
android:id="@+id/favourite_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
@ -62,12 +62,12 @@
tools:text="213 m" />
<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_height="match_parent" />
<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_height="wrap_content"
android:text="•"
@ -76,12 +76,12 @@
tools:visibility="visible" />
<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_height="match_parent" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_description"
android:id="@+id/favourite_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"

View file

@ -43,10 +43,10 @@ public class FavouritesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
public FavouritesViewHolder(View itemView) {
super(itemView);
FavouriteImage = itemView.findViewById(R.id.favourite_icon);
title = itemView.findViewById(R.id.map_marker_title);
description = itemView.findViewById(R.id.map_marker_description);
distance = itemView.findViewById(R.id.map_marker_distance);
arrowImage = itemView.findViewById(R.id.map_marker_direction_icon);
title = itemView.findViewById(R.id.favourite_title);
description = itemView.findViewById(R.id.favourite_description);
distance = itemView.findViewById(R.id.favourite_distance);
arrowImage = itemView.findViewById(R.id.favourite_direction_icon);
}
}

View file

@ -55,19 +55,19 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
View titleView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.bottom_sheet_item_favourite_title, null);
TextView title = (TextView) titleView.findViewById(R.id.title);
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),
View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.fragment_marker_add_group_bottom_sheet_dialog, null);
final RecyclerView recyclerView = (RecyclerView) mainView.findViewById(R.id.groups_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
TextView title = (TextView) titleView.findViewById(R.id.title);
final ImageView sortIconView = (ImageView) titleView.findViewById(R.id.sort_icon);
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);
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() {
@Override
public void onClick(View v) {
@ -94,7 +94,6 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
if (position == RecyclerView.NO_POSITION) {
return;
}
Toast.makeText(getContext(), "" + position, Toast.LENGTH_LONG).show();
selectFavorite(list.get(position));
}
});