Skip to content

Commit

Permalink
Update 2.0_r1.
Browse files Browse the repository at this point in the history
  • Loading branch information
D4rK7355608 committed Sep 22, 2022
1 parent d749516 commit 4ec6157
Show file tree
Hide file tree
Showing 142 changed files with 1,815 additions and 956 deletions.
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Version 2.0_r1:
- Added support for per-app languages (Android 13+);
- Added Romanian language support;
- Added Hindi language support;
- Added Italian language support;
- Added Indonesian language support;
- Added French language support;
- Added Russian language support;
- Added Japanese language support;
- Fixed about activity on split screen mode;
- Fixed feedback activity on split screen mode;
- Minor code cleanup;
- UI tweaks;
- Under the hood improvements.

# Version 1.4_r1:
- Added WebView lesson;
- Added Password Box lesson;
Expand Down
36 changes: 21 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,28 @@ plugins {
}
android {
compileSdk 33
def tagName = '1.4_r1'
def tagName = '2.0_r1'
defaultConfig {
applicationId "com.d4rk.androidtutorials"
minSdk 26
targetSdk 33
versionCode 14
versionCode 16
versionName tagName
multiDexEnabled true
archivesBaseName = "com.d4rk.androidtutorials-v${versionName}"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "VERSION_NAME", "\"${tagName}\""
}
buildTypes {
release {
multiDexEnabled true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
shrinkResources true
multiDexEnabled true
debuggable true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Expand All @@ -43,29 +44,34 @@ android {
viewBinding true
buildConfig true
}
bundle {
storeArchive {
enable = false
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.12'
implementation 'com.google.firebase:firebase-analytics-ktx:21.1.0'
implementation 'com.google.firebase:firebase-perf:20.1.0'
implementation 'com.google.android.gms:play-services-ads:21.1.0'
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.13'
implementation 'com.google.firebase:firebase-analytics-ktx:21.1.1'
implementation 'com.google.firebase:firebase-perf:20.1.1'
implementation 'com.google.android.gms:play-services-ads:21.2.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
implementation 'com.google.android.play:review-ktx:2.0.0'
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.5.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.core:core-splashscreen:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-process:2.5.1'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.5.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.1'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
implementation "androidx.lifecycle:lifecycle-process:2.5.1"
implementation "androidx.lifecycle:lifecycle-common-java8:2.5.1"
implementation 'com.airbnb.android:lottie:5.2.0'
implementation 'com.github.KieronQuinn:MonetCompat:0.4.1'
implementation 'me.zhanghai.android.fastscroll:library:1.1.8'
Expand Down
9 changes: 8 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile
-keep public class com.google.android.gms.ads.** {
public *;
}

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

This file was deleted.

30 changes: 12 additions & 18 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
Expand All @@ -13,26 +12,18 @@
</queries>
<application
android:name=".ads.Ads"
android:appCategory="productivity"
android:label="@string/app_name"
android:description="@string/app_description"
android:banner="@drawable/banner"
android:logo="@mipmap/ic_launcher"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:resizeableActivity="true"
android:logo="@drawable/ic_launcher_foreground"
android:supportsRtl="true"
android:theme="@style/AppThemeActionBar">
<activity
android:name=".ui.language.LanguageActivity"
android:label="@string/language"
android:screenOrientation="portrait"
android:exported="false"
tools:ignore="LockedOrientationActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.language.LanguageActivity"/>
</activity>
android:resizeableActivity="true"
android:enableOnBackInvokedCallback="true"
android:appCategory="productivity"
android:theme="@style/AppThemeActionBar"
android:localeConfig="@xml/locales_config"
tools:targetApi="33">
<activity
android:name=".ui.android.toggle.ToggleCodeActivity"
android:exported="false"
Expand Down Expand Up @@ -89,7 +80,6 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.android.webview.WebViewCodeActivity"/>
</activity>

<activity
android:name=".ui.android.passwordbox.PasswordBoxActivity"
android:exported="false"
Expand Down Expand Up @@ -233,6 +223,7 @@
android:exported="true"
android:theme="@style/Theme.App.Starting">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
Expand All @@ -246,5 +237,8 @@
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-5294151573817700~4228267194"/>
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true"/>
</application>
</manifest>
11 changes: 2 additions & 9 deletions app/src/main/kotlin/com/d4rk/androidtutorials/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
import androidx.preference.PreferenceManager
import com.d4rk.androidtutorials.ads.Ads
import com.google.firebase.FirebaseApp
import com.d4rk.androidtutorials.databinding.ActivityMainBinding
import com.google.firebase.FirebaseApp
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
FirebaseApp.initializeApp(this)
@Suppress("UNUSED_VARIABLE")
val splashScreen = installSplashScreen()
installSplashScreen()
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
val navController by lazy {
Expand All @@ -30,11 +28,6 @@ class MainActivity : AppCompatActivity() {
darkModeValues[2] -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
darkModeValues[3] -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY)
}
val application = application as? Ads ?: return
application.showAdIfAvailable(this, object : Ads.OnShowAdCompleteListener {
override fun onShowAdComplete() {
}
})
}
@Deprecated("Deprecated in Java", ReplaceWith("moveTaskToBack(true)"))
override fun onBackPressed() {
Expand Down
42 changes: 21 additions & 21 deletions app/src/main/kotlin/com/d4rk/androidtutorials/ads/Ads.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@file:Suppress("DEPRECATION")
package com.d4rk.androidtutorials.ads
import android.app.Activity
import android.app.Application
Expand All @@ -16,18 +15,17 @@ import com.google.android.gms.ads.MobileAds
import com.google.android.gms.ads.appopen.AppOpenAd
import com.google.android.gms.ads.appopen.AppOpenAd.AppOpenAdLoadCallback
import java.util.Date
private const val AD_UNIT_ID = "\n" + "ca-app-pub-5294151573817700/1738685282"
private const val AD_UNIT_ID = "ca-app-pub-5294151573817700/1738685282"
class Ads : Application(), Application.ActivityLifecycleCallbacks, LifecycleObserver {
private lateinit var appOpenAdManager: AppOpenAdManager
private var currentActivity: Activity? = null
override fun onCreate() {
super.onCreate()
registerActivityLifecycleCallbacks(this)
MobileAds.initialize(this) {}
MobileAds.initialize(this)
ProcessLifecycleOwner.get().lifecycle.addObserver(this)
appOpenAdManager = AppOpenAdManager()
}
@Suppress("SameParameterValue")
@OnLifecycleEvent(Lifecycle.Event.ON_START)
fun onMoveToForeground() {
currentActivity?.let { appOpenAdManager.showAdIfAvailable(it) }
Expand Down Expand Up @@ -77,7 +75,6 @@ class Ads : Application(), Application.ActivityLifecycleCallbacks, LifecycleObse
}
)
}
@Suppress("SameParameterValue")
private fun wasLoadTimeLessThanNHoursAgo(numHours: Long): Boolean {
val dateDifference: Long = Date().time - loadTime
val numMilliSecondsPerHour: Long = 3600000
Expand All @@ -92,7 +89,8 @@ class Ads : Application(), Application.ActivityLifecycleCallbacks, LifecycleObse
object : OnShowAdCompleteListener {
override fun onShowAdComplete() {
}
})
}
)
}
fun showAdIfAvailable(activity: Activity, onShowAdCompleteListener: OnShowAdCompleteListener) {
if (isShowingAd) {
Expand All @@ -103,22 +101,24 @@ class Ads : Application(), Application.ActivityLifecycleCallbacks, LifecycleObse
loadAd(activity)
return
}
appOpenAd!!.fullScreenContentCallback = object : FullScreenContentCallback() {
override fun onAdDismissedFullScreenContent() {
appOpenAd = null
isShowingAd = false
onShowAdCompleteListener.onShowAdComplete()
loadAd(activity)
}
override fun onAdFailedToShowFullScreenContent(adError: AdError) {
appOpenAd = null
isShowingAd = false
onShowAdCompleteListener.onShowAdComplete()
loadAd(activity)
}
override fun onAdShowedFullScreenContent() {
appOpenAd!!.setFullScreenContentCallback(
object : FullScreenContentCallback() {
override fun onAdDismissedFullScreenContent() {
appOpenAd = null
isShowingAd = false
onShowAdCompleteListener.onShowAdComplete()
loadAd(activity)
}
override fun onAdFailedToShowFullScreenContent(adError: AdError) {
appOpenAd = null
isShowingAd = false
onShowAdCompleteListener.onShowAdComplete()
loadAd(activity)
}
override fun onAdShowedFullScreenContent() {
}
}
}
)
isShowingAd = true
appOpenAd!!.show(activity)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,30 @@ import com.d4rk.androidtutorials.R
import com.d4rk.androidtutorials.databinding.FragmentAboutBinding
import com.d4rk.androidtutorials.ui.settings.SettingsActivity
import com.d4rk.androidtutorials.ui.viewmodel.ViewModel
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.MobileAds
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
class AboutFragment : Fragment(R.layout.fragment_about) {
import me.zhanghai.android.fastscroll.FastScrollerBuilder
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Locale
class AboutFragment : Fragment() {
private lateinit var _binding: FragmentAboutBinding
private val binding get() = _binding
private val calendar: Calendar = Calendar.getInstance()
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
ViewModelProvider(this)[ViewModel::class.java]
_binding = FragmentAboutBinding.inflate(inflater, container, false)
FastScrollerBuilder(binding.scrollView).useMd2Style().build()
MobileAds.initialize(requireContext())
val adRequestBuilder = AdRequest.Builder().build()
binding.adView.loadAd(adRequestBuilder)
val content = getString(R.string.app_version, BuildConfig.VERSION_NAME)
binding.itemSettingsMoreAboutVersion.text = content
val simpleDateFormat = SimpleDateFormat("yyyy", Locale.getDefault())
val dateText = simpleDateFormat.format(calendar.time)
val copyright = requireContext().getString(R.string.copyright, dateText)
binding.copyright.text = copyright
binding.itemSettingsMoreAboutSettings.setOnClickListener {
val intent = Intent (activity, SettingsActivity::class.java)
startActivity(intent)
Expand Down Expand Up @@ -49,8 +64,7 @@ class AboutFragment : Fragment(R.layout.fragment_about) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://forum.xda-developers.com/m/d4rk7355608.10095012"))
startActivity(intent)
}
binding.itemSettingsMoreAboutLibraries.setOnClickListener {
OssLicensesMenuActivity.setActivityTitle(getString(R.string.libraries))
binding.itemSettingsMoreAboutLicenses.setOnClickListener {
val intent = Intent(activity, OssLicensesMenuActivity::class.java)
startActivity(intent)
}
Expand Down
Loading

0 comments on commit 4ec6157

Please sign in to comment.