Bump minSDK to 21

This commit is contained in:
Phillip Thelen 2019-02-27 16:24:59 +01:00
parent 67c6d5675e
commit b9de152514
15 changed files with 63 additions and 59 deletions

View file

@ -45,8 +45,8 @@ repositories {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//Networking
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
implementation 'com.squareup.okhttp3:okhttp:3.13.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.13.1'
//REST API handling
implementation('com.squareup.retrofit2:retrofit:2.5.0') {
exclude module: 'okhttp'
@ -58,12 +58,12 @@ dependencies {
transitive = true
}
//Dependency Injection
implementation 'com.google.dagger:dagger:2.17'
kapt 'com.google.dagger:dagger-compiler:2.17'
implementation 'com.google.dagger:dagger:2.21'
kapt 'com.google.dagger:dagger-compiler:2.21'
compileOnly 'javax.annotation:javax.annotation-api:1.3.1'
//App Compatibility and Material Design
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.1.0-alpha02'
implementation 'com.google.android.material:material:1.1.0-alpha03'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
//QR Code
@ -89,7 +89,7 @@ dependencies {
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
//RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
//Analytics
implementation 'com.amplitude:android-sdk:2.18.1'
implementation 'com.instabug.library:instabug:8.0.11'
@ -131,8 +131,8 @@ dependencies {
implementation 'androidx.core:core-ktx:1.0.1'
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
kapt "androidx.lifecycle:lifecycle-compiler:2.0.0"
implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha09'
implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-alpha09'
implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-beta02'
implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-beta02'
implementation 'com.plattysoft.leonids:LeonidsLib:1.3.2'
}
@ -141,7 +141,7 @@ android {
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 16
minSdkVersion 21
applicationId "com.habitrpg.android.habitica"
vectorDrawables.useSupportLibrary = true
buildConfigField "String", "STORE", "\"google\""

View file

@ -2,10 +2,10 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_medium"
android:layout_marginBottom="@dimen/spacing_medium"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large">
android:paddingTop="@dimen/spacing_medium"
android:paddingBottom="@dimen/spacing_medium"
android:paddingStart="@dimen/spacing_large"
android:paddingEnd="@dimen/spacing_large">
<com.habitrpg.android.habitica.ui.views.social.UsernameLabel
android:id="@+id/display_name_view"
android:layout_width="match_parent"

View file

@ -82,7 +82,7 @@ class AboutActivity : BaseActivity() {
private inner class PagerAdapter(fm: androidx.fragment.app.FragmentManager, internal var mNumOfTabs: Int) : FragmentStatePagerAdapter(fm) {
override fun getItem(position: Int): androidx.fragment.app.Fragment? {
override fun getItem(position: Int): androidx.fragment.app.Fragment {
return when (position) {
0 -> AboutFragment()
1 -> LibsBuilder()
@ -96,7 +96,7 @@ class AboutActivity : BaseActivity() {
.withAboutVersionShownCode(true)
.withAboutVersionShownName(true)
.supportFragment()
else -> null
else -> Fragment()
}
}

View file

@ -45,7 +45,7 @@ abstract class BaseMainFragment : BaseFragment() {
this.user = user
}
override fun onAttach(context: Context?) {
override fun onAttach(context: Context) {
super.onAttach(context)
if (getActivity()?.javaClass == MainActivity::class.java) {

View file

@ -114,7 +114,7 @@ class ItemRecyclerFragment : BaseFragment() {
when {
this.isHatching -> {
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog?.requestWindowFeature(Window.FEATURE_NO_TITLE)
this.titleView?.text = getString(R.string.hatch_with, this.hatchingItem?.text)
this.titleView?.visibility = View.VISIBLE
this.footerView?.text = getString(R.string.hatching_market_info)
@ -122,7 +122,7 @@ class ItemRecyclerFragment : BaseFragment() {
this.openMarketButton?.visibility = View.VISIBLE
}
this.isFeeding -> {
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog?.requestWindowFeature(Window.FEATURE_NO_TITLE)
this.titleView?.text = getString(R.string.dialog_feeding, this.feedingPet?.colorText, this.feedingPet?.animalText)
this.titleView?.visibility = View.VISIBLE
this.footerView?.text = getString(R.string.feeding_market_info)
@ -147,11 +147,11 @@ class ItemRecyclerFragment : BaseFragment() {
}
override fun onResume() {
if ((this.isHatching || this.isFeeding) && dialog.window != null) {
val params = dialog.window?.attributes
if ((this.isHatching || this.isFeeding) && dialog?.window != null) {
val params = dialog?.window?.attributes
params?.width = ViewGroup.LayoutParams.MATCH_PARENT
params?.verticalMargin = 60f
dialog.window?.attributes = params
dialog?.window?.attributes = params
}
super.onResume()

View file

@ -119,7 +119,7 @@ class PetDetailRecyclerFragment : BaseMainFragment() {
fragment.isHatching = false
fragment.itemType = "food"
fragment.itemTypeText = getString(R.string.food)
fragment.show(fragmentManager, "feedDialog")
fragmentManager?.let { fragment.show(it, "feedDialog") }
}
}

View file

@ -222,13 +222,17 @@ class PreferencesFragment : BasePreferencesFragment(), SharedPreferences.OnShare
if (preference is TimePreference) {
if (preference.getKey() == "cds_time") {
if (fragmentManager?.findFragmentByTag(DayStartPreferenceDialogFragment.TAG) == null) {
DayStartPreferenceDialogFragment.newInstance(this, preference.getKey())
.show(fragmentManager, DayStartPreferenceDialogFragment.TAG)
fragmentManager?.let {
DayStartPreferenceDialogFragment.newInstance(this, preference.getKey())
.show(it, DayStartPreferenceDialogFragment.TAG)
}
}
} else {
if (fragmentManager?.findFragmentByTag(TimePreferenceDialogFragment.TAG) == null) {
TimePreferenceDialogFragment.newInstance(this, preference.getKey())
.show(fragmentManager, TimePreferenceDialogFragment.TAG)
fragmentManager?.let {
TimePreferenceDialogFragment.newInstance(this, preference.getKey())
.show(it, TimePreferenceDialogFragment.TAG)
}
}
}
} else {

View file

@ -78,7 +78,7 @@ class GuildFragment : BaseMainFragment() {
}
}
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
if (this.activity != null && this.guild != null) {
if (this.isMember) {
if (this.user != null && this.user?.id == this.guild?.leaderID) {
@ -94,8 +94,8 @@ class GuildFragment : BaseMainFragment() {
}
@Suppress("ReturnCount")
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
val id = item?.itemId
override fun onOptionsItemSelected(item: MenuItem): Boolean {
val id = item.itemId
when (id) {
R.id.menu_guild_join -> {
@ -124,7 +124,7 @@ class GuildFragment : BaseMainFragment() {
viewPager?.adapter = object : FragmentPagerAdapter(fragmentManager) {
override fun getItem(position: Int): androidx.fragment.app.Fragment? {
override fun getItem(position: Int): androidx.fragment.app.Fragment {
val fragment: androidx.fragment.app.Fragment?
@ -141,7 +141,7 @@ class GuildFragment : BaseMainFragment() {
else -> fragment = Fragment()
}
return fragment
return fragment ?: Fragment()
}
override fun getCount(): Int {

View file

@ -65,13 +65,13 @@ class InboxFragment : BaseMainFragment(), androidx.swiperefreshlayout.widget.Swi
super.onDestroy()
}
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
//this.activity?.menuInflater?.inflate(R.menu.inbox, menu)
super.onCreateOptionsMenu(menu, inflater)
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
val id = item?.itemId
override fun onOptionsItemSelected(item: MenuItem): Boolean {
val id = item.itemId
when (id) {
R.id.send_message -> {

View file

@ -82,7 +82,7 @@ class InboxMessageListFragment : BaseMainFragment(), androidx.swiperefreshlayout
communityGuidelinesView.visibility = View.GONE
}
override fun onAttach(context: Context?) {
override fun onAttach(context: Context) {
view?.invalidate()
view?.forceLayout()

View file

@ -68,8 +68,8 @@ class PublicGuildsFragment : BaseMainFragment(), SearchView.OnQueryTextListener
compositeSubscription.add(this.socialRepository.retrieveGroups("publicGuilds").subscribe(Consumer { }, RxErrorHandler.handleEmptyError()))
}
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
inflater?.inflate(R.menu.menu_public_guild, menu)
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.menu_public_guild, menu)
val searchItem = menu?.findItem(R.id.action_guild_search)
val guildSearchView = searchItem?.actionView as? SearchView

View file

@ -145,23 +145,23 @@ class ChallengeDetailFragment: BaseMainFragment() {
}, RxErrorHandler.handleEmptyError()))
}
joinButton?.setOnClickListener { _ -> challenge.notNull { challenge -> challengeRepository.joinChallenge(challenge).subscribe(Consumer {}, RxErrorHandler.handleEmptyError()) } }
joinButton?.setOnClickListener { challenge.notNull { challenge -> challengeRepository.joinChallenge(challenge).subscribe(Consumer {}, RxErrorHandler.handleEmptyError()) } }
leaveButton?.setOnClickListener { showChallengeLeaveDialog() }
refresh()
}
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
if (!isCreator) {
return
}
inflater?.inflate(R.menu.menu_challenge_details, menu)
val editMenuItem = menu?.findItem(R.id.action_edit)
inflater.inflate(R.menu.menu_challenge_details, menu)
val editMenuItem = menu.findItem(R.id.action_edit)
editMenuItem?.isVisible = isCreator
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
if (item?.itemId == R.id.action_edit) {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == R.id.action_edit) {
val intent = Intent(getActivity(), ChallengeFormActivity::class.java)
val bundle = Bundle()
bundle.putString(ChallengeFormActivity.CHALLENGE_ID_KEY, challengeID)

View file

@ -61,11 +61,11 @@ class ChallengesOverviewFragment : BaseMainFragment() {
}
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
inflater?.inflate(R.menu.menu_list_challenges, menu)
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.menu_list_challenges, menu)
@Suppress("Deprecation")
val badgeLayout = MenuItemCompat.getActionView(menu?.findItem(R.id.action_search)) as? RelativeLayout
val badgeLayout = MenuItemCompat.getActionView(menu.findItem(R.id.action_search)) as? RelativeLayout
if (badgeLayout != null) {
val filterCountTextView = badgeLayout.findViewById<TextView>(R.id.badge_textview)
filterCountTextView.text = null
@ -75,11 +75,11 @@ class ChallengesOverviewFragment : BaseMainFragment() {
}
@Suppress("ReturnCount")
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
val id = item?.itemId
val id = item.itemId
when (id) {
R.id.action_create_challenge -> {
@ -113,12 +113,12 @@ class ChallengesOverviewFragment : BaseMainFragment() {
statePagerAdapter = object : FragmentStatePagerAdapter(fragmentManager) {
override fun getItem(position: Int): androidx.fragment.app.Fragment? {
override fun getItem(position: Int): androidx.fragment.app.Fragment {
return if (position == 0) {
userChallengesFragment
} else {
availableChallengesFragment
}
} ?: Fragment()
}
override fun getCount(): Int {

View file

@ -188,7 +188,7 @@ class PartyDetailFragment constructor(private val viewModel: PartyViewModel) : B
val fragment = ItemRecyclerFragment()
fragment.itemType = "quests"
fragment.itemTypeText = getString(R.string.quest)
fragment.show(fragmentManager, "questDialog")
fragmentManager?.let { fragment.show(it, "questDialog") }
}
private fun leaveParty() {

View file

@ -97,20 +97,20 @@ class PartyFragment : BaseMainFragment() {
this.activity?.invalidateOptionsMenu()
}
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
val group = viewModel.getGroupData().value
if (group != null && this.user != null) {
if (group.leaderID == this.user?.id) {
inflater?.inflate(R.menu.menu_party_admin, menu)
inflater.inflate(R.menu.menu_party_admin, menu)
} else {
inflater?.inflate(R.menu.menu_party, menu)
inflater.inflate(R.menu.menu_party, menu)
}
}
}
@Suppress("ReturnCount")
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
val id = item?.itemId
override fun onOptionsItemSelected(item: MenuItem): Boolean {
val id = item.itemId
when (id) {
R.id.menu_invite_item -> {
@ -198,7 +198,7 @@ class PartyFragment : BaseMainFragment() {
viewPagerAdapter = object : FragmentPagerAdapter(fragmentManager) {
override fun getItem(position: Int): androidx.fragment.app.Fragment? {
override fun getItem(position: Int): androidx.fragment.app.Fragment {
return when (position) {
0 -> {
if (user?.hasParty() == true) {
@ -212,7 +212,7 @@ class PartyFragment : BaseMainFragment() {
if (chatFragment == null) {
chatFragment = ChatFragment(viewModel)
}
chatFragment
chatFragment ?: Fragment()
}
2 -> {
if (partyMemberListFragment == null) {
@ -221,7 +221,7 @@ class PartyFragment : BaseMainFragment() {
partyMemberListFragment?.setPartyId(user?.party?.id ?: "")
}
}
partyMemberListFragment
partyMemberListFragment ?: Fragment()
}
else -> Fragment()
}