External storage permission is now only required below API level 26, added shadows to cards in notification sound picker and colour picker

This commit is contained in:
Deniz Düzgören
2019-08-31 16:56:00 +02:00
parent f139f28137
commit d4e69462b6
4 changed files with 44 additions and 36 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
<uses-permission android:name="android.permission.INTERNET" android:required="true"/> <uses-permission android:name="android.permission.INTERNET" android:required="true"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" android:required="true"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" android:required="true"/>
<uses-permission android:name="android.permission.WAKE_LOCK" android:required="true"/> <uses-permission android:name="android.permission.WAKE_LOCK" android:required="true"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="25"/>
<application <application
android:allowBackup="true" android:allowBackup="true"
@@ -6,7 +6,13 @@ import com.google.firebase.messaging.RemoteMessage
class FBNotificationService : FirebaseMessagingService() { class FBNotificationService : FirebaseMessagingService() {
override fun onMessageReceived(p0: RemoteMessage) { override fun onMessageReceived(p0: RemoteMessage) {
DataFetcher(isPlan = true, isMenu = true, isJobService = true, context = applicationContext, DataFetcher(
application = application, parentView = null).execute() isPlan = true,
isMenu = true,
isJobService = true,
context = applicationContext,
application = application,
parentView = null
).execute()
} }
} }
@@ -22,9 +22,8 @@ open class PlanFragment : Fragment(R.layout.plan) {
private lateinit var layoutManager: GridLayoutManager private lateinit var layoutManager: GridLayoutManager
var planCardList = ArrayList<Subst>() var planCardList = ArrayList<Subst>()
lateinit var substViewModel: SubstViewModel lateinit var substViewModel: SubstViewModel
lateinit var mContext: Context private lateinit var mContext: Context
lateinit var prefs: SharedPreferences lateinit var prefs: SharedPreferences
lateinit var edit: SharedPreferences.Editor
lateinit var smileydown: TextView lateinit var smileydown: TextView
lateinit var smileydowntext: TextView lateinit var smileydowntext: TextView
@@ -40,19 +39,7 @@ open class PlanFragment : Fragment(R.layout.plan) {
override fun onConfigurationChanged(newConfig: Configuration) { override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig) super.onConfigurationChanged(newConfig)
val tabletSize = resources.getBoolean(R.bool.isTablet) layoutManager = GridLayoutManager(mContext, getGridColumnCount(newConfig))
val grid = if (tabletSize) {
when (newConfig.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 2
else -> 3
}
} else {
when (newConfig.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 1
else -> 2
}
}
layoutManager = GridLayoutManager(mContext, grid)
recyclerView.layoutManager = layoutManager recyclerView.layoutManager = layoutManager
} }
@@ -62,21 +49,7 @@ open class PlanFragment : Fragment(R.layout.plan) {
recyclerView = view.findViewById(R.id.linearRecycler) recyclerView = view.findViewById(R.id.linearRecycler)
recyclerView.hasFixedSize() recyclerView.hasFixedSize()
layoutManager = GridLayoutManager(mContext, getGridColumnCount(resources.configuration))
val tabletSize = resources.getBoolean(R.bool.isTablet)
val grid = if (tabletSize) {
when (resources.configuration.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 2
else -> 3
}
} else {
when (resources.configuration.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 1
else -> 2
}
}
layoutManager = GridLayoutManager(mContext, grid)
recyclerView.layoutManager = layoutManager recyclerView.layoutManager = layoutManager
mAdapter = CardAdapter(planCardList) mAdapter = CardAdapter(planCardList)
@@ -92,13 +65,42 @@ open class PlanFragment : Fragment(R.layout.plan) {
if (prefs.getBoolean("autoRefresh", false)) { if (prefs.getBoolean("autoRefresh", false)) {
pullToRefresh.isRefreshing = true pullToRefresh.isRefreshing = true
DataFetcher(true, false, false, mContext, activity!!.application, view.rootView).execute() DataFetcher(
isPlan = true,
isMenu = false,
isJobService = false,
context = mContext,
application = activity!!.application,
parentView = view.rootView
).execute()
} }
substViewModel = ViewModelProviders.of(this).get(SubstViewModel::class.java) substViewModel = ViewModelProviders.of(this).get(SubstViewModel::class.java)
pullToRefresh.setOnRefreshListener { pullToRefresh.setOnRefreshListener {
pullToRefresh.isRefreshing = true pullToRefresh.isRefreshing = true
DataFetcher(true, false, false, mContext, activity!!.application, view.rootView).execute() DataFetcher(
isPlan = true,
isMenu = false,
isJobService = false,
context = mContext,
application = activity!!.application,
parentView = view.rootView
).execute()
}
}
private fun getGridColumnCount(config: Configuration): Int {
val tabletSize = resources.getBoolean(R.bool.isTablet)
return if (tabletSize) {
when (config.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 2
else -> 3
}
} else {
when (config.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 1
else -> 2
}
} }
} }
} }
+1 -1
View File
@@ -13,7 +13,7 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:layout_marginBottom="3dp" android:layout_marginBottom="3dp"
app:cardElevation="0dp"> app:cardElevation="2dp">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"