Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions app/src/main/java/ca/pkay/rcloneexplorer/Activities/TaskActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class TaskActivity : AppCompatActivity(), FolderSelectorCallback{
private lateinit var onSuccessDropdown: Spinner


private lateinit var localPathPickerButton: ImageButton
private lateinit var remotePathPickerButton: ImageButton
private lateinit var filterOptionsButton: ImageButton


Expand Down Expand Up @@ -162,6 +164,8 @@ class TaskActivity : AppCompatActivity(), FolderSelectorCallback{
}
}

localPathPickerButton = findViewById(R.id.task_local_path_picker_button)
remotePathPickerButton = findViewById(R.id.task_remote_path_picker_button)
filterOptionsButton = findViewById(R.id.task_edit_filter_options_button)
filterOptionsButton.setOnClickListener {
val filter = if(filterDropdown.selectedItemPosition > 0 && filterDropdown.selectedItemPosition < filterDropdown.count) filterItems[filterDropdown.selectedItemPosition - 1] else null
Expand Down Expand Up @@ -306,14 +310,11 @@ class TaskActivity : AppCompatActivity(), FolderSelectorCallback{
existingTask.let {
localPath.setText(it?.localPath ?: "")
}
localPath.onFocusChangeListener =
View.OnFocusChangeListener { v: View?, hasFocus: Boolean ->
if (hasFocus) {
val intent = Intent(this.applicationContext, FilePicker::class.java)
intent.putExtra(FilePicker.FILE_PICKER_PICK_DESTINATION_TYPE, true)
startActivityForResult(intent, REQUEST_CODE_FP_LOCAL)
}
}
localPathPickerButton.setOnClickListener {
val intent = Intent(this.applicationContext, FilePicker::class.java)
intent.putExtra(FilePicker.FILE_PICKER_PICK_DESTINATION_TYPE, true)
startActivityForResult(intent, REQUEST_CODE_FP_LOCAL)
}
}

private fun prepareRemote() {
Expand Down Expand Up @@ -342,15 +343,10 @@ class TaskActivity : AppCompatActivity(), FolderSelectorCallback{
override fun onNothingSelected(parentView: AdapterView<*>?) {}
}

// Todo: This will break if the remote changed, but the path did not.
// Catch this issue by forcing the path to be emtpy
remotePath.onFocusChangeListener = object : View.OnFocusChangeListener {
override fun onFocusChange(p0: View?, p1: Boolean) {
startRemotePicker(
rcloneInstance.getRemoteItemFromName(remoteDropdown.selectedItem.toString()), "/"
)
remotePath.clearFocus()
}
remotePathPickerButton.setOnClickListener {
startRemotePicker(
rcloneInstance.getRemoteItemFromName(remoteDropdown.selectedItem.toString()), "/"
)
}
}

Expand Down
58 changes: 46 additions & 12 deletions app/src/main/res/layout/content_task.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,32 @@
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:textSize="24sp" />

<EditText
android:id="@+id/task_local_path_textfield"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:autofillHints=""
android:hint="@string/task_edit_hint_local"
android:inputType=""
android:minHeight="48dp" />
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageButton
android:id="@+id/task_local_path_picker_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/task_edit_hint_local"
android:src="@drawable/ic_folder_open" />

<EditText
android:id="@+id/task_local_path_textfield"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:autofillHints=""
android:hint="@string/task_edit_hint_local"
android:inputType="text"
android:minHeight="48dp" />

</LinearLayout>

</LinearLayout>
</androidx.cardview.widget.CardView>
Expand Down Expand Up @@ -193,15 +210,32 @@
android:contentDescription="@string/description_sync_direction"
android:minHeight="48dp" />

<EditText
android:id="@+id/task_remote_path_textfield"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:autofillHints=""
android:hint="@string/task_edit_hint_remote"
android:inputType=""
android:minHeight="48dp" />
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageButton
android:id="@+id/task_remote_path_picker_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/task_edit_hint_remote"
android:src="@drawable/ic_folder_open" />

<EditText
android:id="@+id/task_remote_path_textfield"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:autofillHints=""
android:hint="@string/task_edit_hint_remote"
android:inputType="text"
android:minHeight="48dp" />

</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>

Expand Down