feat: 优化代码

pull/123/head
kunfei 5 years ago
parent 6ce554173d
commit e30fdbbe9f
  1. 8
      app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt

@ -21,7 +21,7 @@ object FilePicker {
selectList.removeAt(0) selectList.removeAt(0)
} }
items(selectList) { _, index -> items(selectList) { _, index ->
when (if (default == null) index - 1 else index) { when (if (default == null) index + 1 else index) {
0 -> default?.invoke() 0 -> default?.invoke()
1 -> { 1 -> {
try { try {
@ -60,7 +60,7 @@ object FilePicker {
selectList.removeAt(0) selectList.removeAt(0)
} }
items(selectList) { _, index -> items(selectList) { _, index ->
when (if (default == null) index - 1 else index) { when (if (default == null) index + 1 else index) {
0 -> default?.invoke() 0 -> default?.invoke()
1 -> { 1 -> {
try { try {
@ -104,7 +104,7 @@ object FilePicker {
selectList.removeAt(0) selectList.removeAt(0)
} }
items(selectList) { _, index -> items(selectList) { _, index ->
when (if (default == null) index - 1 else index) { when (if (default == null) index + 1 else index) {
0 -> default?.invoke() 0 -> default?.invoke()
1 -> { 1 -> {
try { try {
@ -152,7 +152,7 @@ object FilePicker {
selectList.removeAt(0) selectList.removeAt(0)
} }
items(selectList) { _, index -> items(selectList) { _, index ->
when (if (default == null) index - 1 else index) { when (if (default == null) index + 1 else index) {
0 -> default?.invoke() 0 -> default?.invoke()
1 -> { 1 -> {
try { try {

Loading…
Cancel
Save