| | |
| | | package com.dayu.pipirrapp.activity; |
| | | |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.view.LayoutInflater; |
| | | |
| | | import androidx.activity.result.ActivityResult; |
| | | import androidx.activity.result.ActivityResultCallback; |
| | | import androidx.activity.result.ActivityResultLauncher; |
| | | import androidx.activity.result.contract.ActivityResultContracts; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | |
| | |
| | | * @since 2024-12-10 |
| | | */ |
| | | public class IssueListActivity extends BaseActivity { |
| | | public static final int RESULT_REFRESH = 1001; |
| | | |
| | | |
| | | ActivityIssueListBinding binding; |
| | | RefreshLayout myRefreshLayout; |
| | | List<IssueResult> recordsList = new ArrayList<>(); |
| | | IssueAdapter mAdapter; |
| | | |
| | | private final ActivityResultLauncher<Intent> activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() { |
| | | @Override |
| | | public void onActivityResult(ActivityResult result) { |
| | | if (result.getResultCode() == RESULT_REFRESH) { |
| | | myRefreshLayout.autoRefresh(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | protected void onCreate(@Nullable Bundle savedInstanceState) { |
| | |
| | | } |
| | | |
| | | public void startDetail(String issueReportId) { |
| | | |
| | | Intent intent = new Intent(IssueListActivity.this, IssueDetailActivity.class); |
| | | intent.putExtra("issueReportId", issueReportId); |
| | | activityResultLauncher.launch(intent); |
| | | } |
| | | } |