Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
App Lounge
Commits
160c1250
Commit
160c1250
authored
Apr 08, 2021
by
Aayush Gupta
Browse files
MainActivity: Provide a way to access the applicationContext via MainActivity
Signed-off-by:
Aayush Gupta
<
theimpulson@e.email
>
parent
70e22125
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/foundation/e/apps/MainActivity.kt
View file @
160c1250
...
...
@@ -70,11 +70,24 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
private
var
isReceiverRegistered
=
false
var
accentColorOS
=
0
init
{
instance
=
this
}
companion
object
{
private
var
instance
:
MainActivity
?
=
null
lateinit
var
mActivity
:
MainActivity
var
sharedPreferences
:
SharedPreferences
?=
null
val
sharedPrefFile
=
"kotlinsharedpreference"
/*
* Provides the application context via MainActivity
* @return applicationContext
*/
fun
applicationContext
():
Context
{
return
instance
!!
.
applicationContext
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment