URL-адрес изображения в моем коде - https://firebasestorage.googleapis.com/v0/b/fir-tutorial-93465.appspot.com/o?name=User_Images%2F86461&uploadType=resumable&upload_id=AEnB2UrFNN1VjeknIL2f7KYGTvEsTFi9aWqDVTd2BhmxOK2CFm_A2Seo5CTKCDDacc51AHJwAkvkjMwTLzlQAxi9dZkugnkE1Q&upload_protocol=resumable
URL-адрес изображения из Firebase- https://firebasestorage.googleapis.com/v0/b/fir-tutorial-93465.appspot.com/o/User_Images%2F86461?alt=media&token=652fefaa-6d22-4e02-a33e-5fdb1aaa8112
Почему URL-адрес в моем коде изменился?Я застрял в этом.Код-
открытый класс ShowData расширяет AppCompatActivity {
RecyclerView recyclerView;
FirebaseDatabase firebaseDatabase;
DatabaseReference myRef;
private FirebaseRecyclerAdapter<ShowDataItems, ShowDataViewHolder> mFirebaseAdapter;
public ShowData(){
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.show_data_layout);
firebaseDatabase = FirebaseDatabase.getInstance();
myRef = FirebaseDatabase.getInstance().getReference("User_Details");
recyclerView = (RecyclerView)findViewById(R.id.show_data_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(ShowData.this));
Toast.makeText(ShowData.this, "Wait ! Fetching List...", Toast.LENGTH_SHORT).show();
}
protected void onStart(){
super.onStart();
//Log.d("LOGGED", "IN onStart ");
mFirebaseAdapter = new FirebaseRecyclerAdapter<ShowDataItems, ShowDataViewHolder>
(ShowDataItems.class, R.layout.show_data_single_item, ShowDataViewHolder.class, myRef)
{
public void populateViewHolder(final ShowDataViewHolder viewHolder, ShowDataItems model, final int position) {
viewHolder.Image_URL(model.getImage_URL());
viewHolder.Image_Title(model.getImage_Title());
//OnClick Item
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(ShowData.this);
builder.setMessage("Do you want to Delete this data ?").setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
int selectedItems = position;
mFirebaseAdapter.getRef(selectedItems).removeValue();
mFirebaseAdapter.notifyItemRemoved(selectedItems);
recyclerView.invalidate();
onStart();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog dialog = builder.create();
dialog.setTitle("Confirm");
dialog.show();
}
});
}
};
recyclerView.setAdapter(mFirebaseAdapter);
}
//View Holder For Recycler View
public static class ShowDataViewHolder extends RecyclerView.ViewHolder {
private final TextView image_title;
private final ImageView image_url;
public ShowDataViewHolder(final View itemView) {
super(itemView);
image_url = (ImageView) itemView.findViewById(R.id.fetch_image);
image_title = (TextView) itemView.findViewById(R.id.fetch_image_title);
}
private void Image_Title(String title) {
image_title.setText(title);
}
private void Image_URL(String title) {
// image_url.setImageResource(R.drawable.loading);
Glide.with(itemView.getContext())
.load(title)
.apply(new RequestOptions()
.placeholder(R.drawable.loading)
.error(new ColorDrawable(Color.RED))
.centerCrop()
.dontAnimate()
.dontTransform())
.into(image_url);
}
}
}