fixed npe for the rare case that user has disabled his action bar
This commit is contained in:
parent
b9f920ebf6
commit
f765dc8423
|
@ -18,6 +18,7 @@ import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
|
import android.app.ActionBar;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
@ -157,7 +158,7 @@ public class ConversationActivity extends XmppActivity {
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
view = (View) inflater.inflate(
|
view = (View) inflater.inflate(
|
||||||
R.layout.conversation_list_row, null);
|
R.layout.conversation_list_row, parent,false);
|
||||||
}
|
}
|
||||||
Conversation conv;
|
Conversation conv;
|
||||||
if (conversationList.size() > position) {
|
if (conversationList.size() > position) {
|
||||||
|
@ -261,9 +262,12 @@ public class ConversationActivity extends XmppActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onPanelOpened(View arg0) {
|
public void onPanelOpened(View arg0) {
|
||||||
paneShouldBeOpen = true;
|
paneShouldBeOpen = true;
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(false);
|
ActionBar ab = getActionBar();
|
||||||
getActionBar().setHomeButtonEnabled(false);
|
if (ab!=null) {
|
||||||
getActionBar().setTitle(R.string.app_name);
|
ab.setDisplayHomeAsUpEnabled(false);
|
||||||
|
ab.setHomeButtonEnabled(false);
|
||||||
|
ab.setTitle(R.string.app_name);
|
||||||
|
}
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
hideKeyboard();
|
hideKeyboard();
|
||||||
}
|
}
|
||||||
|
@ -273,10 +277,13 @@ public class ConversationActivity extends XmppActivity {
|
||||||
paneShouldBeOpen = false;
|
paneShouldBeOpen = false;
|
||||||
if ((conversationList.size() > 0)
|
if ((conversationList.size() > 0)
|
||||||
&& (getSelectedConversation() != null)) {
|
&& (getSelectedConversation() != null)) {
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
ActionBar ab = getActionBar();
|
||||||
getActionBar().setHomeButtonEnabled(true);
|
if (ab!=null) {
|
||||||
getActionBar().setTitle(
|
ab.setDisplayHomeAsUpEnabled(true);
|
||||||
|
ab.setHomeButtonEnabled(true);
|
||||||
|
ab.setTitle(
|
||||||
getSelectedConversation().getName(useSubject));
|
getSelectedConversation().getName(useSubject));
|
||||||
|
}
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
if (!getSelectedConversation().isRead()) {
|
if (!getSelectedConversation().isRead()) {
|
||||||
xmppConnectionService
|
xmppConnectionService
|
||||||
|
|
Loading…
Reference in a new issue