Separate adapters and Kotlin extensions
This commit is contained in:
parent
c5fae3d869
commit
39fb36fb91
14 changed files with 22 additions and 21 deletions
|
@ -10,8 +10,8 @@ import android.os.Build
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import android.support.v4.app.NotificationCompat
|
import android.support.v4.app.NotificationCompat
|
||||||
import eu.depau.etchdroid.R
|
import eu.depau.etchdroid.R
|
||||||
import eu.depau.etchdroid.utils.toHRSize
|
import eu.depau.etchdroid.kotlin_exts.toHRSize
|
||||||
import eu.depau.etchdroid.utils.toHRTime
|
import eu.depau.etchdroid.kotlin_exts.toHRTime
|
||||||
|
|
||||||
|
|
||||||
abstract class UsbWriteService(name: String) : IntentService(name) {
|
abstract class UsbWriteService(name: String) : IntentService(name) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.depau.etchdroid.utils
|
package eu.depau.etchdroid.adapters
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
@ -8,6 +8,7 @@ import android.view.ViewGroup
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
import com.github.mjdev.libaums.UsbMassStorageDevice
|
import com.github.mjdev.libaums.UsbMassStorageDevice
|
||||||
import eu.depau.etchdroid.R
|
import eu.depau.etchdroid.R
|
||||||
|
import eu.depau.etchdroid.kotlin_exts.vidpid
|
||||||
import kotlinx.android.synthetic.main.usb_device_row.view.*
|
import kotlinx.android.synthetic.main.usb_device_row.view.*
|
||||||
|
|
||||||
class UsbDrivesRecyclerViewAdapter(private val dataset: Array<UsbMassStorageDevice>) : RecyclerView.Adapter<UsbDrivesRecyclerViewAdapter.ViewHolder>() {
|
class UsbDrivesRecyclerViewAdapter(private val dataset: Array<UsbMassStorageDevice>) : RecyclerView.Adapter<UsbDrivesRecyclerViewAdapter.ViewHolder>() {
|
||||||
|
@ -16,7 +17,7 @@ class UsbDrivesRecyclerViewAdapter(private val dataset: Array<UsbMassStorageDevi
|
||||||
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int):
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int):
|
||||||
UsbDrivesRecyclerViewAdapter.ViewHolder {
|
ViewHolder {
|
||||||
|
|
||||||
val relLayout = LayoutInflater.from(parent.context)
|
val relLayout = LayoutInflater.from(parent.context)
|
||||||
.inflate(R.layout.usb_device_row, parent, false) as RelativeLayout
|
.inflate(R.layout.usb_device_row, parent, false) as RelativeLayout
|
|
@ -9,7 +9,7 @@ import eu.depau.etchdroid.R
|
||||||
import eu.depau.etchdroid.StateKeeper
|
import eu.depau.etchdroid.StateKeeper
|
||||||
import eu.depau.etchdroid.abc.WizardFragment
|
import eu.depau.etchdroid.abc.WizardFragment
|
||||||
import eu.depau.etchdroid.services.UsbAPIWriteService
|
import eu.depau.etchdroid.services.UsbAPIWriteService
|
||||||
import eu.depau.etchdroid.utils.*
|
import eu.depau.etchdroid.kotlin_exts.*
|
||||||
import eu.depau.etchdroid.values.FlashMethod
|
import eu.depau.etchdroid.values.FlashMethod
|
||||||
import eu.depau.etchdroid.values.WizardStep
|
import eu.depau.etchdroid.values.WizardStep
|
||||||
import kotlinx.android.synthetic.main.fragment_confirminfo.view.*
|
import kotlinx.android.synthetic.main.fragment_confirminfo.view.*
|
||||||
|
|
|
@ -8,7 +8,7 @@ import eu.depau.etchdroid.R
|
||||||
import eu.depau.etchdroid.StateKeeper
|
import eu.depau.etchdroid.StateKeeper
|
||||||
import eu.depau.etchdroid.abc.WizardActivity
|
import eu.depau.etchdroid.abc.WizardActivity
|
||||||
import eu.depau.etchdroid.abc.WizardFragment
|
import eu.depau.etchdroid.abc.WizardFragment
|
||||||
import eu.depau.etchdroid.utils.snackbar
|
import eu.depau.etchdroid.kotlin_exts.snackbar
|
||||||
import eu.depau.etchdroid.values.FlashMethod
|
import eu.depau.etchdroid.values.FlashMethod
|
||||||
import eu.depau.etchdroid.values.WizardStep
|
import eu.depau.etchdroid.values.WizardStep
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ import eu.depau.etchdroid.R
|
||||||
import eu.depau.etchdroid.StateKeeper
|
import eu.depau.etchdroid.StateKeeper
|
||||||
import eu.depau.etchdroid.abc.WizardActivity
|
import eu.depau.etchdroid.abc.WizardActivity
|
||||||
import eu.depau.etchdroid.abc.WizardFragment
|
import eu.depau.etchdroid.abc.WizardFragment
|
||||||
import eu.depau.etchdroid.utils.getFileName
|
import eu.depau.etchdroid.kotlin_exts.getFileName
|
||||||
import eu.depau.etchdroid.utils.snackbar
|
import eu.depau.etchdroid.kotlin_exts.snackbar
|
||||||
import eu.depau.etchdroid.values.FlashMethod
|
import eu.depau.etchdroid.values.FlashMethod
|
||||||
import eu.depau.etchdroid.values.ImageLocation
|
import eu.depau.etchdroid.values.ImageLocation
|
||||||
import eu.depau.etchdroid.values.WizardStep
|
import eu.depau.etchdroid.values.WizardStep
|
||||||
|
|
|
@ -15,9 +15,9 @@ import eu.depau.etchdroid.abc.ClickListener
|
||||||
import eu.depau.etchdroid.abc.WizardActivity
|
import eu.depau.etchdroid.abc.WizardActivity
|
||||||
import eu.depau.etchdroid.abc.WizardFragment
|
import eu.depau.etchdroid.abc.WizardFragment
|
||||||
import eu.depau.etchdroid.activities.MainActivity
|
import eu.depau.etchdroid.activities.MainActivity
|
||||||
import eu.depau.etchdroid.utils.UsbDrivesRecyclerViewAdapter
|
import eu.depau.etchdroid.adapters.UsbDrivesRecyclerViewAdapter
|
||||||
import eu.depau.etchdroid.utils.name
|
import eu.depau.etchdroid.kotlin_exts.name
|
||||||
import eu.depau.etchdroid.utils.snackbar
|
import eu.depau.etchdroid.kotlin_exts.snackbar
|
||||||
import eu.depau.etchdroid.values.WizardStep
|
import eu.depau.etchdroid.values.WizardStep
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.fragment_select_usb_drive.view.*
|
import kotlinx.android.synthetic.main.fragment_select_usb_drive.view.*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.depau.etchdroid.utils
|
package eu.depau.etchdroid.kotlin_exts
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.depau.etchdroid.utils
|
package eu.depau.etchdroid.kotlin_exts
|
||||||
|
|
||||||
// https://stackoverflow.com/a/3758880/1124621
|
// https://stackoverflow.com/a/3758880/1124621
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.depau.etchdroid.utils
|
package eu.depau.etchdroid.kotlin_exts
|
||||||
|
|
||||||
private val timeStrings = arrayOf("s", "m", "h", "d")
|
private val timeStrings = arrayOf("s", "m", "h", "d")
|
||||||
private val timeDivs = arrayOf(60, 60, 24)
|
private val timeDivs = arrayOf(60, 60, 24)
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.depau.etchdroid.utils
|
package eu.depau.etchdroid.kotlin_exts
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.depau.etchdroid.utils
|
package eu.depau.etchdroid.kotlin_exts
|
||||||
|
|
||||||
import android.content.ContentResolver
|
import android.content.ContentResolver
|
||||||
import android.content.Context
|
import android.content.Context
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.depau.etchdroid.utils
|
package eu.depau.etchdroid.kotlin_exts
|
||||||
|
|
||||||
import android.hardware.usb.UsbDevice
|
import android.hardware.usb.UsbDevice
|
||||||
import android.os.Build
|
import android.os.Build
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.depau.etchdroid.utils
|
package eu.depau.etchdroid.kotlin_exts
|
||||||
|
|
||||||
import android.support.design.widget.Snackbar
|
import android.support.design.widget.Snackbar
|
||||||
import android.view.View
|
import android.view.View
|
|
@ -6,9 +6,9 @@ import android.net.Uri
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.github.mjdev.libaums.UsbMassStorageDevice
|
import com.github.mjdev.libaums.UsbMassStorageDevice
|
||||||
import eu.depau.etchdroid.abc.UsbWriteService
|
import eu.depau.etchdroid.abc.UsbWriteService
|
||||||
import eu.depau.etchdroid.utils.getFileName
|
import eu.depau.etchdroid.kotlin_exts.getFileName
|
||||||
import eu.depau.etchdroid.utils.getFileSize
|
import eu.depau.etchdroid.kotlin_exts.getFileSize
|
||||||
import eu.depau.etchdroid.utils.name
|
import eu.depau.etchdroid.kotlin_exts.name
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
|
|
||||||
class UsbAPIWriteService : UsbWriteService("UsbAPIWriteService") {
|
class UsbAPIWriteService : UsbWriteService("UsbAPIWriteService") {
|
||||||
|
|
Loading…
Reference in a new issue