Reformat code, optimize imports

This commit is contained in:
Davide Depau 2018-08-15 19:06:50 +02:00
parent d49497f2e0
commit 1268381a6e
17 changed files with 52 additions and 53 deletions

View file

@ -25,7 +25,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:28.0.0-rc01'

View file

@ -2,12 +2,10 @@ package eu.depau.etchdroid
import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*

View file

@ -3,7 +3,7 @@
package="eu.depau.etchdroid">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application
android:allowBackup="true"

View file

@ -6,12 +6,10 @@ import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.PowerManager
import android.support.v4.app.NotificationCompat
import eu.depau.etchdroid.R
import eu.depau.etchdroid.utils.getFileName
import eu.depau.etchdroid.utils.toHRSize
import eu.depau.etchdroid.utils.toHRTime
@ -135,7 +133,7 @@ abstract class UsbWriteService(name: String) : IntentService(name) {
.setProgress(100, progr, indet)
if (usbDevice != null && filename != null)
b.setContentText("${filename} to $usbDevice")
b.setContentText("${filename} to $usbDevice")
else
b.setContentText(getString(R.string.notif_initializing))

View file

@ -2,13 +2,11 @@ package eu.depau.etchdroid.fragments
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
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.services.UsbAPIWriteService
import eu.depau.etchdroid.utils.*

View file

@ -4,7 +4,6 @@ import android.content.Context
import android.hardware.usb.UsbDevice
import android.hardware.usb.UsbManager
import android.os.Bundle
import android.support.design.widget.Snackbar
import android.support.v4.widget.SwipeRefreshLayout
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView

View file

@ -3,7 +3,7 @@ package eu.depau.etchdroid.utils
import android.hardware.usb.UsbDevice
import android.os.Build
fun formatID(id: Int): String = Integer.toHexString(id).padStart(4,'0')
fun formatID(id: Int): String = Integer.toHexString(id).padStart(4, '0')
val UsbDevice.vidpid: String
get() = "${formatID(this.vendorId)}:${formatID(this.productId)}"

View file

@ -6,11 +6,9 @@ import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.RelativeLayout
import android.widget.TextView
import com.github.mjdev.libaums.UsbMassStorageDevice
import eu.depau.etchdroid.R
import kotlinx.android.synthetic.main.usb_device_row.view.*
import java.lang.Integer
class UsbDrivesRecyclerViewAdapter(private val dataset: Array<UsbMassStorageDevice>) : RecyclerView.Adapter<UsbDrivesRecyclerViewAdapter.ViewHolder>() {

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromXDelta="100%"
android:toXDelta="0"
android:interpolator="@android:anim/decelerate_interpolator"
android:duration="500"/>
android:toXDelta="0"/>
</set>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromXDelta="0"
android:toXDelta="-100%"
android:interpolator="@android:anim/decelerate_interpolator"
android:duration="500"/>
android:toXDelta="-100%"/>
</set>

View file

@ -1,5 +1,11 @@
<vector android:autoMirrored="true" android:height="24dp"
android:tint="#FFFFFF" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:autoMirrored="true"
android:tint="#FFFFFF"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
</vector>

View file

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M15,7v4h1v2h-3V5h2l-3,-4 -3,4h2v8H8v-2.07c0.7,-0.37 1.2,-1.08 1.2,-1.93 0,-1.21 -0.99,-2.2 -2.2,-2.2 -1.21,0 -2.2,0.99 -2.2,2.2 0,0.85 0.5,1.56 1.2,1.93V13c0,1.11 0.89,2 2,2h3v3.05c-0.71,0.37 -1.2,1.1 -1.2,1.95 0,1.22 0.99,2.2 2.2,2.2 1.21,0 2.2,-0.98 2.2,-2.2 0,-0.85 -0.49,-1.58 -1.2,-1.95V15h3c1.11,0 2,-0.89 2,-2v-2h1V7h-4z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M15,7v4h1v2h-3V5h2l-3,-4 -3,4h2v8H8v-2.07c0.7,-0.37 1.2,-1.08 1.2,-1.93 0,-1.21 -0.99,-2.2 -2.2,-2.2 -1.21,0 -2.2,0.99 -2.2,2.2 0,0.85 0.5,1.56 1.2,1.93V13c0,1.11 0.89,2 2,2h3v3.05c-0.71,0.37 -1.2,1.1 -1.2,1.95 0,1.22 0.99,2.2 2.2,2.2 1.21,0 2.2,-0.98 2.2,-2.2 0,-0.85 -0.49,-1.58 -1.2,-1.95V15h3c1.11,0 2,-0.89 2,-2v-2h1V7h-4z"/>
</vector>

View file

@ -26,11 +26,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:ellipsize="end"
android:text="@string/selected_method"
android:textColor="@color/name"
android:textSize="16sp"
android:textStyle="bold"
android:ellipsize="end"
android:text="@string/selected_method"/>
android:textStyle="bold"/>
<TextView
android:id="@+id/confirm_sel_method"
@ -56,11 +56,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:ellipsize="end"
android:text="@string/selected_image"
android:textColor="@color/name"
android:textSize="16sp"
android:textStyle="bold"
android:ellipsize="end"
android:text="@string/selected_image"/>
android:textStyle="bold"/>
<TextView
android:id="@+id/confirm_sel_image"
@ -95,11 +95,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:ellipsize="end"
android:text="@string/selected_usbdev"
android:textColor="@color/name"
android:textSize="16sp"
android:textStyle="bold"
android:ellipsize="end"
android:text="@string/selected_usbdev"/>
android:textStyle="bold"/>
<TextView
android:id="@+id/confirm_sel_usbdev"
@ -117,7 +117,6 @@
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -135,9 +134,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:ellipsize="end"
android:textColor="@color/name"
android:textSize="16sp"
android:ellipsize="end"/>
android:textSize="16sp"/>
</RelativeLayout>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -17,32 +16,32 @@
android:id="@+id/flash_dd_usb_api_radio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/flash_dd_usb_api"
android:onClick="onRadioButtonClicked"/>
android:onClick="onRadioButtonClicked"
android:text="@string/flash_dd_usb_api"/>
<RadioButton
android:id="@+id/flash_dd_root_radio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:text="@string/flash_dd_root"
android:onClick="onRadioButtonClicked"/>
android:onClick="onRadioButtonClicked"
android:text="@string/flash_dd_root"/>
<RadioButton
android:id="@+id/flash_unetbootin_radio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:text="@string/flash_unetbootin"
android:onClick="onRadioButtonClicked"/>
android:onClick="onRadioButtonClicked"
android:text="@string/flash_unetbootin"/>
<RadioButton
android:id="@+id/flash_woeusb_radio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:text="@string/flash_woeusb"
android:onClick="onRadioButtonClicked"/>
android:onClick="onRadioButtonClicked"
android:text="@string/flash_woeusb"/>
</RadioGroup>
</LinearLayout>

View file

@ -39,9 +39,9 @@
android:id="@+id/img_url_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textUri"
android:enabled="false"
android:hint="@string/image_url_hint"/>
android:hint="@string/image_url_hint"
android:inputType="textUri"/>
<CheckBox
android:id="@+id/streaming_write_checkbox"

View file

@ -16,10 +16,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:ellipsize="end"
android:textColor="@color/name"
android:textSize="16sp"
android:textStyle="bold"
android:ellipsize="end"/>
android:textStyle="bold"/>
<TextView
android:id="@+id/devpath"

View file

@ -1,9 +1,8 @@
package eu.depau.etchdroid
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*