Skip to content

Commit

Permalink
FoldersAdapter: Move code into onClickOverride
Browse files Browse the repository at this point in the history
  • Loading branch information
Catfriend1 committed Jul 11, 2019
1 parent 6b9745c commit 8824349
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,7 @@ public View getView(int position, View convertView, @NonNull ViewGroup parent) {
Folder folder = getItem(position);
binding.label.setText(TextUtils.isEmpty(folder.label) ? folder.id : folder.label);
binding.directory.setText(folder.path);
binding.override.setOnClickListener(v -> {
// Send "Override changes" through our service to the REST API.
Intent intent = new Intent(mContext, SyncthingService.class)
.putExtra(SyncthingService.EXTRA_FOLDER_ID, folder.id);
intent.setAction(SyncthingService.ACTION_OVERRIDE_CHANGES);
mContext.startService(intent);
});
binding.override.setOnClickListener(view -> { onClickOverride(view, folder); } );
binding.openFolder.setOnClickListener(view -> { FileUtils.openFolder(mContext, folder.path); } );

// Update folder icon.
Expand Down Expand Up @@ -194,5 +188,12 @@ private void setTextOrHide(TextView view, String text) {
}
}

private void onClickOverride(View view, Folder folder) {
// Send "Override changes" through our service to the REST API.
Intent intent = new Intent(mContext, SyncthingService.class)
.putExtra(SyncthingService.EXTRA_FOLDER_ID, folder.id);
intent.setAction(SyncthingService.ACTION_OVERRIDE_CHANGES);
mContext.startService(intent);
}

}

0 comments on commit 8824349

Please sign in to comment.