Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
655ec32
Initial plan
Copilot Feb 16, 2026
97bf80c
Initial plan for Material 3 migration
Copilot Feb 16, 2026
1fef187
Add Material 3 themes and extract hardcoded colors
Copilot Feb 16, 2026
9d9e8ec
Migrate existing themes to Material 3 and extract progress bar colors
Copilot Feb 16, 2026
b9daf38
Address code review - add semantic color aliases for drawer text
Copilot Feb 16, 2026
3ca7acb
Fix ActionBar conflict - use NoActionBar variants for Material 3 themes
Copilot Feb 19, 2026
0370825
Enable Edge-to-Edge support with transparent status and navigation bars
Copilot Feb 19, 2026
e443481
Clean up unused imports in CABaseActivity
Copilot Feb 19, 2026
4a7d5d8
Remove trailing whitespace for cleaner formatting
Copilot Feb 19, 2026
40d7389
Implement dynamic colors with system theme auto-detection
Copilot Feb 19, 2026
848c23b
Add Edge-to-Edge window insets handling for proper padding
Copilot Feb 19, 2026
220af1e
Address code review - extract helper method and preserve original pad…
Copilot Feb 19, 2026
f87fd50
Remove theme selector from Settings and apply Edge-to-Edge to more ac…
Copilot Feb 19, 2026
a72517d
Add theme-aware color support for charts and icons
Copilot Feb 19, 2026
0750426
Remove unnecessary helper methods - use resource qualifiers instead
Copilot Feb 19, 2026
584ee38
Fix search_container reference error by adding proper ID to layout
Copilot Feb 19, 2026
342a2a9
Apply Edge-to-Edge support to all remaining activities
Copilot Feb 19, 2026
442b8f9
Apply dynamic theme-aware icon tinting
Copilot Feb 19, 2026
1245f86
Fix Material 3 DayNight theme implementation for proper dynamic colors
Copilot Feb 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified gradlew
100644 → 100755
Empty file.
30 changes: 18 additions & 12 deletions wows/src/main/java/com/half/wowsca/CAApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,30 +87,36 @@ class CAApp : Application() {

@JvmStatic
fun setTheme(act: FragmentActivity) {
val theme = getTheme(act)
if (theme == "ocean") { //dark theme
act.setTheme(R.style.Theme_CA_Material_Ocean)
} else if (theme == "dark") {
act.setTheme(R.style.Theme_CA_Material_Dark)
// Use single Material 3 DayNight theme with dynamic colors
// The system automatically handles:
// - Light/dark mode based on system settings
// - Dynamic colors on Android 12+ (Material You)
// - Fallback colors on older Android versions
act.setTheme(R.style.Theme_CA_Material_Dark)
}
}
}

@JvmStatic
@JvmStatic
fun isOceanTheme(ctx: Context?): Boolean {
val theme = getTheme(ctx)
return theme == "ocean"
// Ocean theme is no longer used - we use Material 3 DayNight theme
return false
}

@JvmStatic
fun isDarkTheme(ctx: Context?): Boolean {
val theme = getTheme(ctx)
return theme == "dark"
if (ctx == null) return true
// Check if system is in dark mode
return (ctx.resources.configuration.uiMode and
android.content.res.Configuration.UI_MODE_NIGHT_MASK) ==
android.content.res.Configuration.UI_MODE_NIGHT_YES
}

@JvmStatic
fun getTheme(ctx: Context?): String? {
val prefs = Prefs(ctx)
return prefs.getString(SettingActivity.THEME_CHOICE, "ocean")
if (ctx == null) return "dark"
// Return based on system theme
return if (isDarkTheme(ctx)) "dark" else "light"
}

@JvmStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class AuthenticationActivity : CABaseActivity() {
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
title = getString(R.string.login)

// Apply Edge-to-Edge insets
applyEdgeToEdgeInsets()
val container = findViewById<View>(R.id.auth_container)
applyEdgeToEdgeInsetsToContainer(container)

swipeBackLayout!!.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT)
}

Expand Down
55 changes: 55 additions & 0 deletions wows/src/main/java/com/half/wowsca/ui/CABaseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.half.wowsca.ui
import android.content.res.Configuration
import android.os.Bundle
import androidx.appcompat.widget.Toolbar
import androidx.core.view.WindowCompat
import androidx.fragment.app.FragmentManager
import com.half.wowsca.CAApp.Companion.getAppLanguage
import com.half.wowsca.CAApp.Companion.isDarkTheme
Expand All @@ -26,6 +27,10 @@ open class CABaseActivity : SwipeBackBaseActivity() {
// protected TextView tvKarma;
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

// Enable Edge-to-Edge
WindowCompat.setDecorFitsSystemWindows(window, false)

setTheme(this)
val current = getAppLanguage(applicationContext)
val myLocale = Locale(current)
Expand All @@ -44,6 +49,56 @@ open class CABaseActivity : SwipeBackBaseActivity() {
R.style.WoWSCAThemeToolbarDarkOverflow
}

/**
* Apply window insets to a toolbar to handle Edge-to-Edge properly.
* Call this after setting the toolbar in your activity.
*/
protected fun applyEdgeToEdgeInsets() {
mToolbar?.let { toolbar ->
// Capture original padding
val originalPaddingLeft = toolbar.paddingLeft
val originalPaddingTop = toolbar.paddingTop
val originalPaddingRight = toolbar.paddingRight
val originalPaddingBottom = toolbar.paddingBottom

androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(toolbar) { view, windowInsets ->
val insets = windowInsets.getInsets(androidx.core.view.WindowInsetsCompat.Type.systemBars())
view.setPadding(
originalPaddingLeft + insets.left,
originalPaddingTop + insets.top,
originalPaddingRight + insets.right,
originalPaddingBottom
)
windowInsets
}
}
}

/**
* Apply window insets to the container/content view to handle Edge-to-Edge properly.
* @param containerView The main content view that should respect navigation bar insets
*/
protected fun applyEdgeToEdgeInsetsToContainer(containerView: android.view.View?) {
containerView?.let { view ->
// Capture original padding
val originalPaddingLeft = view.paddingLeft
val originalPaddingTop = view.paddingTop
val originalPaddingRight = view.paddingRight
val originalPaddingBottom = view.paddingBottom

androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(view) { v, windowInsets ->
val insets = windowInsets.getInsets(androidx.core.view.WindowInsetsCompat.Type.systemBars())
v.setPadding(
originalPaddingLeft + insets.left,
originalPaddingTop,
originalPaddingRight + insets.right,
originalPaddingBottom + insets.bottom
)
windowInsets
}
}
}

protected fun initBackStackListener() {
backStackListener = FragmentManager.OnBackStackChangedListener {
invalidateOptionsMenu()
Expand Down
6 changes: 6 additions & 0 deletions wows/src/main/java/com/half/wowsca/ui/InformationActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class InformationActivity : CABaseActivity() {
setSupportActionBar(bar)

supportActionBar!!.setDisplayHomeAsUpEnabled(true)

// Apply Edge-to-Edge insets
applyEdgeToEdgeInsets()
val scrollView = findViewById<View>(R.id.info_scroll_view)
applyEdgeToEdgeInsetsToContainer(scrollView)

swipeBackLayout!!.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT)
}

Expand Down
7 changes: 7 additions & 0 deletions wows/src/main/java/com/half/wowsca/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ class MainActivity : CABaseActivity(), ICaptain {
// tvKarma = (TextView) findViewById(R.id.toolbar_text);
setSupportActionBar(mToolbar)

// Apply Edge-to-Edge insets to toolbar
applyEdgeToEdgeInsets()

// Apply Edge-to-Edge insets to container for navigation bar
val container = findViewById<View>(R.id.container)
applyEdgeToEdgeInsetsToContainer(container)

setUpDrawer()

initBackStackListener()
Expand Down
5 changes: 5 additions & 0 deletions wows/src/main/java/com/half/wowsca/ui/ResourcesActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ class ResourcesActivity : CABaseActivity() {
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setHomeButtonEnabled(true)

// Apply Edge-to-Edge insets
applyEdgeToEdgeInsets()
val container = findViewById<View>(R.id.resources_main_container)
applyEdgeToEdgeInsetsToContainer(container)

if (!TextUtils.isEmpty(type)) {
if (type == EXTRA_WEBSITES_TOOLS) {
title = getString(R.string.resources_websites)
Expand Down
5 changes: 5 additions & 0 deletions wows/src/main/java/com/half/wowsca/ui/SearchActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ class SearchActivity : CABaseActivity() {
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setHomeButtonEnabled(true)

// Apply Edge-to-Edge insets
applyEdgeToEdgeInsets()
val container = findViewById<View>(R.id.search_content_container)
applyEdgeToEdgeInsetsToContainer(container)

etSearch = findViewById<View>(R.id.search_et) as EditText?
delete = findViewById<View>(R.id.search_et_delete)
sServers = findViewById<View>(R.id.search_server_spinner) as Spinner?
Expand Down
8 changes: 7 additions & 1 deletion wows/src/main/java/com/half/wowsca/ui/SettingActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ class SettingActivity : CABaseActivity() {
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setHomeButtonEnabled(true)

// Apply Edge-to-Edge insets
applyEdgeToEdgeInsets()
val scrollView = findViewById<View>(R.id.settings_scroll_view)
applyEdgeToEdgeInsetsToContainer(scrollView)

aColorblind = findViewById<View>(R.id.settings_colorblind_area)
cbColorblind = findViewById<View>(R.id.settings_colorblind_checkbox) as CheckBox?

Expand Down Expand Up @@ -189,7 +194,8 @@ class SettingActivity : CABaseActivity() {

initServerLangauge()

initTheme()
// Theme selection removed - now uses system auto-detect (Android 12+) or navy fallback
// initTheme()

initServer()

Expand Down
15 changes: 15 additions & 0 deletions wows/src/main/java/com/half/wowsca/ui/SplashActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ class SplashActivity : CABaseActivity() {
iv = findViewById<View>(R.id.imageView) as ImageView?
Picasso.get().load(R.drawable.web_hi_res_512).into(iv)

// Apply Edge-to-Edge insets to root layout
val rootView = findViewById<View>(android.R.id.content)
rootView?.let { view ->
androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(view) { v, windowInsets ->
val insets = windowInsets.getInsets(androidx.core.view.WindowInsetsCompat.Type.systemBars())
v.setPadding(
insets.left,
insets.top,
insets.right,
insets.bottom
)
windowInsets
}
}

swipeBackLayout!!.setEnableGesture(false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ class ExpandableStatsAdapter(
xVals.add(child.titles[i])
val key = child.types[i]
if (key.equals("cruiser", ignoreCase = true)) {
colorList.add(Color.parseColor("#4CAF50"))
colorList.add(ContextCompat.getColor(ctx, R.color.chart_green))
} else if (key.equals("battleship", ignoreCase = true)) {
colorList.add(Color.parseColor("#F44336"))
colorList.add(ContextCompat.getColor(ctx, R.color.chart_red))
} else if (key.equals("aircarrier", ignoreCase = true)) {
colorList.add(Color.parseColor("#673AB7"))
colorList.add(ContextCompat.getColor(ctx, R.color.chart_purple))
} else if (key.equals("destroyer", ignoreCase = true)) {
colorList.add(Color.parseColor("#FDD835"))
colorList.add(ContextCompat.getColor(ctx, R.color.chart_yellow))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ class CompareActivity : CABaseActivity() {
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setHomeButtonEnabled(true)

// Apply Edge-to-Edge insets
applyEdgeToEdgeInsets()
val scrollView = findViewById<View>(R.id.compare_scroll)
applyEdgeToEdgeInsetsToContainer(scrollView)

container = findViewById<View>(R.id.compare_container) as LinearLayout?
progressBar = findViewById<View>(R.id.compare_progress)
tvErrorText = findViewById<View>(R.id.compare_middle_text) as TextView?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class ShipCompareActivity : CABaseActivity() {
supportActionBar!!.setHomeButtonEnabled(true)
supportActionBar!!.setTitle(R.string.ship_compare_title)

// Apply Edge-to-Edge insets
applyEdgeToEdgeInsets()
val container = findViewById<View>(R.id.ship_compare_container)
applyEdgeToEdgeInsetsToContainer(container)

progress = findViewById<View>(R.id.activity_compare_ships_progress)
pagerTabs = findViewById<View>(R.id.ship_compare_pager_tab) as SlidingTabLayout?
mViewPager = findViewById<View>(R.id.ship_compare_tabbed_pager) as ViewPager?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ class EncyclopediaTabbedActivity : CABaseActivity() {
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setHomeButtonEnabled(true)

// Apply Edge-to-Edge insets
applyEdgeToEdgeInsets()
val container = findViewById<View>(R.id.encyclopedia_container)
applyEdgeToEdgeInsetsToContainer(container)

mViewPager = findViewById<View>(R.id.encyclopedia_pager) as ViewPager?
pager = ShipopediaPager(supportFragmentManager)
val iconResourceArray = arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ class ShipProfileActivity : CABaseActivity() {
supportActionBar!!.setHomeButtonEnabled(true)
title = ""

// Apply Edge-to-Edge insets
applyEdgeToEdgeInsets()
val scrollView = findViewById<View>(R.id.encyclopedia_scroll)
applyEdgeToEdgeInsetsToContainer(scrollView)

scroll = findViewById<View>(R.id.encyclopedia_scroll) as ScrollView?

progress = findViewById<View>(R.id.encyclopedia_progress)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ class FlagsFragment : CAFragment() {
}
}
val d = ContextCompat.getDrawable(requireContext(), R.drawable.ic_flags)
if (!isDarkTheme(context)) d!!.setColorFilter(
// Apply theme-aware icon tint
d!!.setColorFilter(
ContextCompat.getColor(
requireContext(),
R.color.top_background
), PorterDuff.Mode.MULTIPLY
R.color.icon_tint_color
), PorterDuff.Mode.SRC_IN
)
createGeneralAlert(activity, item.name, sb.toString(), getString(R.string.dismiss), d)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ class ViewCaptainActivity : CABaseActivity(), ICaptain {
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setHomeButtonEnabled(true)

// Apply Edge-to-Edge insets
applyEdgeToEdgeInsets()
val container = findViewById<View>(R.id.container)
applyEdgeToEdgeInsetsToContainer(container)

initBackStackListener()
swipeBackLayout!!.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT)
}
Expand Down
Loading