|
|
@ -10,6 +10,7 @@ import androidx.core.view.isGone |
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.base.VMBaseActivity |
|
|
|
import io.legado.app.base.VMBaseActivity |
|
|
|
|
|
|
|
import io.legado.app.data.entities.RemoteBook |
|
|
|
import io.legado.app.databinding.ActivityImportBookBinding |
|
|
|
import io.legado.app.databinding.ActivityImportBookBinding |
|
|
|
import io.legado.app.lib.theme.backgroundColor |
|
|
|
import io.legado.app.lib.theme.backgroundColor |
|
|
|
import io.legado.app.ui.about.AppLogDialog |
|
|
|
import io.legado.app.ui.about.AppLogDialog |
|
|
@ -50,7 +51,7 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV |
|
|
|
binding.selectActionBar.setCallBack(this) |
|
|
|
binding.selectActionBar.setCallBack(this) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun sortCheck(sortKey: Sort) { |
|
|
|
private fun sortCheck(sortKey: RemoteBookSort) { |
|
|
|
if (viewModel.sortKey == sortKey) { |
|
|
|
if (viewModel.sortKey == sortKey) { |
|
|
|
viewModel.sortAscending = !viewModel.sortAscending |
|
|
|
viewModel.sortAscending = !viewModel.sortAscending |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -89,12 +90,12 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV |
|
|
|
R.id.menu_log -> showDialogFragment<AppLogDialog>() |
|
|
|
R.id.menu_log -> showDialogFragment<AppLogDialog>() |
|
|
|
R.id.menu_sort_name -> { |
|
|
|
R.id.menu_sort_name -> { |
|
|
|
item.isChecked = true |
|
|
|
item.isChecked = true |
|
|
|
sortCheck(Sort.Name) |
|
|
|
sortCheck(RemoteBookSort.Name) |
|
|
|
upPath() |
|
|
|
upPath() |
|
|
|
} |
|
|
|
} |
|
|
|
R.id.menu_sort_time -> { |
|
|
|
R.id.menu_sort_time -> { |
|
|
|
item.isChecked = true |
|
|
|
item.isChecked = true |
|
|
|
sortCheck(Sort.Default) |
|
|
|
sortCheck(RemoteBookSort.Default) |
|
|
|
upPath() |
|
|
|
upPath() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -104,8 +105,10 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV |
|
|
|
override fun onPrepareOptionsMenu(menu: Menu): Boolean { |
|
|
|
override fun onPrepareOptionsMenu(menu: Menu): Boolean { |
|
|
|
groupMenu = menu.findItem(R.id.menu_sort)?.subMenu |
|
|
|
groupMenu = menu.findItem(R.id.menu_sort)?.subMenu |
|
|
|
groupMenu?.setGroupCheckable(R.id.menu_group_sort, true, true) |
|
|
|
groupMenu?.setGroupCheckable(R.id.menu_group_sort, true, true) |
|
|
|
groupMenu?.findItem(R.id.menu_sort_name)?.isChecked = viewModel.sortKey == Sort.Name |
|
|
|
groupMenu?.findItem(R.id.menu_sort_name)?.isChecked = |
|
|
|
groupMenu?.findItem(R.id.menu_sort_time)?.isChecked = viewModel.sortKey == Sort.Default |
|
|
|
viewModel.sortKey == RemoteBookSort.Name |
|
|
|
|
|
|
|
groupMenu?.findItem(R.id.menu_sort_time)?.isChecked = |
|
|
|
|
|
|
|
viewModel.sortKey == RemoteBookSort.Default |
|
|
|
return super.onPrepareOptionsMenu(menu) |
|
|
|
return super.onPrepareOptionsMenu(menu) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|