Browse Source

Permission and approve list

features/permission
Apalak Dutta 1 year ago
parent
commit
6072c4bb1a
3 changed files with 218 additions and 5 deletions
  1. +45
    -5
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ApprovalListActivity.java
  2. +41
    -0
      examples/example_bestshot/example/app/src/main/res/layout/activity_approval_new_list.xml
  3. +132
    -0
      examples/example_bestshot/example/app/src/main/res/layout/listview_layout.xml

+ 45
- 5
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ApprovalListActivity.java View File

@ -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<HashMap<String,String>> 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<jsonArray.length();i++){
JSONObject jb1=jsonArray.getJSONObject(0);
RequestID = jb1.getString("RequestID");
EmployeeID = jb1.getString("EmployeeID");
@ -80,7 +101,26 @@ public class ApprovalListActivity extends AppCompatActivity {
ApproverName = jb1.getString("ApproverName");
Reason = jb1.getString("Reason");
RequestIDVal.setText(RequestID);
HashMap<String,String> 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);


+ 41
- 0
examples/example_bestshot/example/app/src/main/res/layout/activity_approval_new_list.xml View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="23dp"
>
<LinearLayout
android:id="@+id/lin1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:id="@+id/back"
android:layout_width="14dp"
android:layout_height="20dp"
android:src="@drawable/ic_baseline_arrow_back_24"
android:background="@color/white"
android:contentDescription="Back"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Approval list"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="110dp"
/>
</LinearLayout>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listview"
android:layout_marginTop="20dp"/>
</LinearLayout>

+ 132
- 0
examples/example_bestshot/example/app/src/main/res/layout/listview_layout.xml View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2"
android:padding="10dp"
android:layout_margin="10dp"
android:orientation="vertical"
android:background="@drawable/edittext_border"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/EmployeeName"
android:text="Employee Name"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="0.5"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary" />
<TextView
android:id="@+id/EmployeeNameVal"
android:text="EmployeeName"
android:layout_weight="0.5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#5d5d5d"
android:gravity="center_horizontal"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/EmployeeID"
android:text="Employee ID"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="0.5"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary" />
<TextView
android:id="@+id/EmployeeIDVal"
android:text="EmployeeID"
android:layout_weight="0.5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#5d5d5d"
android:gravity="center_horizontal"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/LeaveType"
android:text="Leave Type"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="0.5"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary" />
<TextView
android:id="@+id/LeaveTypeVal"
android:text="LeaveType"
android:layout_weight="0.5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#5d5d5d"
android:gravity="center_horizontal"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/ApproverName"
android:text="Approver Name"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="0.5"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary" />
<TextView
android:id="@+id/ApproverNameVal"
android:text="ApproverName"
android:layout_weight="0.5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#5d5d5d"
android:gravity="center_horizontal"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

Loading…
Cancel
Save