forked from armorycodes/android-research-tech-deprecated
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6035def
commit 133fc4c
Showing
15 changed files
with
273 additions
and
16 deletions.
There are no files selected for viewing
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.frogobox.research | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import android.os.Build | ||
import java.util.* | ||
|
||
/** | ||
* Created by Faisal Amir on 24/10/22 | ||
* ----------------------------------------- | ||
* E-mail : [email protected] | ||
* Github : github.com/amirisback | ||
* ----------------------------------------- | ||
* Copyright (C) Frogobox ID / amirisback | ||
* All rights reserved | ||
*/ | ||
|
||
class MainApp : Application() { | ||
|
||
companion object { | ||
val TAG: String = MainApp::class.java.simpleName | ||
|
||
lateinit var instance: MainApp | ||
|
||
fun getContext(): Context = instance.applicationContext | ||
|
||
fun getCurrentLocale(): Locale? { | ||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | ||
instance.resources.configuration.locales[0] | ||
} else { | ||
instance.resources.configuration.locale | ||
} | ||
} | ||
|
||
} | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
instance = this | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/frogobox/research/core/BaseActivity.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,17 @@ | ||
package com.frogobox.research.core | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
/** | ||
* Created by Faisal Amir on 24/10/22 | ||
* ----------------------------------------- | ||
* E-mail : [email protected] | ||
* Github : github.com/amirisback | ||
* ----------------------------------------- | ||
* Copyright (C) Frogobox ID / amirisback | ||
* All rights reserved | ||
*/ | ||
|
||
abstract class BaseActivity : AppCompatActivity() { | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
app/src/main/java/com/frogobox/research/core/BaseBindActivity.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,30 @@ | ||
package com.frogobox.research.core | ||
|
||
import android.os.Bundle | ||
import androidx.viewbinding.ViewBinding | ||
|
||
/** | ||
* Created by Faisal Amir on 24/10/22 | ||
* ----------------------------------------- | ||
* E-mail : [email protected] | ||
* Github : github.com/amirisback | ||
* ----------------------------------------- | ||
* Copyright (C) Frogobox ID / amirisback | ||
* All rights reserved | ||
*/ | ||
|
||
abstract class BaseBindActivity<VB: ViewBinding> : BaseActivity() { | ||
|
||
protected val binding: VB by lazy { initBinding() } | ||
|
||
abstract fun initBinding(): VB | ||
|
||
open fun initView() {} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(binding.root) | ||
initView() | ||
} | ||
|
||
} |
50 changes: 50 additions & 0 deletions
50
app/src/main/java/com/frogobox/research/core/BaseBindFragment.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,50 @@ | ||
package com.frogobox.research.core | ||
|
||
import android.os.Bundle | ||
import android.util.Log | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.viewbinding.ViewBinding | ||
|
||
/** | ||
* Created by Faisal Amir on 24/10/22 | ||
* ----------------------------------------- | ||
* E-mail : [email protected] | ||
* Github : github.com/amirisback | ||
* ----------------------------------------- | ||
* Copyright (C) Frogobox ID / amirisback | ||
* All rights reserved | ||
*/ | ||
|
||
abstract class BaseBindFragment<VB : ViewBinding> : BaseFragment() { | ||
|
||
companion object { | ||
val TAG: String = BaseBindFragment::class.java.simpleName | ||
} | ||
|
||
private var _binding: VB? = null | ||
|
||
protected val binding: VB get() = _binding!! | ||
|
||
abstract fun setupViewBinding(inflater: LayoutInflater, container: ViewGroup?): VB | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
_binding = setupViewBinding(inflater, container) | ||
if (savedInstanceState == null) { | ||
Log.d(TAG,"View Binding : ${binding::class.java.simpleName}") | ||
} | ||
return binding.root | ||
} | ||
|
||
override fun onDestroy() { | ||
super.onDestroy() | ||
_binding = null | ||
Log.d(TAG,"Destroying View Binding") | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/frogobox/research/core/BaseFragment.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,17 @@ | ||
package com.frogobox.research.core | ||
|
||
import androidx.fragment.app.Fragment | ||
|
||
/** | ||
* Created by Faisal Amir on 24/10/22 | ||
* ----------------------------------------- | ||
* E-mail : [email protected] | ||
* Github : github.com/amirisback | ||
* ----------------------------------------- | ||
* Copyright (C) Frogobox ID / amirisback | ||
* All rights reserved | ||
*/ | ||
|
||
abstract class BaseFragment : Fragment() { | ||
|
||
} |
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,18 @@ | ||
package com.frogobox.research.ext | ||
|
||
import android.content.Context | ||
import android.widget.Toast | ||
|
||
/** | ||
* Created by Faisal Amir on 24/10/22 | ||
* ----------------------------------------- | ||
* E-mail : [email protected] | ||
* Github : github.com/amirisback | ||
* ----------------------------------------- | ||
* Copyright (C) Frogobox ID / amirisback | ||
* All rights reserved | ||
*/ | ||
|
||
fun Context.showToast(message: String) { | ||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show() | ||
} |
29 changes: 29 additions & 0 deletions
29
app/src/main/java/com/frogobox/research/ui/DetailActivity.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,29 @@ | ||
package com.frogobox.research.ui | ||
|
||
import android.os.Bundle | ||
import com.frogobox.research.core.BaseBindActivity | ||
import com.frogobox.research.databinding.ActivityDetailBinding | ||
|
||
class DetailActivity : BaseBindActivity<ActivityDetailBinding>() { | ||
|
||
companion object { | ||
private val TAG: String = DetailActivity::class.java.simpleName | ||
} | ||
|
||
override fun initBinding(): ActivityDetailBinding { | ||
return ActivityDetailBinding.inflate(layoutInflater) | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
// TODO : Add your code here | ||
|
||
} | ||
|
||
override fun initView() { | ||
binding.apply { | ||
|
||
} | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
app/src/main/java/com/frogobox/research/ui/MainActivity.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,29 @@ | ||
package com.frogobox.research.ui | ||
|
||
import android.os.Bundle | ||
import com.frogobox.research.core.BaseBindActivity | ||
import com.frogobox.research.databinding.ActivityMainBinding | ||
|
||
class MainActivity : BaseBindActivity<ActivityMainBinding>() { | ||
|
||
companion object { | ||
private val TAG: String = MainActivity::class.java.simpleName | ||
} | ||
|
||
override fun initBinding(): ActivityMainBinding { | ||
return ActivityMainBinding.inflate(layoutInflater) | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
// TODO : Add your code here | ||
|
||
} | ||
|
||
override fun initView() { | ||
binding.apply { | ||
|
||
} | ||
} | ||
|
||
} |
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,19 @@ | ||
package com.frogobox.research.util | ||
|
||
/** | ||
* Created by Faisal Amir on 24/10/22 | ||
* ----------------------------------------- | ||
* E-mail : [email protected] | ||
* Github : github.com/amirisback | ||
* ----------------------------------------- | ||
* Copyright (C) Frogobox ID / amirisback | ||
* All rights reserved | ||
*/ | ||
|
||
object Constant { | ||
|
||
object Extra { | ||
const val EXTRA_DATA = "EXTRA_DATA" | ||
} | ||
|
||
} |
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,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent" | ||
tools:context=".ui.DetailActivity"> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
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