Separate adapters and Kotlin extensions

This commit is contained in:
Davide Depau 2018-08-16 16:22:50 +02:00
parent c5fae3d869
commit 39fb36fb91
Signed by: depau
GPG key ID: C7D999B6A55EFE86
14 changed files with 22 additions and 21 deletions

View file

@ -10,8 +10,8 @@ import android.os.Build
import android.os.PowerManager
import android.support.v4.app.NotificationCompat
import eu.depau.etchdroid.R
import eu.depau.etchdroid.utils.toHRSize
import eu.depau.etchdroid.utils.toHRTime
import eu.depau.etchdroid.kotlin_exts.toHRSize
import eu.depau.etchdroid.kotlin_exts.toHRTime
abstract class UsbWriteService(name: String) : IntentService(name) {

View file

@ -1,4 +1,4 @@
package eu.depau.etchdroid.utils
package eu.depau.etchdroid.adapters
import android.annotation.SuppressLint
import android.os.Build
@ -8,6 +8,7 @@ import android.view.ViewGroup
import android.widget.RelativeLayout
import com.github.mjdev.libaums.UsbMassStorageDevice
import eu.depau.etchdroid.R
import eu.depau.etchdroid.kotlin_exts.vidpid
import kotlinx.android.synthetic.main.usb_device_row.view.*
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):
UsbDrivesRecyclerViewAdapter.ViewHolder {
ViewHolder {
val relLayout = LayoutInflater.from(parent.context)
.inflate(R.layout.usb_device_row, parent, false) as RelativeLayout

View file

@ -9,7 +9,7 @@ import eu.depau.etchdroid.R
import eu.depau.etchdroid.StateKeeper
import eu.depau.etchdroid.abc.WizardFragment
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.WizardStep
import kotlinx.android.synthetic.main.fragment_confirminfo.view.*

View file

@ -8,7 +8,7 @@ import eu.depau.etchdroid.R
import eu.depau.etchdroid.StateKeeper
import eu.depau.etchdroid.abc.WizardActivity
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.WizardStep

View file

@ -18,8 +18,8 @@ import eu.depau.etchdroid.R
import eu.depau.etchdroid.StateKeeper
import eu.depau.etchdroid.abc.WizardActivity
import eu.depau.etchdroid.abc.WizardFragment
import eu.depau.etchdroid.utils.getFileName
import eu.depau.etchdroid.utils.snackbar
import eu.depau.etchdroid.kotlin_exts.getFileName
import eu.depau.etchdroid.kotlin_exts.snackbar
import eu.depau.etchdroid.values.FlashMethod
import eu.depau.etchdroid.values.ImageLocation
import eu.depau.etchdroid.values.WizardStep

View file

@ -15,9 +15,9 @@ import eu.depau.etchdroid.abc.ClickListener
import eu.depau.etchdroid.abc.WizardActivity
import eu.depau.etchdroid.abc.WizardFragment
import eu.depau.etchdroid.activities.MainActivity
import eu.depau.etchdroid.utils.UsbDrivesRecyclerViewAdapter
import eu.depau.etchdroid.utils.name
import eu.depau.etchdroid.utils.snackbar
import eu.depau.etchdroid.adapters.UsbDrivesRecyclerViewAdapter
import eu.depau.etchdroid.kotlin_exts.name
import eu.depau.etchdroid.kotlin_exts.snackbar
import eu.depau.etchdroid.values.WizardStep
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_select_usb_drive.view.*

View file

@ -1,4 +1,4 @@
package eu.depau.etchdroid.utils
package eu.depau.etchdroid.kotlin_exts
import android.content.Context
import android.widget.Toast

View file

@ -1,4 +1,4 @@
package eu.depau.etchdroid.utils
package eu.depau.etchdroid.kotlin_exts
// https://stackoverflow.com/a/3758880/1124621

View file

@ -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 timeDivs = arrayOf(60, 60, 24)

View file

@ -1,4 +1,4 @@
package eu.depau.etchdroid.utils
package eu.depau.etchdroid.kotlin_exts
import android.content.Context
import android.net.Uri

View file

@ -1,4 +1,4 @@
package eu.depau.etchdroid.utils
package eu.depau.etchdroid.kotlin_exts
import android.content.ContentResolver
import android.content.Context

View file

@ -1,4 +1,4 @@
package eu.depau.etchdroid.utils
package eu.depau.etchdroid.kotlin_exts
import android.hardware.usb.UsbDevice
import android.os.Build

View file

@ -1,4 +1,4 @@
package eu.depau.etchdroid.utils
package eu.depau.etchdroid.kotlin_exts
import android.support.design.widget.Snackbar
import android.view.View

View file

@ -6,9 +6,9 @@ import android.net.Uri
import android.util.Log
import com.github.mjdev.libaums.UsbMassStorageDevice
import eu.depau.etchdroid.abc.UsbWriteService
import eu.depau.etchdroid.utils.getFileName
import eu.depau.etchdroid.utils.getFileSize
import eu.depau.etchdroid.utils.name
import eu.depau.etchdroid.kotlin_exts.getFileName
import eu.depau.etchdroid.kotlin_exts.getFileSize
import eu.depau.etchdroid.kotlin_exts.name
import java.nio.ByteBuffer
class UsbAPIWriteService : UsbWriteService("UsbAPIWriteService") {