diff --git a/app/build.gradle b/app/build.gradle
index d8cc1be..0b6637c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -27,13 +27,13 @@ android {
}
defaultConfig {
applicationId "com.wbrawner.simplemarkdown"
- minSdkVersion 19
+ minSdkVersion 20
targetSdkVersion 'Q'
multiDexEnabled true
versionCode 18
versionName "0.6.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- buildConfigField "boolean", "ENABLE_CUSTOM_CSS", "true"
+ buildConfigField "boolean", "ENABLE_CUSTOM_CSS", "false"
}
signingConfigs {
release {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4227bd8..defe2b9 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -67,10 +67,6 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".view.activity.MainActivity" />
-
+// pager.updatePadding(top = insets.systemWindowInsetTop)
+// insets
+// }
+ }
(application as MarkdownApplication).component.inject(this)
pager.adapter = EditPagerAdapter(supportFragmentManager, this@MainActivity)
pager.pageMargin = 1
pager.setPageMarginDrawable(R.color.colorAccent)
+ tabLayout.setupWithViewPager(pager)
if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
tabLayout!!.visibility = View.GONE
}
diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/EditFragment.kt b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/EditFragment.kt
index 04008e6..a608e60 100644
--- a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/EditFragment.kt
+++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/EditFragment.kt
@@ -76,13 +76,13 @@ class EditFragment : Fragment(), MarkdownEditView {
override fun onResume() {
super.onResume()
- presenter!!.setEditView(this)
- markdown = presenter!!.markdown
+ presenter.setEditView(this)
+ markdown = presenter.markdown
}
override fun onPause() {
super.onPause()
- presenter!!.setEditView(null)
+ presenter.setEditView(null)
}
override fun getMarkdown(): String {
@@ -101,7 +101,7 @@ class EditFragment : Fragment(), MarkdownEditView {
}
override fun onFileSaved(success: Boolean) {
- val location = Utils.getDocsPath(activity) + presenter!!.fileName
+ val location = Utils.getDocsPath(activity) + presenter.fileName
val message: String
message = if (success) {
getString(R.string.file_saved, location)
diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.kt b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.kt
index c58a0e8..cd9fb2f 100644
--- a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.kt
+++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/PreviewFragment.kt
@@ -1,6 +1,8 @@
package com.wbrawner.simplemarkdown.view.fragment
import android.content.SharedPreferences
+import android.content.res.Configuration.UI_MODE_NIGHT_MASK
+import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.os.Bundle
import android.preference.PreferenceManager
import android.view.LayoutInflater
@@ -15,6 +17,7 @@ import com.wbrawner.simplemarkdown.presentation.MarkdownPresenter
import com.wbrawner.simplemarkdown.view.MarkdownPreviewView
import javax.inject.Inject
+
class PreviewFragment : Fragment(), MarkdownPreviewView {
@Inject
lateinit var presenter: MarkdownPresenter
@@ -48,15 +51,18 @@ class PreviewFragment : Fragment(), MarkdownPreviewView {
return@post
}
+ val isNightMode = context!!.resources.configuration.uiMode and UI_MODE_NIGHT_MASK == UI_MODE_NIGHT_YES
+ val defaultCssId = if (isNightMode) {
+ R.string.pref_custom_css_default_dark
+ } else {
+ R.string.pref_custom_css_default
+ }
val css: String? = if (!BuildConfig.ENABLE_CUSTOM_CSS) {
- sharedPreferences!!.getString(
- getString(R.string.pref_custom_css_default),
- ""
- )
+ getString(defaultCssId)
} else {
sharedPreferences!!.getString(
getString(R.string.pref_custom_css),
- getString(R.string.pref_custom_css_default)
+ getString(defaultCssId)
)
}
diff --git a/app/src/main/res/layout/activity_explorer.xml b/app/src/main/res/layout/activity_explorer.xml
deleted file mode 100644
index ba015e8..0000000
--- a/app/src/main/res/layout/activity_explorer.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 7f1d0c2..ce72f4d 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,14 +1,32 @@
-
+ android:layout_height="match_parent"
+ android:clipChildren="false"
+ android:fitsSystemWindows="true"
+ android:clipToPadding="false">
+
+
+ android:background="@color/colorBackground"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintBottom_toTopOf="@+id/toolbar">
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 684a1f8..e64a999 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -2,7 +2,7 @@
+ android:fitsSystemWindows="true">
+
+ #000000
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 65687cf..8f521e5 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -3,4 +3,5 @@
#d32f2f
#b71c1c
#d32f2f
+ #FFFFFF
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 19ee33d..37ee8e6 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -56,6 +56,8 @@
Custom CSS
Paste or write your own CSS to be used for the preview pane
pre {overflow:scroll; padding:15px; background: #F1F1F1;}
+ body{background:
+ #000000;color: #F1F1F1;}a{color:#7b91ff;}pre{background:#111111;}
- @string/value_edit_view
- @string/value_explorer_view
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index f3b0791..97bf018 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,29 +1,15 @@
-
-
-
-
-
-
-
-
-
-