diff --git a/app/src/main/kotlin/com/github/premnirmal/ticker/CustomTabs.kt b/app/src/main/kotlin/com/github/premnirmal/ticker/CustomTabs.kt index 5e6395f6..1bdb1d36 100644 --- a/app/src/main/kotlin/com/github/premnirmal/ticker/CustomTabs.kt +++ b/app/src/main/kotlin/com/github/premnirmal/ticker/CustomTabs.kt @@ -2,13 +2,12 @@ package com.github.premnirmal.ticker import android.content.ActivityNotFoundException import android.content.Context -import android.graphics.PorterDuff.Mode.SRC_IN import android.net.Uri +import androidx.browser.customtabs.CustomTabColorSchemeParams import androidx.browser.customtabs.CustomTabsIntent import androidx.browser.customtabs.CustomTabsIntent.SHARE_STATE_ON -import androidx.core.content.ContextCompat import com.github.premnirmal.ticker.settings.WebViewActivity -import com.github.premnirmal.tickerwidget.R +import com.google.android.material.elevation.SurfaceColors import timber.log.Timber object CustomTabs { @@ -18,13 +17,13 @@ object CustomTabs { url: String ) { try { - val closeButton = ContextCompat.getDrawable(context, R.drawable.ic_close)!! - closeButton.setTint(ContextCompat.getColor(context, R.color.icon_tint)) - closeButton.setTintMode(SRC_IN) + val color = SurfaceColors.SURFACE_2.getColor(context) val customTabsIntent = CustomTabsIntent.Builder() .setShareState(SHARE_STATE_ON) .setShowTitle(true) - .setCloseButtonIcon(closeButton.toBitmap()) + .setDefaultColorSchemeParams( + CustomTabColorSchemeParams.Builder().setToolbarColor(color).build() + ) .setExitAnimations(context, android.R.anim.fade_in, android.R.anim.fade_out) .build() customTabsIntent.launchUrl(context, Uri.parse(url)) diff --git a/app/src/main/kotlin/com/github/premnirmal/ticker/news/QuoteDetailActivity.kt b/app/src/main/kotlin/com/github/premnirmal/ticker/news/QuoteDetailActivity.kt index 893bf177..b84a5c84 100644 --- a/app/src/main/kotlin/com/github/premnirmal/ticker/news/QuoteDetailActivity.kt +++ b/app/src/main/kotlin/com/github/premnirmal/ticker/news/QuoteDetailActivity.kt @@ -43,9 +43,9 @@ import com.github.premnirmal.ticker.ui.SpacingDecoration import com.github.premnirmal.ticker.viewBinding import com.github.premnirmal.ticker.widget.WidgetDataProvider import com.github.premnirmal.tickerwidget.R -import com.github.premnirmal.tickerwidget.R.dimen import com.github.premnirmal.tickerwidget.databinding.ActivityQuoteDetailBinding import com.google.android.material.appbar.AppBarLayout +import com.google.android.material.elevation.SurfaceColors import com.robinhood.ticker.TickerUtils import javax.inject.Inject import kotlin.math.abs @@ -116,6 +116,7 @@ class QuoteDetailActivity : BaseGraphActivity(), New binding.change.setCharacterLists(TickerUtils.provideNumberList()) binding.changePercent.setCharacterLists(TickerUtils.provideNumberList()) if (resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) { + binding.gradient.setBackgroundColor(SurfaceColors.SURFACE_2.getColor(this)) binding.appBarLayout.addOnOffsetChangedListener(offsetChangedListener) } setupGraphView() @@ -179,7 +180,7 @@ class QuoteDetailActivity : BaseGraphActivity(), New private val offsetChangedListener = AppBarLayout.OnOffsetChangedListener { appBarLayout, verticalOffset -> if (verticalOffset < -20) { - binding.gradient.alpha = abs(verticalOffset / appBarLayout.height.toFloat()) + binding.gradient.alpha = abs(verticalOffset/appBarLayout.height.toFloat()) } else { binding.gradient.alpha = 0f } diff --git a/app/src/main/kotlin/com/github/premnirmal/ticker/portfolio/PortfolioFragment.kt b/app/src/main/kotlin/com/github/premnirmal/ticker/portfolio/PortfolioFragment.kt index 9c2717a4..8ba50697 100644 --- a/app/src/main/kotlin/com/github/premnirmal/ticker/portfolio/PortfolioFragment.kt +++ b/app/src/main/kotlin/com/github/premnirmal/ticker/portfolio/PortfolioFragment.kt @@ -6,7 +6,6 @@ import android.os.Bundle import android.os.Parcelable import android.view.View import android.widget.PopupMenu -import androidx.appcompat.app.AlertDialog import androidx.fragment.app.viewModels import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.ItemTouchHelper @@ -88,7 +87,7 @@ class PortfolioFragment : BaseFragment(), ChildFragmen popupWindow.setOnMenuItemClickListener { menuItem -> when (menuItem.itemId) { R.id.remove -> { - promptRemove(quote) + remove(quote) } } true @@ -141,19 +140,9 @@ class PortfolioFragment : BaseFragment(), ChildFragmen stocksAdapter.refresh() } - private fun promptRemove(quote: Quote?) { - quote?.let { - AlertDialog.Builder(requireContext()) - .setTitle(R.string.remove) - .setMessage(getString(R.string.remove_prompt, it.symbol)) - .setPositiveButton(R.string.remove) { dialog, _ -> - viewModel.removeStock(widgetId, it.symbol) - stocksAdapter.refresh() - dialog.dismiss() - } - .setNegativeButton(R.string.cancel) { dialog, _ -> dialog.dismiss() } - .show() - } + private fun remove(quote: Quote) { + viewModel.removeStock(widgetId, quote.symbol) + stocksAdapter.refresh() } override fun onSaveInstanceState(outState: Bundle) { diff --git a/app/src/main/res/layout-land/activity_quote_detail.xml b/app/src/main/res/layout-land/activity_quote_detail.xml index d213b5b1..72ac46e6 100644 --- a/app/src/main/res/layout-land/activity_quote_detail.xml +++ b/app/src/main/res/layout-land/activity_quote_detail.xml @@ -33,8 +33,7 @@ android:layout_height="wrap_content" app:layout_collapseMode="pin" app:navigationIcon="?attr/homeAsUpIndicator" - app:titleTextAppearance="@style/ActionBarTitleText" - tools:title="AAPL" + tools:title="AAPL" /> diff --git a/app/src/main/res/layout-sw600dp-land/activity_alerts.xml b/app/src/main/res/layout-sw600dp-land/activity_alerts.xml index 58063e90..48759e17 100644 --- a/app/src/main/res/layout-sw600dp-land/activity_alerts.xml +++ b/app/src/main/res/layout-sw600dp-land/activity_alerts.xml @@ -18,8 +18,7 @@ android:layout_height="wrap_content" app:title="@string/add_alerts" app:navigationIcon="?attr/homeAsUpIndicator" - app:titleTextAppearance="@style/ActionBarTitleText" - /> + /> diff --git a/app/src/main/res/layout-sw600dp-land/activity_notes.xml b/app/src/main/res/layout-sw600dp-land/activity_notes.xml index 7ce29762..5af1ef3c 100644 --- a/app/src/main/res/layout-sw600dp-land/activity_notes.xml +++ b/app/src/main/res/layout-sw600dp-land/activity_notes.xml @@ -19,8 +19,7 @@ android:layout_height="wrap_content" app:navigationIcon="?attr/homeAsUpIndicator" app:title="@string/notes" - app:titleTextAppearance="@style/ActionBarTitleText" - app:menu="@menu/menu_notes" + app:menu="@menu/menu_notes" /> diff --git a/app/src/main/res/layout-sw600dp-land/activity_quote_detail.xml b/app/src/main/res/layout-sw600dp-land/activity_quote_detail.xml index f46dbd01..4f751672 100644 --- a/app/src/main/res/layout-sw600dp-land/activity_quote_detail.xml +++ b/app/src/main/res/layout-sw600dp-land/activity_quote_detail.xml @@ -29,8 +29,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:navigationIcon="?attr/homeAsUpIndicator" - app:titleTextAppearance="@style/ActionBarTitleText" - tools:title="AAPL" + tools:title="AAPL" /> diff --git a/app/src/main/res/layout-sw600dp-land/fragment_news_feed.xml b/app/src/main/res/layout-sw600dp-land/fragment_news_feed.xml index 24ca6ae9..7d43a6f2 100644 --- a/app/src/main/res/layout-sw600dp-land/fragment_news_feed.xml +++ b/app/src/main/res/layout-sw600dp-land/fragment_news_feed.xml @@ -26,8 +26,7 @@ app:elevation="0dp" app:layout_scrollFlags="scroll|exitUntilCollapsed" app:title="@string/news_feed" - app:titleTextAppearance="@style/ActionBarTitleText" - /> + /> + /> + /> + /> @@ -168,7 +167,7 @@ android:layout_marginEnd="16dp" android:layout_marginRight="16dp" android:layout_marginBottom="20dp" - android:text="@string/add" + android:text="@string/save" /> diff --git a/app/src/main/res/layout/activity_db_viewer.xml b/app/src/main/res/layout/activity_db_viewer.xml index fac8e506..2b50fe6d 100644 --- a/app/src/main/res/layout/activity_db_viewer.xml +++ b/app/src/main/res/layout/activity_db_viewer.xml @@ -13,8 +13,7 @@ app:layout_collapseMode="pin" app:navigationIcon="?attr/homeAsUpIndicator" - app:titleTextAppearance="@style/ActionBarTitleText" - app:title="@string/db_viewer" + app:title="@string/db_viewer" /> diff --git a/app/src/main/res/layout/activity_positions.xml b/app/src/main/res/layout/activity_positions.xml index 97eab80b..637b10bb 100644 --- a/app/src/main/res/layout/activity_positions.xml +++ b/app/src/main/res/layout/activity_positions.xml @@ -20,8 +20,7 @@ app:title="@string/add_position" app:navigationIcon="?attr/homeAsUpIndicator" - app:titleTextAppearance="@style/ActionBarTitleText" - /> + /> diff --git a/app/src/main/res/layout/activity_quote_detail.xml b/app/src/main/res/layout/activity_quote_detail.xml index c881ae74..1b71f0a3 100644 --- a/app/src/main/res/layout/activity_quote_detail.xml +++ b/app/src/main/res/layout/activity_quote_detail.xml @@ -39,10 +39,8 @@ app:layout_collapseMode="parallax" app:layout_collapseParallaxMultiplier="1" app:navigationIcon="?attr/homeAsUpIndicator" - app:titleTextAppearance="@style/ActionBarTitleText" - tools:title="AAPL" + tools:title="AAPL" /> - - + + android:alpha="0.0" + tools:background="?attr/colorAccent" + tools:alpha="0.5" + /> + > diff --git a/app/src/main/res/layout/fragment_news_feed.xml b/app/src/main/res/layout/fragment_news_feed.xml index 7b268be2..00696ec3 100644 --- a/app/src/main/res/layout/fragment_news_feed.xml +++ b/app/src/main/res/layout/fragment_news_feed.xml @@ -3,6 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior" > + /> diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml index 44e99cea..aefc3856 100644 --- a/app/src/main/res/layout/fragment_search.xml +++ b/app/src/main/res/layout/fragment_search.xml @@ -30,8 +30,7 @@ app:elevation="0dp" app:layout_scrollFlags="scroll|exitUntilCollapsed" app:title="@string/action_search" - app:titleTextAppearance="@style/ActionBarTitleText" - /> + /> + /> diff --git a/app/src/main/res/layout/fragment_widgets.xml b/app/src/main/res/layout/fragment_widgets.xml index 8351bec7..f98c837d 100644 --- a/app/src/main/res/layout/fragment_widgets.xml +++ b/app/src/main/res/layout/fragment_widgets.xml @@ -27,8 +27,7 @@ android:elevation="0dp" app:elevation="0dp" app:title="@string/widgets" - app:titleTextAppearance="@style/ActionBarTitleText" - /> + /> @@ -35,7 +35,7 @@ android:gravity="center" tools:text="v3.0.0" style="@style/Widget.StocksWidget.TextView.Footer" - android:textAppearance="@style/TextAppearance.StocksWidget.Footer" + android:textAppearance="@style/TextAppearance.StocksWidget.Footer" /> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 460fd7f1..475b983b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -91,11 +91,11 @@ Equity Value Value Price - Add Position + Positions Add Done Skip - Edit Position + Positions No such stock in your portfolio. Remove Move to different widget @@ -183,7 +183,7 @@ Dismiss Alerts disabled, check settings Add Notes - Add Alerts + Alerts Are you sure you want to remove the entry %1$s from your portfolio? Save Stock alerts diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index e8d9a274..b07bafa7 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -16,6 +16,15 @@ ?attr/colorOnSurface + + + + + + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 8daca042..d19fdbbb 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -32,6 +32,7 @@ @style/Snackbar @style/Snackbar.TextView @style/StocksWidget.Widget.CardView + @style/StocksWidget.ToolbarStyle diff --git a/app/version.properties b/app/version.properties index d9ff2576..f529cafb 100644 --- a/app/version.properties +++ b/app/version.properties @@ -1,3 +1,3 @@ # this file is purely for f-droid because it cannot infer the version name/code from the git tag -versionName=3.9.803 -versionCode=300900003 +versionName=3.9.804 +versionCode=300900004