Fix lint warnings

This commit is contained in:
William Brawner 2020-02-05 08:18:01 -06:00
parent fdbd55cdf8
commit 66838ed4a2
24 changed files with 127 additions and 190 deletions

View file

@ -0,0 +1,14 @@
<component name="ProjectDictionaryState">
<dictionary name="wbrawner">
<words>
<w>acra</w>
<w>brawner</w>
<w>mins</w>
<w>moshi</w>
<w>pihelper</w>
<w>pihole</w>
<w>piholeclient</w>
<w>wbrawner</w>
</words>
</dictionary>
</component>

View file

@ -1,48 +0,0 @@
{
"project_info": {
"project_number": "511023365625",
"firebase_url": "https://pi-helper-d3885.firebaseio.com",
"project_id": "pi-helper-d3885",
"storage_bucket": "pi-helper-d3885.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:511023365625:android:f8d76275e55f6db4efd128",
"android_client_info": {
"package_name": "com.wbrawner.pihelper"
}
},
"oauth_client": [
{
"client_id": "511023365625-d5fi76hu5mu838tblaahrfdudjdlels8.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.wbrawner.pihelper",
"certificate_hash": "e705f9dfdbd6ab7a79c902bc94c8448030f52c89"
}
},
{
"client_id": "511023365625-k0t6fbagmsgdveg6e673detjf75fmi2l.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDv9-WRa4xWFswXr5qBWVaAzA-UOraAsHc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "511023365625-k0t6fbagmsgdveg6e673detjf75fmi2l.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

View file

@ -1,24 +0,0 @@
package com.wbrawner.pihelper
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.wbrawner.pihelper", appContext.packageName)
}
}

View file

@ -48,13 +48,6 @@
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
<meta-data
android:name="firebase_analytics_collection_enabled"
android:value="false" />
</application>
</manifest>

View file

@ -7,7 +7,6 @@ import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
import androidx.navigation.NavOptionsBuilder
import androidx.navigation.fragment.FragmentNavigatorExtras
import androidx.navigation.fragment.findNavController
import kotlinx.android.synthetic.main.fragment_add_pi_hole.*

View file

@ -11,6 +11,7 @@ import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin
@Suppress("unused")
@AcraCore(buildConfigClass = BuildConfig::class)
@AcraMailSender(mailTo = "pihelper@wbrawner.com")
@AcraNotification(

View file

@ -1,19 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="196.32849"
android:viewportHeight="196.32849"
android:viewportWidth="213.40053"
android:viewportHeight="213.40053"
android:tint="#FFFFFF">
<group android:translateX="-37.302414"
android:translateY="-37.302414">
<group
android:translateX="8.536021"
android:translateY="8.536021">
<path
android:pathData="M135.467,53.19C94.537,53.19 61.19,86.537 61.19,127.467C61.19,139.777 64.21,151.399 69.543,161.636A33.872,33.872 135,0 0,61.191 183.871A33.872,33.872 0,0 0,95.063 217.743A33.872,33.872 0,0 0,124.303 200.904A33.872,33.872 0,0 0,124.304 200.903C127.946,201.455 131.673,201.743 135.467,201.743C176.397,201.743 209.743,168.397 209.743,127.467C209.743,86.537 176.397,53.19 135.467,53.19zM135.467,68.748C167.99,68.748 194.192,94.944 194.192,127.467C194.192,159.99 167.99,186.192 135.467,186.192C133.225,186.192 131.014,186.063 128.839,185.82A33.872,33.872 0,0 0,128.839 185.813A33.872,33.872 0,0 0,128.936 183.871A33.872,33.872 0,0 0,95.063 149.999A33.872,33.872 0,0 0,82.318 152.512C82.318,152.511 82.318,152.511 82.318,152.511A33.872,33.872 135,0 0,82.312 152.513C78.744,144.922 76.748,136.436 76.748,127.467C76.748,94.944 102.944,68.748 135.467,68.748z"
android:strokeAlpha="1"
android:strokeLineJoin="miter"
android:pathData="M98.165 15.888c-40.93 0-74.277 33.347-74.277 74.277 0 12.31 3.02 23.932 8.353 34.169a33.872 33.872 0 0 0-8.352 22.235 33.872 33.872 0 0 0 33.872 33.872 33.872 33.872 0 0 0 29.24-16.839 33.872 33.872 0 0 0 0.001-0.001c3.642 0.552 7.369 0.84 11.163 0.84 40.93 0 74.276-33.346 74.276-74.276s-33.346-74.277-74.276-74.277zm0 15.558c32.523 0 58.725 26.196 58.725 58.719 0 32.523-26.202 58.725-58.725 58.725-2.242 0-4.453-0.129-6.628-0.372a33.872 33.872 0 0 0 0-0.007 33.872 33.872 0 0 0 0.097-1.942 33.872 33.872 0 0 0-33.873-33.872 33.872 33.872 0 0 0-12.745 2.513v-0.001a33.872 33.872 0 0 0-0.006 0.002c-3.568-7.591-5.564-16.077-5.564-25.046 0-32.523 26.196-58.719 58.719-58.719z"
android:strokeWidth="6.53636312"
android:fillColor="#1a1a1a"
android:strokeColor="#00000000"
android:fillAlpha="1"
android:strokeLineCap="butt"/>
android:fillColor="#1a1a1a" />
</group>
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 403 B

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 791 B

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<merge 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"
@ -14,4 +14,4 @@
android:fitsSystemWindows="true"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_graph" />
</FrameLayout>
</merge>

View file

@ -12,7 +12,7 @@
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Time to disable">
android:hint="@string/hint_disable_duration">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/time"
@ -33,12 +33,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Secs" />
android:text="@string/duration_seconds" />
<RadioButton
android:id="@+id/minutes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mins" />
android:text="@string/duration_minutes" />
</RadioGroup>
</LinearLayout>

View file

@ -19,6 +19,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:contentDescription="@string/app_name"
android:src="@drawable/ic_app_logo"
android:tint="@color/colorOnSurface"
android:transitionName="piHelperLogo" />
@ -26,28 +27,28 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="If you're not sure what the IP address for your Pi-Hole is, Pi-Helper can attempt to find it for you by scanning your network."
android:text="@string/info_scan_network"
android:textAlignment="center" />
<com.google.android.material.button.MaterialButton
android:id="@+id/scanNetworkButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Scan Network" />
android:text="@string/action_scan_network" />
<include layout="@layout/or_divider" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="If you already know the IP address of your Pi-Hole, you can also enter it below:"
android:text="@string/info_connect"
android:textAlignment="center" />
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Pi-Hole IP Address">
android:hint="@string/prompt_ip_address">
<!-- TODO: Figure out how to get this to work for inputting an IP address -->
<com.google.android.material.textfield.TextInputEditText
@ -60,7 +61,7 @@
android:id="@+id/connectButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Connect to Pi-Hole" />
android:text="@string/action_connect_pihole" />
</LinearLayout>

View file

@ -86,6 +86,7 @@
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/app_name"
android:src="@drawable/ic_app_logo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -27,21 +27,21 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Pi-Helper has successfully connected to your Pi-Hole!"
android:text="@string/info_connection_success"
android:textAlignment="center" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="You'll need to authenticate in order to enable and disable the Pi-hole."
android:text="@string/info_authentication_required"
android:textAlignment="center" />
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Pi-Hole Web Password">
android:hint="@string/prompt_password">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password"
@ -54,7 +54,7 @@
android:id="@+id/connectWithPasswordButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Authenticate with Password" />
android:text="@string/action_authenticate_password" />
<include layout="@layout/or_divider" />
@ -62,7 +62,7 @@
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Pi-Hole API Key">
android:hint="@string/prompt_api_key">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/apiKey"
@ -75,7 +75,7 @@
android:id="@+id/connectWithApiKeyButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Authenticate with API Key" />
android:text="@string/action_authenticate_api_key" />
</LinearLayout>

View file

@ -12,7 +12,8 @@
android:layout_gravity="center"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/horizontal_rule" />
android:src="@drawable/horizontal_rule"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
@ -29,6 +30,7 @@
android:layout_gravity="center"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/horizontal_rule" />
android:src="@drawable/horizontal_rule"
tools:ignore="ContentDescription" />
</LinearLayout>

View file

@ -18,10 +18,6 @@
<string name="connection_failed_title">Pi-Helper failed to connect to your Pi-Hole</string>
<string name="configure_pihelper">Please configure Pi-Helper before using shortcuts</string>
<string name="or">or</string>
<string name="action_opt_out">Sorry, but no</string>
<string name="action_opt_in">Yes, I\'ll help!</string>
<string name="prompt_usage_opt_in">Would you like to help me make Pi-Helper better by automatically sending crash reports and usage details via Firebase? These are immensely helpful in tracking down issues that may arise or optimizing the app for only the features that are used. You can change your mind at any time from the settings.</string>
<string name="title_usage_opt_in">Help make Pi-Helper better</string>
<string name="action_settings">Settings</string>
<string name="action_forget_pihole">Forget Pi-hole</string>
<string name="content_info"><![CDATA[Pi-Helper was made with ❤ by <a href=\"https://wbrawner.com\">William Brawner</a>. You can find the source code or report issues on the <a href=\"https://github.com/wbrawner/PiHelperAndroid\">GitHub page</a> for the project.]]></string>
@ -31,4 +27,18 @@
<string name="text_crash_notification">Would you please consider sending the crash report to me?</string>
<string name="channel_crash_notification">Crash Reports</string>
<string name="status_unknown">Unknown</string>
<string name="duration_seconds">Secs</string>
<string name="duration_minutes">Mins</string>
<string name="hint_disable_duration">Time to disable</string>
<string name="info_scan_network">If you\'re not sure what the IP address for your Pi-Hole is, Pi-Helper can attempt to find it for you by scanning your network.</string>
<string name="action_scan_network">Scan Network</string>
<string name="info_connect">If you already know the IP address or host of your Pi-Hole, you can also enter it below:</string>
<string name="prompt_ip_address">Pi-Hole IP Address/Host</string>
<string name="action_connect_pihole">Connect to Pi-Hole</string>
<string name="info_connection_success">Pi-Helper has successfully connected to your Pi-Hole!</string>
<string name="info_authentication_required">You\'ll need to authenticate in order to enable and disable the Pi-hole.</string>
<string name="prompt_password">Pi-Hole Web Password</string>
<string name="action_authenticate_password">Authenticate with Password</string>
<string name="prompt_api_key">Pi-Hole API Key</string>
<string name="action_authenticate_api_key">Authenticate with API Key</string>
</resources>

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_shortcut_pause"
android:shortcutId="disable5Minutes"
android:shortcutLongLabel="@string/action_disable_5_minutes"
android:shortcutShortLabel="@string/action_disable_5_minutes">
<intent
android:action="com.wbrawner.pihelper.MainFragment.ACTION_DISABLE"
android:targetClass="com.wbrawner.pihelper.MainActivity"
android:targetPackage="com.wbrawner.pihelper">
<extra
android:name="com.wbrawner.pihelper.MainFragment.EXTRA_DURATION"
android:value="300" />
</intent>
</shortcut>
<shortcut
android:enabled="true"
android:icon="@drawable/ic_shortcut_pause"
android:shortcutId="disable30Seconds"
android:shortcutLongLabel="@string/action_disable_30_seconds"
android:shortcutShortLabel="@string/action_disable_30_seconds">
<intent
android:action="com.wbrawner.pihelper.MainFragment.ACTION_DISABLE"
android:targetClass="com.wbrawner.pihelper.MainActivity"
android:targetPackage="com.wbrawner.pihelper">
<extra
android:name="com.wbrawner.pihelper.MainFragment.EXTRA_DURATION"
android:value="30" />
</intent>
</shortcut>
<shortcut
android:enabled="true"
android:icon="@drawable/ic_shortcut_pause"
android:shortcutId="disable10Seconds"
android:shortcutLongLabel="@string/action_disable_10_seconds"
android:shortcutShortLabel="@string/action_disable_10_seconds">
<intent
android:action="com.wbrawner.pihelper.MainFragment.ACTION_DISABLE"
android:targetClass="com.wbrawner.pihelper.MainActivity"
android:targetPackage="com.wbrawner.pihelper">
<extra
android:name="com.wbrawner.pihelper.MainFragment.EXTRA_DURATION"
android:value="10" />
</intent>
</shortcut>
<shortcut
android:enabled="true"
android:icon="@drawable/ic_shortcut_enable"
android:shortcutId="enable"
android:shortcutLongLabel="@string/action_enable"
android:shortcutShortLabel="@string/action_enable">
<intent
android:action="com.wbrawner.pihelper.MainFragment.ACTION_ENABLE"
android:targetClass="com.wbrawner.pihelper.MainActivity"
android:targetPackage="com.wbrawner.pihelper" />
</shortcut>
</shortcuts>

View file

@ -2,10 +2,7 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_shortcut_pause"
android:shortcutId="disable5Minutes"
android:shortcutLongLabel="@string/action_disable_5_minutes"
android:shortcutShortLabel="@string/action_disable_5_minutes">
android:icon="@drawable/ic_shortcut_pause">
<intent
android:action="com.wbrawner.pihelper.MainFragment.ACTION_DISABLE"
android:targetClass="com.wbrawner.pihelper.MainActivity"
@ -18,10 +15,7 @@
<shortcut
android:enabled="true"
android:icon="@drawable/ic_shortcut_pause"
android:shortcutId="disable30Seconds"
android:shortcutLongLabel="@string/action_disable_30_seconds"
android:shortcutShortLabel="@string/action_disable_30_seconds">
android:icon="@drawable/ic_shortcut_pause">
<intent
android:action="com.wbrawner.pihelper.MainFragment.ACTION_DISABLE"
android:targetClass="com.wbrawner.pihelper.MainActivity"
@ -34,10 +28,7 @@
<shortcut
android:enabled="true"
android:icon="@drawable/ic_shortcut_pause"
android:shortcutId="disable10Seconds"
android:shortcutLongLabel="@string/action_disable_10_seconds"
android:shortcutShortLabel="@string/action_disable_10_seconds">
android:icon="@drawable/ic_shortcut_pause">
<intent
android:action="com.wbrawner.pihelper.MainFragment.ACTION_DISABLE"
android:targetClass="com.wbrawner.pihelper.MainActivity"
@ -50,10 +41,7 @@
<shortcut
android:enabled="true"
android:icon="@drawable/ic_shortcut_enable"
android:shortcutId="enable"
android:shortcutLongLabel="@string/action_enable"
android:shortcutShortLabel="@string/action_enable">
android:icon="@drawable/ic_shortcut_enable">
<intent
android:action="com.wbrawner.pihelper.MainFragment.ACTION_ENABLE"
android:targetClass="com.wbrawner.pihelper.MainActivity"

View file

@ -1,17 +0,0 @@
package com.wbrawner.pihelper
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View file

@ -11,7 +11,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

View file

@ -1,24 +0,0 @@
package com.wbrawner.piholeclient
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.wbrawner.piholeclient.test", appContext.packageName)
}
}

View file

@ -1,17 +0,0 @@
package com.wbrawner.piholeclient
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}