Lint fixes (#19)

- Code inspection
 - Redundant resources removed
 - Resources moved the corresponding flavours
 - Deprecated dependencies upgraded
 - lint changes
 - circleci updated to capture screenshot
This commit is contained in:
2023-08-09 00:21:15 +01:00
committed by GitHub
parent baabebd40d
commit ce1d13e630
177 changed files with 1393 additions and 1265 deletions

View File

@@ -13,10 +13,9 @@
tools:node="merge">
<activity
android:name="com.appttude.h_mal.atlas_weather.ui.MainActivity"
android:label="@string/app_name"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/AppTheme.NoActionBar"
android:exported="true">
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
@@ -25,14 +24,16 @@
</intent-filter>
</activity>
<activity android:name="com.appttude.h_mal.monoWeather.ui.widget.WidgetLocationPermissionActivity"
<activity
android:name="com.appttude.h_mal.monoWeather.ui.widget.WidgetLocationPermissionActivity"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<receiver android:name="com.appttude.h_mal.atlas_weather.widget.NewAppWidget"
<receiver
android:name="com.appttude.h_mal.atlas_weather.widget.NewAppWidget"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />

View File

@@ -1,14 +1,10 @@
package com.appttude.h_mal.monoWeather.dialog
import android.content.Context
import android.content.res.Resources
import android.os.Build
import android.text.Html
import androidx.annotation.RequiresApi
import androidx.annotation.StringRes
import androidx.core.content.ContextCompat
interface DeclarationBuilder{
interface DeclarationBuilder {
val link: String
val message: String

View File

@@ -10,10 +10,11 @@ import androidx.appcompat.app.AlertDialog
class PermissionsDeclarationDialog(context: Context) : BaseDeclarationDialog(context) {
override val link: String = "https://sites.google.com/view/hmaldev/home/monochrome"
override val message: String = "Hi, thank you for downloading my app. Google play isn't letting me upload my app to the Playstore until I have a privacy declaration :(. My app is basically used to demonstrate my code=ing to potential employers and others. I do NOT store or process any information. The location permission in the app is there just to provide the end user with weather data."
override val message: String =
"Hi, thank you for downloading my app. Google play isn't letting me upload my app to the Playstore until I have a privacy declaration :(. My app is basically used to demonstrate my coding to potential employers and others. I do NOT store or process any information. The location permission in the app is there just to provide the end user with weather data."
}
abstract class BaseDeclarationDialog(val context: Context): DeclarationBuilder {
abstract class BaseDeclarationDialog(val context: Context) : DeclarationBuilder {
abstract override val link: String
abstract override val message: String
@@ -23,14 +24,14 @@ abstract class BaseDeclarationDialog(val context: Context): DeclarationBuilder {
val myMessage = buildMessage()
val builder = AlertDialog.Builder(context)
.setPositiveButton("agree") { _, _ ->
agreeCallback()
}
.setNegativeButton("disagree") { _, _ ->
disagreeCallback()
}
.setMessage(myMessage)
.setCancelable(false)
.setPositiveButton("agree") { _, _ ->
agreeCallback()
}
.setNegativeButton("disagree") { _, _ ->
disagreeCallback()
}
.setMessage(myMessage)
.setCancelable(false)
dialog = builder.create()
dialog.show()

View File

@@ -7,12 +7,12 @@ import androidx.annotation.DrawableRes
import androidx.recyclerview.widget.RecyclerView
import com.appttude.h_mal.atlas_weather.R
class EmptyViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){
class EmptyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val icon: ImageView = itemView.findViewById(R.id.icon)
var bodyTV: TextView = itemView.findViewById(R.id.body_text)
var headerTV: TextView = itemView.findViewById(R.id.header_text)
fun bindData(@DrawableRes imageRes: Int?,header: String, body: String){
fun bindData(@DrawableRes imageRes: Int?, header: String, body: String) {
imageRes?.let { icon.setImageResource(it) }
headerTV.text = header
bodyTV.text = body

View File

@@ -6,10 +6,12 @@ import android.view.View
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.monoWeather.ui.home.adapter.WeatherRecyclerAdapter
import com.appttude.h_mal.atlas_weather.utils.navigateTo
import com.appttude.h_mal.atlas_weather.viewmodel.WorldViewModel
import kotlinx.android.synthetic.main.fragment_home.*
import com.appttude.h_mal.monoWeather.ui.home.adapter.WeatherRecyclerAdapter
import kotlinx.android.synthetic.main.fragment_home.forecast_listview
import kotlinx.android.synthetic.main.fragment_home.progressBar
import kotlinx.android.synthetic.main.fragment_home.swipe_refresh
class WorldItemFragment : BaseFragment(R.layout.fragment_home) {
@@ -27,7 +29,7 @@ class WorldItemFragment : BaseFragment(R.layout.fragment_home) {
val recyclerAdapter = WeatherRecyclerAdapter {
val directions =
WorldItemFragmentDirections.actionWorldItemFragmentToFurtherDetailsFragment(it)
WorldItemFragmentDirections.actionWorldItemFragmentToFurtherDetailsFragment(it)
navigateTo(directions)
}

View File

@@ -23,7 +23,11 @@ class FurtherInfoFragment : Fragment() {
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.activity_further_info, container, false)
}
@@ -31,18 +35,20 @@ class FurtherInfoFragment : Fragment() {
super.onViewCreated(view, savedInstanceState)
maxtemp.text = param1?.mainTemp.appendWith(requireContext().getString(R.string.degrees))
averagetemp.text = param1?.averageTemp.appendWith(requireContext().getString(R.string.degrees))
minimumtemp.text = param1?.minorTemp.appendWith(requireContext().getString(R.string.degrees))
averagetemp.text =
param1?.averageTemp.appendWith(requireContext().getString(R.string.degrees))
minimumtemp.text =
param1?.minorTemp.appendWith(requireContext().getString(R.string.degrees))
windtext.text = param1?.windText.appendWith(" km")
preciptext.text = param1?.precipitation.appendWith(" %")
cloudtext.text = param1?.cloud.appendWith(" %")
cloudtext.text = param1?.cloud.appendWith(" %")
humiditytext.text = param1?.humidity.appendWith(" %")
uvtext.text = param1?.uvi
sunrisetext.text = param1?.sunrise
sunsettext.text = param1?.sunset
}
fun String?.appendWith(suffix: String): String?{
fun String?.appendWith(suffix: String): String? {
return this?.let {
StringBuilder().append(it).append(suffix).toString()
}

View File

@@ -13,11 +13,11 @@ import androidx.navigation.ui.onNavDestinationSelected
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.atlas_weather.application.LOCATION_PERMISSION_REQUEST
import com.appttude.h_mal.atlas_weather.model.forecast.Forecast
import com.appttude.h_mal.atlas_weather.utils.navigateTo
import com.appttude.h_mal.atlas_weather.viewmodel.MainViewModel
import com.appttude.h_mal.monoWeather.dialog.PermissionsDeclarationDialog
import com.appttude.h_mal.monoWeather.ui.BaseFragment
import com.appttude.h_mal.monoWeather.ui.home.adapter.WeatherRecyclerAdapter
import com.appttude.h_mal.atlas_weather.utils.navigateTo
import com.appttude.h_mal.atlas_weather.viewmodel.MainViewModel
import kotlinx.android.synthetic.main.fragment_home.*
@@ -81,9 +81,9 @@ class HomeFragment : BaseFragment(R.layout.fragment_home) {
viewModel.fetchData()
}
private fun navigateToFurtherDetails(forecast: Forecast){
private fun navigateToFurtherDetails(forecast: Forecast) {
val directions = HomeFragmentDirections
.actionHomeFragmentToFurtherDetailsFragment(forecast)
.actionHomeFragmentToFurtherDetailsFragment(forecast)
navigateTo(directions)
}

View File

@@ -16,7 +16,7 @@ class ViewHolderCurrent(listItemView: View) : RecyclerView.ViewHolder(listItemVi
var avgTempTV: TextView = listItemView.findViewById(R.id.temp_main_4)
var tempUnit: TextView = listItemView.findViewById(R.id.temp_unit_4)
fun bindData(weather: WeatherDisplay?){
fun bindData(weather: WeatherDisplay?) {
locationTV.text = weather?.displayName
conditionTV.text = weather?.description
weatherIV.loadImage(weather?.iconURL)

View File

@@ -5,40 +5,44 @@ import androidx.recyclerview.widget.RecyclerView
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.atlas_weather.model.forecast.Forecast
import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
import com.appttude.h_mal.atlas_weather.utils.generateView
import com.appttude.h_mal.monoWeather.ui.EmptyViewHolder
import com.appttude.h_mal.monoWeather.ui.home.adapter.forecast.ViewHolderForecast
import com.appttude.h_mal.monoWeather.ui.home.adapter.forecastDaily.ViewHolderForecastDaily
import com.appttude.h_mal.monoWeather.ui.home.adapter.further.ViewHolderFurtherDetails
import com.appttude.h_mal.atlas_weather.utils.generateView
class WeatherRecyclerAdapter(
private val itemClick: (Forecast) -> Unit
private val itemClick: (Forecast) -> Unit
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
var weather: WeatherDisplay? = null
fun addCurrent(current: WeatherDisplay){
fun addCurrent(current: WeatherDisplay) {
weather = current
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (getDataType(viewType)){
return when (getDataType(viewType)) {
is ViewType.Empty -> {
val emptyViewHolder = parent.generateView(R.layout.empty_state_layout)
EmptyViewHolder(emptyViewHolder)
}
is ViewType.Current -> {
val viewCurrent = parent.generateView(R.layout.mono_item_one)
ViewHolderCurrent(viewCurrent)
}
is ViewType.ForecastHourly -> {
val viewForecast = parent.generateView(R.layout.mono_item_forecast)
ViewHolderForecast(viewForecast)
}
is ViewType.Further -> {
val viewFurther = parent.generateView(R.layout.mono_item_two)
ViewHolderFurtherDetails(viewFurther)
}
is ViewType.ForecastDaily -> {
val viewForecast = parent.generateView(R.layout.list_item_forecast)
ViewHolderForecastDaily(viewForecast)
@@ -46,7 +50,7 @@ class WeatherRecyclerAdapter(
}
}
sealed class ViewType{
sealed class ViewType {
object Empty : ViewType()
object Current : ViewType()
object ForecastHourly : ViewType()
@@ -55,7 +59,7 @@ class WeatherRecyclerAdapter(
}
private fun getDataType(type: Int): ViewType {
return when (type){
return when (type) {
0 -> ViewType.Empty
1 -> ViewType.Current
2 -> ViewType.ForecastHourly
@@ -67,32 +71,36 @@ class WeatherRecyclerAdapter(
override fun getItemViewType(position: Int): Int {
if (weather == null) return 0
return when(position){
return when (position) {
0 -> 1
1 -> 3
2 -> 2
2 -> 2
in 3 until (itemCount) -> 4
else -> 0
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (getDataType(getItemViewType(position))){
when (getDataType(getItemViewType(position))) {
is ViewType.Empty -> {
holder as EmptyViewHolder
}
is ViewType.Current -> {
val viewHolderCurrent = holder as ViewHolderCurrent
viewHolderCurrent.bindData(weather)
}
is ViewType.Further -> {
val viewHolderCurrent = holder as ViewHolderFurtherDetails
viewHolderCurrent.bindData(weather)
}
is ViewType.ForecastHourly -> {
val viewHolderForecast = holder as ViewHolderForecast
viewHolderForecast.bindView(weather?.hourly)
}
is ViewType.ForecastDaily -> {
val viewHolderForecast = holder as ViewHolderForecastDaily
weather?.forecast?.getOrNull(position - 3)?.let { f ->

View File

@@ -6,10 +6,10 @@ import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.atlas_weather.model.weather.Hour
import com.appttude.h_mal.atlas_weather.utils.generateView
class GridForecastAdapter(): RecyclerView.Adapter<RecyclerView.ViewHolder>(){
class GridForecastAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
var weather: MutableList<Hour> = mutableListOf()
fun addCurrent(current: List<Hour>?){
fun addCurrent(current: List<Hour>?) {
weather.clear()
current?.let { weather.addAll(it) }
notifyDataSetChanged()

View File

@@ -6,7 +6,7 @@ import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.atlas_weather.model.weather.Hour
class ViewHolderForecast(
itemView: View
itemView: View
) : RecyclerView.ViewHolder(itemView) {
var recyclerView: RecyclerView = itemView.findViewById(R.id.forecast_recyclerview)

View File

@@ -6,13 +6,14 @@ import android.view.ViewGroup
import android.widget.ArrayAdapter
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.atlas_weather.utils.generateView
import kotlinx.android.synthetic.monoWeather.mono_item_two_cell.view.*
import kotlinx.android.synthetic.monoWeather.mono_item_two_cell.view.mono_item_cell
import kotlinx.android.synthetic.monoWeather.mono_item_two_cell.view.mono_text_cell
class GridAdapter(
context: Context,
list: List<Pair<Int, String>>
) : ArrayAdapter<Pair<Int, String>>(context, 0, list){
context: Context,
list: List<Pair<Int, String>>
) : ArrayAdapter<Pair<Int, String>>(context, 0, list) {
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val view = convertView ?: parent.generateView(R.layout.mono_item_two_cell)

View File

@@ -10,12 +10,14 @@ class ViewHolderFurtherDetails(itemView: View) : RecyclerView.ViewHolder(itemVie
var grid: GridView = itemView.findViewById(R.id.grid_mono)
fun bindData(weather: WeatherDisplay?){
grid.adapter = GridAdapter(itemView.context, listOf<Pair<Int, String>>(
Pair(R.drawable.breeze,"${weather?.windSpeed ?: "0"} km"),
Pair(R.drawable.water_drop,"${weather?.precipitation ?: "0"} %" ),
Pair(R.drawable.cloud_symbol,"${weather?.clouds ?: "0"} %" )
))
fun bindData(weather: WeatherDisplay?) {
grid.adapter = GridAdapter(
itemView.context, listOf<Pair<Int, String>>(
Pair(R.drawable.breeze, "${weather?.windSpeed ?: "0"} km"),
Pair(R.drawable.water_drop, "${weather?.precipitation ?: "0"} %"),
Pair(R.drawable.cloud_symbol, "${weather?.clouds ?: "0"} %")
)
)
}
}

View File

@@ -30,7 +30,12 @@ class SettingsFragment : PreferenceFragmentCompat() {
val intent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE)
val widgetManager = AppWidgetManager.getInstance(requireContext())
val ids =
widgetManager.getAppWidgetIds(ComponentName(requireContext(), NewAppWidget::class.java))
widgetManager.getAppWidgetIds(
ComponentName(
requireContext(),
NewAppWidget::class.java
)
)
AppWidgetManager.getInstance(requireContext())
.notifyAppWidgetViewDataChanged(ids, R.id.whole_widget_view)
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)

View File

@@ -2,7 +2,10 @@ package com.appttude.h_mal.monoWeather.ui.widget
import android.Manifest.permission.ACCESS_COARSE_LOCATION
import android.app.Activity
import android.appwidget.AppWidgetManager.*
import android.appwidget.AppWidgetManager.ACTION_APPWIDGET_UPDATE
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_IDS
import android.appwidget.AppWidgetManager.INVALID_APPWIDGET_ID
import android.content.Intent
import android.content.pm.PackageManager.PERMISSION_GRANTED
import android.os.Bundle
@@ -11,9 +14,10 @@ import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat.checkSelfPermission
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.monoWeather.dialog.DeclarationBuilder
import com.appttude.h_mal.atlas_weather.utils.displayToast
import kotlinx.android.synthetic.monoWeather.permissions_declaration_dialog.*
import com.appttude.h_mal.monoWeather.dialog.DeclarationBuilder
import kotlinx.android.synthetic.monoWeather.permissions_declaration_dialog.cancel
import kotlinx.android.synthetic.monoWeather.permissions_declaration_dialog.submit
const val PERMISSION_CODE = 401
@@ -60,7 +64,11 @@ class WidgetLocationPermissionActivity : AppCompatActivity(), DeclarationBuilder
cancel.setOnClickListener { finish() }
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == PERMISSION_CODE) {
if (grantResults.isNotEmpty() && grantResults[0] == PERMISSION_GRANTED) {
@@ -87,8 +95,9 @@ class WidgetLocationPermissionActivity : AppCompatActivity(), DeclarationBuilder
private fun sendUpdateIntent() {
// It is the responsibility of the configuration activity to update the app widget
// Send update broadcast to widget app class
Intent(this@WidgetLocationPermissionActivity,
WidgetLocationPermissionActivity::class.java
Intent(
this@WidgetLocationPermissionActivity,
WidgetLocationPermissionActivity::class.java
).apply {
action = ACTION_APPWIDGET_UPDATE

View File

@@ -4,24 +4,26 @@ import android.os.Bundle
import android.view.View
import androidx.lifecycle.observe
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.monoWeather.ui.BaseFragment
import com.appttude.h_mal.atlas_weather.utils.displayToast
import com.appttude.h_mal.atlas_weather.utils.goBack
import com.appttude.h_mal.atlas_weather.utils.hideKeyboard
import com.appttude.h_mal.atlas_weather.viewmodel.WorldViewModel
import kotlinx.android.synthetic.main.activity_add_forecast.*
import com.appttude.h_mal.monoWeather.ui.BaseFragment
import kotlinx.android.synthetic.main.activity_add_forecast.location_name_tv
import kotlinx.android.synthetic.main.activity_add_forecast.progressBar
import kotlinx.android.synthetic.main.activity_add_forecast.submit
class AddLocationFragment : BaseFragment(R.layout.activity_add_forecast) {
private val viewModel by getFragmentViewModel<WorldViewModel>()
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val viewModel by getFragmentViewModel<WorldViewModel>()
submit.setOnClickListener {
val locationName = location_name_tv.text?.trim()?.toString()
if (locationName.isNullOrBlank()){
if (locationName.isNullOrBlank()) {
location_name_tv.error = "Location cannot be blank"
return@setOnClickListener
}
@@ -37,7 +39,6 @@ class AddLocationFragment : BaseFragment(R.layout.activity_add_forecast) {
displayToast(message)
}
goBack()
}
}
}

View File

@@ -6,14 +6,14 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.observe
import androidx.recyclerview.widget.LinearLayoutManager
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.monoWeather.ui.BaseFragment
import com.appttude.h_mal.monoWeather.ui.world.WorldFragmentDirections.actionWorldFragmentToWorldItemFragment
import com.appttude.h_mal.atlas_weather.utils.navigateTo
import com.appttude.h_mal.atlas_weather.viewmodel.WorldViewModel
import com.appttude.h_mal.monoWeather.ui.BaseFragment
import com.appttude.h_mal.monoWeather.ui.world.WorldFragmentDirections.actionWorldFragmentToWorldItemFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.android.synthetic.main.fragment__two.*
import kotlinx.android.synthetic.main.fragment_add_location.floatingActionButton
import kotlinx.android.synthetic.main.fragment_add_location.world_recycler
import kotlinx.android.synthetic.main.fragment__two.floatingActionButton
import kotlinx.android.synthetic.main.fragment__two.progressBar
import kotlinx.android.synthetic.main.fragment__two.world_recycler
/**
@@ -34,18 +34,18 @@ class WorldFragment : BaseFragment(R.layout.fragment__two) {
val recyclerAdapter = WorldRecyclerAdapter({
val direction =
actionWorldFragmentToWorldItemFragment(it.location)
actionWorldFragmentToWorldItemFragment(it.location)
navigateTo(direction)
}){
}) {
MaterialAlertDialogBuilder(requireContext())
.setTitle("Delete weather?")
.setMessage("Are you sure want to delete $it?")
.setPositiveButton("Yes"){ _, _ ->
viewModel.deleteLocation(it)
}
.setNegativeButton("No", null)
.create()
.show()
.setTitle("Delete weather?")
.setMessage("Are you sure want to delete $it?")
.setPositiveButton("Yes") { _, _ ->
viewModel.deleteLocation(it)
}
.setNegativeButton("No", null)
.create()
.show()
}
world_recycler.apply {
@@ -57,7 +57,7 @@ class WorldFragment : BaseFragment(R.layout.fragment__two) {
recyclerAdapter.addCurrent(it)
}
floatingActionButton.setOnClickListener{
floatingActionButton.setOnClickListener {
navigateTo(R.id.action_worldFragment_to_addLocationFragment)
}

View File

@@ -7,28 +7,29 @@ import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
import com.appttude.h_mal.monoWeather.ui.EmptyViewHolder
import com.appttude.h_mal.atlas_weather.utils.generateView
import com.appttude.h_mal.atlas_weather.utils.loadImage
import com.appttude.h_mal.monoWeather.ui.EmptyViewHolder
class WorldRecyclerAdapter(
private val itemClick: (WeatherDisplay) -> Unit,
private val itemLongClick: (String) -> Unit
private val itemClick: (WeatherDisplay) -> Unit,
private val itemLongClick: (String) -> Unit
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
var weather: MutableList<WeatherDisplay> = mutableListOf()
fun addCurrent(current: List<WeatherDisplay>){
fun addCurrent(current: List<WeatherDisplay>) {
weather.clear()
weather.addAll(current)
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (getDataType(viewType)){
return when (getDataType(viewType)) {
is ViewType.Empty -> {
val emptyViewHolder = parent.generateView(R.layout.empty_state_layout)
EmptyViewHolder(emptyViewHolder)
}
is ViewType.Current -> {
val viewCurrent = parent.generateView(R.layout.db_list_item)
WorldHolderCurrent(viewCurrent)
@@ -36,13 +37,13 @@ class WorldRecyclerAdapter(
}
}
sealed class ViewType{
sealed class ViewType {
object Empty : ViewType()
object Current : ViewType()
}
private fun getDataType(type: Int): ViewType {
return when (type){
return when (type) {
0 -> ViewType.Empty
1 -> ViewType.Current
else -> ViewType.Empty
@@ -54,11 +55,12 @@ class WorldRecyclerAdapter(
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (getDataType(getItemViewType(position))){
when (getDataType(getItemViewType(position))) {
is ViewType.Empty -> {
holder as EmptyViewHolder
holder.bindData(null, "World List Empty", "Please add a location")
}
is ViewType.Current -> {
val viewHolderCurrent = holder as WorldHolderCurrent
val currentWeather = weather[position]
@@ -86,7 +88,7 @@ class WorldRecyclerAdapter(
private val avgTempTV: TextView = cellView.findViewById(R.id.db_main_temp)
private val tempUnit: TextView = cellView.findViewById(R.id.db_temp_unit)
override fun bindData(data: WeatherDisplay?){
override fun bindData(data: WeatherDisplay?) {
locationTV.text = data?.displayName
conditionTV.text = data?.description
weatherIV.loadImage(data?.iconURL)
@@ -95,7 +97,7 @@ class WorldRecyclerAdapter(
}
}
abstract class BaseViewHolder<T : Any>(cellView: View) : RecyclerView.ViewHolder(cellView) {
abstract fun bindData(data : T?)
abstract class BaseViewHolder<T : Any>(cellView: View) : RecyclerView.ViewHolder(cellView) {
abstract fun bindData(data: T?)
}
}

View File

@@ -1,15 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#FFFFFF">
<group android:scaleX="2.61"
android:scaleY="2.61"
android:translateX="22.68"
android:translateY="22.68">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM11,19.93c-3.95,-0.49 -7,-3.85 -7,-7.93 0,-0.62 0.08,-1.21 0.21,-1.79L9,15v1c0,1.1 0.9,2 2,2v1.93zM17.9,17.39c-0.26,-0.81 -1,-1.39 -1.9,-1.39h-1v-3c0,-0.55 -0.45,-1 -1,-1L8,12v-2h2c0.55,0 1,-0.45 1,-1L11,7h2c1.1,0 2,-0.9 2,-2v-0.41c2.93,1.19 5,4.06 5,7.41 0,2.08 -0.8,3.97 -2.1,5.39z"/>
</group>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@@ -2,11 +2,11 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginTop="6dp"
android:layout_marginRight="24dp"
android:layout_marginBottom="6dp"
android:layout_height="wrap_content">
android:layout_marginBottom="6dp">
<LinearLayout
@@ -18,6 +18,7 @@
android:id="@+id/db_icon"
android:layout_width="64dp"
android:layout_height="64dp"
android:contentDescription="@string/image_string"
tools:src="@drawable/cloud_symbol"
tools:tint="@color/colour_one" />
@@ -25,7 +26,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="15dp"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:orientation="vertical">
@@ -49,7 +50,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="4dp"
android:layout_marginEnd="4dp"
android:orientation="horizontal">
<TextView
@@ -65,7 +66,7 @@
android:id="@+id/db_temp_unit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="°" />
android:text="@string/degrees" />
</LinearLayout>

View File

@@ -23,6 +23,7 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:contentDescription="@string/image_string"
tools:src="@drawable/cloud_symbol"
tools:tint="@color/colour_one" />
@@ -31,6 +32,7 @@
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/widget_item_temp_high"
android:layout_width="wrap_content"
@@ -39,11 +41,12 @@
android:textSize="12sp"
android:textStyle="bold"
tools:text="20" />
<TextView
android:id="@+id/db_temp_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="°" />
android:text="@string/degrees" />
</LinearLayout>

View File

@@ -1,25 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<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="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginBottom="24dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
android:layout_marginBottom="24dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/forecast_recyclerview"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:listitem="@layout/widget_item"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:spanCount="1"
tools:itemCount="24"
app:spanCount="1"/>
tools:listitem="@layout/widget_item" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -14,13 +14,15 @@
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginRight="12dp"
android:tint="@color/colorAccent"
android:layout_marginEnd="12dp"
android:contentDescription="@string/image_string"
app:tint="@color/colorAccent"
app:srcCompat="@drawable/maps_and_flags" />
<TextView
@@ -60,7 +62,8 @@
android:layout_height="64dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="12dp"
android:tint="@color/colorAccent"
android:contentDescription="@string/image_string"
app:tint="@color/colorAccent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/temp_main_4"
@@ -71,11 +74,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/icon_main_4"
android:textSize="16sp"
tools:text="windy with rain" />

View File

@@ -1,21 +1,22 @@
<?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="wrap_content"
android:layout_margin="24dp"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
android:layout_margin="24dp">
<GridView
android:id="@+id/grid_mono"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:listitem="@layout/mono_item_two_cell"
android:numColumns="3"
android:gravity="center"
android:numColumns="3"
android:stretchMode="columnWidth"
tools:layout_height="88dp"/>
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_height="88dp"
tools:listitem="@layout/mono_item_two_cell" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<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">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/mono_item_cell"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:src="@drawable/cloud_symbol"
style="@style/icon_style__further_details"
android:contentDescription="@string/image_string"
android:padding="6dp"
style="@style/icon_style__further_deatils" />
android:src="@drawable/cloud_symbol"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/mono_text_cell"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="15 km"
android:textSize="16sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/mono_item_cell"/>
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/mono_item_cell"
tools:text="15 km" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -13,7 +13,8 @@
android:id="@+id/imageView"
android:layout_width="0dp"
android:layout_height="128dp"
android:tint="@android:color/white"
android:contentDescription="@string/image_string"
app:tint="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -12,7 +12,7 @@
tools:layout="@layout/fragment_home">
<action
android:id="@+id/action_homeFragment_to_furtherDetailsFragment"
app:destination="@id/furtherDetailsFragment"/>
app:destination="@id/furtherDetailsFragment" />
</fragment>
<fragment
@@ -22,7 +22,7 @@
<argument
android:name="forecast"
app:argType="com.appttude.h_mal.atlas_weather.model.forecast.Forecast"
app:nullable="true"/>
app:nullable="true" />
</fragment>
<fragment
@@ -32,10 +32,10 @@
tools:layout="@layout/fragment__two">
<action
android:id="@+id/action_worldFragment_to_addLocationFragment"
app:destination="@id/addLocationFragment"/>
app:destination="@id/addLocationFragment" />
<action
android:id="@+id/action_worldFragment_to_worldItemFragment"
app:destination="@id/worldItemFragment"/>
app:destination="@id/worldItemFragment" />
</fragment>
<fragment
android:id="@+id/addLocationFragment"

View File

@@ -1,12 +0,0 @@
<resources>
<!-- Reply Preference -->
<string-array name="reply_entries">
<item>Reply</item>
<item>Reply to all</item>
</string-array>
<string-array name="reply_values">
<item>reply</item>
<item>reply_all</item>
</string-array>
</resources>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#000000</color>
</resources>

View File

@@ -10,18 +10,5 @@
<string name="title_world">World</string>
<string name="widget_declaration">When using the app widget with app will require the use of background location services. Just to confirm the location data is used just to provide the end user with widget data. The use of background location permission is to update the widget at 30 minute intervals. </string>
<!-- Preference Titles -->
<string name="messages_header">Messages</string>
<string name="sync_header">Sync</string>
<!-- Messages Preferences -->
<string name="signature_title">Your signature</string>
<string name="reply_title">Default reply action</string>
<!-- Sync Preferences -->
<string name="sync_title">Sync email periodically</string>
<string name="attachment_title">Download incoming attachments</string>
<string name="attachment_summary_on">Automatically download attachments for incoming emails
</string>
<string name="attachment_summary_off">Only download attachments when manually requested</string>
</resources>

View File

@@ -14,9 +14,11 @@
<item name="android:textColorHint">@color/colorAccent</item>
<item name="android:editTextColor">@color/colorAccent</item>
<item name="materialAlertDialogTheme">@style/YourAlertDialogTheme</item>
<item name="bottomNavigationStyle">@style/Widget.MaterialComponents.BottomNavigationView.Colored</item>
<item name="bottomNavigationStyle">
@style/Widget.MaterialComponents.BottomNavigationView.Colored
</item>
<item name="floatingActionButtonStyle">@style/Widget.App.FloatingActionButton</item>
<!-- <item name="fontFamily">@font/font_family</item>-->
<!-- <item name="fontFamily">@font/font_family</item>-->
</style>
<style name="YourAlertDialogTheme" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
@@ -26,7 +28,7 @@
<style name="TitleTextStyle" parent="MaterialAlertDialog.MaterialComponents.Title.Text">
<item name="android:textColor">@color/colorPrimaryDark</item>
<item name="tint">@color/colorPrimaryDark</item>
<!-- <item name="android:textSize">20sp</item>-->
<!-- <item name="android:textSize">20sp</item>-->
</style>
<style name="Widget.App.FloatingActionButton" parent="Widget.MaterialComponents.FloatingActionButton">
@@ -52,12 +54,6 @@
<item name="windowNoTitle">true</item>
</style>
<style name="TextAppearance.AppCompat.Widget.ActionBar.Title" parent="@android:style/TextAppearance">
<!-- <item name="android:fontFamily">@font/archeologicaps</item>-->
<!--<item name="android:textColor">@color/colour_five</item>-->
</style>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="textView_major">

View File

@@ -3,13 +3,13 @@
android:configure="com.appttude.h_mal.monoWeather.ui.widget.WidgetLocationPermissionActivity"
android:initialKeyguardLayout="@layout/weather_app_widget"
android:initialLayout="@layout/weather_app_widget"
android:minHeight="110.0dp"
android:minWidth="320.0dp"
android:minHeight="110.0dp"
android:minResizeWidth="320.0dp"
android:minResizeHeight="110.0dp"
android:previewImage="@drawable/widget_screenshot"
android:updatePeriodMillis="1800000"
android:resizeMode="vertical"
android:updatePeriodMillis="1800000"
android:widgetCategory="home_screen">
</appwidget-provider>

View File

@@ -1,35 +0,0 @@
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/messages_header">
<EditTextPreference
app:key="signature"
app:title="@string/signature_title"
app:useSimpleSummaryProvider="true" />
<ListPreference
app:defaultValue="reply"
app:entries="@array/reply_entries"
app:entryValues="@array/reply_values"
app:key="reply"
app:title="@string/reply_title"
app:useSimpleSummaryProvider="true" />
</PreferenceCategory>
<PreferenceCategory app:title="@string/sync_header">
<SwitchPreferenceCompat
app:key="sync"
app:title="@string/sync_title" />
<SwitchPreferenceCompat
app:dependency="sync"
app:key="attachment"
app:summaryOff="@string/attachment_summary_off"
app:summaryOn="@string/attachment_summary_on"
app:title="@string/attachment_title" />
</PreferenceCategory>
</PreferenceScreen>