Skip to content

Commit 6413673

Browse files
committed
passing the repoId fixed.
1 parent bf969c6 commit 6413673

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

mobile/src/main/java/io/syslogic/github/fragment/WorkflowJobsFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void onResponse(@NonNull Call<Repository> call, @NonNull Response<Reposit
117117
}
118118
}
119119
}
120-
case 403, 404 -> {
120+
case 403 -> {
121121
if (response.errorBody() != null) {
122122
try {
123123
String errors = response.errorBody().string();

mobile/src/main/java/io/syslogic/github/fragment/WorkflowRunsFragment.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class WorkflowRunsFragment extends BaseFragment {
4747

4848
/** The itemId is the repositoryId. */
4949
private Long itemId = -1L;
50-
private Long runId = -1L;
50+
5151

5252
/** Constructor */
5353
public WorkflowRunsFragment() {}
@@ -67,7 +67,6 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
6767
Bundle args = this.getArguments();
6868
if (args != null) {
6969
this.setItemId(args.getLong(Constants.ARGUMENT_REPO_ID));
70-
this.setRunId(args.getLong(Constants.ARGUMENT_RUN_ID));
7170
}
7271
}
7372

@@ -87,7 +86,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
8786
if (! isNetworkAvailable(this.requireContext())) {
8887
this.onNetworkLost();
8988
} else if (this.itemId != -1L) {
90-
WorkflowRunsAdapter adapter = new WorkflowRunsAdapter(requireContext());
89+
WorkflowRunsAdapter adapter = new WorkflowRunsAdapter(requireContext(), this.itemId);
9190
this.getDataBinding().recyclerviewWorkflowRuns.setAdapter(adapter);
9291
this.setRepositoryId(this.itemId);
9392
}
@@ -146,17 +145,10 @@ public void onFailure(@NonNull Call<Repository> call, @NonNull Throwable t) {
146145
public Long getItemId() {
147146
return this.itemId;
148147
}
149-
@NonNull
150-
public Long getRunId() {
151-
return this.runId;
152-
}
153148

154149
private void setItemId(@NonNull Long value) {
155150
this.itemId = value;
156151
}
157-
private void setRunId(@NonNull Long value) {
158-
this.runId = value;
159-
}
160152

161153
@NonNull
162154
public FragmentWorkflowRunsBinding getDataBinding() {

mobile/src/main/java/io/syslogic/github/recyclerview/WorkflowRunsAdapter.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ public class WorkflowRunsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
4343
/** Log Tag */
4444
@NonNull @SuppressWarnings("unused") private static final String LOG_TAG = WorkflowRunsAdapter.class.getSimpleName();
4545
private static WeakReference<Context> mContext;
46+
private static Long repositoryId;
4647
List<WorkflowRun> mItems = new ArrayList<>();
4748

48-
public WorkflowRunsAdapter(@NonNull Context context) {
49+
public WorkflowRunsAdapter(@NonNull Context context, @NonNull Long repoId) {
4950
mContext = new WeakReference<>(context);
51+
repositoryId = repoId;
5052
Abstraction.executorService.execute(() -> {
51-
// mItems = Abstraction.getInstance(getContext()).workflowRunsDao().getItems()
53+
// mItems = Abstraction.getInstance(getContext()).workflowRunsDao().getItems(repoId)
5254
});
5355
}
5456

@@ -150,7 +152,7 @@ public void onClick(@NonNull View viewHolder) {
150152
ViewDataBinding databinding = activity.getFragmentDataBinding();
151153
if (databinding != null) {
152154
Bundle args = new Bundle();
153-
args.putLong(Constants.ARGUMENT_REPO_ID, itemId);
155+
args.putLong(Constants.ARGUMENT_REPO_ID, repositoryId);
154156
args.putLong(Constants.ARGUMENT_RUN_ID, item.getId());
155157
NavController controller = Navigation.findNavController(databinding.getRoot());
156158
controller.navigate(R.id.action_workflowRunsFragment_to_workflowJobsFragment, args);

0 commit comments

Comments
 (0)