diff --git a/app/src/main/assets/Cheatsheet.md b/app/src/main/assets/Cheatsheet.md index f3dcd07..e402c66 100644 --- a/app/src/main/assets/Cheatsheet.md +++ b/app/src/main/assets/Cheatsheet.md @@ -1,7 +1,3 @@ -# Introduction - -*** - Markdown is a markup language that allows you to quickly and easily write for the web! Many blogging platforms allow you to use markdown in your posts, WordPress for example. This document has also been written in Markdown :) Using Markdown is quite simple. There are just a few syntax rules you'll need to remember. Below I have written a few to get you started, followed by their appearance in this app. diff --git a/app/src/main/assets/Libraries.md b/app/src/main/assets/Libraries.md index a8dc663..2958111 100644 --- a/app/src/main/assets/Libraries.md +++ b/app/src/main/assets/Libraries.md @@ -1,7 +1,3 @@ -# Libraries - -*** - The following libraries were a huge help in the development of SimpleMarkdown. Big thanks to the developers of them :) diff --git a/app/src/main/assets/Privacy Policy.md b/app/src/main/assets/Privacy Policy.md index b631fca..578b86b 100644 --- a/app/src/main/assets/Privacy Policy.md +++ b/app/src/main/assets/Privacy Policy.md @@ -1,5 +1,3 @@ -## Privacy Policy - First and foremost, Simple Markdown DOES NOT collect any personally identifiable information. The internet access permission is requested primarily for retrieving images from the internet in case you embed them in your markdown, but it also allows me to send automated error and crash diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/utility/ErrorHandler.kt b/app/src/main/java/com/wbrawner/simplemarkdown/utility/ErrorHandler.kt index fbdd3d5..ad23c6e 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/utility/ErrorHandler.kt +++ b/app/src/main/java/com/wbrawner/simplemarkdown/utility/ErrorHandler.kt @@ -37,7 +37,6 @@ class SentryErrorHandler : ErrorHandler { @Suppress("ConstantConditionIf") if (BuildConfig.DEBUG) { Log.e("SentryErrorHandler", "Caught exception: $message", t) - return } Sentry.captureException(t) } diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/utility/Extensions.kt b/app/src/main/java/com/wbrawner/simplemarkdown/utility/Extensions.kt index d87cae0..1194c38 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/utility/Extensions.kt +++ b/app/src/main/java/com/wbrawner/simplemarkdown/utility/Extensions.kt @@ -11,9 +11,11 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import java.io.Reader -fun View.showKeyboard() = - (context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager) - .toggleSoftInput(InputMethodManager.SHOW_FORCED, 0) +fun View.showKeyboard() { + (context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager) + .toggleSoftInput(InputMethodManager.SHOW_FORCED, 0) + requestFocus() +} fun View.hideKeyboard() = (context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager) diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MainActivity.kt b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MainActivity.kt index ba7a2ba..14d8e62 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MainActivity.kt +++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MainActivity.kt @@ -43,13 +43,6 @@ class MainActivity : AppCompatActivity(), ActivityCompat.OnRequestPermissionsRes setSupportActionBar(toolbar) supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp) supportActionBar?.setDisplayHomeAsUpEnabled(true) - window.decorView.apply { - systemUiVisibility = ( - View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - or View.SYSTEM_UI_FLAG_LAYOUT_STABLE - or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - ) - } val adapter = EditPagerAdapter(supportFragmentManager, this@MainActivity) pager.adapter = adapter pager.addOnPageChangeListener(adapter) @@ -61,7 +54,7 @@ class MainActivity : AppCompatActivity(), ActivityCompat.OnRequestPermissionsRes } @Suppress("CAST_NEVER_SUCCEEDS") viewModel.fileName.observe(this, Observer { - title = it + toolbar?.title = it }) intent?.data?.let { launch { diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MarkdownInfoActivity.kt b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MarkdownInfoActivity.kt index af53bb7..1e1c2ee 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MarkdownInfoActivity.kt +++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MarkdownInfoActivity.kt @@ -32,6 +32,7 @@ class MarkdownInfoActivity : AppCompatActivity(), CoroutineScope { return } + setTitle(title) val isNightMode = AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES || resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.kt b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.kt index a76d449..cb053fe 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.kt +++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SettingsActivity.kt @@ -4,6 +4,7 @@ import android.os.Bundle import android.view.MenuItem import androidx.appcompat.app.AppCompatActivity import com.wbrawner.simplemarkdown.R +import com.wbrawner.simplemarkdown.view.fragment.SettingsFragment class SettingsActivity : AppCompatActivity() { @@ -12,6 +13,11 @@ class SettingsActivity : AppCompatActivity() { setContentView(R.layout.activity_settings) setSupportActionBar(findViewById(R.id.toolbar)) supportActionBar?.setDisplayHomeAsUpEnabled(true) + if (supportFragmentManager.fragments.isEmpty()) { + supportFragmentManager.beginTransaction() + .add(R.id.fragment_settings, SettingsFragment()) + .commit() + } } override fun onOptionsItemSelected(item: MenuItem): Boolean { diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SupportActivity.kt b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SupportActivity.kt index a726625..91ef1f0 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SupportActivity.kt +++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/SupportActivity.kt @@ -5,7 +5,6 @@ import android.content.Intent import android.net.Uri import android.os.Bundle import android.view.MenuItem -import android.view.View import androidx.appcompat.app.AppCompatActivity import androidx.browser.customtabs.CustomTabsIntent import androidx.lifecycle.Observer @@ -19,13 +18,6 @@ class SupportActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_support) setSupportActionBar(toolbar) - window.decorView.apply { - systemUiVisibility = ( - View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - or View.SYSTEM_UI_FLAG_LAYOUT_STABLE - or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - ) - } setTitle(R.string.support_title) supportActionBar?.setDisplayHomeAsUpEnabled(true) githubButton.setOnClickListener { 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 e411105..f353afa 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 @@ -13,8 +13,8 @@ import android.view.MotionEvent import android.view.View import android.view.ViewGroup import android.widget.EditText -import android.widget.ScrollView import android.widget.TextView +import androidx.core.widget.NestedScrollView import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.lifecycle.Observer @@ -31,7 +31,7 @@ import kotlin.math.abs class EditFragment : Fragment(), ViewPagerPage, CoroutineScope { private var markdownEditor: EditText? = null - private var markdownEditorScroller: ScrollView? = null + private var markdownEditorScroller: NestedScrollView? = null private val viewModel: MarkdownViewModel by activityViewModels() override val coroutineContext: CoroutineContext = Dispatchers.Main private var readabilityWatcher: TextWatcher? = null diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/MainMenuFragment.kt b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/MainMenuFragment.kt index 70f66dd..5063908 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/MainMenuFragment.kt +++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/MainMenuFragment.kt @@ -39,12 +39,12 @@ class MainMenuFragment : BottomSheetDialogFragment() { R.id.action_libraries -> Triple( MarkdownInfoActivity::class.java, "Libraries.md", - R.id.action_libraries + R.string.action_libraries ) R.id.action_privacy -> Triple( MarkdownInfoActivity::class.java, "Privacy Policy.md", - R.id.action_libraries + R.string.action_privacy ) R.id.action_support -> Triple( SupportActivity::class.java, @@ -73,9 +73,9 @@ class MainMenuFragment : BottomSheetDialogFragment() { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { if (requestCode == MainActivity.REQUEST_DARK_MODE) { activity?.recreate() - dialog?.dismiss() - return + } else { + super.onActivityResult(requestCode, resultCode, data) } - super.onActivityResult(requestCode, resultCode, data) + dialog?.dismiss() } } \ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml index 95ed776..33207f6 100644 --- a/app/src/main/res/layout-land/activity_main.xml +++ b/app/src/main/res/layout-land/activity_main.xml @@ -1,75 +1,47 @@ - + android:layout_height="match_parent"> + android:layout_height="match_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> - + android:layout_height="wrap_content"> - + + + android:background="@color/colorBackground" + android:visibility="gone"> - + android:text="@string/action_edit" /> - + + - - + - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index e96d18d..fa01013 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,73 +1,48 @@ - + android:layout_height="match_parent"> + android:layout_height="match_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> - + app:liftOnScroll="true"> - + + + android:layout_gravity="bottom" + android:background="@color/colorBackground"> - + android:text="@string/action_edit" /> - + + - - + - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_markdown_info.xml b/app/src/main/res/layout/activity_markdown_info.xml index 37750c9..8446872 100644 --- a/app/src/main/res/layout/activity_markdown_info.xml +++ b/app/src/main/res/layout/activity_markdown_info.xml @@ -1,41 +1,43 @@ - + tools:context="com.wbrawner.simplemarkdown.view.activity.MarkdownInfoActivity"> - + + + + + + + + + + + app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - - - + android:layout_height="match_parent" + android:nestedScrollingEnabled="false" /> + - + diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 1a8b362..005fbd3 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -5,34 +5,26 @@ android:layout_height="match_parent" android:fitsSystemWindows="true"> - - - + app:layout_constraintTop_toTopOf="parent"> - - + android:background="@color/colorBackground" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_support.xml b/app/src/main/res/layout/activity_support.xml index 3e3eeb9..25dacb3 100644 --- a/app/src/main/res/layout/activity_support.xml +++ b/app/src/main/res/layout/activity_support.xml @@ -2,8 +2,14 @@ + android:layout_height="match_parent"> + + + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toBottomOf="@+id/toolbar"> - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_edit.xml b/app/src/main/res/layout/fragment_edit.xml index 0cf1c19..a03d90e 100644 --- a/app/src/main/res/layout/fragment_edit.xml +++ b/app/src/main/res/layout/fragment_edit.xml @@ -1,4 +1,4 @@ - - + diff --git a/app/src/main/res/layout/fragment_preview.xml b/app/src/main/res/layout/fragment_preview.xml index 00573d7..047600d 100644 --- a/app/src/main/res/layout/fragment_preview.xml +++ b/app/src/main/res/layout/fragment_preview.xml @@ -1,4 +1,4 @@ - - + diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index 874c0af..2d93108 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -1,10 +1,11 @@ - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 33c30bc..1f0dad3 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -6,10 +6,15 @@ @color/colorPrimary @color/colorPrimaryDark @color/colorAccent - true + @color/colorBackground + true + #FF000000