X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Factivity%2FMainActivity.java;h=641d296c2d502c28ec81e0de4f71b215031d56a7;hb=b90ee9f0732b38a4ca35265ff68ad69353330f05;hp=83b608bff321561f3b0caac9ce191fead44beeff;hpb=22f72903c1b7d827064c90b4472ff5c69ab3ba2f;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index 83b608bf..641d296c 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -1,18 +1,18 @@ /* * Copyright © 2019 Damyan Ivanov. - * This file is part of Mobile-Ledger. - * Mobile-Ledger is free software: you can distribute it and/or modify it + * This file is part of MoLe. + * MoLe 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, + * MoLe 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 . + * along with MoLe. If not, see . */ package net.ktnx.mobileledger.ui.activity; @@ -30,7 +30,6 @@ import android.support.v4.view.GravityCompat; import android.support.v4.view.ViewPager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; -import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; @@ -53,7 +52,7 @@ import java.lang.ref.WeakReference; import java.text.DateFormat; import java.util.Date; -public class MainActivity extends AppCompatActivity { +public class MainActivity extends CrashReportingActivity { DrawerLayout drawer; private FragmentManager fragmentManager; private TextView tvLastUpdate; @@ -97,8 +96,14 @@ public class MainActivity extends AppCompatActivity { if (profile == null) setTitle(R.string.app_name); else setTitle(profile.getName()); updateLastUpdateTextFromDB(); - if (profile.isPostingPermitted()) fab.show(); - else fab.hide(); + if (profile.isPostingPermitted()) { + toolbar.setSubtitle(null); + fab.show(); + } + else { + toolbar.setSubtitle(R.string.profile_subitlte_read_only); + fab.hide(); + } }); }); @@ -390,6 +395,6 @@ public class MainActivity extends AppCompatActivity { } public void fabShouldShow() { MobileLedgerProfile profile = Data.profile.get(); - if (profile.isPostingPermitted()) fab.show(); + if ((profile != null) && profile.isPostingPermitted()) fab.show(); } }