From f9a38c607d777d18e680f1bfaa4fb6e6b43a3f8d Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Wed, 31 Aug 2022 11:54:24 -0700 Subject: [PATCH] set recycler view --- .idea/misc.xml | 2 + app/build.gradle | 1 + app/src/main/AndroidManifest.xml | 3 ++ .../asgardius/page/s3manager/Adapter.java | 52 +++++++++++++++++++ .../asgardius/page/s3manager/list_item.java | 14 +++++ .../res/layout/activity_bucket_select.xml | 8 +-- .../main/res/layout/activity_list_item.xml | 35 +++++++++++++ 7 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 app/src/main/java/asgardius/page/s3manager/Adapter.java create mode 100644 app/src/main/java/asgardius/page/s3manager/list_item.java create mode 100644 app/src/main/res/layout/activity_list_item.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index 693a61f..c42851f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,8 +4,10 @@ diff --git a/app/build.gradle b/app/build.gradle index 4826e23..fec5e65 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -36,6 +36,7 @@ dependencies { implementation 'com.google.android.material:material:1.4.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'com.google.android.exoplayer:exoplayer:2.18.1' + implementation 'androidx.recyclerview:recyclerview:1.2.1' // BEGIN AWS DEPENDENCIES def aws_version = "2.16.+" implementation "com.amazonaws:aws-android-sdk-s3:$aws_version" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ac1b71d..b2fde79 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,6 +15,9 @@ android:supportsRtl="true" android:theme="@style/Theme.AsgardiusS3Manager" tools:targetApi="31"> + diff --git a/app/src/main/java/asgardius/page/s3manager/Adapter.java b/app/src/main/java/asgardius/page/s3manager/Adapter.java new file mode 100644 index 0000000..bada64d --- /dev/null +++ b/app/src/main/java/asgardius/page/s3manager/Adapter.java @@ -0,0 +1,52 @@ +package asgardius.page.s3manager; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; +import java.util.ArrayList; + +public class Adapter extends RecyclerView.Adapter{ + ArrayList Img, Name; + Context context; + + // Constructor for initialization + public Adapter(Context context, ArrayList Img, ArrayList Name) { + this.context = context; + this.Img = Img; + this.Name = Name; + } + @NonNull + @Override + public Adapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_list_item, parent, false); + + // Passing view to ViewHolder + Adapter.ViewHolder viewHolder = new Adapter.ViewHolder(view); + return viewHolder; + } + @Override + public void onBindViewHolder(@NonNull Adapter.ViewHolder holder, int position) { + int res = (int) Img.get(position); + holder.images.setImageResource(res); + holder.text.setText((Integer) Name.get(position)); + } + @Override + public int getItemCount() { + return Img.size(); + } + public class ViewHolder extends RecyclerView.ViewHolder { + ImageView images; + TextView text; + + public ViewHolder(View view) { + super(view); + images = itemView.findViewById(R.id.image); + text = itemView.findViewById(R.id.imageinfo); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/asgardius/page/s3manager/list_item.java b/app/src/main/java/asgardius/page/s3manager/list_item.java new file mode 100644 index 0000000..0934a20 --- /dev/null +++ b/app/src/main/java/asgardius/page/s3manager/list_item.java @@ -0,0 +1,14 @@ +package asgardius.page.s3manager; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class list_item extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_list_item); + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_bucket_select.xml b/app/src/main/res/layout/activity_bucket_select.xml index 009cb24..09b7ddd 100644 --- a/app/src/main/res/layout/activity_bucket_select.xml +++ b/app/src/main/res/layout/activity_bucket_select.xml @@ -7,9 +7,11 @@ tools:context=".BucketSelect"> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0" + tools:layout_editor_absoluteX="-27dp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_list_item.xml b/app/src/main/res/layout/activity_list_item.xml new file mode 100644 index 0000000..589638a --- /dev/null +++ b/app/src/main/res/layout/activity_list_item.xml @@ -0,0 +1,35 @@ + + + + + + + + \ No newline at end of file