diff --git a/app/build.gradle b/app/build.gradle index 27f4bad..6d73888 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -122,9 +122,9 @@ dependencies { implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services" implementation 'androidx.appcompat:appcompat:1.3.1' - implementation 'com.google.android.material:material:1.4.0' - implementation 'androidx.core:core-ktx:1.6.0' - implementation "androidx.core:core-splashscreen:1.0.0-alpha01" + implementation 'com.google.android.material:material:1.6.0-alpha01' + implementation 'androidx.core:core-ktx:1.7.0' + implementation "androidx.core:core-splashscreen:1.0.0-alpha02" implementation "androidx.fragment:fragment-ktx:1.3.6" // HTTP Client diff --git a/app/src/main/java/tw/com/louis383/coffeefinder/CoffeeTripApplication.kt b/app/src/main/java/tw/com/louis383/coffeefinder/CoffeeTripApplication.kt index 6956470..f19a5bb 100644 --- a/app/src/main/java/tw/com/louis383/coffeefinder/CoffeeTripApplication.kt +++ b/app/src/main/java/tw/com/louis383/coffeefinder/CoffeeTripApplication.kt @@ -2,7 +2,9 @@ package tw.com.louis383.coffeefinder import android.app.Application import androidx.appcompat.app.AppCompatDelegate +import com.google.android.material.color.DynamicColors import dagger.hilt.android.HiltAndroidApp +import tw.com.louis383.coffeefinder.utils.QuickCheckUtils /** * Created by louis383 on 2017/1/24. @@ -13,5 +15,8 @@ class CoffeeTripApplication : Application() { override fun onCreate() { super.onCreate() AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) + if (QuickCheckUtils.canApplyDynamicColor()) { + DynamicColors.applyToActivitiesIfAvailable(this) + } } } \ No newline at end of file diff --git a/app/src/main/java/tw/com/louis383/coffeefinder/details/DetailsFragment.kt b/app/src/main/java/tw/com/louis383/coffeefinder/details/DetailsFragment.kt index de073b8..4eb42ba 100644 --- a/app/src/main/java/tw/com/louis383/coffeefinder/details/DetailsFragment.kt +++ b/app/src/main/java/tw/com/louis383/coffeefinder/details/DetailsFragment.kt @@ -1,5 +1,9 @@ package tw.com.louis383.coffeefinder.details +import android.content.res.ColorStateList +import android.graphics.BlendMode +import android.graphics.ColorMatrix +import android.graphics.ColorMatrixColorFilter import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -9,6 +13,7 @@ import android.widget.ImageView import android.widget.ProgressBar import android.widget.RatingBar import android.widget.TextView +import androidx.core.content.ContextCompat import androidx.core.widget.NestedScrollView import androidx.fragment.app.Fragment import androidx.lifecycle.Lifecycle @@ -20,6 +25,7 @@ import tw.com.louis383.coffeefinder.core.domain.model.CoffeeShop import tw.com.louis383.coffeefinder.uimodel.CoffeeShopUiModel import tw.com.louis383.coffeefinder.uimodel.getUiModel import tw.com.louis383.coffeefinder.utils.FragmentArgumentDelegate +import tw.com.louis383.coffeefinder.utils.QuickCheckUtils import javax.inject.Inject @AndroidEntryPoint @@ -50,6 +56,7 @@ class DetailsFragment: Fragment() { private lateinit var standingDestText: TextView private lateinit var distanceText: TextView + private lateinit var shareBackground: ImageView @Inject lateinit var currentLocationCarrier: CurrentLocationCarrier @@ -61,6 +68,10 @@ class DetailsFragment: Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) retrieveViews(view) + if (QuickCheckUtils.canApplyDynamicColor()) { + applyColorThemes() + } + nestedScrollView = view.findViewById(R.id.detail_view_scrollview) setDetailInfo(coffeeShop.getUiModel()) @@ -80,23 +91,39 @@ class DetailsFragment: Fragment() { } private fun retrieveViews(view: View) { - titleText = view.findViewById(R.id.detail_view_title) - cheapRating = view.findViewById(R.id.detail_view_expense) + titleText = view.findViewById(R.id.detail_view_title) + cheapRating = view.findViewById(R.id.detail_view_expense) - wiFiPointBar = view.findViewById(R.id.detail_view_wifi_quality) - wiFiScoreText = view.findViewById(R.id.detail_view_wifi_score) - seatPointBar = view.findViewById(R.id.detail_view_seat_quality) - seatScoreText = view.findViewById(R.id.detail_view_seat_score) + wiFiPointBar = view.findViewById(R.id.detail_view_wifi_quality) + wiFiScoreText = view.findViewById(R.id.detail_view_wifi_score) + seatPointBar = view.findViewById(R.id.detail_view_seat_quality) + seatScoreText = view.findViewById(R.id.detail_view_seat_score) - webSiteText = view.findViewById(R.id.detail_view_website) - openTimeText = view.findViewById(R.id.detail_view_opentime) - mrtText = view.findViewById(R.id.detail_view_mrt) + webSiteText = view.findViewById(R.id.detail_view_website) + openTimeText = view.findViewById(R.id.detail_view_opentime) + mrtText = view.findViewById(R.id.detail_view_mrt) - limitedTimeText = view.findViewById(R.id.detail_view_limited_time) - socketText = view.findViewById(R.id.detail_view_socket) - standingDestText = view.findViewById(R.id.detail_view_standing_desk) + limitedTimeText = view.findViewById(R.id.detail_view_limited_time) + socketText = view.findViewById(R.id.detail_view_socket) + standingDestText = view.findViewById(R.id.detail_view_standing_desk) - distanceText = view.findViewById(R.id.detail_view_distance) + distanceText = view.findViewById(R.id.detail_view_distance) + shareBackground = view.findViewById(R.id.detail_view_share_background_image) + } + + private fun applyColorThemes() { + cheapRating.progressTintList = ColorStateList.valueOf(ContextCompat.getColor(requireContext(), R.color.dynamic_light_primary)) + wiFiPointBar.progressTintList = ColorStateList.valueOf(ContextCompat.getColor(requireContext(), R.color.dynamic_light_secondary)) + wiFiPointBar.progressTintBlendMode = BlendMode.HUE + seatPointBar.progressTintList = ColorStateList.valueOf(ContextCompat.getColor(requireContext(), R.color.dynamic_light_secondary)) + seatPointBar.progressTintBlendMode = BlendMode.HUE + + // set share background to monochrome + shareBackground.colorFilter = ColorMatrixColorFilter( + ColorMatrix().also { + it.setSaturation(0f) + } + ) } fun setDetailInfo(uiModel: CoffeeShopUiModel) { diff --git a/app/src/main/java/tw/com/louis383/coffeefinder/mainpage/MainActivity.kt b/app/src/main/java/tw/com/louis383/coffeefinder/mainpage/MainActivity.kt index 36d15c2..54b11f7 100644 --- a/app/src/main/java/tw/com/louis383/coffeefinder/mainpage/MainActivity.kt +++ b/app/src/main/java/tw/com/louis383/coffeefinder/mainpage/MainActivity.kt @@ -5,11 +5,13 @@ import android.animation.ObjectAnimator import android.app.Activity import android.content.Intent import android.content.pm.PackageManager +import android.content.res.ColorStateList import android.net.Uri import android.os.Build import android.os.Bundle import android.provider.Settings import android.view.View +import android.view.ViewGroup import android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS import android.view.animation.AnticipateInterpolator import android.widget.FrameLayout @@ -23,14 +25,17 @@ import androidx.core.content.ContextCompat import androidx.core.splashscreen.SplashScreen import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.splashscreen.SplashScreenViewProvider +import androidx.core.view.* import androidx.lifecycle.LifecycleOwner import androidx.viewpager.widget.ViewPager import com.google.android.gms.common.api.ResolvableApiException import com.google.android.gms.maps.model.LatLng import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.snackbar.Snackbar +import com.rd.PageIndicatorView import com.trafi.anchorbottomsheetbehavior.AnchorBottomSheetBehavior import dagger.hilt.android.AndroidEntryPoint +import javax.inject.Inject import tw.com.louis383.coffeefinder.R import tw.com.louis383.coffeefinder.adapter.ViewPagerAdapter import tw.com.louis383.coffeefinder.core.domain.model.CoffeeShop @@ -40,16 +45,21 @@ import tw.com.louis383.coffeefinder.list.ListFragment import tw.com.louis383.coffeefinder.maps.MapsClickHandler import tw.com.louis383.coffeefinder.maps.MapsFragment import tw.com.louis383.coffeefinder.uimodel.getUiModel +import tw.com.louis383.coffeefinder.utils.QuickCheckUtils import tw.com.louis383.coffeefinder.utils.bindView -import javax.inject.Inject /** * Created by louis383 on 2017/2/17. */ @AndroidEntryPoint -class MainActivity : AppCompatActivity(), MainView, MapsClickHandler, ListFragment.Callback, - DetailsItemClickListener, View.OnClickListener { +class MainActivity : + AppCompatActivity(), + MainView, + MapsClickHandler, + ListFragment.Callback, + DetailsItemClickListener, + View.OnClickListener { private val locationSettingResolution = 1001 @Inject @@ -61,6 +71,7 @@ class MainActivity : AppCompatActivity(), MainView, MapsClickHandler, ListFragme private val rootView: CoordinatorLayout by bindView(R.id.main_rootview) private val mainContainer: FrameLayout by bindView(R.id.main_container) private val myLocationButton: ImageButton by bindView(R.id.main_my_location_button) + private val indicatorView: PageIndicatorView by bindView(R.id.main_view_pager_indicator) // Bottom Sheet private lateinit var bottomSheetViewPager: ViewPager @@ -69,9 +80,9 @@ class MainActivity : AppCompatActivity(), MainView, MapsClickHandler, ListFragme // View States sealed class ViewState { - data class EnterDetailInfoFromMap(val coffeeshop: CoffeeShop): ViewState() - data class EnterDetailInfoFromList(val coffeeshop: CoffeeShop): ViewState() - object Browsing: ViewState() + data class EnterDetailInfoFromMap(val coffeeshop: CoffeeShop) : ViewState() + data class EnterDetailInfoFromList(val coffeeshop: CoffeeShop) : ViewState() + object Browsing : ViewState() } private var detailViewState: ViewState = ViewState.Browsing @@ -93,6 +104,11 @@ class MainActivity : AppCompatActivity(), MainView, MapsClickHandler, ListFragme bottomSheetBehavior = getViewPagerBottomSheetBehavior() bottomSheetBehavior.state = AnchorBottomSheetBehavior.STATE_COLLAPSED + if (QuickCheckUtils.canApplyDynamicColor()) { + myLocationButton.imageTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.dynamic_light_primary)) + indicatorView.selectedColor = ContextCompat.getColor(this, R.color.dynamic_light_primary) + } + presenter.attachView(this) myLocationButton.setOnClickListener(this) } @@ -153,7 +169,7 @@ class MainActivity : AppCompatActivity(), MainView, MapsClickHandler, ListFragme override fun checkLocationPermission(): Boolean { return ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || - hasApproximateLocationPermission() + hasApproximateLocationPermission() } override fun hasApproximateLocationPermission(): Boolean { @@ -177,13 +193,12 @@ class MainActivity : AppCompatActivity(), MainView, MapsClickHandler, ListFragme else -> { // No location access granted. if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_COARSE_LOCATION) && - ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) { + ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION) + ) { MaterialAlertDialogBuilder(this) .setMessage(getResourceString(R.string.request_location)) - .setPositiveButton(getResourceString(R.string.dialog_auth)) - { _, _ -> presenter.requestLocationPermission() } - .setNegativeButton(getResourceString(R.string.dialog_cancel)) - { _, _ -> showPermissionNeedSnackBar() } + .setPositiveButton(getResourceString(R.string.dialog_auth)) { _, _ -> presenter.requestLocationPermission() } + .setNegativeButton(getResourceString(R.string.dialog_cancel)) { _, _ -> showPermissionNeedSnackBar() } .create() .show() } else { @@ -194,10 +209,8 @@ class MainActivity : AppCompatActivity(), MainView, MapsClickHandler, ListFragme MaterialAlertDialogBuilder(this) .setTitle(getResourceString(R.string.dialog_auth)) .setMessage(resources.getString(R.string.auth_yourself, appName, permissionName)) - .setPositiveButton(getResourceString(R.string.auto_go)) - { _, _ -> openApplicationSetting() } - .setNegativeButton(getResourceString(R.string.dialog_cancel)) - { _, _ -> } + .setPositiveButton(getResourceString(R.string.auto_go)) { _, _ -> openApplicationSetting() } + .setNegativeButton(getResourceString(R.string.dialog_cancel)) { _, _ -> } .create() .show() } @@ -249,9 +262,32 @@ class MainActivity : AppCompatActivity(), MainView, MapsClickHandler, ListFragme window.insetsController?.setSystemBarsAppearance(APPEARANCE_LIGHT_STATUS_BARS, APPEARANCE_LIGHT_STATUS_BARS) } else { window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or - View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or - View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or + View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR } + fixBottomUiHeight() + } + + private fun fixBottomUiHeight() { + ViewCompat.setOnApplyWindowInsetsListener( + window.decorView, + object : OnApplyWindowInsetsListener { + override fun onApplyWindowInsets( + v: View, + insets: WindowInsetsCompat + ): WindowInsetsCompat { + val navigationBarHeight = + insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom + bottomSheetViewPager.setPadding(0, 0, 0, navigationBarHeight) + + val indicatorLayoutParams = indicatorView.layoutParams as ViewGroup.MarginLayoutParams + indicatorLayoutParams.updateMargins(bottom = navigationBarHeight + indicatorView.marginBottom) + + ViewCompat.setOnApplyWindowInsetsListener(window.decorView, null) + return insets + } + } + ) } private val internetRequestCallback = registerForActivityResult( @@ -460,7 +496,7 @@ class MainActivity : AppCompatActivity(), MainView, MapsClickHandler, ListFragme presenter.let { val myLocation = it.currentLocation val mapFragment = supportFragmentManager.findFragmentByTag(MapsFragment.TAG) - as MapsFragment + as MapsFragment mapFragment.moveToMyLocation(myLocation) } } diff --git a/app/src/main/java/tw/com/louis383/coffeefinder/mainpage/MainPresenter.kt b/app/src/main/java/tw/com/louis383/coffeefinder/mainpage/MainPresenter.kt index 9d9ba7e..207bdfa 100644 --- a/app/src/main/java/tw/com/louis383/coffeefinder/mainpage/MainPresenter.kt +++ b/app/src/main/java/tw/com/louis383/coffeefinder/mainpage/MainPresenter.kt @@ -118,7 +118,7 @@ class MainPresenter @Inject constructor( override fun onSlide(bottomSheet: View, slideOffset: Float) { if (slideOffset >= 0f) { // negative values to move view up - val additionalDistances = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0.5f, bottomSheet.resources.displayMetrics) + val additionalDistances = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0.7f, bottomSheet.resources.displayMetrics) view?.moveMapView((anchorHeight * slideOffset) * (additionalDistances * -1)) } } diff --git a/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsFragment.kt b/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsFragment.kt index 8ab6d14..1af05f2 100644 --- a/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsFragment.kt +++ b/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsFragment.kt @@ -183,9 +183,11 @@ class MapsFragment : BaseFragment(), OnMapReadyCallback, MapsView, GoogleMap.OnM } override fun getResourceDrawable(resId: Int): Drawable? { - return context?.run { - ContextCompat.getDrawable(this, resId) - } + return ContextCompat.getDrawable(requireContext(), resId) + } + + override fun getColorInt(colorResId: Int): Int { + return ContextCompat.getColor(requireContext(), colorResId) } fun moveToMyLocation(currentLocation: Location?) { diff --git a/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsPresenter.kt b/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsPresenter.kt index 9384d21..81bbf74 100644 --- a/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsPresenter.kt +++ b/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsPresenter.kt @@ -2,17 +2,21 @@ package tw.com.louis383.coffeefinder.maps import android.graphics.Bitmap import android.graphics.Canvas +import android.graphics.LightingColorFilter +import android.graphics.Paint +import androidx.annotation.ColorRes import com.google.android.gms.maps.GoogleMap import com.google.android.gms.maps.model.BitmapDescriptor import com.google.android.gms.maps.model.BitmapDescriptorFactory import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.Marker import dagger.hilt.android.scopes.FragmentScoped +import javax.inject.Inject import tw.com.louis383.coffeefinder.BasePresenter import tw.com.louis383.coffeefinder.R import tw.com.louis383.coffeefinder.core.domain.model.CoffeeShop +import tw.com.louis383.coffeefinder.utils.QuickCheckUtils import tw.com.louis383.coffeefinder.utils.toLatLng -import javax.inject.Inject /** * Created by louis383 on 2017/1/13. @@ -49,18 +53,16 @@ class MapsPresenter @Inject constructor() : BasePresenter(), GoogleMap } private fun getDrawableBitmapDescriptor(resId: Int): BitmapDescriptor? { - val drawable = view?.getResourceDrawable(resId) - drawable?.run { - val width = intrinsicWidth - val height = intrinsicHeight - setBounds(0, 0, width, height) - - val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888) - val canvas = Canvas(bitmap) - draw(canvas) - - return BitmapDescriptorFactory.fromBitmap(bitmap) - } ?: return null + val drawable = view?.getResourceDrawable(resId) ?: return null + + val width = drawable.intrinsicWidth + val height = drawable.intrinsicHeight + drawable.setBounds(0, 0, width, height) + + val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888) + val canvas = Canvas(bitmap) + drawable.draw(canvas) + return BitmapDescriptorFactory.fromBitmap(bitmap) } private fun highlightMarker(marker: Marker, highlight: Boolean) { @@ -94,7 +96,7 @@ class MapsPresenter @Inject constructor() : BasePresenter(), GoogleMap coffeeShop?.run { view?.openDetailView(this) } - return true // disable snippet + return true // disable snippet } //endregion diff --git a/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsView.kt b/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsView.kt index 8e547a2..a4a3905 100644 --- a/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsView.kt +++ b/app/src/main/java/tw/com/louis383/coffeefinder/maps/MapsView.kt @@ -1,6 +1,7 @@ package tw.com.louis383.coffeefinder.maps import android.graphics.drawable.Drawable +import androidx.annotation.ColorRes import androidx.annotation.DrawableRes import com.google.android.gms.maps.model.BitmapDescriptor import com.google.android.gms.maps.model.LatLng @@ -11,6 +12,7 @@ import tw.com.louis383.coffeefinder.core.domain.model.CoffeeShop interface MapsView : BaseView { fun checkLocationPermission(): Boolean fun getResourceDrawable(@DrawableRes resId: Int): Drawable? + fun getColorInt(@ColorRes colorResId: Int): Int fun addMakers(latLng: LatLng, title: String, snippet: String, coffeeShop: CoffeeShop, icon: BitmapDescriptor): Marker? fun moveCamera(latLng: LatLng, zoom: Float?) fun setupDetailedMapInterface() diff --git a/app/src/main/java/tw/com/louis383/coffeefinder/utils/Utils.kt b/app/src/main/java/tw/com/louis383/coffeefinder/utils/Utils.kt index a058b1f..2200906 100644 --- a/app/src/main/java/tw/com/louis383/coffeefinder/utils/Utils.kt +++ b/app/src/main/java/tw/com/louis383/coffeefinder/utils/Utils.kt @@ -1,6 +1,7 @@ package tw.com.louis383.coffeefinder.utils import android.content.Context +import android.os.Build import androidx.annotation.StringRes /** @@ -9,3 +10,10 @@ import androidx.annotation.StringRes fun Context.getResourceString(@StringRes stringId: Int): String { return resources.getString(stringId) } + +object QuickCheckUtils { + fun canApplyDynamicColor(): Boolean { + return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S + } +} + diff --git a/app/src/main/java/tw/com/louis383/coffeefinder/view/CoffeeListAdapter.kt b/app/src/main/java/tw/com/louis383/coffeefinder/view/CoffeeListAdapter.kt index da645fe..8db5148 100644 --- a/app/src/main/java/tw/com/louis383/coffeefinder/view/CoffeeListAdapter.kt +++ b/app/src/main/java/tw/com/louis383/coffeefinder/view/CoffeeListAdapter.kt @@ -1,5 +1,6 @@ package tw.com.louis383.coffeefinder.view +import android.content.res.ColorStateList import android.graphics.PorterDuff import android.view.LayoutInflater import android.view.View @@ -14,6 +15,7 @@ import tw.com.louis383.coffeefinder.R import tw.com.louis383.coffeefinder.core.domain.model.CoffeeShop import tw.com.louis383.coffeefinder.list.ListAdapterHandler import tw.com.louis383.coffeefinder.uimodel.getUiModel +import tw.com.louis383.coffeefinder.utils.QuickCheckUtils /** * Created by louis383 on 2017/2/26. @@ -45,7 +47,11 @@ class CoffeeListAdapter(private val handler: ListAdapterHandler) : RecyclerView. distance.text = distanceString expenseChart.rating = coffeeShopUiModel.cheapPoints if (coffeeShopUiModel.wifiPoints > 0) { - wifiIcon.setColorFilter(ContextCompat.getColor(context, R.color.primary_orange), PorterDuff.Mode.SRC_IN) + if (QuickCheckUtils.canApplyDynamicColor()) { + wifiIcon.setColorFilter(ContextCompat.getColor(context, R.color.dynamic_light_primary), PorterDuff.Mode.SRC_IN) + } else { + wifiIcon.setColorFilter(ContextCompat.getColor(context, R.color.primary_orange), PorterDuff.Mode.SRC_IN) + } } else { wifiIcon.setColorFilter(0) } @@ -55,6 +61,10 @@ class CoffeeListAdapter(private val handler: ListAdapterHandler) : RecyclerView. handler.onItemTapped(coffeeShop, index) } } + + if (QuickCheckUtils.canApplyDynamicColor()) { + expenseChart.progressTintList = ColorStateList.valueOf(ContextCompat.getColor(context, R.color.dynamic_light_primary)) + } } } @@ -73,11 +83,11 @@ class CoffeeListAdapter(private val handler: ListAdapterHandler) : RecyclerView. } class ViewHolder(internal val rootView: View) : RecyclerView.ViewHolder(rootView) { - internal val title: TextView = rootView.findViewById(R.id.list_title) - internal val distance: TextView = rootView.findViewById(R.id.list_distance) - internal val expenseNoData: TextView = rootView.findViewById(R.id.list_chart_money_nodata) - internal val wifiIcon: ImageView = rootView.findViewById(R.id.list_wifi_icon) - internal val bookmarkIcon: ImageView = rootView.findViewById(R.id.list_bookmark_icon) - internal val expenseChart: RatingBar = rootView.findViewById(R.id.list_chart_money) + val title: TextView = rootView.findViewById(R.id.list_title) + val distance: TextView = rootView.findViewById(R.id.list_distance) + val expenseNoData: TextView = rootView.findViewById(R.id.list_chart_money_nodata) + val wifiIcon: ImageView = rootView.findViewById(R.id.list_wifi_icon) + val bookmarkIcon: ImageView = rootView.findViewById(R.id.list_bookmark_icon) + val expenseChart: RatingBar = rootView.findViewById(R.id.list_chart_money) } } diff --git a/app/src/main/res/drawable-v31/ic_map_pin.xml b/app/src/main/res/drawable-v31/ic_map_pin.xml new file mode 100644 index 0000000..860408f --- /dev/null +++ b/app/src/main/res/drawable-v31/ic_map_pin.xml @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-v31/ic_map_pin_active.xml b/app/src/main/res/drawable-v31/ic_map_pin_active.xml new file mode 100644 index 0000000..41969ba --- /dev/null +++ b/app/src/main/res/drawable-v31/ic_map_pin_active.xml @@ -0,0 +1,25 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 7cc6080..3bec45e 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -31,7 +31,7 @@ android:id="@+id/main_bottom_sheet" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/white" + android:background="?android:attr/colorBackground" app:layout_behavior="@string/anchor_bottom_sheet_behaviour" app:behavior_peekHeight="170dp" app:behavior_hideable="false" diff --git a/app/src/main/res/layout/coffee_list_item.xml b/app/src/main/res/layout/coffee_list_item.xml index 0ec6c5e..d25f813 100644 --- a/app/src/main/res/layout/coffee_list_item.xml +++ b/app/src/main/res/layout/coffee_list_item.xml @@ -38,15 +38,14 @@ app:srcCompat="@drawable/ic_bookmark" tools:visibility="gone" /> - + + android:id="@id/list_wifi_icon" + android:layout_width="16dp" + android:layout_height="16dp" + android:layout_alignBottom="@id/list_title" + android:layout_alignParentEnd="true" + app:srcCompat="@drawable/ic_wifi" /> + android:id="@+id/list_chart_money_nodata" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignEnd="@id/list_chart_money" + android:layout_alignBottom="@id/list_chart_money" + android:fontFamily="sans-serif" + android:text="@string/list_no_money_data" + android:textColor="@color/gray" + android:textSize="10sp" + android:visibility="gone" + tools:visibility="visible" /> \ No newline at end of file diff --git a/app/src/main/res/layout/detail_info.xml b/app/src/main/res/layout/detail_info.xml index 259c6d9..b181785 100644 --- a/app/src/main/res/layout/detail_info.xml +++ b/app/src/main/res/layout/detail_info.xml @@ -10,12 +10,10 @@ > + android:numStars="5" + android:stepSize="0.1" /> + android:text="@string/unit_m_words" /> + android:id="@+id/detail_view_wifi_quality" + style="@style/RateProgressBar" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/detail_view_wifi_quality_title" + android:layout_marginTop="5dp" + android:layout_toEndOf="@id/left_margin" + tools:progress="75" /> + android:id="@+id/detail_view_wifi_score" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@id/detail_view_wifi_icon" + android:layout_marginStart="@dimen/margin_next_to_progress" + android:layout_marginTop="7dp" + android:layout_toEndOf="@id/detail_view_wifi_quality" + android:gravity="bottom" + android:textColor="?attr/secondaryAccentColor" + android:textSize="22sp" + tools:text="4.5" /> + android:id="@+id/detail_view_seat_score" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@id/detail_view_seat_icon" + android:layout_marginStart="@dimen/margin_next_to_progress" + android:layout_marginTop="7dp" + android:layout_toEndOf="@id/detail_view_seat_quality" + android:gravity="bottom" + android:textColor="?attr/secondaryAccentColor" + android:textSize="22sp" + tools:text="3.0" /> diff --git a/app/src/main/res/values-v31/colors.xml b/app/src/main/res/values-v31/colors.xml new file mode 100644 index 0000000..79bd96e --- /dev/null +++ b/app/src/main/res/values-v31/colors.xml @@ -0,0 +1,130 @@ + + + #EC651E + #4455AA + #90A4AE + #FFFFFF + #F5F5F5 + #CDCDCD + #BFBFBF + #757575 + #5B5B5B + #212121 + #1E1E1E + + + #BFFFFFFF + #26C0C0C0 + #403C3C3C + + + @android:color/system_neutral1_1000 + @android:color/system_neutral1_900 + @android:color/system_neutral1_0 + @android:color/system_neutral1_800 + @android:color/system_neutral1_700 + @android:color/system_neutral1_600 + @android:color/system_neutral1_500 + @android:color/system_neutral1_400 + @android:color/system_neutral1_300 + @android:color/system_neutral1_200 + @android:color/system_neutral1_100 + @android:color/system_neutral1_50 + @android:color/system_neutral1_10 + @android:color/system_neutral2_1000 + @android:color/system_neutral2_900 + @android:color/system_neutral2_0 + @android:color/system_neutral2_800 + @android:color/system_neutral2_700 + @android:color/system_neutral2_600 + @android:color/system_neutral2_500 + @android:color/system_neutral2_400 + @android:color/system_neutral2_300 + @android:color/system_neutral2_200 + @android:color/system_neutral2_100 + @android:color/system_neutral2_50 + @android:color/system_neutral2_10 + @android:color/system_accent1_1000 + @android:color/system_accent1_900 + @android:color/system_accent1_0 + @android:color/system_accent1_800 + @android:color/system_accent1_700 + @android:color/system_accent1_600 + @android:color/system_accent1_500 + @android:color/system_accent1_400 + @android:color/system_accent1_300 + @android:color/system_accent1_200 + @android:color/system_accent1_100 + @android:color/system_accent1_50 + @android:color/system_accent1_10 + @android:color/system_accent2_1000 + @android:color/system_accent2_900 + @android:color/system_accent2_0 + @android:color/system_accent2_800 + @android:color/system_accent2_700 + @android:color/system_accent2_600 + @android:color/system_accent2_500 + @android:color/system_accent2_400 + @android:color/system_accent2_300 + @android:color/system_accent2_200 + @android:color/system_accent2_100 + @android:color/system_accent2_50 + @android:color/system_accent2_10 + @android:color/system_accent3_1000 + @android:color/system_accent3_900 + @android:color/system_accent3_0 + @android:color/system_accent3_800 + @android:color/system_accent3_700 + @android:color/system_accent3_600 + @android:color/system_accent3_500 + @android:color/system_accent3_400 + @android:color/system_accent3_300 + @android:color/system_accent3_200 + @android:color/system_accent3_100 + @android:color/system_accent3_50 + @android:color/system_accent3_10 + @color/palette_dynamic_neutral10 + @color/palette_dynamic_neutral20 + @color/palette_dynamic_primary40 + @color/palette_dynamic_neutral90 + @color/palette_dynamic_neutral90 + @color/palette_dynamic_primary20 + @color/palette_dynamic_primary90 + @color/palette_dynamic_secondary20 + @color/palette_dynamic_secondary90 + @color/palette_dynamic_neutral90 + @color/palette_dynamic_neutral_variant80 + @color/palette_dynamic_tertiary20 + @color/palette_dynamic_tertiary90 + @color/palette_dynamic_neutral_variant60 + @color/palette_dynamic_primary80 + @color/palette_dynamic_primary30 + @color/palette_dynamic_secondary80 + @color/palette_dynamic_secondary30 + @color/palette_dynamic_neutral10 + @color/palette_dynamic_neutral_variant30 + @color/palette_dynamic_tertiary80 + @color/palette_dynamic_tertiary30 + @color/palette_dynamic_neutral99 + @color/palette_dynamic_neutral95 + @color/palette_dynamic_primary80 + @color/palette_dynamic_neutral20 + @color/palette_dynamic_neutral10 + @color/palette_dynamic_primary100 + @color/palette_dynamic_primary10 + @color/palette_dynamic_secondary100 + @color/palette_dynamic_secondary10 + @color/palette_dynamic_neutral10 + @color/palette_dynamic_neutral_variant30 + @color/palette_dynamic_tertiary100 + @color/palette_dynamic_tertiary10 + @color/palette_dynamic_neutral_variant50 + @color/palette_dynamic_primary40 + @color/palette_dynamic_primary90 + @color/palette_dynamic_secondary40 + @color/palette_dynamic_secondary90 + @color/palette_dynamic_neutral99 + @color/palette_dynamic_neutral_variant90 + @color/palette_dynamic_tertiary40 + @color/palette_dynamic_tertiary90 + diff --git a/app/src/main/res/values-v31/styles.xml b/app/src/main/res/values-v31/styles.xml new file mode 100644 index 0000000..2311f34 --- /dev/null +++ b/app/src/main/res/values-v31/styles.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-v31/styles_components.xml b/app/src/main/res/values-v31/styles_components.xml new file mode 100644 index 0000000..4d32419 --- /dev/null +++ b/app/src/main/res/values-v31/styles_components.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-v31/themes.xml b/app/src/main/res/values-v31/themes.xml new file mode 100644 index 0000000..14f5a96 --- /dev/null +++ b/app/src/main/res/values-v31/themes.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000..363902d --- /dev/null +++ b/app/src/main/res/values/attrs.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index c6c2fd6..51de38c 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -8,6 +8,9 @@ @style/CoffeeDialogTheme @style/CoffeeDialogTheme @color/gray + @color/white + + @color/secondary_blue diff --git a/build.gradle b/build.gradle index 2c65748..0b0687a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.5.30' + ext.kotlin_version = '1.5.31' ext.dagger_version = '2.38.1' repositories { google() @@ -9,7 +9,7 @@ buildscript { maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:7.0.1' + classpath 'com.android.tools.build:gradle:7.0.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" classpath "com.google.dagger:hilt-android-gradle-plugin:$dagger_version"