Skip to content

Commit

Permalink
Small code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
D4rK7355608 committed Jul 16, 2024
1 parent 0033c0b commit aac4474
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 126 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Version 5.0.0:
- Major : Migrated to same ver
- Reworked the entire project strucutre in jetpack compose for better performance and compatibility
- Reduced the app size
- Now the app is more interactive and resposive
- A new and improved media3 player
- Added a new API and now the app syncronizezs with it, showing new lessons without updating the app.
- **Major**: This release brings significant improvements to the app's core functionality, user experience, and architecture.
- **Major**: The entire project has been rewritten using Jetpack Compose, resulting in enhanced performance, improved compatibility, and a more modern UI.
- **Major**: The Media3 player has been upgraded to provide a more reliable and feature-rich media playback experience.
- **Major**: The app now integrates with a new API, enabling real-time content synchronization. This eliminates the need for app updates to access new lessons, offering a more dynamic and up-to-date experience.
- **Minor**: The app size has been optimized, making it faster to download and consume less storage space on the user's device.
- **Minor**: The app now offers a smoother and more engaging user experience with improved interactivity and responsiveness.

# Version 4.0_r1:
- Added language support for Hungarian.
Expand Down
6 changes: 5 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
-keep public class com.google.android.gms.ads.** {
public *;
}

-keep public class com.google.ads.** {
public *;
}

-keep class com.google.firebase.** {
public *;
}
}

-keep class ch.qos.logback.** { *; }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@file:OptIn(kotlinx.serialization.ExperimentalSerializationApi::class)

package com.d4rk.englishwithlidia.plus.data.model.api

import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonNames

Expand All @@ -10,7 +11,7 @@ data class ApiResponse(
)

@Serializable
data class NetworkLesson @OptIn(ExperimentalSerializationApi::class) constructor(
data class NetworkLesson(
val id: Int,
val title: String,
val banner: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.d4rk.englishwithlidia.plus.data.model.ui.lessons

import android.os.Parcelable
import androidx.annotation.RawRes
import androidx.annotation.StringRes
import kotlinx.parcelize.Parcelize

@Parcelize
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.d4rk.englishwithlidia.plus.ui.help

import android.app.Application
import androidx.compose.runtime.*
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.viewModelScope
import com.google.android.play.core.review.ReviewInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ import com.airbnb.lottie.compose.LottieCompositionSpec
import com.airbnb.lottie.compose.rememberLottieComposition
import com.d4rk.englishwithlidia.plus.R
import com.d4rk.englishwithlidia.plus.data.model.ui.lessons.UiLessonsAsset
import com.d4rk.englishwithlidia.plus.ui.settings.display.theme.style.annotatedStringHtmlParser
import com.d4rk.englishwithlidia.plus.utils.compose.bounceClick
import com.d4rk.englishwithlidia.plus.utils.compose.components.annotatedStringHtmlParser

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.d4rk.englishwithlidia.plus.ui.settings.display.theme.style

import androidx.compose.material3.Typography
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.unit.sp

val Typography = Typography(
Expand All @@ -14,4 +18,47 @@ val Typography = Typography(
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
)
)

fun String.annotatedStringHtmlParser(
boldTag: String = "<b>",
underlineTag: String = "<i>",
italicTag: String = "\n",
) =
buildAnnotatedString {
val pattern =
"(${Regex.escape(boldTag)}|${Regex.escape(underlineTag)}|${Regex.escape(italicTag)})(.*?)(\\1|$)".toRegex()
var lastIndex = 0
val text = this@annotatedStringHtmlParser
pattern.findAll(text).forEach { result ->
val (tag, content) = result.destructured
append(text.substring(lastIndex, result.range.first))
val start = length
append(content)
val end = length
when (tag) {
boldTag -> addStyle(
style = SpanStyle(fontWeight = FontWeight.Bold),
start = start,
end = end,
)

underlineTag -> addStyle(
style = SpanStyle(textDecoration = TextDecoration.Underline),
start = start,
end = end,
)

italicTag -> addStyle(
style = SpanStyle(fontStyle = FontStyle.Italic),
start = start,
end = end,
)
}
lastIndex = result.range.last + 1
if (tag != italicTag && lastIndex < text.length && text[lastIndex] == '\n') {
lastIndex++
}
}
append(text.substring(lastIndex, text.length))
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package com.d4rk.englishwithlidia.plus.utils.drawable
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp

Expand Down
57 changes: 0 additions & 57 deletions app/src/main/res/drawable-anydpi/il_drawer.xml

This file was deleted.

6 changes: 3 additions & 3 deletions app/src/main/res/xml/shortcuts.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="openSettings"
android:enabled="true"
android:icon="@mipmap/ic_shortcut_settings"
android:shortcutId="openSettings"
android:shortcutShortLabel="@string/settings">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.d4rk.englishwithlidia.plus"
android:targetClass="com.d4rk.englishwithlidia.plus.ui.settings.SettingsActivity"/>
android:targetClass="com.d4rk.englishwithlidia.plus.ui.settings.SettingsActivity"
android:targetPackage="com.d4rk.englishwithlidia.plus" />
</shortcut>
</shortcuts>

0 comments on commit aac4474

Please sign in to comment.