Skip to content

Commit

Permalink
Splash screen
Browse files Browse the repository at this point in the history
  • Loading branch information
massivemadness committed Feb 6, 2023
1 parent 4cdfd6f commit 0e675e1
Show file tree
Hide file tree
Showing 41 changed files with 106 additions and 90 deletions.
23 changes: 23 additions & 0 deletions .github/images/vector.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ dependencies {
implementation library.core
implementation library.activity
implementation library.fragment
implementation library.splash

// Google Play
googlePlayImplementation library.playcore
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="false"
android:theme="@style/AppTheme"
android:name="com.blacksquircle.ui.SquircleApp"
android:supportsRtl="true"
android:theme="@style/SplashTheme"
android:name=".SquircleApp"
android:requestLegacyExternalStorage="true"
tools:replace="android:supportsRtl">
tools:replace="android:theme">

<activity
android:name="com.blacksquircle.ui.application.activity.MainActivity"
android:name=".application.activity.MainActivity"
android:windowSoftInputMode="adjustResize"
android:configChanges="keyboard|keyboardHidden"
android:launchMode="singleTask"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.updatePadding
import com.blacksquircle.ui.R
import com.blacksquircle.ui.application.viewmodel.MainViewModel
Expand All @@ -31,7 +32,6 @@ import com.blacksquircle.ui.utils.inappupdate.InAppUpdate
import com.google.android.material.snackbar.Snackbar
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import com.blacksquircle.ui.uikit.R as UiR

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
Expand All @@ -44,8 +44,8 @@ class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding

override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
window.setBackgroundDrawableResource(UiR.color.colorBackground)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import android.content.res.ColorStateList
import android.graphics.drawable.InsetDrawable
import android.view.MenuItem
import android.view.View
import android.widget.EditText
import android.widget.ImageView
import androidx.annotation.ColorRes
import androidx.appcompat.view.menu.MenuBuilder
Expand All @@ -32,7 +31,6 @@ import androidx.appcompat.widget.SearchView
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.iterator
import androidx.core.widget.doAfterTextChanged
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
Expand Down Expand Up @@ -63,21 +61,6 @@ fun View.applySystemWindowInsets(
}
}

fun EditText.debounce(
coroutineScope: CoroutineScope,
waitMs: Long = 250L,
destinationFunction: (String) -> Unit,
) {
var debounceJob: Job? = null
doAfterTextChanged {
debounceJob?.cancel()
debounceJob = coroutineScope.launch {
delay(waitMs)
destinationFunction(text.toString())
}
}
}

fun SearchView.debounce(
coroutineScope: CoroutineScope,
waitMs: Long = 250L,
Expand Down
3 changes: 3 additions & 0 deletions common-ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ android {

dependencies {

// Core
implementation library.splash

// UI
implementation library.appcompat
implementation library.materialdesign
Expand Down
45 changes: 45 additions & 0 deletions common-ui/src/main/res/drawable/ic_splash_screen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="200dp"
android:height="200dp"
android:viewportWidth="200"
android:viewportHeight="200">
<group>
<clip-path
android:pathData="M36,100C36,135.35 64.65,164 100,164C135.35,164 164,135.35 164,100C164,64.65 135.35,36 100,36C64.65,36 36,64.65 36,100Z"/>
<path
android:pathData="M164,36H36V164H164V36Z">
<aapt:attr name="android:fillColor">
<gradient
android:centerX="65"
android:centerY="130"
android:gradientRadius="120.0"
android:type="radial">
<item android:offset="0" android:color="#FFC13338"/>
<item android:offset="0.1" android:color="#FFBC3338"/>
<item android:offset="0.3" android:color="#FF86383C"/>
<item android:offset="0.6" android:color="#FF573D3F"/>
<item android:offset="0.75" android:color="#FF3E3F41"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M101.35,77.77L93.56,85.57L84.81,76.82L100.78,60.47L101.35,77.77Z"
android:fillColor="#E4E4E4"/>
<path
android:pathData="M123.22,99.64L115.42,107.25L124.17,115.99L139.76,99.64H123.22Z"
android:fillColor="#E4E4E4"/>
<path
android:pathData="M139.76,99.64L100.78,60.47V78.34L123.22,99.64H139.76Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M77.39,100.97L85.57,92.79L76.82,84.05L60.47,100.02L77.39,100.97Z"
android:fillColor="#E4E4E4"/>
<path
android:pathData="M99.45,122.65L107.24,114.66L115.99,123.41L99.64,139L99.45,122.65Z"
android:fillColor="#E4E4E4"/>
<path
android:pathData="M99.64,139L60.47,100.02H78.34L99.64,122.46V139Z"
android:fillColor="#ffffff"/>
</group>
</vector>
26 changes: 0 additions & 26 deletions common-ui/src/main/res/drawable/launch_screen.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
-->

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<background android:drawable="@mipmap/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
-->

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<background android:drawable="@mipmap/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
23 changes: 0 additions & 23 deletions common-ui/src/main/res/values-v29/themes.xml

This file was deleted.

16 changes: 11 additions & 5 deletions common-ui/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@
~ limitations under the License.
-->

<resources>
<resources xmlns:tools="http://schemas.android.com/tools">

<style name="AppThemeCompat" parent="Theme.MaterialComponents.NoActionBar">
<style name="SplashTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/colorBackground</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_splash_screen</item>
<item name="windowSplashScreenAnimationDuration">1000</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>

<style name="AppTheme" parent="Theme.MaterialComponents.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorSecondary">@color/colorSecondary</item>
<item name="colorSurface">@color/colorSurface</item>
Expand All @@ -44,12 +51,11 @@

<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">?colorSecondaryVariant</item>
<item name="android:windowBackground">@drawable/launch_screen</item>

<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowTranslucentNavigation">false</item>
</style>

<style name="AppTheme" parent="AppThemeCompat" />
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
</style>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ open class TextProcessor @JvmOverloads constructor(
}

private val plugins = hashSetOf<EditorPlugin>()
private var _freezesText = true

override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
Expand All @@ -67,13 +68,13 @@ open class TextProcessor @JvmOverloads constructor(
}
}

/**
* Text is not saved to SavedState due to [android.os.TransactionTooLargeException].
* You should keep the entire text somewhere outside the view, like ViewModel.
* You can override this behavior if you don't work with large files.
*/
override fun getFreezesText(): Boolean {
return false
return _freezesText
}

override fun setFreezesText(freezesText: Boolean) {
super.setFreezesText(freezesText)
_freezesText = freezesText
}

override fun onColorSchemeChanged() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class EditorFragment : Fragment(R.layout.fragment_editor),
binding.extendedKeyboard.setKeyListener(binding.editor::insert)
binding.extendedKeyboard.setHasFixedSize(true)

binding.editor.freezesText = false
binding.editor.onUndoRedoChangedListener = UndoRedoEditText.OnUndoRedoChangedListener {
val canUndo = binding.editor.canUndo()
val canRedo = binding.editor.canRedo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<PreferenceCategory android:title="@string/pref_category_about">

<Preference
android:icon="@mipmap/ic_launch_screen"
android:icon="@mipmap/ic_launcher"
android:summary="@string/pref_about_summary"
android:key="ABOUT"/>

Expand Down
4 changes: 3 additions & 1 deletion gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
ext {

versions = [
minSdk: 23,
minSdk: 24,
targetSdk: 32,
compileSdk: 33,
buildTools: '33.0.0',
Expand All @@ -35,6 +35,7 @@ ext {
core_version = '1.9.0'
activity_version = '1.6.1'
fragment_version = '1.5.5'
splash_version = '1.0.0'

// Google Play
playcore_version = '1.8.1'
Expand Down Expand Up @@ -93,6 +94,7 @@ ext {
core: "androidx.core:core-ktx:$core_version",
activity: "androidx.activity:activity-ktx:$activity_version",
fragment: "androidx.fragment:fragment-ktx:$fragment_version",
splash: "androidx.core:core-splashscreen:$splash_version",

// Google Play
playcore: "com.google.android.play:core-ktx:$playcore_version",
Expand Down

0 comments on commit 0e675e1

Please sign in to comment.