Skip to content

Commit

Permalink
Merge pull request #33 from emreesen27/develop
Browse files Browse the repository at this point in the history
v1.0.0-beta2 is completed
  • Loading branch information
emreesen27 authored Feb 13, 2024
2 parents 67649f4 + 6fee171 commit e9ada6b
Show file tree
Hide file tree
Showing 40 changed files with 713 additions and 40 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
env:
BUILD_TOOLS_VERSION: "34.0.0"

# Upload the signed APK as an artifact
- name: Upload Signed APK
uses: actions/upload-artifact@v2
with:
Expand All @@ -64,7 +63,7 @@ jobs:
release_name: Release ${{ steps.android_version.outputs.VERSION_NAME }}
body: |
This is the release APK for version ${{ steps.android_version.outputs.VERSION_NAME }}.
See here for changes in version -> [Changelog](https://github.com/emreesen27/Android-Sn-File-Manager/blob/master/CHANGELOG)
See here for changes in version -> [Changelog](https://github.com/emreesen27/Android-Sn-File-Manager/blob/master/CHANGELOG.md)
- name: Upload Release Asset
id: upload-release-asset
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
.cxx
local.properties
app/release/
app/google-services.json
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v1.0.0-beta2 (14.02.2024)

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

## v1.0.0-beta1 (12.02.2024)

* Initial release
3 changes: 2 additions & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/build
/build
google-services.json
4 changes: 2 additions & 2 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 1
versionName "1.0.0-beta1"
versionCode 2
versionName "1.0.0-beta2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/sn/snfilemanager/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import com.sn.snfilemanager.core.Config
import com.sn.snfilemanager.core.extensions.observe
import com.sn.snfilemanager.core.util.Config
import com.sn.snfilemanager.databinding.ActivityMainBinding
import com.sn.snfilemanager.feature.settings.SettingsUtils
import dagger.hilt.android.AndroidEntryPoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,11 @@ fun Context.shareFiles(uris: List<Uri>): Boolean {
false
}
}

fun Context.startActivitySafely(intent: Intent) {
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
// Todo
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sn.snfilemanager.core
package com.sn.snfilemanager.core.util

object Config {
var hiddenFile: Boolean = false
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/com/sn/snfilemanager/core/util/Constant.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.sn.snfilemanager.core.util

object Constant {
const val GITHUB_URL =
"https://github.com/emreesen27/Android-Sn-File-Manager"
const val PRIVACY_URL =
"https://github.com/emreesen27/Android-Sn-File-Manager/blob/develop/PRIVACY.md"
const val OPEN_SOURCE_LICENSE =
"https://github.com/emreesen27/Android-Sn-File-Manager/blob/develop/LICENSE"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.sn.snfilemanager.feature.about

import android.content.Intent
import android.net.Uri
import androidx.navigation.fragment.findNavController
import com.sn.snfilemanager.core.base.BaseFragment
import com.sn.snfilemanager.core.extensions.click
import com.sn.snfilemanager.core.extensions.startActivitySafely
import com.sn.snfilemanager.core.util.Constant.GITHUB_URL
import com.sn.snfilemanager.core.util.Constant.PRIVACY_URL
import com.sn.snfilemanager.databinding.FragmentAboutBinding
import com.sn.snfilemanager.view.dialog.license.LicenseDialog

class AboutFragment : BaseFragment<FragmentAboutBinding, AboutViewModel>() {
override fun getViewModelClass() = AboutViewModel::class.java

override fun getViewBinding() = FragmentAboutBinding.inflate(layoutInflater)

override fun setupViews() {
binding.vm = viewModel
binding.lifecycleOwner = viewLifecycleOwner
initClicks()
}

private fun initClicks() {
binding.toolbar.setNavigationOnClickListener { findNavController().popBackStack() }
binding.btnGithub.click { openUrl(GITHUB_URL) }
binding.btnLicense.click { showLicensesDialog() }
binding.btnPrivacy.click { openUrl(PRIVACY_URL) }
}

private fun showLicensesDialog() {
LicenseDialog().show(childFragmentManager, LicenseDialog.TAG)
}

private fun openUrl(url: String) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
context?.startActivitySafely(intent)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.sn.snfilemanager.feature.about

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.sn.snfilemanager.BuildConfig

class AboutViewModel : ViewModel() {
private val _versionLiveData: MutableLiveData<String> = MutableLiveData()
val versionLiveData: LiveData<String> = _versionLiveData

init {
getVersion()
}

private fun getVersion() {
_versionLiveData.value = BuildConfig.VERSION_NAME
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.sn.mediastorepv.data.ConflictStrategy
import com.sn.mediastorepv.data.MediaType
import com.sn.snfilemanager.core.Config
import com.sn.snfilemanager.core.base.BaseResult
import com.sn.snfilemanager.core.util.Config
import com.sn.snfilemanager.core.util.Event
import com.sn.snfilemanager.core.util.RootPath
import com.sn.snfilemanager.feature.files.data.FileModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>() {
btnSettings.click {
navigate(HomeFragmentDirections.actionSettings())
}
btnAbout.click {
navigate(HomeFragmentDirections.actionAbout())
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import android.content.SharedPreferences
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import android.os.Bundle
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat
import com.sn.snfilemanager.R
import com.sn.snfilemanager.core.Config
import com.sn.snfilemanager.core.util.Config

class SettingsFragment : PreferenceFragmentCompat() {
private lateinit var mListenerOptions: OnSharedPreferenceChangeListener
Expand All @@ -19,13 +18,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
) {
setPreferencesFromResource(R.xml.preferences, rootKey)

val aboutButton: Preference? = findPreference(SettingsUtils.SN_ABOUT)
aboutButton?.setOnPreferenceClickListener {
// todo
// findNavController().navigate(SettingsFragmentDirections.actionSettingsToAbout())
true
}

val themeListPreference: ListPreference? = findPreference(SettingsUtils.SN_THEME_MODE)
val hiddenFilePreference: SwitchPreferenceCompat? =
findPreference(SettingsUtils.SN_HIDDEN_FILE)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.sn.snfilemanager.feature.settings

import android.content.Context
import android.util.AttributeSet
import androidx.navigation.findNavController
import androidx.preference.Preference
import androidx.preference.PreferenceViewHolder
import com.google.android.material.appbar.MaterialToolbar
import com.sn.snfilemanager.R

class SettingsToolbar
@JvmOverloads
constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
) : Preference(context, attrs, defStyleAttr) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)

val toolbar = holder.findViewById(R.id.toolbar_settings) as MaterialToolbar
toolbar.setNavigationOnClickListener {
toolbar.findNavController().popBackStack()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import androidx.appcompat.app.AppCompatDelegate
import androidx.preference.PreferenceManager

object SettingsUtils {
const val SECRETIVE_REPOSITORY_LINK = "https://github.com/emreesen27/Secretive"

const val SN_THEME_MODE = "sn.theme.mode"
const val SN_ABOUT = "sn.about"
const val SN_HIDDEN_FILE = "sn.hidden.file"

const val SYSTEM = "System"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package com.sn.snfilemanager.feature.start

import android.content.Intent
import android.net.Uri
import com.sn.snfilemanager.BuildConfig
import com.sn.snfilemanager.core.base.BaseFragment
import com.sn.snfilemanager.core.extensions.click
import com.sn.snfilemanager.core.extensions.startActivitySafely
import com.sn.snfilemanager.core.util.Constant.OPEN_SOURCE_LICENSE
import com.sn.snfilemanager.core.util.Constant.PRIVACY_URL
import com.sn.snfilemanager.databinding.FragmentStartBinding
import dagger.hilt.android.AndroidEntryPoint

Expand All @@ -29,9 +34,13 @@ class StartFragment : BaseFragment<FragmentStartBinding, StartViewModel>() {
}
}

// Todo click implementation
private fun clicksPolicy() {
binding.mtvPrivacyPolicy.click { }
binding.mtvOpenSourcePolicy.click { }
binding.mtvPrivacyPolicy.click { openUrl(PRIVACY_URL) }
binding.mtvOpenSourcePolicy.click { openUrl(OPEN_SOURCE_LICENSE) }
}

private fun openUrl(url: String) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
context?.startActivitySafely(intent)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import androidx.appcompat.widget.AppCompatImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.google.android.material.textview.MaterialTextView
import com.sn.snfilemanager.R
import com.sn.snfilemanager.core.extensions.gone
import com.sn.snfilemanager.core.extensions.visible

class HrImageButton
@JvmOverloads
Expand All @@ -23,10 +25,11 @@ class HrImageButton
titleTextView.text = value
}

var subTitle: String
var subTitle: String?
get() = subTitleTextView.text.toString()
set(value) {
subTitleTextView.text = value
checkSubTitle()
}

init {
Expand All @@ -44,4 +47,12 @@ class HrImageButton

attributes.recycle()
}

private fun checkSubTitle() {
if (subTitle.isNullOrEmpty()) {
subTitleTextView.gone()
} else {
subTitleTextView.visible()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.sn.snfilemanager.view.dialog.license

data class License(
val name: String,
val url: String,
val license: String,
)
Loading

0 comments on commit e9ada6b

Please sign in to comment.