2 * Copyright © 2020 Damyan Ivanov.
3 * This file is part of MoLe.
4 * MoLe is free software: you can distribute it and/or modify it
5 * under the term of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your opinion), any later version.
9 * MoLe is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License terms for details.
14 * You should have received a copy of the GNU General Public License
15 * along with MoLe. If not, see <https://www.gnu.org/licenses/>.
18 package net.ktnx.mobileledger.ui.activity;
20 import android.app.Activity;
21 import android.content.Intent;
22 import android.os.Bundle;
23 import android.os.Handler;
25 import androidx.annotation.Nullable;
27 import net.ktnx.mobileledger.R;
28 import net.ktnx.mobileledger.model.Data;
29 import net.ktnx.mobileledger.model.MobileLedgerProfile;
30 import net.ktnx.mobileledger.utils.MLDB;
32 public class SplashActivity extends Activity {
34 protected void onCreate(@Nullable Bundle savedInstanceState) {
35 super.onCreate(savedInstanceState);
36 setTheme(R.style.AppTheme_default);
37 setContentView(R.layout.splash_activity_layout);
40 protected void onStart() {
43 MobileLedgerProfile.loadAllFromDB(null);
45 String profileUUID = MLDB.getOption(MLDB.OPT_PROFILE_UUID, null);
46 MobileLedgerProfile startupProfile = Data.getProfile(profileUUID);
47 if (startupProfile != null)
48 Data.setCurrentProfile(startupProfile);
50 new Handler().postDelayed(() -> {
51 Intent intent = new Intent(this, MainActivity.class);
52 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_USER_ACTION |
53 Intent.FLAG_ACTIVITY_NEW_TASK);
54 startActivity(intent);
55 overridePendingTransition(R.anim.fade_in, R.anim.dummy);