reference support actionbar in all activities
This commit is contained in:
parent
6e89427d5e
commit
fe4ebb6244
|
@ -1,10 +1,10 @@
|
|||
package eu.siacs.conversations.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);
|
||||
|
|
|
@ -245,9 +245,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
|||
mInviteButton = (Button) findViewById(R.id.invite);
|
||||
mInviteButton.setOnClickListener(inviteListener);
|
||||
mConferenceType = (TextView) 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() {
|
||||
|
||||
|
|
|
@ -224,9 +224,9 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
|
|||
keysWrapper = (LinearLayout) findViewById(R.id.keys_wrapper);
|
||||
tags = (FlowLayout) findViewById(R.id.tags);
|
||||
mShowInactiveDevicesButton = (Button) 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
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package eu.siacs.conversations.ui;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.PendingIntent;
|
||||
|
@ -15,8 +14,8 @@ 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.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -653,12 +652,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);
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package eu.siacs.conversations.ui;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
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;
|
||||
|
@ -62,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);
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package eu.siacs.conversations.ui;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -33,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);
|
||||
|
|
|
@ -168,9 +168,9 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
new EmojiService(this).init();
|
||||
if (getActionBar() != null) {
|
||||
getActionBar().setDisplayHomeAsUpEnabled(false);
|
||||
getActionBar().setHomeButtonEnabled(false);
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
||||
getSupportActionBar().setHomeButtonEnabled(false);
|
||||
}
|
||||
|
||||
setContentView(R.layout.share_with);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package eu.siacs.conversations.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;
|
||||
|
@ -107,9 +107,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) {
|
||||
|
@ -133,7 +133,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();
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package eu.siacs.conversations.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) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package eu.siacs.conversations.ui;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.Button;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -50,7 +50,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);
|
||||
|
@ -94,7 +94,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);
|
||||
|
|
|
@ -3,8 +3,6 @@ package eu.siacs.conversations.ui;
|
|||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.PendingIntent;
|
||||
|
@ -38,6 +36,7 @@ import android.os.PowerManager;
|
|||
import android.os.SystemClock;
|
||||
import android.preference.PreferenceManager;
|
||||
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;
|
||||
|
@ -406,7 +405,7 @@ public abstract class XmppActivity extends AppCompatActivity {
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue