import net.ktnx.mobileledger.ui.FabManager;
import net.ktnx.mobileledger.ui.QR;
import net.ktnx.mobileledger.ui.activity.ProfileThemedActivity;
+import net.ktnx.mobileledger.ui.activity.SplashActivity;
import net.ktnx.mobileledger.ui.templates.TemplatesActivity;
import net.ktnx.mobileledger.utils.Logger;
import net.ktnx.mobileledger.utils.Misc;
b = ActivityNewTransactionBinding.inflate(getLayoutInflater(), null, false);
setContentView(b.getRoot());
setSupportActionBar(b.toolbar);
- Data.observeProfile(this,
- mobileLedgerProfile -> b.toolbar.setSubtitle(mobileLedgerProfile.getName()));
+ Data.observeProfile(this, profile -> {
+ if (profile == null) {
+ Logger.debug("new-t-act", "no active profile. Redirecting to SplashActivity");
+ Intent intent = new Intent(this, SplashActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent);
+ finish();
+ }
+ else
+ b.toolbar.setSubtitle(profile.getName());
+ });
NavHostFragment navHostFragment = (NavHostFragment) Objects.requireNonNull(
getSupportFragmentManager().findFragmentById(R.id.new_transaction_nav));
outState.putBoolean("keep", true);
final NewTransactionModel.FocusInfo focusInfo = viewModel.getFocusInfo()
.getValue();
- final int focusedItem = focusInfo.position;
- if (focusedItem >= 0)
- outState.putInt("focused-item", focusedItem);
- outState.putString("focused-element", focusInfo.element.toString());
+ if (focusInfo != null) {
+ final int focusedItem = focusInfo.position;
+ if (focusedItem >= 0)
+ outState.putInt("focused-item", focusedItem);
+ outState.putString("focused-element", focusInfo.element.toString());
+ }
}
@Override
private final AtomicInteger busyCounter = new AtomicInteger(0);
private final MutableLiveData<Boolean> busyFlag = new InertMutableLiveData<>(false);
private final Observer<Profile> profileObserver = profile -> {
- showCurrency.postValue(profile.getShowCommodityByDefault());
- showComments.postValue(profile.getShowCommentsByDefault());
+ if (profile != null) {
+ showCurrency.postValue(profile.getShowCommodityByDefault());
+ showComments.postValue(profile.getShowCommentsByDefault());
+ }
};
private final MutableLiveData<FocusInfo> focusInfo = new MutableLiveData<>();
private boolean observingDataProfile;
<string name="restore_explanation">Зареждане на настройките на профилите и макетите от резервно копие, създадено по-рано. Съществуващите записи не се променят. Ако искате да върнете някой запис (профил или макет) към състоянитето от резервното копие, първо го изтрийте.</string>
<string name="config_restored">Успешно възстановяване на настройките</string>
<string name="no_profile_restore_hint">… а може и да възстановите настройките от резервно копие</string>
+ <string name="profile_not_available">Недостъпен профил</string>
</resources>
<string name="backups_activity_label">Backup / Restore</string>
<string name="config_restored">Configuration restored successfully</string>
<string name="no_profile_restore_hint">… or, you may restore from backup</string>
+ <string name="profile_not_available">Profile not available</string>
</resources>