This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener { | |
private OnItemClickListener mListener; | |
public interface OnItemClickListener { | |
public void onItemClick(View view, int position); | |
public void onLongItemClick(View view, int position); | |
} | |
GestureDetector mGestureDetector; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FeedAdapter( | |
private val pictures: List<Hit>, | |
) : ListAdapter<Hit, FeedAdapter.FeedViewHolder>(ItemDiffCallback()) { | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = FeedViewHolder( | |
LayoutInflater.from(parent.context).inflate(R.layout.item_feed, parent, false) | |
) | |
override fun onBindViewHolder(holder: FeedViewHolder, position: Int) { | |
val pic = pictures[position] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HomeFragment : Fragment(R.layout.fragment_home) { | |
private var binding: FragmentHomeBinding? = null | |
private val viewModel by inject<HomeViewModel>() | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
binding = FragmentHomeBinding.bind(view) | |
viewModel.pictures.observe(viewLifecycleOwner) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="@dimen/margin_8dp" | |
android:layout_marginBottom="@dimen/margin_8dp"> | |
<ImageView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun View.getTransform(mEndView: View) = MaterialContainerTransform().apply { | |
startView = this@getTransform | |
endView = mEndView | |
addTarget(mEndView) | |
pathMotion = MaterialArcMotion() | |
duration = 550 | |
scrimColor = Color.TRANSPARENT | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
when (it.clickStatus) { | |
0 -> { | |
beginDelayedTransition(scan, btn_complete.getTransform(pick_window)) | |
btn_complete.gone() | |
pick_window.visible() | |
lastProduct = it | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun addProductQuantity() { | |
beginDelayedTransition(scan, pick_window.getTransform(btn_complete)) | |
btn_complete.visible() | |
pick_window.gone() | |
pick_bg.gone() | |
requireView().hideKeyboard() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Context.showOneButtonDialog( | |
title: String, | |
message: String, | |
isRegistrationDialog: Boolean, | |
transitionFunction: (View, ConstraintLayout) -> (Unit) | |
): View { | |
val dialogView = LayoutInflater.from(this).inflate(R.layout.dialog_one_button, null) | |
val builder = AlertDialog.Builder(this).setView(dialogView) | |
val alertDialog = builder.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
view_terms.setOnClickListener { | |
val dialogView = requireContext().showOneButtonDialog( | |
getString(R.string.connection_terms), | |
getString(R.string.terms_description), | |
true | |
) { view, rootLayout -> | |
beginDelayedTransition(rootLayout, view.getTransform(view_terms)) | |
} | |
beginDelayedTransition(root_layout, it.getTransform(dialogView)) | |
} |
OlderNewer