Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
xabber-android
Commits
920eb760
Commit
920eb760
authored
Feb 18, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FingerprintViewer and QuestionViewer: old contact title removed.
Light refactoring.
parent
3b651f6e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
102 deletions
+71
-102
SMProgress.java
...ava/com/xabber/android/data/extension/otr/SMProgress.java
+1
-1
FingerprintViewer.java
...rc/main/java/com/xabber/android/ui/FingerprintViewer.java
+42
-56
QuestionViewer.java
app/src/main/java/com/xabber/android/ui/QuestionViewer.java
+28
-39
fingerprint_viewer.xml
app/src/main/res/layout/fingerprint_viewer.xml
+0
-2
question_viewer.xml
app/src/main/res/layout/question_viewer.xml
+0
-2
secret_viewer.xml
app/src/main/res/layout/secret_viewer.xml
+0
-2
No files found.
app/src/main/java/com/xabber/android/data/extension/otr/SMProgress.java
View file @
920eb760
...
@@ -31,7 +31,7 @@ public class SMProgress extends BaseEntity implements EntityNotificationItem {
...
@@ -31,7 +31,7 @@ public class SMProgress extends BaseEntity implements EntityNotificationItem {
@Override
@Override
public
Intent
getIntent
()
{
public
Intent
getIntent
()
{
return
QuestionViewer
.
createCanelIntent
(
return
QuestionViewer
.
createCan
c
elIntent
(
Application
.
getInstance
(),
account
,
user
);
Application
.
getInstance
(),
account
,
user
);
}
}
...
...
app/src/main/java/com/xabber/android/ui/FingerprintViewer.java
View file @
920eb760
...
@@ -48,7 +48,6 @@ import com.xabber.android.ui.dialog.DialogBuilder;
...
@@ -48,7 +48,6 @@ 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.ContactTitleActionBarInflater
;
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
;
...
@@ -88,30 +87,26 @@ public class FingerprintViewer extends ManagedActivity implements
...
@@ -88,30 +87,26 @@ public class FingerprintViewer extends ManagedActivity implements
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
if
(
isFinishing
())
if
(
isFinishing
())
{
return
;
return
;
}
setContentView
(
R
.
layout
.
fingerprint_viewer
);
setContentView
(
R
.
layout
.
fingerprint_viewer
);
integrator
=
new
IntentIntegrator
(
this
);
integrator
=
new
IntentIntegrator
(
this
);
Intent
intent
=
getIntent
();
Intent
intent
=
getIntent
();
account
=
getAccount
(
intent
);
account
=
getAccount
(
intent
);
user
=
getUser
(
intent
);
user
=
getUser
(
intent
);
if
(
AccountManager
.
getInstance
().
getAccount
(
account
)
==
null
if
(
AccountManager
.
getInstance
().
getAccount
(
account
)
==
null
||
user
==
null
)
{
||
user
==
null
)
{
Application
.
getInstance
().
onError
(
R
.
string
.
ENTRY_IS_NOT_FOUND
);
Application
.
getInstance
().
onError
(
R
.
string
.
ENTRY_IS_NOT_FOUND
);
finish
();
finish
();
return
;
return
;
}
}
if
(
savedInstanceState
!=
null
)
{
if
(
savedInstanceState
!=
null
)
{
remoteFingerprint
=
savedInstanceState
remoteFingerprint
=
savedInstanceState
.
getString
(
SAVED_REMOTE_FINGERPRINT
);
.
getString
(
SAVED_REMOTE_FINGERPRINT
);
localFingerprint
=
savedInstanceState
.
getString
(
SAVED_LOCAL_FINGERPRINT
);
localFingerprint
=
savedInstanceState
.
getString
(
SAVED_LOCAL_FINGERPRINT
);
}
else
{
}
else
{
remoteFingerprint
=
OTRManager
.
getInstance
().
getRemoteFingerprint
(
remoteFingerprint
=
OTRManager
.
getInstance
().
getRemoteFingerprint
(
account
,
user
);
account
,
user
);
localFingerprint
=
OTRManager
.
getInstance
().
getLocalFingerprint
(
account
);
localFingerprint
=
OTRManager
.
getInstance
().
getLocalFingerprint
(
account
);
}
}
verifiedView
=
(
CheckBox
)
findViewById
(
R
.
id
.
verified
);
verifiedView
=
(
CheckBox
)
findViewById
(
R
.
id
.
verified
);
verifiedView
.
setOnCheckedChangeListener
(
this
);
verifiedView
.
setOnCheckedChangeListener
(
this
);
...
@@ -130,20 +125,16 @@ public class FingerprintViewer extends ManagedActivity implements
...
@@ -130,20 +125,16 @@ public class FingerprintViewer extends ManagedActivity implements
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
this
);
Application
.
getInstance
().
addUIListener
(
OnContactChangedListener
.
class
,
this
);
Application
.
getInstance
().
addUIListener
(
OnContactChangedListener
.
class
,
this
);
update
();
update
();
}
}
@Override
@Override
protected
void
onPause
()
{
protected
void
onPause
()
{
super
.
onPause
();
super
.
onPause
();
Application
.
getInstance
().
removeUIListener
(
Application
.
getInstance
().
removeUIListener
(
OnAccountChangedListener
.
class
,
this
);
OnAccountChangedListener
.
class
,
this
);
Application
.
getInstance
().
removeUIListener
(
OnContactChangedListener
.
class
,
this
);
Application
.
getInstance
().
removeUIListener
(
OnContactChangedListener
.
class
,
this
);
}
}
@Override
@Override
...
@@ -169,36 +160,39 @@ public class FingerprintViewer extends ManagedActivity implements
...
@@ -169,36 +160,39 @@ public class FingerprintViewer extends ManagedActivity implements
String
code
=
scanResult
.
getContents
();
String
code
=
scanResult
.
getContents
();
boolean
equals
=
code
!=
null
&&
code
.
equals
(
remoteFingerprint
);
boolean
equals
=
code
!=
null
&&
code
.
equals
(
remoteFingerprint
);
verifiedView
.
setChecked
(
equals
);
verifiedView
.
setChecked
(
equals
);
if
(
equals
)
if
(
equals
)
{
showDialog
(
R
.
string
.
action_otr_smp_verified
);
showDialog
(
R
.
string
.
action_otr_smp_verified
);
else
}
else
{
showDialog
(
R
.
string
.
action_otr_smp_unverified
);
showDialog
(
R
.
string
.
action_otr_smp_unverified
);
}
}
}
}
}
@Override
@Override
public
void
onContactsChanged
(
Collection
<
BaseEntity
>
entities
)
{
public
void
onContactsChanged
(
Collection
<
BaseEntity
>
entities
)
{
String
thisBareAddress
=
Jid
.
getBareAddress
(
user
);
String
thisBareAddress
=
Jid
.
getBareAddress
(
user
);
for
(
BaseEntity
entity
:
entities
)
for
(
BaseEntity
entity
:
entities
)
{
if
(
entity
.
equals
(
account
,
thisBareAddress
))
{
if
(
entity
.
equals
(
account
,
thisBareAddress
))
{
update
();
update
();
break
;
break
;
}
}
}
}
}
@Override
@Override
public
void
onAccountsChanged
(
Collection
<
String
>
accounts
)
{
public
void
onAccountsChanged
(
Collection
<
String
>
accounts
)
{
if
(
accounts
.
contains
(
account
))
if
(
accounts
.
contains
(
account
))
{
update
();
update
();
}
}
}
@Override
@Override
public
void
onCheckedChanged
(
CompoundButton
buttonView
,
boolean
isChecked
)
{
public
void
onCheckedChanged
(
CompoundButton
buttonView
,
boolean
isChecked
)
{
switch
(
buttonView
.
getId
())
{
switch
(
buttonView
.
getId
())
{
case
R
.
id
.
verified
:
case
R
.
id
.
verified
:
if
(!
isUpdating
)
if
(!
isUpdating
)
{
OTRManager
.
getInstance
().
setVerify
(
account
,
user
,
OTRManager
.
getInstance
().
setVerify
(
account
,
user
,
remoteFingerprint
,
isChecked
);
remoteFingerprint
,
isChecked
);
}
break
;
break
;
default
:
default
:
break
;
break
;
...
@@ -211,8 +205,9 @@ public class FingerprintViewer extends ManagedActivity implements
...
@@ -211,8 +205,9 @@ public class FingerprintViewer extends ManagedActivity implements
* @param alertDialog
* @param alertDialog
*/
*/
private
void
wrapInstallDialog
(
AlertDialog
alertDialog
)
{
private
void
wrapInstallDialog
(
AlertDialog
alertDialog
)
{
if
(
alertDialog
==
null
)
if
(
alertDialog
==
null
)
{
return
;
return
;
}
alertDialog
.
dismiss
();
alertDialog
.
dismiss
();
showDialog
(
R
.
string
.
zxing_install_message
);
showDialog
(
R
.
string
.
zxing_install_message
);
}
}
...
@@ -221,16 +216,14 @@ public class FingerprintViewer extends ManagedActivity implements
...
@@ -221,16 +216,14 @@ public class FingerprintViewer extends ManagedActivity implements
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
switch
(
view
.
getId
())
{
switch
(
view
.
getId
())
{
case
R
.
id
.
scan
:
case
R
.
id
.
scan
:
wrapInstallDialog
(
integrator
wrapInstallDialog
(
integrator
.
initiateScan
(
IntentIntegrator
.
QR_CODE_TYPES
));
.
initiateScan
(
IntentIntegrator
.
QR_CODE_TYPES
));
break
;
break
;
case
R
.
id
.
show
:
case
R
.
id
.
show
:
wrapInstallDialog
(
integrator
.
shareText
(
localFingerprint
));
wrapInstallDialog
(
integrator
.
shareText
(
localFingerprint
));
break
;
break
;
case
R
.
id
.
copy
:
case
R
.
id
.
copy
:
((
ClipboardManager
)
getSystemService
(
CLIPBOARD_SERVICE
))
((
ClipboardManager
)
getSystemService
(
CLIPBOARD_SERVICE
))
.
setText
(((
TextView
)
findViewById
(
R
.
id
.
otr_local_fingerprint
))
.
setText
(((
TextView
)
findViewById
(
R
.
id
.
otr_local_fingerprint
)).
getText
());
.
getText
());
break
;
break
;
default
:
default
:
break
;
break
;
...
@@ -241,17 +234,17 @@ public class FingerprintViewer extends ManagedActivity implements
...
@@ -241,17 +234,17 @@ public class FingerprintViewer extends ManagedActivity implements
protected
Dialog
onCreateDialog
(
int
id
)
{
protected
Dialog
onCreateDialog
(
int
id
)
{
switch
(
id
)
{
switch
(
id
)
{
case
R
.
string
.
zxing_install_message
:
case
R
.
string
.
zxing_install_message
:
return
new
ConfirmDialogBuilder
(
this
,
id
,
this
)
.
setMessage
(
return
new
ConfirmDialogBuilder
(
this
,
id
,
this
)
R
.
string
.
zxing_install_message
).
create
();
.
setMessage
(
R
.
string
.
zxing_install_message
).
create
();
case
R
.
string
.
zxing_install_fail
:
case
R
.
string
.
zxing_install_fail
:
return
new
NotificationDialogBuilder
(
this
,
id
,
this
)
.
setMessage
(
return
new
NotificationDialogBuilder
(
this
,
id
,
this
)
R
.
string
.
zxing_install_fail
).
create
();
.
setMessage
(
R
.
string
.
zxing_install_fail
).
create
();
case
R
.
string
.
action_otr_smp_verified
:
case
R
.
string
.
action_otr_smp_verified
:
return
new
NotificationDialogBuilder
(
this
,
id
,
this
)
.
setMessage
(
return
new
NotificationDialogBuilder
(
this
,
id
,
this
)
R
.
string
.
action_otr_smp_verified
).
create
();
.
setMessage
(
R
.
string
.
action_otr_smp_verified
).
create
();
case
R
.
string
.
action_otr_smp_unverified
:
case
R
.
string
.
action_otr_smp_unverified
:
return
new
NotificationDialogBuilder
(
this
,
id
,
this
)
.
setMessage
(
return
new
NotificationDialogBuilder
(
this
,
id
,
this
)
R
.
string
.
action_otr_smp_unverified
).
create
();
.
setMessage
(
R
.
string
.
action_otr_smp_unverified
).
create
();
default
:
default
:
return
super
.
onCreateDialog
(
id
);
return
super
.
onCreateDialog
(
id
);
}
}
...
@@ -261,8 +254,7 @@ public class FingerprintViewer extends ManagedActivity implements
...
@@ -261,8 +254,7 @@ public class FingerprintViewer extends ManagedActivity implements
public
void
onAccept
(
DialogBuilder
dialogBuilder
)
{
public
void
onAccept
(
DialogBuilder
dialogBuilder
)
{
switch
(
dialogBuilder
.
getDialogId
())
{
switch
(
dialogBuilder
.
getDialogId
())
{
case
R
.
string
.
zxing_install_message
:
case
R
.
string
.
zxing_install_message
:
Uri
uri
=
Uri
.
parse
(
"market://details?id="
Uri
uri
=
Uri
.
parse
(
"market://details?id="
+
IntentIntegrator
.
BS_PACKAGE
);
+
IntentIntegrator
.
BS_PACKAGE
);
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
uri
);
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
uri
);
try
{
try
{
startActivity
(
intent
);
startActivity
(
intent
);
...
@@ -286,30 +278,24 @@ public class FingerprintViewer extends ManagedActivity implements
...
@@ -286,30 +278,24 @@ public class FingerprintViewer extends ManagedActivity implements
private
void
update
()
{
private
void
update
()
{
isUpdating
=
true
;
isUpdating
=
true
;
AbstractContact
abstractContact
=
RosterManager
.
getInstance
()
AbstractContact
abstractContact
=
RosterManager
.
getInstance
().
getBestContact
(
account
,
user
);
.
getBestContact
(
account
,
user
);
ContactTitleInflater
.
updateTitle
(
findViewById
(
R
.
id
.
title
),
this
,
verifiedView
.
setChecked
(
OTRManager
.
getInstance
().
isVerified
(
account
,
user
));
abstractContact
);
verifiedView
.
setChecked
(
OTRManager
.
getInstance
().
isVerified
(
account
,
user
));
scanView
.
setEnabled
(
remoteFingerprint
!=
null
);
scanView
.
setEnabled
(
remoteFingerprint
!=
null
);
verifiedView
.
setEnabled
(
remoteFingerprint
!=
null
);
verifiedView
.
setEnabled
(
remoteFingerprint
!=
null
);
((
TextView
)
findViewById
(
R
.
id
.
otr_remote_fingerprint
))
((
TextView
)
findViewById
(
R
.
id
.
otr_remote_fingerprint
)).
setText
(
.
setText
(
remoteFingerprint
==
null
?
getString
(
R
.
string
.
unknown
)
remoteFingerprint
==
null
?
getString
(
R
.
string
.
unknown
)
:
CertificateManager
.
showFingerprint
(
remoteFingerprint
));
:
CertificateManager
.
showFingerprint
(
remoteFingerprint
));
showView
.
setEnabled
(
localFingerprint
!=
null
);
showView
.
setEnabled
(
localFingerprint
!=
null
);
copyView
.
setEnabled
(
localFingerprint
!=
null
);
copyView
.
setEnabled
(
localFingerprint
!=
null
);
((
TextView
)
findViewById
(
R
.
id
.
otr_local_fingerprint
))
((
TextView
)
findViewById
(
R
.
id
.
otr_local_fingerprint
)).
setText
(
.
setText
(
localFingerprint
==
null
?
getString
(
R
.
string
.
unknown
)
localFingerprint
==
null
?
getString
(
R
.
string
.
unknown
)
:
CertificateManager
.
showFingerprint
(
localFingerprint
));
:
CertificateManager
.
showFingerprint
(
localFingerprint
));
contactTitleActionBarInflater
.
update
(
abstractContact
);
contactTitleActionBarInflater
.
update
(
abstractContact
);
isUpdating
=
false
;
isUpdating
=
false
;
}
}
public
static
Intent
createIntent
(
Context
context
,
String
account
,
public
static
Intent
createIntent
(
Context
context
,
String
account
,
String
user
)
{
String
user
)
{
return
new
EntityIntentBuilder
(
context
,
FingerprintViewer
.
class
)
return
new
EntityIntentBuilder
(
context
,
FingerprintViewer
.
class
)
.
setAccount
(
account
).
setUser
(
user
).
build
();
.
setAccount
(
account
).
setUser
(
user
).
build
();
}
}
...
...
app/src/main/java/com/xabber/android/ui/QuestionViewer.java
View file @
920eb760
...
@@ -34,7 +34,6 @@ import com.xabber.android.data.roster.AbstractContact;
...
@@ -34,7 +34,6 @@ 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.ContactTitleActionBarInflater
;
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
;
...
@@ -64,14 +63,14 @@ public class QuestionViewer extends ManagedActivity implements
...
@@ -64,14 +63,14 @@ public class QuestionViewer extends ManagedActivity implements
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
if
(
isFinishing
())
if
(
isFinishing
())
{
return
;
return
;
}
Intent
intent
=
getIntent
();
Intent
intent
=
getIntent
();
account
=
QuestionViewer
.
getAccount
(
intent
);
account
=
QuestionViewer
.
getAccount
(
intent
);
user
=
QuestionViewer
.
getUser
(
intent
);
user
=
QuestionViewer
.
getUser
(
intent
);
if
(
AccountManager
.
getInstance
().
getAccount
(
account
)
==
null
if
(
AccountManager
.
getInstance
().
getAccount
(
account
)
==
null
||
user
==
null
)
{
||
user
==
null
)
{
Application
.
getInstance
().
onError
(
R
.
string
.
ENTRY_IS_NOT_FOUND
);
Application
.
getInstance
().
onError
(
R
.
string
.
ENTRY_IS_NOT_FOUND
);
finish
();
finish
();
return
;
return
;
...
@@ -86,18 +85,19 @@ public class QuestionViewer extends ManagedActivity implements
...
@@ -86,18 +85,19 @@ public class QuestionViewer extends ManagedActivity implements
return
;
return
;
}
}
showQuestion
=
intent
.
getBooleanExtra
(
EXTRA_FIELD_SHOW_QUESTION
,
true
);
showQuestion
=
intent
.
getBooleanExtra
(
EXTRA_FIELD_SHOW_QUESTION
,
true
);
answerRequest
=
intent
.
getBooleanExtra
(
EXTRA_FIELD_ANSWER_REQUEST
,
answerRequest
=
intent
.
getBooleanExtra
(
EXTRA_FIELD_ANSWER_REQUEST
,
false
);
false
);
if
(
showQuestion
)
{
if
(
showQuestion
)
{
setContentView
(
R
.
layout
.
question_viewer
);
setContentView
(
R
.
layout
.
question_viewer
);
questionView
=
(
EditText
)
findViewById
(
R
.
id
.
question
);
questionView
=
(
EditText
)
findViewById
(
R
.
id
.
question
);
questionView
.
setEnabled
(!
answerRequest
);
questionView
.
setEnabled
(!
answerRequest
);
if
(
answerRequest
)
if
(
answerRequest
)
{
questionView
.
setText
(
intent
.
getStringExtra
(
Intent
.
EXTRA_TEXT
));
questionView
.
setText
(
intent
.
getStringExtra
(
Intent
.
EXTRA_TEXT
));
else
}
else
{
findViewById
(
R
.
id
.
cancel
).
setVisibility
(
View
.
GONE
);
findViewById
(
R
.
id
.
cancel
).
setVisibility
(
View
.
GONE
);
}
else
}
}
else
{
setContentView
(
R
.
layout
.
secret_viewer
);
setContentView
(
R
.
layout
.
secret_viewer
);
}
findViewById
(
R
.
id
.
cancel
).
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
cancel
).
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
send
).
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
send
).
setOnClickListener
(
this
);
...
@@ -108,53 +108,48 @@ public class QuestionViewer extends ManagedActivity implements
...
@@ -108,53 +108,48 @@ public class QuestionViewer extends ManagedActivity implements
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
this
);
Application
.
getInstance
().
addUIListener
(
OnContactChangedListener
.
class
,
this
);
Application
.
getInstance
().
addUIListener
(
OnContactChangedListener
.
class
,
this
);
update
();
update
();
}
}
@Override
@Override
protected
void
onPause
()
{
protected
void
onPause
()
{
super
.
onPause
();
super
.
onPause
();
Application
.
getInstance
().
removeUIListener
(
Application
.
getInstance
().
removeUIListener
(
OnAccountChangedListener
.
class
,
this
);
OnAccountChangedListener
.
class
,
this
);
Application
.
getInstance
().
removeUIListener
(
OnContactChangedListener
.
class
,
this
);
Application
.
getInstance
().
removeUIListener
(
OnContactChangedListener
.
class
,
this
);
}
}
@Override
@Override
public
void
onContactsChanged
(
Collection
<
BaseEntity
>
entities
)
{
public
void
onContactsChanged
(
Collection
<
BaseEntity
>
entities
)
{
String
thisBareAddress
=
Jid
.
getBareAddress
(
user
);
String
thisBareAddress
=
Jid
.
getBareAddress
(
user
);
for
(
BaseEntity
entity
:
entities
)
for
(
BaseEntity
entity
:
entities
)
{
if
(
entity
.
equals
(
account
,
thisBareAddress
))
{
if
(
entity
.
equals
(
account
,
thisBareAddress
))
{
update
();
update
();
break
;
break
;
}
}
}
}
}
@Override
@Override
public
void
onAccountsChanged
(
Collection
<
String
>
accounts
)
{
public
void
onAccountsChanged
(
Collection
<
String
>
accounts
)
{
if
(
accounts
.
contains
(
account
))
if
(
accounts
.
contains
(
account
))
{
update
();
update
();
}
}
}
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
switch
(
view
.
getId
())
{
switch
(
view
.
getId
())
{
case
R
.
id
.
send
:
case
R
.
id
.
send
:
String
question
=
showQuestion
?
questionView
.
getText
().
toString
()
String
question
=
showQuestion
?
questionView
.
getText
().
toString
()
:
null
;
:
null
;
String
answer
=
((
TextView
)
findViewById
(
R
.
id
.
answer
)).
getText
().
toString
();
String
answer
=
((
TextView
)
findViewById
(
R
.
id
.
answer
)).
getText
()
.
toString
();
try
{
try
{
if
(
answerRequest
)
if
(
answerRequest
)
{
OTRManager
.
getInstance
().
respondSmp
(
account
,
user
,
OTRManager
.
getInstance
().
respondSmp
(
account
,
user
,
question
,
answer
);
question
,
answer
);
}
else
{
else
OTRManager
.
getInstance
().
initSmp
(
account
,
user
,
question
,
answer
);
OTRManager
.
getInstance
().
initSmp
(
account
,
user
,
question
,
}
answer
);
}
catch
(
NetworkException
e
)
{
}
catch
(
NetworkException
e
)
{
Application
.
getInstance
().
onError
(
e
);
Application
.
getInstance
().
onError
(
e
);
}
}
...
@@ -173,11 +168,7 @@ public class QuestionViewer extends ManagedActivity implements
...
@@ -173,11 +168,7 @@ public class QuestionViewer extends ManagedActivity implements
}
}
private
void
update
()
{
private
void
update
()
{
AbstractContact
abstractContact
=
RosterManager
.
getInstance
()
AbstractContact
abstractContact
=
RosterManager
.
getInstance
().
getBestContact
(
account
,
user
);
.
getBestContact
(
account
,
user
);
ContactTitleInflater
.
updateTitle
(
findViewById
(
R
.
id
.
title
),
this
,
abstractContact
);
contactTitleActionBarInflater
.
update
(
abstractContact
);
contactTitleActionBarInflater
.
update
(
abstractContact
);
}
}
...
@@ -187,8 +178,7 @@ public class QuestionViewer extends ManagedActivity implements
...
@@ -187,8 +178,7 @@ public class QuestionViewer extends ManagedActivity implements
* @param user
* @param user
* @return Intent to cancel negotiation.
* @return Intent to cancel negotiation.
*/
*/
public
static
Intent
createCanelIntent
(
Context
context
,
String
account
,
public
static
Intent
createCancelIntent
(
Context
context
,
String
account
,
String
user
)
{
String
user
)
{
Intent
intent
=
new
EntityIntentBuilder
(
context
,
QuestionViewer
.
class
)
Intent
intent
=
new
EntityIntentBuilder
(
context
,
QuestionViewer
.
class
)
.
setAccount
(
account
).
setUser
(
user
).
build
();
.
setAccount
(
account
).
setUser
(
user
).
build
();
intent
.
putExtra
(
EXTRA_FIELD_CANCEL
,
true
);
intent
.
putExtra
(
EXTRA_FIELD_CANCEL
,
true
);
...
@@ -205,9 +195,8 @@ public class QuestionViewer extends ManagedActivity implements
...
@@ -205,9 +195,8 @@ public class QuestionViewer extends ManagedActivity implements
* answerRequest are <code>true</code>.
* answerRequest are <code>true</code>.
* @return
* @return
*/
*/
public
static
Intent
createIntent
(
Context
context
,
String
account
,
public
static
Intent
createIntent
(
Context
context
,
String
account
,
String
user
,
String
user
,
boolean
showQuestion
,
boolean
answerRequest
,
boolean
showQuestion
,
boolean
answerRequest
,
String
question
)
{
String
question
)
{
Intent
intent
=
new
EntityIntentBuilder
(
context
,
QuestionViewer
.
class
)
Intent
intent
=
new
EntityIntentBuilder
(
context
,
QuestionViewer
.
class
)
.
setAccount
(
account
).
setUser
(
user
).
build
();
.
setAccount
(
account
).
setUser
(
user
).
build
();
intent
.
putExtra
(
EXTRA_FIELD_SHOW_QUESTION
,
showQuestion
);
intent
.
putExtra
(
EXTRA_FIELD_SHOW_QUESTION
,
showQuestion
);
...
...
app/src/main/res/layout/fingerprint_viewer.xml
View file @
920eb760
...
@@ -19,8 +19,6 @@
...
@@ -19,8 +19,6 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
>
>
<include
layout=
"@layout/contact_title"
/>
<ScrollView
<ScrollView
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
...
...
app/src/main/res/layout/question_viewer.xml
View file @
920eb760
...
@@ -19,8 +19,6 @@
...
@@ -19,8 +19,6 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
>
>
<include
layout=
"@layout/contact_title"
/>
<ScrollView
<ScrollView
android:orientation=
"vertical"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/secret_viewer.xml
View file @
920eb760
...
@@ -19,8 +19,6 @@
...
@@ -19,8 +19,6 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
>
>
<include
layout=
"@layout/contact_title"
/>
<ScrollView
<ScrollView
android:orientation=
"vertical"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment