导航菜单

页面标题

页面副标题

EFFICIENT POS v1.5.7 - EmployeeAttendanceHistoryActivity.java 源代码

正在查看: EFFICIENT POS v1.5.7 应用的 EmployeeAttendanceHistoryActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package dev.gtr.pos.activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import dev.gtr.pos.R;
import dev.gtr.pos.adapter.AdapterAttendance;
import dev.gtr.pos.api.ApiClient;
import dev.gtr.pos.config.Constant;
import dev.gtr.pos.model.AttendanceList;
import java.util.ArrayList;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class EmployeeAttendanceHistoryActivity extends AppCompatActivity {
    AdapterAttendance adapterAttendance;
    int empId;
    String fromAttendance;
    String fromDate;
    String isLoc;
    ArrayList<AttendanceList.Attendance> item;
    RecyclerView recyclerView;
    TextView textViewLoc;
    TextView textViewStatus;
    String toDate;

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_employee);
        this.recyclerView = findViewById(R.id.recyclerview_attendance);
        this.textViewLoc = (TextView) findViewById(R.id.textView_loc);
        this.textViewStatus = (TextView) findViewById(R.id.textView_status);
        this.item = new ArrayList<>();
        Intent intent = getIntent();
        this.fromDate = intent.getStringExtra(Constant.FROM);
        this.toDate = intent.getStringExtra(Constant.TO);
        this.empId = intent.getIntExtra(Constant.EMPID, 0);
        this.fromAttendance = intent.getStringExtra(Constant.FromAttendance);
        String stringExtra = intent.getStringExtra(Constant.ISLOC);
        this.isLoc = stringExtra;
        if (this.fromAttendance == null || stringExtra == null) {
            return;
        }
        getAttendanceList(stringExtra);
        if (this.isLoc.equals("1")) {
            this.textViewLoc.setVisibility(0);
            this.textViewStatus.setVisibility(8);
        } else {
            this.textViewLoc.setVisibility(8);
            this.textViewStatus.setVisibility(0);
        }
    }

    private void getAttendanceList(final String str) {
        ApiClient.getInstance(getApplicationContext()).getApi().getEmployeeAttendanceList("Bearer " + Constant.Token, String.valueOf(this.empId), this.fromDate, this.toDate, str).enqueue(new Callback<AttendanceList>() {
            @Override
            public void onResponse(Call<AttendanceList> call, Response<AttendanceList> response) {
                if (response.isSuccessful()) {
                    EmployeeAttendanceHistoryActivity.this.item = (ArrayList) response.body().getAttendanceList();
                    if (EmployeeAttendanceHistoryActivity.this.item.size() > 0) {
                        EmployeeAttendanceHistoryActivity.this.adapterAttendance = new AdapterAttendance(EmployeeAttendanceHistoryActivity.this.item, EmployeeAttendanceHistoryActivity.this.getApplicationContext(), str);
                        EmployeeAttendanceHistoryActivity.this.recyclerView.setLayoutManager(new LinearLayoutManager(EmployeeAttendanceHistoryActivity.this.getApplicationContext()));
                        EmployeeAttendanceHistoryActivity.this.recyclerView.setHasFixedSize(true);
                        EmployeeAttendanceHistoryActivity.this.recyclerView.setAdapter(EmployeeAttendanceHistoryActivity.this.adapterAttendance);
                    }
                    Log.e("found", "" + EmployeeAttendanceHistoryActivity.this.item.size());
                    return;
                }
                Log.e("found", "" + response.code());
            }

            @Override
            public void onFailure(Call<AttendanceList> call, Throwable th) {
                Log.e("found", "" + th.toString());
            }
        });
    }
}