Моя android активность перезапускается и приостанавливается после перехода в темный режим. Это происходит только при реализации темного режима - PullRequest
0 голосов
/ 16 апреля 2020
    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);

        profileImage = findViewById(R.id.profileImage);
        profileName = findViewById(R.id.profileName);
        saveSettings = findViewById(R.id.saveSettings);
        settingsProgressBar = findViewById(R.id.settingsProgressBar);

        firebaseAuth = FirebaseAuth.getInstance();
        storageReference = FirebaseStorage.getInstance().getReference();
        database = FirebaseDatabase.getInstance();
        mRef = database.getReference();

        userId = firebaseAuth.getCurrentUser().getUid();

        Toolbar settingToolbar = findViewById(R.id.settingToolbar);
        setSupportActionBar(settingToolbar);
        getSupportActionBar().setTitle("Account Settings");



        //this line is causing the problem
        //If this line is removed then there is no problem
        AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);


        //other snippets (removed for showing the exact error)
}


Это то, что появляется в моих журналах после открытия занятия.

V/FA: Activity resumed, time: 391895155
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
D/OpenGLRenderer: endAllActiveAnimators on 0x76a8ace700 (MenuPopupWindow$MenuDropDownListView) with handle 0x76aac8c240
V/FA: onActivityCreated
V/FA: Activity resumed, time: 391895295
V/FA: onActivityCreated
V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 9
    Connection attempt already in progress
    Activity paused, time: 391895304
V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 11
    Connection attempt already in progress
V/FA: Activity paused, time: 391895306
V/FA: Activity resumed, time: 391895373
E/RecyclerView: No adapter attached; skipping layout
V/FA: Activity resumed, time: 391895612
W/ample.photoblo: Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (light greylist, reflection)

Кроме того, есть ли способ, с помощью которого я могу установить все приложение в темный режим без изменения темы и стили. Заранее спасибо !!!

...