package com.xbsaykat.easy24vendorapp.DailyReport; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.firebase.ui.database.FirebaseRecyclerAdapter; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.xbsaykat.easy24vendorapp.R; import com.xbsaykat.easy24vendorapp.SharedPreferenceWait; import java.util.ArrayList; public class ReportDaily extends AppCompatActivity { private RecyclerView mRecyclerView; private static DatabaseReference mRef,mRefAmount; String date; int totalallpricevalue=0; TextView AllTotalA,AllTotalB,AllTotal; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dailyreport); date= String.valueOf(android.text.format.DateFormat.format("dd-MM-yyyy", new java.util.Date())); mRef = FirebaseDatabase.getInstance().getReference("AdminDiscountRequestReportDaily").child(FirebaseAuth.getInstance().getCurrentUser().getUid()).child(date); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimary, this.getTheme())); } else { View decorView = getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); } AllTotal=findViewById(R.id.Totalallprice); mRefAmount= FirebaseDatabase.getInstance().getReference("AdminDiscountRequestReportDailyAmount").child(FirebaseAuth.getInstance().getCurrentUser().getUid()).child(date); mRefAmount.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { String total=dataSnapshot.child("TotalCalculation").getValue().toString(); AllTotal.setText("BDT "+total); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); mRecyclerView = findViewById(R.id.report_recycler); mRecyclerView.setHasFixedSize(true); LinearLayoutManager LayoutManager=new LinearLayoutManager(this); mRecyclerView.setLayoutManager(LayoutManager); } @Override protected void onStart() { super.onStart(); FirebaseRecyclerAdapter<ModelClass, ViewClass> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<ModelClass, ViewClass>(ModelClass.class, R.layout.reportview, ViewClass.class, mRef) { @Override protected void populateViewHolder( ViewClass viewHolder, ModelClass model, int position) { viewHolder.setDetails(getApplicationContext(), model.getUserNumber(),model.getMoneyrequest()); } }; mRecyclerView.setAdapter(firebaseRecyclerAdapter); } }