diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-03-09 20:44:45 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-03-09 20:44:45 +0100 |
commit | e3fa33a1bfca1160ae0818be8227771e125cf766 (patch) | |
tree | 94915b2a744872c3b01274879ea8087ba706c196 /src/main/java/de/pixart | |
parent | 6fb4eb97510b6e980c95daa35664c46c45f5234d (diff) |
reference support actionbar in all activities
Diffstat (limited to 'src/main/java/de/pixart')
14 files changed, 70 insertions, 65 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java index 9d51a1c1d..011c8b051 100644 --- a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java @@ -1,10 +1,10 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.StringRes; +import android.support.v7.app.ActionBar; import android.view.ActionMode; import android.view.Menu; import android.view.MenuInflater; @@ -140,7 +140,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity { Intent intent = getIntent(); @StringRes int res = intent != null ? intent.getIntExtra(EXTRA_TITLE_RES_ID, R.string.title_activity_choose_contact) : R.string.title_activity_choose_contact; - ActionBar bar = getActionBar(); + ActionBar bar = getSupportActionBar(); if (bar != null) { try { bar.setTitle(res); diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java index 21442bcd1..9efd4b22a 100644 --- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java @@ -1,6 +1,5 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; import android.app.AlertDialog; import android.app.PendingIntent; import android.content.Context; @@ -9,6 +8,7 @@ import android.content.Intent; import android.content.IntentSender.SendIntentException; import android.graphics.PorterDuff; import android.os.Bundle; +import android.support.v7.app.ActionBar; import android.util.Log; import android.view.ContextMenu; import android.view.LayoutInflater; @@ -294,9 +294,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers mDestroyButton.setOnClickListener(destroyListener); mDestroyButton.getBackground().setColorFilter(getWarningButtonColor(), PorterDuff.Mode.MULTIPLY); mConferenceType = findViewById(R.id.muc_conference_type); - if (getActionBar() != null) { - getActionBar().setHomeButtonEnabled(true); - getActionBar().setDisplayHomeAsUpEnabled(true); + if (getSupportActionBar() != null) { + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); } mEditNickButton.setOnClickListener(new OnClickListener() { @@ -600,17 +600,19 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } else { account = mConversation.getAccount().getJid().toBareJid().toString(); } - if (getActionBar() != null) { - final ActionBar ab = getActionBar(); - ab.setCustomView(R.layout.ab_title); - ab.setDisplayShowCustomEnabled(true); - TextView abtitle = findViewById(android.R.id.text1); - TextView absubtitle = findViewById(android.R.id.text2); - abtitle.setText(mConversation.getName()); - abtitle.setSelected(true); - abtitle.setClickable(false); - absubtitle.setVisibility(View.GONE); - absubtitle.setClickable(false); + if (getSupportActionBar() != null) { + final ActionBar ab = getSupportActionBar(); + if (ab != null) { + ab.setCustomView(R.layout.ab_title); + ab.setDisplayShowCustomEnabled(true); + TextView abtitle = findViewById(android.R.id.text1); + TextView absubtitle = findViewById(android.R.id.text2); + abtitle.setText(mConversation.getName()); + abtitle.setSelected(true); + abtitle.setClickable(false); + absubtitle.setVisibility(View.GONE); + absubtitle.setClickable(false); + } } ConferenceName.setText(mConversation.getName()); mAccountJid.setText(getString(R.string.using_account, account)); diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java index ca435d6a5..a9ede6729 100644 --- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java @@ -1,6 +1,5 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; @@ -14,6 +13,7 @@ import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Intents; import android.support.v4.content.ContextCompat; +import android.support.v7.app.ActionBar; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -288,9 +288,9 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp keysWrapper = findViewById(R.id.keys_wrapper); tags = findViewById(R.id.tags); mShowInactiveDevicesButton = findViewById(R.id.show_inactive_devices); - if (getActionBar() != null) { - getActionBar().setHomeButtonEnabled(true); - getActionBar().setDisplayHomeAsUpEnabled(true); + if (getSupportActionBar() != null) { + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); } mShowInactiveDevicesButton.setOnClickListener(new OnClickListener() { @Override @@ -409,17 +409,19 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp mNotifyStatusButton.setImageResource(R.drawable.ic_notifications_grey600_24dp); mNotifyStatusText.setText(R.string.notify_on_all_messages); } - if (getActionBar() != null) { - final ActionBar ab = getActionBar(); - ab.setCustomView(R.layout.ab_title); - ab.setDisplayShowCustomEnabled(true); - TextView abtitle = findViewById(android.R.id.text1); - TextView absubtitle = findViewById(android.R.id.text2); - abtitle.setText(contact.getDisplayName()); - abtitle.setSelected(true); - abtitle.setClickable(false); - absubtitle.setVisibility(View.GONE); - absubtitle.setClickable(false); + if (getSupportActionBar() != null) { + final ActionBar ab = getSupportActionBar(); + if (ab != null) { + ab.setCustomView(R.layout.ab_title); + ab.setDisplayShowCustomEnabled(true); + TextView abtitle = findViewById(android.R.id.text1); + TextView absubtitle = findViewById(android.R.id.text2); + abtitle.setText(contact.getDisplayName()); + abtitle.setSelected(true); + abtitle.setClickable(false); + absubtitle.setVisibility(View.GONE); + absubtitle.setClickable(false); + } } invalidateOptionsMenu(); diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index c94ceb44b..7c95946d8 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -1,6 +1,5 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.PendingIntent; @@ -15,6 +14,7 @@ import android.provider.Settings; import android.security.KeyChain; import android.security.KeyChainAliasCallback; import android.support.v4.content.ContextCompat; +import android.support.v7.app.ActionBar; import android.text.Editable; import android.text.TextWatcher; import android.view.Menu; @@ -688,12 +688,12 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.messageFingerprint = getIntent().getStringExtra("fingerprint"); if (!mInitMode) { this.mRegisterNew.setVisibility(View.GONE); - if (getActionBar() != null) { - getActionBar().setTitle(getString(R.string.account_details)); + if (getSupportActionBar() != null) { + getSupportActionBar().setTitle(getString(R.string.account_details)); } } else { this.mAvatar.setVisibility(View.GONE); - ActionBar ab = getActionBar(); + ActionBar ab = getSupportActionBar(); if (ab != null) { if (init && Config.MAGIC_CREATE_DOMAIN == null) { ab.setDisplayShowHomeEnabled(false); diff --git a/src/main/java/de/pixart/messenger/ui/LocationActivity.java b/src/main/java/de/pixart/messenger/ui/LocationActivity.java index 6389fa7d4..04bd03584 100644 --- a/src/main/java/de/pixart/messenger/ui/LocationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/LocationActivity.java @@ -6,10 +6,11 @@ import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; import de.pixart.messenger.Config; -public abstract class LocationActivity extends Activity implements LocationListener { +public abstract class LocationActivity extends AppCompatActivity implements LocationListener { private LocationManager locationManager; @Override diff --git a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java index 2d0d98ce7..bb65b64e0 100644 --- a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java @@ -1,12 +1,12 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.Intent; import android.os.Bundle; import android.security.KeyChain; import android.security.KeyChainAliasCallback; +import android.support.v7.app.ActionBar; import android.util.Pair; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; @@ -60,7 +60,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda accountList.clear(); accountList.addAll(xmppConnectionService.getAccounts()); } - ActionBar actionBar = getActionBar(); + ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(this.accountList.size() > 0); actionBar.setDisplayHomeAsUpEnabled(this.accountList.size() > 0); diff --git a/src/main/java/de/pixart/messenger/ui/ShareLocationActivity.java b/src/main/java/de/pixart/messenger/ui/ShareLocationActivity.java index 5a1122c7a..510135c5a 100644 --- a/src/main/java/de/pixart/messenger/ui/ShareLocationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShareLocationActivity.java @@ -41,9 +41,9 @@ public class ShareLocationActivity extends LocationActivity implements LocationL protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_share_locaction); - if (getActionBar() != null) { - getActionBar().setHomeButtonEnabled(true); - getActionBar().setDisplayHomeAsUpEnabled(true); + if (getSupportActionBar() != null) { + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); } locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); diff --git a/src/main/java/de/pixart/messenger/ui/ShareViaAccountActivity.java b/src/main/java/de/pixart/messenger/ui/ShareViaAccountActivity.java index 41d22f2a5..e7ee427db 100644 --- a/src/main/java/de/pixart/messenger/ui/ShareViaAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShareViaAccountActivity.java @@ -1,7 +1,7 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; import android.os.Bundle; +import android.support.v7.app.ActionBar; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; @@ -31,7 +31,7 @@ public class ShareViaAccountActivity extends XmppActivity { accountList.clear(); accountList.addAll(xmppConnectionService.getAccounts()); } - ActionBar actionBar = getActionBar(); + ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(this.accountList.size() > 0); actionBar.setDisplayHomeAsUpEnabled(this.accountList.size() > 0); diff --git a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java index 15e7b7267..64671c1f2 100644 --- a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java @@ -170,9 +170,9 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer super.onCreate(savedInstanceState); boolean useBundledEmoji = getPreferences().getBoolean(USE_BUNDLED_EMOJIS, getResources().getBoolean(R.bool.use_bundled_emoji)); new EmojiService(this).init(useBundledEmoji); - if (getActionBar() != null) { - getActionBar().setDisplayHomeAsUpEnabled(false); - getActionBar().setHomeButtonEnabled(false); + if (getSupportActionBar() != null) { + getSupportActionBar().setDisplayHomeAsUpEnabled(false); + getSupportActionBar().setHomeButtonEnabled(false); } setContentView(R.layout.share_with); diff --git a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java index 2f844e107..2661589d8 100644 --- a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java @@ -1,6 +1,5 @@ package de.pixart.messenger.ui; -import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; @@ -12,6 +11,7 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; +import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.view.Menu; import android.view.MenuInflater; @@ -30,7 +30,7 @@ import de.pixart.messenger.services.EmojiService; import static de.pixart.messenger.ui.SettingsActivity.USE_BUNDLED_EMOJIS; -public class ShowLocationActivity extends Activity { +public class ShowLocationActivity extends AppCompatActivity { private Location location; private String mLocationName; @@ -39,9 +39,9 @@ public class ShowLocationActivity extends Activity { super.onCreate(savedInstanceState); boolean useBundledEmoji = getPreferences().getBoolean(USE_BUNDLED_EMOJIS, getResources().getBoolean(R.bool.use_bundled_emoji)); new EmojiService(this).init(useBundledEmoji); - if (getActionBar() != null) { - getActionBar().setHomeButtonEnabled(true); - getActionBar().setDisplayHomeAsUpEnabled(true); + if (getSupportActionBar() != null) { + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); } setContentView(R.layout.activity_show_locaction); diff --git a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java index 853b1b2a4..48a9125ce 100644 --- a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java +++ b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java @@ -1,8 +1,8 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; import android.content.Intent; import android.os.Bundle; +import android.support.v7.app.ActionBar; import android.util.Log; import android.view.Gravity; import android.view.Menu; @@ -109,9 +109,9 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat mSaveButton.setOnClickListener(mSaveButtonListener); - if (getActionBar() != null) { - getActionBar().setHomeButtonEnabled(true); - getActionBar().setDisplayHomeAsUpEnabled(true); + if (getSupportActionBar() != null) { + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); } if (savedInstanceState != null) { @@ -135,7 +135,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat private void showCameraToast() { mUseCameraHintToast = Toast.makeText(this,R.string.use_camera_icon_to_scan_barcode,Toast.LENGTH_LONG); - ActionBar actionBar = getActionBar(); + ActionBar actionBar = getSupportActionBar(); mUseCameraHintToast.setGravity(Gravity.TOP | Gravity.END, 0 ,actionBar == null ? 0 : actionBar.getHeight()); mUseCameraHintToast.show(); } diff --git a/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java b/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java index a64f39a03..34d6d5970 100644 --- a/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java +++ b/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java @@ -1,10 +1,10 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; +import android.support.v7.app.ActionBar; import android.view.Menu; import android.view.View; import android.widget.Button; @@ -251,7 +251,7 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer protected void updateView() { if (this.mConversation != null && this.mConversation.hasValidOtrSession()) { - final ActionBar actionBar = getActionBar(); + final ActionBar actionBar = getSupportActionBar(); this.mVerificationExplain.setText(R.string.no_otr_session_found); invalidateOptionsMenu(); switch (this.mode) { diff --git a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java index 0e84d1d64..1fcfb307c 100644 --- a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java +++ b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java @@ -1,8 +1,6 @@ package de.pixart.messenger.ui; import android.Manifest; -import android.app.ActionBar; -import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; @@ -13,6 +11,8 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.os.Build; import android.os.Bundle; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -79,7 +79,7 @@ public class WelcomeActivity extends XmppActivity { } super.onCreate(savedInstanceState); setContentView(R.layout.welcome); - final ActionBar ab = getActionBar(); + final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayShowHomeEnabled(false); ab.setDisplayHomeAsUpEnabled(false); @@ -336,7 +336,7 @@ public class WelcomeActivity extends XmppActivity { } } - public static void launch(Activity activity) { + public static void launch(AppCompatActivity activity) { Intent intent = new Intent(activity, WelcomeActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); activity.startActivity(intent); diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 3881b3569..f5fc20265 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -3,7 +3,6 @@ package de.pixart.messenger.ui; import android.Manifest; import android.annotation.SuppressLint; import android.annotation.TargetApi; -import android.app.ActionBar; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.PendingIntent; @@ -38,6 +37,7 @@ import android.os.SystemClock; import android.preference.PreferenceManager; import android.provider.Settings; import android.support.v4.content.ContextCompat; +import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.text.InputType; import android.util.DisplayMetrics; @@ -437,7 +437,7 @@ public abstract class XmppActivity extends AppCompatActivity { setTheme(this.mTheme); this.mUsingEnterKey = usingEnterKey(); mUseSubject = getPreferences().getBoolean("use_subject", getResources().getBoolean(R.bool.use_subject)); - final ActionBar ab = getActionBar(); + final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayHomeAsUpEnabled(true); } |