Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions app/src/main/java/com/adpth/bottomsheet/MDAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
Expand Down Expand Up @@ -76,6 +78,37 @@ private void openBottomSheet(View v) {
dialog.setContentView(view);
dialog.show();

LinearLayout share,link,edit,delete;

share=view.findViewById(R.id.share);
share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(), "Share "+getAdapterPosition(), Toast.LENGTH_SHORT).show();
}
});
link=view.findViewById(R.id.link);
link.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(), "Get Link "+getAdapterPosition(), Toast.LENGTH_SHORT).show();
}
});
edit=view.findViewById(R.id.edit);
edit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(), "Edit "+getAdapterPosition(), Toast.LENGTH_SHORT).show();
}
});
delete=view.findViewById(R.id.delete);
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(), "Delete "+getAdapterPosition(), Toast.LENGTH_SHORT).show();
}
});

}
}
}
3 changes: 2 additions & 1 deletion app/src/main/java/com/adpth/bottomsheet/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import android.os.Bundle;
import java.util.ArrayList;
Expand Down Expand Up @@ -31,7 +32,7 @@ protected void onCreate(Bundle savedInstanceState) {

recyclerView = findViewById(R.id.RecyclerView);
MDAdapter mAdapter = new MDAdapter(this,listModal);
recyclerView.setLayoutManager(new GridLayoutManager(this,2));
recyclerView.setLayoutManager(new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL));
recyclerView.setAdapter(mAdapter);

}
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/layout/bottom_sheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="5"
android:id="@+id/share"
android:orientation="horizontal">

<ImageView
Expand All @@ -40,6 +41,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/link"
android:weightSum="5">

<ImageView
Expand All @@ -65,6 +67,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="5"
android:id="@+id/edit"
android:orientation="horizontal">

<ImageView
Expand All @@ -90,6 +93,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/delete"
android:weightSum="5">

<ImageView
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/res/layout/layout_design.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="200dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:padding="8dp">
android:orientation="vertical">

<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="15dp"
android:layout_marginLeft="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="5dp">
app:layout_constraintTop_toTopOf="parent">

<RelativeLayout
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<string name="app_name">Bottom Sheet</string>
<string name="picture_1_title">Picture 1 Title</string>
<string name="size">size</string>
<string name="delete_collection">delete collection</string>
<string name="delete_collection">Delete collection</string>
<string name="edit">Edit</string>
<string name="get_link">Get link</string>
<string name="share">Share</string>
Expand Down