-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
16 changed files
with
397 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
app/src/main/java/com/etb/filemanager/settings/preference/AboutFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package com.etb.filemanager.settings.preference | ||
|
||
import android.content.ActivityNotFoundException | ||
import android.content.Intent | ||
import android.content.pm.PackageManager | ||
import android.os.Build | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.core.net.toUri | ||
import androidx.fragment.app.Fragment | ||
import com.etb.filemanager.BuildConfig | ||
import com.etb.filemanager.databinding.FragmentAboutBinding | ||
import com.google.android.material.transition.MaterialFadeThrough | ||
|
||
class AboutFragment : Fragment() { | ||
|
||
private var _binding: FragmentAboutBinding? = null | ||
private val binding get() = _binding!! | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
enterTransition = MaterialFadeThrough() | ||
exitTransition = MaterialFadeThrough() | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? | ||
): View { | ||
_binding = FragmentAboutBinding.inflate(inflater, container, false) | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
binding.aboutToolbar.setNavigationOnClickListener { requireActivity().supportFragmentManager.popBackStack() } | ||
binding.aboutVersion.text = BuildConfig.VERSION_NAME | ||
binding.aboutCode.setOnClickListener {openLinkInBrowser(LINK_SOURCE) } | ||
binding.aboutLicenses.setOnClickListener {openLinkInBrowser(LINK_LICENSES) } | ||
binding.aboutAuthor.setOnClickListener {openLinkInBrowser(LINK_AUTHOR) } | ||
} | ||
|
||
private fun openLinkInBrowser(uri: String) { | ||
val context = requireContext() | ||
val browserIntent = | ||
Intent(Intent.ACTION_VIEW, uri.toUri()).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | ||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { | ||
try { | ||
context.startActivity(browserIntent) | ||
} catch (e: ActivityNotFoundException) { | ||
|
||
} | ||
} else { | ||
val packageName = context.packageManager.resolveActivity( | ||
browserIntent, | ||
PackageManager.MATCH_DEFAULT_ONLY | ||
)?.run { activityInfo.packageName } | ||
if (packageName != null) { | ||
if (packageName == "android") { | ||
openAppChooser(browserIntent) | ||
} | ||
try { | ||
browserIntent.setPackage(packageName) | ||
startActivity(browserIntent) | ||
} catch (e: ActivityNotFoundException) { | ||
browserIntent.setPackage(null) | ||
openAppChooser(browserIntent) | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
||
companion object { | ||
const val LINK_SOURCE = "https://github.com/Ruan625Br/FileManagerSphere" | ||
const val LINK_LICENSES = "https://github.com/Ruan625Br/FileManagerSphere/wiki/Licences" | ||
const val LINK_AUTHOR = "https://github.com/Ruan625Br" | ||
} | ||
|
||
private fun openAppChooser(intent: Intent) { | ||
val chooserIntent = Intent(Intent.ACTION_CHOOSER).putExtra(Intent.EXTRA_INTENT, intent) | ||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | ||
startActivity(chooserIntent) | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:tint="?attr/colorControlNormal" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M11,17H13V11H11ZM12,9Q12.425,9 12.713,8.712Q13,8.425 13,8Q13,7.575 12.713,7.287Q12.425,7 12,7Q11.575,7 11.288,7.287Q11,7.575 11,8Q11,8.425 11.288,8.712Q11.575,9 12,9ZM12,22Q9.925,22 8.1,21.212Q6.275,20.425 4.925,19.075Q3.575,17.725 2.788,15.9Q2,14.075 2,12Q2,9.925 2.788,8.1Q3.575,6.275 4.925,4.925Q6.275,3.575 8.1,2.787Q9.925,2 12,2Q14.075,2 15.9,2.787Q17.725,3.575 19.075,4.925Q20.425,6.275 21.212,8.1Q22,9.925 22,12Q22,14.075 21.212,15.9Q20.425,17.725 19.075,19.075Q17.725,20.425 15.9,21.212Q14.075,22 12,22ZM12,20Q15.35,20 17.675,17.675Q20,15.35 20,12Q20,8.65 17.675,6.325Q15.35,4 12,4Q8.65,4 6.325,6.325Q4,8.65 4,12Q4,15.35 6.325,17.675Q8.65,20 12,20ZM12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Z" /> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:tint="?attr/colorControlNormal" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M12,12Q10.35,12 9.175,10.825Q8,9.65 8,8Q8,6.35 9.175,5.175Q10.35,4 12,4Q13.65,4 14.825,5.175Q16,6.35 16,8Q16,9.65 14.825,10.825Q13.65,12 12,12ZM4,20V17.2Q4,16.35 4.438,15.637Q4.875,14.925 5.6,14.55Q7.15,13.775 8.75,13.387Q10.35,13 12,13Q13.65,13 15.25,13.387Q16.85,13.775 18.4,14.55Q19.125,14.925 19.562,15.637Q20,16.35 20,17.2V20ZM6,18H18V17.2Q18,16.925 17.863,16.7Q17.725,16.475 17.5,16.35Q16.15,15.675 14.775,15.337Q13.4,15 12,15Q10.6,15 9.225,15.337Q7.85,15.675 6.5,16.35Q6.275,16.475 6.138,16.7Q6,16.925 6,17.2ZM12,10Q12.825,10 13.413,9.412Q14,8.825 14,8Q14,7.175 13.413,6.588Q12.825,6 12,6Q11.175,6 10.588,6.588Q10,7.175 10,8Q10,8.825 10.588,9.412Q11.175,10 12,10ZM12,8Q12,8 12,8Q12,8 12,8Q12,8 12,8Q12,8 12,8Q12,8 12,8Q12,8 12,8Q12,8 12,8Q12,8 12,8ZM12,18Q12,18 12,18Q12,18 12,18Q12,18 12,18Q12,18 12,18Q12,18 12,18Q12,18 12,18Q12,18 12,18Q12,18 12,18Z" /> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:tint="?attr/colorControlNormal" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M12,20 L4,12 12,4 13.425,5.4 7.825,11H20V13H7.825L13.425,18.6Z" /> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:tint="?attr/colorControlNormal" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M8,18 L2,12 8,6 9.425,7.425 4.825,12.025 9.4,16.6ZM16,18 L14.575,16.575 19.175,11.975 14.6,7.4 16,6 22,12Z" /> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:tint="?attr/colorControlNormal" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M11.95,18Q12.475,18 12.838,17.637Q13.2,17.275 13.2,16.75Q13.2,16.225 12.838,15.863Q12.475,15.5 11.95,15.5Q11.425,15.5 11.062,15.863Q10.7,16.225 10.7,16.75Q10.7,17.275 11.062,17.637Q11.425,18 11.95,18ZM11.05,14.15H12.9Q12.9,13.325 13.088,12.85Q13.275,12.375 14.15,11.55Q14.8,10.9 15.175,10.312Q15.55,9.725 15.55,8.9Q15.55,7.5 14.525,6.75Q13.5,6 12.1,6Q10.675,6 9.788,6.75Q8.9,7.5 8.55,8.55L10.2,9.2Q10.325,8.75 10.763,8.225Q11.2,7.7 12.1,7.7Q12.9,7.7 13.3,8.137Q13.7,8.575 13.7,9.1Q13.7,9.6 13.4,10.037Q13.1,10.475 12.65,10.85Q11.55,11.825 11.3,12.325Q11.05,12.825 11.05,14.15ZM12,22Q9.925,22 8.1,21.212Q6.275,20.425 4.925,19.075Q3.575,17.725 2.788,15.9Q2,14.075 2,12Q2,9.925 2.788,8.1Q3.575,6.275 4.925,4.925Q6.275,3.575 8.1,2.787Q9.925,2 12,2Q14.075,2 15.9,2.787Q17.725,3.575 19.075,4.925Q20.425,6.275 21.212,8.1Q22,9.925 22,12Q22,14.075 21.212,15.9Q20.425,17.725 19.075,19.075Q17.725,20.425 15.9,21.212Q14.075,22 12,22ZM12,20Q15.35,20 17.675,17.675Q20,15.35 20,12Q20,8.65 17.675,6.325Q15.35,4 12,4Q8.65,4 6.325,6.325Q4,8.65 4,12Q4,15.35 6.325,17.675Q8.65,20 12,20ZM12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Z" /> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:tint="?attr/colorControlNormal" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M4,21V19H16V21ZM9.65,16.15 L4,10.5 6.1,8.35 11.8,14ZM16,9.8 L10.35,4.1 12.5,2 18.15,7.65ZM20.6,20 L7.55,6.95 8.95,5.55 22,18.6Z" /> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="?attr/colorSurface" | ||
android:orientation="vertical" | ||
android:transitionGroup="true" | ||
tools:context=".settings.preference.AboutFragment"> | ||
|
||
<com.etb.filemanager.ui.widget.AppBarLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:id="@+id/about_appbar" | ||
app:liftOnScroll="true"> | ||
|
||
<com.google.android.material.appbar.MaterialToolbar | ||
android:id="@+id/about_toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:navigationIcon="@drawable/ic_back_24" | ||
app:title="@string/about" /> | ||
|
||
</com.etb.filemanager.ui.widget.AppBarLayout> | ||
|
||
<androidx.core.widget.NestedScrollView | ||
android:id="@+id/about_contents" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:clipToPadding="false" | ||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_margin="@dimen/spacing_medium" | ||
android:orientation="vertical"> | ||
|
||
<com.google.android.material.card.MaterialCardView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:paddingBottom="@dimen/spacing_tiny" | ||
android:layout_height="match_parent"> | ||
|
||
<ImageView | ||
android:id="@+id/about_manager_icon" | ||
android:layout_width="48dp" | ||
android:layout_height="48dp" | ||
android:layout_marginTop="@dimen/spacing_medium" | ||
android:src="@mipmap/ic_launcher" | ||
app:layout_constraintEnd_toStartOf="@+id/about_app_name" | ||
app:layout_constraintHorizontal_chainStyle="packed" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/about_app_name" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="@dimen/spacing_medium" | ||
android:text="@string/app_name" | ||
android:textAppearance="@style/TextAppearance.Material3.TitleLarge" | ||
app:layout_constraintBottom_toBottomOf="@+id/about_manager_icon" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toEndOf="@+id/about_manager_icon" | ||
app:layout_constraintTop_toTopOf="@+id/about_manager_icon" /> | ||
|
||
<TextView | ||
android:id="@+id/about_desc" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="@dimen/spacing_small" | ||
android:gravity="center" | ||
android:paddingStart="@dimen/spacing_medium" | ||
android:paddingEnd="@dimen/spacing_medium" | ||
android:text="@string/info_app_desc" | ||
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/about_manager_icon" /> | ||
|
||
|
||
<ImageView | ||
android:id="@+id/about_version_icon" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="@dimen/spacing_medium" | ||
android:src="@drawable/ic_about_24" | ||
app:layout_constraintBottom_toBottomOf="@+id/about_version" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="@+id/about_version_title" /> | ||
|
||
<TextView | ||
android:id="@+id/about_version_title" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="@dimen/spacing_medium" | ||
android:layout_marginTop="@dimen/spacing_mid_medium" | ||
android:text="@string/mn_version" | ||
android:textAppearance="@style/TextAppearance.Material3.BodyLarge" | ||
app:layout_constraintBottom_toTopOf="@+id/about_version" | ||
app:layout_constraintStart_toEndOf="@+id/about_version_icon" | ||
app:layout_constraintTop_toBottomOf="@+id/about_desc" /> | ||
|
||
<TextView | ||
android:id="@+id/about_version" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="@dimen/spacing_medium" | ||
android:textAppearance="@style/TextAppearance.Material3.BodySmall" | ||
app:layout_constraintStart_toStartOf="@+id/about_version_title" | ||
app:layout_constraintTop_toBottomOf="@+id/about_version_title" | ||
tools:text="1.0.1" /> | ||
|
||
<TextView | ||
android:id="@+id/about_code" | ||
style="@style/Widget.Manager.TextView.Icon.Clickable" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="@dimen/spacing_mid_medium" | ||
android:text="@string/mn_code" | ||
app:drawableStartCompat="@drawable/ic_code_24" | ||
app:layout_constraintBottom_toTopOf="@+id/about_licenses" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/about_version" /> | ||
|
||
|
||
<TextView | ||
android:id="@+id/about_licenses" | ||
style="@style/Widget.Manager.TextView.Icon.Clickable" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="@string/mn_licenses" | ||
app:drawableStartCompat="@drawable/ic_license_24" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/about_code" /> | ||
|
||
<TextView | ||
android:id="@+id/about_author" | ||
style="@style/Widget.Manager.TextView.Icon.Clickable" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="@string/mn_author" | ||
app:drawableStartCompat="@drawable/ic_author_24" | ||
app:drawableTint="?attr/colorControlNormal" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/about_licenses" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</com.google.android.material.card.MaterialCardView> | ||
|
||
</LinearLayout> | ||
</androidx.core.widget.NestedScrollView> | ||
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
plugins { | ||
id 'com.android.application' version '7.4.1' apply false | ||
id 'com.android.library' version '7.4.1' apply false | ||
id 'com.android.application' version '8.0.2' apply false | ||
id 'com.android.library' version '8.0.2' apply false | ||
id 'org.jetbrains.kotlin.android' version '1.8.21' apply false | ||
} |