Commit 3b651f6e authored by Grigory Fedorov's avatar Grigory Fedorov

ContactTitleActionBarInflater - used in FingerprintViewer and QuestionViewer.

parent 825de168
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
*/ */
package com.xabber.android.ui; package com.xabber.android.ui;
import java.util.Collection;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
...@@ -49,11 +47,14 @@ import com.xabber.android.ui.dialog.ConfirmDialogListener; ...@@ -49,11 +47,14 @@ import com.xabber.android.ui.dialog.ConfirmDialogListener;
import com.xabber.android.ui.dialog.DialogBuilder; import com.xabber.android.ui.dialog.DialogBuilder;
import com.xabber.android.ui.dialog.NotificationDialogBuilder; import com.xabber.android.ui.dialog.NotificationDialogBuilder;
import com.xabber.android.ui.dialog.NotificationDialogListener; import com.xabber.android.ui.dialog.NotificationDialogListener;
import com.xabber.android.ui.helper.ContactTitleActionBarInflater;
import com.xabber.android.ui.helper.ContactTitleInflater; import com.xabber.android.ui.helper.ContactTitleInflater;
import com.xabber.android.ui.helper.ManagedActivity; import com.xabber.android.ui.helper.ManagedActivity;
import com.xabber.androiddev.R; import com.xabber.androiddev.R;
import com.xabber.xmpp.address.Jid; import com.xabber.xmpp.address.Jid;
import java.util.Collection;
public class FingerprintViewer extends ManagedActivity implements public class FingerprintViewer extends ManagedActivity implements
OnCheckedChangeListener, OnAccountChangedListener, OnCheckedChangeListener, OnAccountChangedListener,
OnContactChangedListener, OnClickListener, ConfirmDialogListener, OnContactChangedListener, OnClickListener, ConfirmDialogListener,
...@@ -82,6 +83,8 @@ public class FingerprintViewer extends ManagedActivity implements ...@@ -82,6 +83,8 @@ public class FingerprintViewer extends ManagedActivity implements
*/ */
private IntentIntegrator integrator; private IntentIntegrator integrator;
ContactTitleActionBarInflater contactTitleActionBarInflater;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -120,7 +123,8 @@ public class FingerprintViewer extends ManagedActivity implements ...@@ -120,7 +123,8 @@ public class FingerprintViewer extends ManagedActivity implements
copyView.setOnClickListener(this); copyView.setOnClickListener(this);
isUpdating = false; isUpdating = false;
getSupportActionBar().setDisplayHomeAsUpEnabled(true); contactTitleActionBarInflater = new ContactTitleActionBarInflater(this);
contactTitleActionBarInflater.setActionBarView();
} }
@Override @Override
...@@ -298,6 +302,9 @@ public class FingerprintViewer extends ManagedActivity implements ...@@ -298,6 +302,9 @@ public class FingerprintViewer extends ManagedActivity implements
((TextView) findViewById(R.id.otr_local_fingerprint)) ((TextView) findViewById(R.id.otr_local_fingerprint))
.setText(localFingerprint == null ? getString(R.string.unknown) .setText(localFingerprint == null ? getString(R.string.unknown)
: CertificateManager.showFingerprint(localFingerprint)); : CertificateManager.showFingerprint(localFingerprint));
contactTitleActionBarInflater.update(abstractContact);
isUpdating = false; isUpdating = false;
} }
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
*/ */
package com.xabber.android.ui; package com.xabber.android.ui;
import java.util.Collection;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
...@@ -35,11 +33,14 @@ import com.xabber.android.data.intent.EntityIntentBuilder; ...@@ -35,11 +33,14 @@ import com.xabber.android.data.intent.EntityIntentBuilder;
import com.xabber.android.data.roster.AbstractContact; import com.xabber.android.data.roster.AbstractContact;
import com.xabber.android.data.roster.OnContactChangedListener; import com.xabber.android.data.roster.OnContactChangedListener;
import com.xabber.android.data.roster.RosterManager; import com.xabber.android.data.roster.RosterManager;
import com.xabber.android.ui.helper.ContactTitleActionBarInflater;
import com.xabber.android.ui.helper.ContactTitleInflater; import com.xabber.android.ui.helper.ContactTitleInflater;
import com.xabber.android.ui.helper.ManagedActivity; import com.xabber.android.ui.helper.ManagedActivity;
import com.xabber.androiddev.R; import com.xabber.androiddev.R;
import com.xabber.xmpp.address.Jid; import com.xabber.xmpp.address.Jid;
import java.util.Collection;
/** /**
* Represents OTR question. * Represents OTR question.
* *
...@@ -58,6 +59,8 @@ public class QuestionViewer extends ManagedActivity implements ...@@ -58,6 +59,8 @@ public class QuestionViewer extends ManagedActivity implements
private boolean answerRequest; private boolean answerRequest;
private EditText questionView; private EditText questionView;
ContactTitleActionBarInflater contactTitleActionBarInflater;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -98,7 +101,8 @@ public class QuestionViewer extends ManagedActivity implements ...@@ -98,7 +101,8 @@ public class QuestionViewer extends ManagedActivity implements
findViewById(R.id.cancel).setOnClickListener(this); findViewById(R.id.cancel).setOnClickListener(this);
findViewById(R.id.send).setOnClickListener(this); findViewById(R.id.send).setOnClickListener(this);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); contactTitleActionBarInflater = new ContactTitleActionBarInflater(this);
contactTitleActionBarInflater.setActionBarView();
} }
@Override @Override
...@@ -173,6 +177,8 @@ public class QuestionViewer extends ManagedActivity implements ...@@ -173,6 +177,8 @@ public class QuestionViewer extends ManagedActivity implements
.getBestContact(account, user); .getBestContact(account, user);
ContactTitleInflater.updateTitle(findViewById(R.id.title), this, ContactTitleInflater.updateTitle(findViewById(R.id.title), this,
abstractContact); abstractContact);
contactTitleActionBarInflater.update(abstractContact);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment