Apply auto format

This commit is contained in:
Markus Fisch
2019-03-07 15:43:30 +01:00
parent b8cf3a6fe9
commit 4cf12b71ac
4 changed files with 19 additions and 12 deletions
@@ -15,13 +15,15 @@ import android.view.Window
fun initSystemBars(activity: AppCompatActivity?) {
val view = activity?.findViewById(R.id.main_layout)
if (view != null && setSystemBarColor(
if (view != null &&
setSystemBarColor(
activity.window,
ContextCompat.getColor(
activity,
R.color.primary_dark_translucent
)
)) {
)
) {
view.setPadding(0, getStatusBarHeight(activity.resources), 0, 0)
}
}
@@ -34,9 +36,9 @@ fun setSystemBarColor(window: Window, color: Int): Boolean {
window.statusBarColor = color
window.navigationBarColor = color
window.decorView.systemUiVisibility =
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
return true
}
@@ -36,10 +36,12 @@ class Database {
fun insertScan(timestamp: Long, name: String, code: String): Long {
val cv = ContentValues()
cv.put(SCANS_DATETIME, DateFormat.format(
"yyyy-MM-dd HH:mm:ss",
timestamp
).toString())
cv.put(
SCANS_DATETIME, DateFormat.format(
"yyyy-MM-dd HH:mm:ss",
timestamp
).toString()
)
cv.put(SCANS_CONTENT, name)
cv.put(SCANS_FORMAT, code)
return db.insert(SCANS, null, cv)
@@ -41,7 +41,8 @@ class BarcodeFragment : Fragment() {
)
} catch (e: Exception) {
Toast.makeText(
activity, e.message,
activity,
e.message,
Toast.LENGTH_SHORT
).show()
fragmentManager.popBackStack()
@@ -55,7 +55,8 @@ class EncodeFragment : Fragment() {
ArrayAdapter<String>(
activity,
android.R.layout.simple_list_item_1,
writers.map { it -> it.name })
writers.map { it -> it.name }
)
)
sizeView = view.findViewById<TextView>(R.id.size_display)
@@ -80,7 +81,8 @@ class EncodeFragment : Fragment() {
val content = contentView.getText().toString()
if (content.isEmpty()) {
Toast.makeText(
v.context, R.string.error_no_content,
v.context,
R.string.error_no_content,
Toast.LENGTH_SHORT
).show()
} else {