set recycler view

This commit is contained in:
Page Asgardius 2022-08-31 11:54:24 -07:00
parent 4ba71f9e45
commit f9a38c607d
7 changed files with 112 additions and 3 deletions

View file

@ -4,8 +4,10 @@
<option name="filePathToZoomLevelMap"> <option name="filePathToZoomLevelMap">
<map> <map>
<entry key="app/src/main/res/layout/activity_bucket_select.xml" value="0.2" /> <entry key="app/src/main/res/layout/activity_bucket_select.xml" value="0.2" />
<entry key="app/src/main/res/layout/activity_list_item.xml" value="0.19610507246376813" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.1" /> <entry key="app/src/main/res/layout/activity_main.xml" value="0.1" />
<entry key="app/src/main/res/layout/activity_video_player.xml" value="0.1" /> <entry key="app/src/main/res/layout/activity_video_player.xml" value="0.1" />
<entry key="app/src/main/res/layout/list_buckets.xml" value="0.19610507246376813" />
</map> </map>
</option> </option>
</component> </component>

View file

@ -36,6 +36,7 @@ dependencies {
implementation 'com.google.android.material:material:1.4.0' implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.exoplayer:exoplayer:2.18.1' implementation 'com.google.android.exoplayer:exoplayer:2.18.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
// BEGIN AWS DEPENDENCIES // BEGIN AWS DEPENDENCIES
def aws_version = "2.16.+" def aws_version = "2.16.+"
implementation "com.amazonaws:aws-android-sdk-s3:$aws_version" implementation "com.amazonaws:aws-android-sdk-s3:$aws_version"

View file

@ -15,6 +15,9 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.AsgardiusS3Manager" android:theme="@style/Theme.AsgardiusS3Manager"
tools:targetApi="31"> tools:targetApi="31">
<activity
android:name=".list_item"
android:exported="false" />
<activity <activity
android:name=".BucketSelect" android:name=".BucketSelect"
android:exported="false" /> android:exported="false" />

View file

@ -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<Adapter.ViewHolder>{
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);
}
}
}

View file

@ -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);
}
}

View file

@ -7,9 +7,11 @@
tools:context=".BucketSelect"> tools:context=".BucketSelect">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/blist" android:id="@+id/recyclerview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:layout_editor_absoluteX="1dp" app:layout_constraintBottom_toBottomOf="parent"
tools:layout_editor_absoluteY="1dp" /> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:layout_editor_absoluteX="-27dp" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,35 @@
<?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_marginBottom="10dp"
tools:context=".list_item">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:id="@+id/imageinfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="192dp"
android:text="TextView"
android:textColor="@color/black"
android:textSize="22sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.101"
app:layout_constraintStart_toEndOf="@+id/image"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>