error handling bucket list

This commit is contained in:
Page Asgardius 2022-09-02 10:55:23 -07:00
parent 9b434a1ce0
commit e4da9c7f99
3 changed files with 19 additions and 1 deletions

View file

@ -1,5 +1,6 @@
package asgardius.page.s3manager;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
@ -30,10 +31,16 @@ public class Adapter extends RecyclerView.Adapter<Adapter.ViewHolder>{
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull Adapter.ViewHolder holder, int position) {
public void onBindViewHolder(@NonNull Adapter.ViewHolder holder, @SuppressLint("RecyclerView") int position) {
int res = (int) Img.get(position);
holder.images.setImageResource(res);
holder.text.setText((CharSequence) Name.get(position));
holder.text.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
System.out.println("Click on "+Integer.toString(position));
}
});
}
@Override
public int getItemCount() {

View file

@ -8,6 +8,7 @@ import androidx.recyclerview.widget.RecyclerView;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.Toast;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
@ -83,6 +84,15 @@ public class BucketSelect extends AppCompatActivity {
} catch (Exception e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
}
});
//Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
finish();
}
}
});

View file

@ -10,6 +10,7 @@
<string name="explorer_test_button">File Explorer Test</string>
<string name="video_test_button">Video Test</string>
<string name="media_load_fail">Cannot load media file</string>
<string name="media_list_fail">Cannot connect to server</string>
<string name="dummy_button">Dummy Button</string>
<string name="dummy_content">DUMMY\nCONTENT</string>
</resources>