package fr.free.nrw.commons.theme;

import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import fr.free.nrw.commons.R;

public class BaseAppCompatActivity extends AppCompatActivity {
    boolean currentTheme;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false)) {
            currentTheme = true;
            setTheme(R.style.DarkAppTheme);
        }else {
            currentTheme = false;
            setTheme(R.style.LightAppTheme); //default
        }
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onResume() {
        //Restart activity if theme is changed
        Log.d("deneme","onResume Base");
        boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false);
        if(currentTheme!=newTheme){ //is activity theme changed
            Intent intent = getIntent();
            finish();
            startActivity(intent);
        }
        super.onResume();
    }
}

package fr.free.nrw.commons.theme;

import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import fr.free.nrw.commons.R;

public class BaseAppCompatActivity extends AppCompatActivity {
    boolean currentTheme;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false)) {
            currentTheme = true;g
            setTheme(R.style.DarkAppTheme);
        }else {
            currentTheme = false;
            setTheme(R.style.LightAppTheme); //default
        }
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onResume() {
        //Restart activity if theme is changed
        Log.d("deneme","onResume Base");
        boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false);
        if(currentTheme!=newTheme){ //is activity theme changed
            Intent intent = getIntent();
            finish();
            startActivity(intent);
        }
        super.onResume();
    }
}

--- 
+++ 
@@ -14,7 +14,7 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false)) {
-            currentTheme = true;g
+            currentTheme = true;
             setTheme(R.style.DarkAppTheme);
         }else {
             currentTheme = false;
Fix my cats press on keyboard
