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
d715229a
Commit
d715229a
authored
Mar 20, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ChatViewer: security icon moved from title bar to input bar.
parent
1f05781a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
46 deletions
+51
-46
ChatViewer.java
app/src/main/java/com/xabber/android/ui/ChatViewer.java
+0
-16
ChatViewerFragment.java
...c/main/java/com/xabber/android/ui/ChatViewerFragment.java
+21
-0
ContactTitleActionBarInflater.java
...bber/android/ui/helper/ContactTitleActionBarInflater.java
+0
-5
ic_security_grey_24dp.xml
app/src/main/res/drawable/ic_security_grey_24dp.xml
+7
-0
chat_viewer_item.xml
app/src/main/res/layout/chat_viewer_item.xml
+12
-0
contact_title.xml
app/src/main/res/layout/contact_title.xml
+11
-25
No files found.
app/src/main/java/com/xabber/android/ui/ChatViewer.java
View file @
d715229a
...
...
@@ -27,7 +27,6 @@ import android.view.Menu;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.inputmethod.InputMethodManager
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
com.xabber.android.data.ActivityManager
;
...
...
@@ -655,21 +654,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
final
AbstractContact
abstractContact
=
RosterManager
.
getInstance
().
getBestContact
(
account
,
user
);
contactTitleActionBarInflater
.
update
(
abstractContact
);
SecurityLevel
securityLevel
=
OTRManager
.
getInstance
().
getSecurityLevel
(
account
,
user
);
SettingsManager
.
SecurityOtrMode
securityOtrMode
=
SettingsManager
.
securityOtrMode
();
ImageView
securityView
=
contactTitleActionBarInflater
.
getSecurityView
();
if
(
securityLevel
==
SecurityLevel
.
plain
&&
(
securityOtrMode
==
SettingsManager
.
SecurityOtrMode
.
disabled
||
securityOtrMode
==
SettingsManager
.
SecurityOtrMode
.
manual
))
{
securityView
.
setVisibility
(
View
.
GONE
);
}
else
{
securityView
.
setVisibility
(
View
.
VISIBLE
);
securityView
.
setImageLevel
(
securityLevel
.
getImageLevel
());
}
}
private
void
updateRegisteredChats
()
{
...
...
app/src/main/java/com/xabber/android/ui/ChatViewerFragment.java
View file @
d715229a
...
...
@@ -23,6 +23,8 @@ import com.xabber.android.data.LogManager;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.account.AccountManager
;
import
com.xabber.android.data.extension.cs.ChatStateManager
;
import
com.xabber.android.data.extension.otr.OTRManager
;
import
com.xabber.android.data.extension.otr.SecurityLevel
;
import
com.xabber.android.data.message.MessageItem
;
import
com.xabber.android.data.message.MessageManager
;
import
com.xabber.android.data.message.chat.ChatManager
;
...
...
@@ -45,6 +47,7 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
boolean
isInputEmpty
=
true
;
private
ImageButton
sendButton
;
private
ImageButton
securityButton
;
public
static
ChatViewerFragment
newInstance
(
String
account
,
String
user
)
{
ChatViewerFragment
fragment
=
new
ChatViewerFragment
();
...
...
@@ -74,6 +77,8 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
sendButton
=
(
ImageButton
)
view
.
findViewById
(
R
.
id
.
button_send_message
);
sendButton
.
setImageResource
(
R
.
drawable
.
ic_button_send_inactive_24dp
);
securityButton
=
(
ImageButton
)
view
.
findViewById
(
R
.
id
.
button_security
);
chatMessageAdapter
=
new
ChatMessageAdapter
(
getActivity
(),
account
,
user
);
listView
=
(
ListView
)
view
.
findViewById
(
android
.
R
.
id
.
list
);
...
...
@@ -274,6 +279,22 @@ public class ChatViewerFragment extends Fragment implements AdapterView.OnItemCl
public
void
updateChat
()
{
chatMessageAdapter
.
onChange
();
updateSecurityButton
();
}
private
void
updateSecurityButton
()
{
SecurityLevel
securityLevel
=
OTRManager
.
getInstance
().
getSecurityLevel
(
account
,
user
);
SettingsManager
.
SecurityOtrMode
securityOtrMode
=
SettingsManager
.
securityOtrMode
();
if
(
securityLevel
==
SecurityLevel
.
plain
&&
(
securityOtrMode
==
SettingsManager
.
SecurityOtrMode
.
disabled
||
securityOtrMode
==
SettingsManager
.
SecurityOtrMode
.
manual
))
{
securityButton
.
setVisibility
(
View
.
GONE
);
}
else
{
securityButton
.
setVisibility
(
View
.
VISIBLE
);
securityButton
.
setImageLevel
(
securityLevel
.
getImageLevel
());
}
}
public
boolean
isEqual
(
String
account
,
String
user
)
{
...
...
app/src/main/java/com/xabber/android/ui/helper/ContactTitleActionBarInflater.java
View file @
d715229a
...
...
@@ -11,7 +11,6 @@ import android.view.Window;
import
android.view.WindowManager
;
import
android.view.animation.Animation
;
import
android.view.animation.AnimationUtils
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.xabber.android.data.account.AccountManager
;
...
...
@@ -91,10 +90,6 @@ public class ContactTitleActionBarInflater {
activity
.
setTitle
(
title
);
}
public
ImageView
getSecurityView
()
{
return
(
ImageView
)
actionBarView
.
findViewById
(
R
.
id
.
security
);
}
public
void
playIncomingAnimation
()
{
if
(
shakeAnimation
==
null
)
{
shakeAnimation
=
AnimationUtils
.
loadAnimation
(
activity
,
R
.
anim
.
shake
);
...
...
app/src/main/res/drawable/ic_security_grey_24dp.xml
0 → 100644
View file @
d715229a
<?xml version="1.0" encoding="utf-8"?>
<level-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/ic_security_plain_24dp"
android:minLevel=
"0"
android:maxLevel=
"0"
/>
<item
android:drawable=
"@drawable/ic_security_encrypted_24dp"
android:minLevel=
"1"
android:maxLevel=
"1"
/>
<item
android:drawable=
"@drawable/ic_security_verified_24dp"
android:minLevel=
"2"
android:maxLevel=
"2"
/>
<item
android:drawable=
"@drawable/ic_security_finished_24dp"
android:minLevel=
"3"
android:maxLevel=
"3"
/>
</level-list>
\ No newline at end of file
app/src/main/res/layout/chat_viewer_item.xml
View file @
d715229a
...
...
@@ -44,6 +44,18 @@
android:elevation=
"8dp"
>
<ImageButton
android:id=
"@+id/button_security"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:padding=
"8dp"
android:src=
"@drawable/ic_security_grey_24dp"
android:background=
"@null"
android:contentDescription=
"@string/otr_encryption"
android:layout_gravity=
"bottom"
android:visibility=
"gone"
/>
<EditText
android:id=
"@+id/chat_input"
android:inputType=
"textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
...
...
app/src/main/res/layout/contact_title.xml
View file @
d715229a
...
...
@@ -21,8 +21,8 @@
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:gravity=
"center_vertical"
android:layout_weight=
"1"
android:gravity=
"center_vertical"
>
<TextView
android:id=
"@+id/name"
...
...
@@ -34,32 +34,18 @@
android:layout_marginLeft=
"6dp"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
<LinearLayout
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/status_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/security"
android:src=
"@drawable/ic_security"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
android:padding=
"3dp"
/>
<TextView
android:id=
"@+id/status_text"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:singleLine=
"true"
android:textColor=
"@color/grey_200"
android:text=
"Lorem ipsum dolor sit amet"
android:layout_marginLeft=
"6dp"
/>
</LinearLayout>
android:singleLine=
"true"
android:textColor=
"@color/grey_200"
android:text=
"Lorem ipsum dolor sit amet"
android:layout_marginLeft=
"6dp"
/>
</LinearLayout>
<ImageView
...
...
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