Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.0.0 beta3 #36

Merged
merged 7 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
## v1.0.0-beta3 (16.02.2024)

* UI improvement
* Turkish language support added

## v1.0.0-beta2 (14.02.2024)

* Start screen is completed
* About screen added
* Minor ui fix
* Minor UI fix

## v1.0.0-beta1 (12.02.2024)

* Initial release
* Initial release
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ android {
applicationId "com.sn.snfilemanager"
minSdk 26
targetSdk 34
versionCode 2
versionName "1.0.0-beta2"
versionCode 3
versionName "1.0.0-beta3"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -72,7 +72,7 @@ android {
dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/sn/snfilemanager/BaseApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ class BaseApplication : Application() {
override fun onCreate() {
super.onCreate()
val theme = SettingsUtils.resolveThemeMode(this)
SettingsUtils.changeTheme(theme)
SettingsUtils.changeTheme(applicationContext, theme)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ abstract class BaseFragment<VBinding : ViewBinding, VModel : ViewModel> : Fragme
getMenuResId()?.let { menuId ->
initMenu(menuId, toolbar)
}
toolbar.setNavigationOnClickListener {
findNavController().popBackStack()
}
}
return binding.root
}
Expand Down
64 changes: 33 additions & 31 deletions app/src/main/java/com/sn/snfilemanager/core/extensions/ImageView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,40 @@ import com.sn.snfilemanager.R

fun ImageView.loadWithGlide(
videoPath: Any,
placeholderResId: Int? = R.drawable.layer_placeholder,
readyOrFailed: ((e: GlideException?) -> Unit)? = null,
) {
Glide.with(context)
.asBitmap()
.load(videoPath)
// .fitCenter()
.placeholder(R.drawable.layer_placeholder)
.error(R.drawable.layer_broken_placeholder)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.addListener(
object : RequestListener<Bitmap> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Bitmap>?,
isFirstResource: Boolean,
): Boolean {
readyOrFailed?.invoke(e)
return false
}
val builder =
Glide.with(context)
.asBitmap()
.load(videoPath)
// .fitCenter()
.error(R.drawable.layer_broken_placeholder)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.addListener(
object : RequestListener<Bitmap> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Bitmap>?,
isFirstResource: Boolean,
): Boolean {
readyOrFailed?.invoke(e)
return false
}

override fun onResourceReady(
resource: Bitmap?,
model: Any?,
target: Target<Bitmap>?,
dataSource: DataSource?,
isFirstResource: Boolean,
): Boolean {
readyOrFailed?.invoke(null)
return false
}
},
)
.into(this)
override fun onResourceReady(
resource: Bitmap?,
model: Any?,
target: Target<Bitmap>?,
dataSource: DataSource?,
isFirstResource: Boolean,
): Boolean {
readyOrFailed?.invoke(null)
return false
}
},
)
placeholderResId?.let { builder.placeholder(it) }
builder.into(this)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.annotation.RequiresApi
import androidx.appcompat.widget.Toolbar
import androidx.core.app.NotificationManagerCompat
import androidx.core.content.ContextCompat
import androidx.core.content.ContextCompat.getColor
import com.sn.mediastorepv.data.MediaType
import com.sn.snfilemanager.R
import com.sn.snfilemanager.core.base.BaseFragment
Expand Down Expand Up @@ -47,6 +48,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>() {
override fun onResume() {
super.onResume()
initPermission()
setStatusBarColor()
}

override fun onMenuItemSelected(menuItemId: Int) =
Expand Down Expand Up @@ -214,6 +216,10 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>() {
}
}

private fun setStatusBarColor() {
binding.appBar.setBackgroundColor(getColor(requireContext(), R.color.bg_color))
}

private fun initMenuButtonListener() {
with(binding) {
ibImages.click {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ class MediaItemAdapter(
private fun bindVideo(data: Media) {
(binding as ItemVideoBinding).ivImage.loadWithGlide(
data.uri,
R.drawable.layer_placeholder_transparent,
) { exception ->
if (exception == null) {
binding.ivPlay.visible()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
when (key) {
SettingsUtils.SN_THEME_MODE -> {
SettingsUtils.changeTheme(
themeListPreference?.value ?: SettingsUtils.SYSTEM,
requireContext(),
themeListPreference?.value ?: SettingsUtils.SYSTEM.asString(context),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,41 @@ package com.sn.snfilemanager.feature.settings
import android.content.Context
import androidx.appcompat.app.AppCompatDelegate
import androidx.preference.PreferenceManager
import com.sn.snfilemanager.R
import com.sn.snfilemanager.core.util.StringValue

object SettingsUtils {
const val SN_THEME_MODE = "sn.theme.mode"
const val SN_HIDDEN_FILE = "sn.hidden.file"

const val SYSTEM = "System"
private const val DARK = "Dark"
private const val LIGHT = "Light"
val SYSTEM = StringValue.StringResource(R.string.system)
private val DARK = StringValue.StringResource(R.string.dark)
private val LIGHT = StringValue.StringResource(R.string.light)

fun resolveThemeMode(context: Context): String {
return PreferenceManager.getDefaultSharedPreferences(context)
.getString(SN_THEME_MODE, SYSTEM).toString()
.getString(SN_THEME_MODE, SYSTEM.asString(context)).toString()
}

fun resolveHiddenFiles(context: Context): Boolean {
return PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean(SN_HIDDEN_FILE, false)
}

fun changeTheme(theme: String) {
fun changeTheme(
context: Context,
theme: String,
) {
when (theme) {
SYSTEM -> {
SYSTEM.asString(context) -> {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
}

DARK -> {
DARK.asString(context) -> {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
}

LIGHT -> {
LIGHT.asString(context) -> {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class MoveMediaJob(

private fun updateProgress() {
val progress = ((movedItemCount.toDouble() / totalItemCount.toDouble()) * 100).toInt()
val title = if (isCopy) R.string.copy else R.string.move
val title = if (isCopy) R.string.copy_key else R.string.move
postNotification(title, progress)
}
}
22 changes: 22 additions & 0 deletions app/src/main/res/drawable/layer_placeholder_transparent.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/bg_color" />
<stroke
android:width="1dp"
android:color="@color/divider_color" />
</shape>

</item>

<item
android:width="16dp"
android:height="16dp"
android:bottom="16dp"
android:drawable="@drawable/layer_transparent"
android:gravity="center"
android:left="16dp"
android:right="16dp"
android:top="16dp" />
</layer-list>
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/layer_transparent.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="0dp"
android:color="@android:color/transparent" />
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_color"
android:elevation="@dimen/_1sdp"
app:liftOnScroll="true">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/bg_color"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:navigationContentDescription="@string/about"
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/res/layout/fragment_files_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,20 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/bg_color"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:layout_scrollFlags="scroll|enterAlways"
app:navigationContentDescription="@string/folders"
app:navigationIcon="@drawable/ic_arrow_back"
app:title="@string/folders"
app:titleTextColor="@color/first_text_color" />

<com.sn.snfilemanager.view.component.breadcrumb.BreadCrumbView
android:id="@+id/breadcrumb_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/_30sdp"
android:layout_marginTop="@dimen/_3sdp"
android:background="@color/bg_color"
android:paddingVertical="@dimen/_15sdp"
android:visibility="@{vm.searchStateLiveData.peekContent().first == true ? View.GONE : View.VISIBLE}" />

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
tools:context=".feature.home.HomeFragment">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_color"
android:elevation="@dimen/_1sdp"
app:liftOnScroll="true">
app:liftOnScroll="true"
app:liftOnScrollColor="@null">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/res/layout/fragment_media.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_color"
android:elevation="@dimen/_1sdp"
app:liftOnScroll="true">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/bg_color"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:navigationContentDescription="@string/media"
app:navigationIcon="@drawable/ic_arrow_back"
app:title="@string/app_name"
app:titleTextColor="@color/first_text_color" />

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/item_bread_crumb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_3sdp"
android:gravity="top"
android:orientation="horizontal">

Expand Down
28 changes: 9 additions & 19 deletions app/src/main/res/layout/toolbar_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,15 @@
android:layout_height="wrap_content"
android:orientation="vertical">

<com.google.android.material.appbar.AppBarLayout
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_color"
android:elevation="@dimen/_1sdp"
app:liftOnScroll="true">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar_settings"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:navigationContentDescription="@string/settings"
app:navigationIcon="@drawable/ic_arrow_back"
app:title="@string/settings"
app:titleTextColor="@color/first_text_color" />

</com.google.android.material.appbar.AppBarLayout>

android:layout_height="?attr/actionBarSize"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:navigationContentDescription="@string/settings"
app:navigationIcon="@drawable/ic_arrow_back"
app:title="@string/settings"
app:titleTextColor="@color/first_text_color" />

</LinearLayout>
8 changes: 8 additions & 0 deletions app/src/main/res/values-tr/array.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="theme_mode">
<item>Sistem</item>
<item>Koyu</item>
<item>Açık</item>
</string-array>
</resources>
Loading