X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2FMobileLedgerApplication.java;fp=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2FMobileLedgerApplication.java;h=39d7e542d8f8a201d37f83e360b5153d41b72f7a;hb=c7b957ab880ff947ef90e70e41c7bc1c19a1caa3;hp=0000000000000000000000000000000000000000;hpb=160edb0e0fe58f5076329e8622db414001895530;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/MobileLedgerApplication.java b/app/src/main/java/net/ktnx/mobileledger/MobileLedgerApplication.java new file mode 100644 index 00000000..39d7e542 --- /dev/null +++ b/app/src/main/java/net/ktnx/mobileledger/MobileLedgerApplication.java @@ -0,0 +1,51 @@ +/* + * Copyright © 2018 Damyan Ivanov. + * This file is part of Mobile-Ledger. + * Mobile-Ledger is free software: you can distribute it and/or modify it + * under the term of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your opinion), any later version. + * + * Mobile-Ledger is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License terms for details. + * + * You should have received a copy of the GNU General Public License + * along with Mobile-Ledger. If not, see . + */ + +package net.ktnx.mobileledger; + +import android.app.Application; +import android.content.res.Configuration; +import android.content.res.Resources; +import android.os.Build; + +import net.ktnx.mobileledger.utils.Globals; + +public class MobileLedgerApplication extends Application { + + @Override + public void onCreate() { + super.onCreate(); + updateColorValues(); + } + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + updateColorValues(); + } + private void updateColorValues() { + Resources rm = getResources(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + Resources.Theme theme = getTheme(); + Globals.table_row_odd_bg = rm.getColor(R.color.table_row_odd_bg, theme); + Globals.table_row_even_bg = rm.getColor(R.color.table_row_even_bg, theme); + } + else { + Globals.table_row_odd_bg = rm.getColor(R.color.table_row_odd_bg); + Globals.table_row_even_bg = rm.getColor(R.color.table_row_even_bg); + } + } +}