Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: background color of splash screen doesn't change with theme #2466 #2485

Closed
wants to merge 2 commits into from

Conversation

Maan-Sharma
Copy link

@Maan-Sharma Maan-Sharma commented Jan 15, 2024

Fixes #2466

WhatsApp.Video.2024-01-15.at.7.43.19.AM.mp4

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Apply the AndroidStyle.xml style template to your code in Android Studio.

  • Run the unit tests with ./gradlew check to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them.

@Maan-Sharma
Copy link
Author

@PratyushSingh07 have a look!!

@PratyushSingh07
Copy link
Collaborator

Please log in to the app with the demo credentials and check if it works after you have changed the theme from inside of the app

@Maan-Sharma
Copy link
Author

Maan-Sharma commented Jan 15, 2024

its work but in app register page didn't change its theme and I think its a new issue or features ,However this work fine
@PratyushSingh07

@PratyushSingh07
Copy link
Collaborator

Awesome , could you please attach a video just so I can cross check

@Maan-Sharma
Copy link
Author

ok

@Maan-Sharma
Copy link
Author

WhatsApp.Video.2024-01-15.at.9.02.49.PM.mp4

look!!

@PratyushSingh07
Copy link
Collaborator

Please log in to the app with the demo credentials and check if it works after you have changed the theme from inside of the app

Did you not understand what I wrote here @Maan-Sharma . I specifically asked you to log into the app with the credentials and then change the theme from the settings. Right now you are just changing the system theme and that's it

@Maan-Sharma
Copy link
Author

Maan-Sharma commented Jan 15, 2024

ohh , where i get the log credentials? can you give me the link or something @PratyushSingh07

@Maan-Sharma
Copy link
Author

hey @PratyushSingh07 can you give me demo log credentials??

@PratyushSingh07
Copy link
Collaborator

Go through readme.md

@Maan-Sharma
Copy link
Author

I found it

@Maan-Sharma
Copy link
Author

its not changing inside the app , I gusse for working with the app theme we have to migrate in compose @PratyushSingh07 or if anything I'm missing out please tell me

@PratyushSingh07
Copy link
Collaborator

its not changing inside the app , I gusse for working with the app theme we have to migrate in compose @PratyushSingh07 or if anything I'm missing out please tell me

Not sure if migrating the splash screen to compose is a good idea. We can just use the api if needed. Moreover, the issue may be because of the ui library. So are you still going to solve this issue or should I close this PR ?

@Maan-Sharma
Copy link
Author

@PratyushSingh07 can you tell me how I work with App Ui

@Maan-Sharma
Copy link
Author

Maan-Sharma commented Jan 17, 2024

@PratyushSingh07 I add api and make changes in Splash screen too but I could't find out the problem
package org.mifos.mobile.ui.activities

import android.content.Intent
import android.os.Build
import android.os.Bundle
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import com.mifos.mobile.passcode.utils.PasscodePreferencesHelper
import org.mifos.mobile.R
import org.mifos.mobile.api.local.PreferencesHelper
import org.mifos.mobile.ui.activities.base.BaseActivity
import org.mifos.mobile.ui.fragments.applySavedTheme
import org.mifos.mobile.ui.login.LoginActivity
import org.mifos.mobile.utils.Constants

/*

  • Created by saksham on 01/June/2018
    */
    class SplashActivity : BaseActivity() {

    private var passcodePreferencesHelper: PasscodePreferencesHelper? = null

    override fun onCreate(savedInstanceState: Bundle?) {

      val intent: Intent?
      super.onCreate(savedInstanceState)
    
    
      // Determine the current mode (light or dark)
      val isDarkMode = isDarkMode()
    
      // Set the theme based on the mode
      val themeId = if (isDarkMode) R.style.SplashTheme_dark else R.style.SplashTheme
      setTheme(themeId)
    
      // Install splash screen
      installSplashScreen().apply {
          // Customize splash screen if needed
      }
    
      passcodePreferencesHelper = PasscodePreferencesHelper(this)
      if (passcodePreferencesHelper?.passCode?.isNotEmpty() == true) {
          intent = Intent(this, PassCodeActivity::class.java)
          intent.putExtra(Constants.INTIAL_LOGIN, true)
      } else {
          intent = Intent(this, LoginActivity::class.java)
      }
      startActivity(intent)
      finish()
    

    }
    private fun isDarkMode(): Boolean {
    return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
    resources.configuration.uiMode and android.content.res.Configuration.UI_MODE_NIGHT_MASK == android.content.res.Configuration.UI_MODE_NIGHT_YES
    } else {
    false // For versions older than Android Q, assume light mode
    }
    }
    }

@PratyushSingh07
Copy link
Collaborator

I will look into it in my spare time . Meanwhile I am converting this PR to draft

@PratyushSingh07 PratyushSingh07 marked this pull request as draft January 17, 2024 11:34
@Vikashgathala
Copy link
Contributor

can i work on this @PratyushSingh07 ? I'll complete this as soon as possible.

@PratyushSingh07
Copy link
Collaborator

can i work on this @PratyushSingh07 ? I'll complete this as soon as possible.

I don't have a say. Ask @Maan-Sharma

@PratyushSingh07
Copy link
Collaborator

closing due to inactivity. Reopen the PR if you make any progress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: background color of splash screen doesn't change with theme
3 participants