From 6072c4bb1a3e54d98b0e03274459fff1db7c84b7 Mon Sep 17 00:00:00 2001 From: Apalak Dutta Date: Sat, 23 Sep 2023 13:11:36 +0530 Subject: [PATCH] Permission and approve list --- .../femdemo/ApprovalListActivity.java | 50 ++++++- .../res/layout/activity_approval_new_list.xml | 41 ++++++ .../src/main/res/layout/listview_layout.xml | 132 ++++++++++++++++++ 3 files changed, 218 insertions(+), 5 deletions(-) create mode 100644 examples/example_bestshot/example/app/src/main/res/layout/activity_approval_new_list.xml create mode 100644 examples/example_bestshot/example/app/src/main/res/layout/listview_layout.xml diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ApprovalListActivity.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ApprovalListActivity.java index 7d3588c..68c4071 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ApprovalListActivity.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ApprovalListActivity.java @@ -3,9 +3,14 @@ package ru.visionlab.femdemo; import androidx.appcompat.app.AppCompatActivity; import android.app.ProgressDialog; +import android.content.Intent; import android.os.Bundle; import android.view.View; +import android.widget.AdapterView; import android.widget.ImageButton; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast; @@ -18,6 +23,9 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import java.util.ArrayList; +import java.util.HashMap; + public class ApprovalListActivity extends AppCompatActivity { ImageButton back; @@ -25,10 +33,14 @@ public class ApprovalListActivity extends AppCompatActivity { String RequestID,EmployeeID,EmployeeName,LDate,LTimeOut,LTimeIn,NoOfHrs,LeaveType,ApproverID,ApproverName,Reason; + ListView lv; + ArrayList> arrayList; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_approval_list); + //setContentView(R.layout.activity_approval_list); + setContentView(R.layout.activity_approval_new_list); back = findViewById(R.id.back); back.setOnClickListener(new View.OnClickListener() { @@ -39,9 +51,14 @@ public class ApprovalListActivity extends AppCompatActivity { } }); + arrayList=new ArrayList<>(); + lv = findViewById(R.id.listview); + + + PermissionApprovalList(); - RequestIDVal = findViewById(R.id.RequestIDVal); + /*RequestIDVal = findViewById(R.id.RequestIDVal); EmployeeIDVal = findViewById(R.id.EmployeeIDVal); EmployeeNameVal = findViewById(R.id.EmployeeNameVal); LDateVal = findViewById(R.id.LDateVal); @@ -52,7 +69,7 @@ public class ApprovalListActivity extends AppCompatActivity { ApproverIDVal = findViewById(R.id.ApproverIDVal); ApproverNameVal = findViewById(R.id.ApproverNameVal); ReasonVal = findViewById(R.id.ReasonVal); - +*/ } @@ -66,7 +83,11 @@ public class ApprovalListActivity extends AppCompatActivity { public void onResponse(String response) { try { + + JSONArray jsonArray=new JSONArray(response); + for(int i = 0;i data = new HashMap<>(); + data.put("EmployeeName",EmployeeName); + data.put("EmployeeID",EmployeeID); + data.put("LeaveType",LeaveType); + data.put("ApproverName",ApproverName); + + arrayList.add(data); + + ListAdapter adapter = new SimpleAdapter(ApprovalListActivity.this,arrayList,R.layout.listview_layout + ,new String[]{"EmployeeName","EmployeeID","LeaveType","ApproverName"},new int[]{R.id.EmployeeNameVal,R.id.EmployeeIDVal,R.id.LeaveTypeVal,R.id.ApproverNameVal}); + lv.setAdapter(adapter); + lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView adapterView, View view, int i, long l) { + Intent intent = new Intent(ApprovalListActivity.this,LeaveRequestDetailsActivity.class); + startActivity(intent); + } + }); + + /*RequestIDVal.setText(RequestID); EmployeeIDVal.setText(EmployeeID); EmployeeNameVal.setText(EmployeeName); LDateVal.setText(LDate); @@ -91,7 +131,7 @@ public class ApprovalListActivity extends AppCompatActivity { ApproverIDVal.setText(ApproverID); ApproverNameVal.setText(ApproverName); ReasonVal.setText(Reason); - +*/ } } catch (JSONException e) { throw new RuntimeException(e); diff --git a/examples/example_bestshot/example/app/src/main/res/layout/activity_approval_new_list.xml b/examples/example_bestshot/example/app/src/main/res/layout/activity_approval_new_list.xml new file mode 100644 index 0000000..6c38a1a --- /dev/null +++ b/examples/example_bestshot/example/app/src/main/res/layout/activity_approval_new_list.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/example_bestshot/example/app/src/main/res/layout/listview_layout.xml b/examples/example_bestshot/example/app/src/main/res/layout/listview_layout.xml new file mode 100644 index 0000000..5fcbbaa --- /dev/null +++ b/examples/example_bestshot/example/app/src/main/res/layout/listview_layout.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file