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 @@ - - - - - - - - - - - - - - - -