aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/contracts
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-12-24 01:47:03 -0500
committerGitHub <noreply@github.com>2018-12-24 01:47:03 -0500
commit697d01882ba8b1dbb85484ba3bf6e810e32448fc (patch)
treef59d2407ffbd724200e3c79eb366a8da1efe0829 /app/src/main/kotlin/com/pitchedapps/frost/contracts
parentc45b30e28f451699f3be828a1201260ed27e321e (diff)
downloadfrost-697d01882ba8b1dbb85484ba3bf6e810e32448fc.tar.gz
frost-697d01882ba8b1dbb85484ba3bf6e810e32448fc.tar.bz2
frost-697d01882ba8b1dbb85484ba3bf6e810e32448fc.zip
Enhancement/ktlint (#1259)
* Add spotless * Reformat code * Apply license header * Add remaining license headers
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/contracts')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/contracts/ActivityContract.kt18
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/contracts/DynamicUiContract.kt20
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/contracts/FileChooser.kt35
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt21
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostObservables.kt19
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostThemable.kt25
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/contracts/VideoViewHolder.kt17
7 files changed, 134 insertions, 21 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/contracts/ActivityContract.kt b/app/src/main/kotlin/com/pitchedapps/frost/contracts/ActivityContract.kt
index 1182e609..2ce83871 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/contracts/ActivityContract.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/contracts/ActivityContract.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
package com.pitchedapps.frost.contracts
import com.mikepenz.iconics.typeface.IIcon
@@ -25,4 +41,4 @@ interface MainActivityContract : ActivityContract, MainFabContract {
interface MainFabContract {
fun showFab(iicon: IIcon, clickEvent: () -> Unit)
fun hideFab()
-} \ No newline at end of file
+}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/contracts/DynamicUiContract.kt b/app/src/main/kotlin/com/pitchedapps/frost/contracts/DynamicUiContract.kt
index 303c64b3..736ef72d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/contracts/DynamicUiContract.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/contracts/DynamicUiContract.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
package com.pitchedapps.frost.contracts
/**
@@ -21,10 +37,8 @@ interface DynamicUiContract {
*/
fun reloadTextSize()
-
/**
* Change text size without propagation
*/
fun reloadTextSizeSelf()
-
-} \ No newline at end of file
+}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FileChooser.kt b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FileChooser.kt
index 15165456..73d5c56d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FileChooser.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FileChooser.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
package com.pitchedapps.frost.contracts
import android.app.Activity
@@ -17,12 +33,19 @@ import com.pitchedapps.frost.utils.L
const val MEDIA_CHOOSER_RESULT = 67
interface FileChooserActivityContract {
- fun openFileChooser(filePathCallback: ValueCallback<Array<Uri>?>, fileChooserParams: WebChromeClient.FileChooserParams)
+ fun openFileChooser(
+ filePathCallback: ValueCallback<Array<Uri>?>,
+ fileChooserParams: WebChromeClient.FileChooserParams
+ )
}
interface FileChooserContract {
var filePathCallback: ValueCallback<Array<Uri>?>?
- fun Activity.openMediaPicker(filePathCallback: ValueCallback<Array<Uri>?>, fileChooserParams: WebChromeClient.FileChooserParams)
+ fun Activity.openMediaPicker(
+ filePathCallback: ValueCallback<Array<Uri>?>,
+ fileChooserParams: WebChromeClient.FileChooserParams
+ )
+
fun Activity.onActivityResultWeb(requestCode: Int, resultCode: Int, intent: Intent?): Boolean
}
@@ -30,7 +53,10 @@ class FileChooserDelegate : FileChooserContract {
override var filePathCallback: ValueCallback<Array<Uri>?>? = null
- override fun Activity.openMediaPicker(filePathCallback: ValueCallback<Array<Uri>?>, fileChooserParams: WebChromeClient.FileChooserParams) {
+ override fun Activity.openMediaPicker(
+ filePathCallback: ValueCallback<Array<Uri>?>,
+ fileChooserParams: WebChromeClient.FileChooserParams
+ ) {
kauRequestPermissions(PERMISSION_WRITE_EXTERNAL_STORAGE) { granted, _ ->
if (!granted) {
filePathCallback.onReceiveValue(null)
@@ -52,5 +78,4 @@ class FileChooserDelegate : FileChooserContract {
filePathCallback = null
return true
}
-
-} \ No newline at end of file
+}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt
index 613295e6..50c2fe77 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
package com.pitchedapps.frost.contracts
import android.view.View
@@ -23,7 +39,6 @@ interface FrostContentContainer {
* Update toolbar title
*/
fun setTitle(title: String)
-
}
/**
@@ -84,7 +99,6 @@ interface FrostContentParent : DynamicUiContract {
* For those cases, we will return false to stop it
*/
fun registerTransition(urlChanged: Boolean, animate: Boolean): Boolean
-
}
/**
@@ -147,5 +161,4 @@ interface FrostContentCore : DynamicUiContract {
* Signal destruction to release some content manually
*/
fun destroy()
-
-} \ No newline at end of file
+}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostObservables.kt b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostObservables.kt
index 882b67a0..b3b93b66 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostObservables.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostObservables.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
package com.pitchedapps.frost.contracts
import io.reactivex.subjects.BehaviorSubject
@@ -27,5 +43,4 @@ interface FrostObservables {
other.progressObservable = progressObservable
other.titleObservable = titleObservable
}
-
-} \ No newline at end of file
+}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostThemable.kt b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostThemable.kt
index 3322f62e..93d827a6 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostThemable.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostThemable.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
package com.pitchedapps.frost.contracts
import android.view.View
@@ -18,12 +34,11 @@ interface FrostThemable {
fun reloadTheme()
fun setTextColors(color: Int, vararg textViews: TextView?) =
- themeViews(color, *textViews) { setTextColor(it) }
+ themeViews(color, *textViews) { setTextColor(it) }
fun setBackgrounds(color: Int, vararg views: View?) =
- themeViews(color, *views) { setBackgroundColor(it) }
+ themeViews(color, *views) { setBackgroundColor(it) }
fun <T : View> themeViews(color: Int, vararg views: T?, action: T.(Int) -> Unit) =
- views.filterNotNull().forEach { it.action(color) }
-
-} \ No newline at end of file
+ views.filterNotNull().forEach { it.action(color) }
+}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/contracts/VideoViewHolder.kt b/app/src/main/kotlin/com/pitchedapps/frost/contracts/VideoViewHolder.kt
index 13b6a7aa..e749b0d3 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/contracts/VideoViewHolder.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/contracts/VideoViewHolder.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
package com.pitchedapps.frost.contracts
import android.app.Activity
@@ -49,5 +65,4 @@ interface FrameWrapper {
setContentView(R.layout.activity_frame_wrapper)
frameWrapper.inflate(layoutRes, true)
}
-
}