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
db10d3cf
Commit
db10d3cf
authored
Apr 14, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New subscription dialog with V-card information.
parent
fffe11b3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
189 additions
and
22 deletions
+189
-22
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+7
-1
SubscriptionRequest.java
...a/com/xabber/android/data/roster/SubscriptionRequest.java
+4
-9
ContactSubscription.java
.../main/java/com/xabber/android/ui/ContactSubscription.java
+59
-10
contact_subscription.xml
app/src/main/res/layout/contact_subscription.xml
+111
-0
contact_editor.xml
app/src/main/res/values-ru/contact_editor.xml
+4
-1
contact_editor.xml
app/src/main/res/values/contact_editor.xml
+4
-1
No files found.
app/src/main/AndroidManifest.xml
View file @
db10d3cf
...
...
@@ -271,7 +271,13 @@
<activity
android:name=
"com.xabber.android.ui.ContactSubscription"
/>
android:parentActivityName=
"com.xabber.android.ui.ContactList"
>
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name=
"android.support.PARENT_ACTIVITY"
android:value=
"com.xabber.android.ui.ContactList"
/>
</activity>
<activity
android:name=
"com.xabber.android.ui.MUCInvite"
/>
...
...
app/src/main/java/com/xabber/android/data/roster/SubscriptionRequest.java
View file @
db10d3cf
...
...
@@ -23,8 +23,7 @@ import com.xabber.android.data.notification.EntityNotificationItem;
import
com.xabber.android.ui.ContactSubscription
;
import
com.xabber.androiddev.R
;
public
class
SubscriptionRequest
extends
BaseEntity
implements
EntityNotificationItem
{
public
class
SubscriptionRequest
extends
BaseEntity
implements
EntityNotificationItem
{
public
SubscriptionRequest
(
String
account
,
String
user
)
{
super
(
account
,
user
);
...
...
@@ -32,8 +31,7 @@ public class SubscriptionRequest extends BaseEntity implements
@Override
public
Intent
getIntent
()
{
return
ContactSubscription
.
createIntent
(
Application
.
getInstance
(),
account
,
user
);
return
ContactSubscription
.
createIntent
(
Application
.
getInstance
(),
account
,
user
);
}
@Override
...
...
@@ -48,11 +46,8 @@ public class SubscriptionRequest extends BaseEntity implements
}
public
String
getConfirmation
()
{
String
accountName
=
AccountManager
.
getInstance
().
getVerboseName
(
account
);
String
userName
=
RosterManager
.
getInstance
().
getName
(
account
,
user
);
return
Application
.
getInstance
().
getString
(
R
.
string
.
contact_subscribe_confirm
,
userName
,
accountName
);
String
accountName
=
AccountManager
.
getInstance
().
getVerboseName
(
account
);
return
Application
.
getInstance
().
getString
(
R
.
string
.
contact_subscribe_confirm
,
accountName
);
}
}
app/src/main/java/com/xabber/android/ui/ContactSubscription.java
View file @
db10d3cf
...
...
@@ -17,17 +17,26 @@ package com.xabber.android.ui;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.v7.widget.Toolbar
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.NetworkException
;
import
com.xabber.android.data.intent.EntityIntentBuilder
;
import
com.xabber.android.data.roster.AbstractContact
;
import
com.xabber.android.data.roster.PresenceManager
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.android.data.roster.SubscriptionRequest
;
import
com.xabber.android.ui.helper.ManagedDialog
;
import
com.xabber.android.ui.helper.ActionBarPainter
;
import
com.xabber.android.ui.helper.SingleActivity
;
import
com.xabber.androiddev.R
;
public
class
ContactSubscription
extends
ManagedDialog
{
import
org.w3c.dom.Text
;
public
class
ContactSubscription
extends
SingleActivity
implements
View
.
OnClickListener
{
private
String
account
;
private
String
user
;
...
...
@@ -40,21 +49,63 @@ public class ContactSubscription extends ManagedDialog {
Intent
intent
=
getIntent
();
account
=
getAccount
(
intent
);
user
=
getUser
(
intent
);
subscriptionRequest
=
PresenceManager
.
getInstance
()
.
getSubscriptionRequest
(
account
,
user
);
subscriptionRequest
=
PresenceManager
.
getInstance
().
getSubscriptionRequest
(
account
,
user
);
if
(
subscriptionRequest
==
null
)
{
Application
.
getInstance
().
onError
(
R
.
string
.
ENTRY_IS_NOT_FOUND
);
finish
();
return
;
}
setDialogMessage
(
subscriptionRequest
.
getConfirmation
());
setDialogTitle
(
R
.
string
.
subscription_request_message
);
findViewById
(
android
.
R
.
id
.
button3
).
setVisibility
(
View
.
GONE
);
setContentView
(
R
.
layout
.
contact_subscription
);
Toolbar
toolbar
=
(
Toolbar
)
findViewById
(
R
.
id
.
top_toolbar
);
setSupportActionBar
(
toolbar
);
getSupportActionBar
().
setDisplayHomeAsUpEnabled
(
true
);
getSupportActionBar
().
setTitle
(
getString
(
R
.
string
.
subscription_request_message
));
ActionBarPainter
actionBarPainter
=
new
ActionBarPainter
(
this
);
actionBarPainter
.
updateWithAccountName
(
account
);
View
fakeToolbar
=
findViewById
(
R
.
id
.
fake_toolbar
);
fakeToolbar
.
setBackgroundColor
(
actionBarPainter
.
getAccountColor
(
account
));
toolbar
.
setBackgroundResource
(
android
.
R
.
color
.
transparent
);
AbstractContact
abstractContact
=
RosterManager
.
getInstance
().
getBestContact
(
account
,
user
);
((
ImageView
)
fakeToolbar
.
findViewById
(
R
.
id
.
avatar
)).
setImageDrawable
(
abstractContact
.
getAvatar
());
((
TextView
)
fakeToolbar
.
findViewById
(
R
.
id
.
dialog_message
)).
setText
(
subscriptionRequest
.
getConfirmation
());
Button
acceptButton
=
(
Button
)
findViewById
(
R
.
id
.
accept_button
);
acceptButton
.
setTextColor
(
actionBarPainter
.
getAccountColor
(
account
));
acceptButton
.
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
decline_button
).
setOnClickListener
(
this
);
if
(
savedInstanceState
==
null
)
{
getFragmentManager
().
beginTransaction
()
.
add
(
R
.
id
.
scrollable_container
,
ContactVcardViewerFragment
.
newInstance
(
account
,
user
)).
commit
();
}
}
@Override
public
void
onClick
(
View
v
)
{
switch
(
v
.
getId
())
{
case
R
.
id
.
accept_button
:
onAccept
();
break
;
case
R
.
id
.
decline_button
:
onDecline
();
break
;
}
}
public
void
onAccept
()
{
super
.
onAccept
();
try
{
PresenceManager
.
getInstance
().
acceptSubscription
(
subscriptionRequest
.
getAccount
(),
...
...
@@ -66,9 +117,7 @@ public class ContactSubscription extends ManagedDialog {
finish
();
}
@Override
public
void
onDecline
()
{
super
.
onDecline
();
try
{
PresenceManager
.
getInstance
().
discardSubscription
(
subscriptionRequest
.
getAccount
(),
...
...
app/src/main/res/layout/contact_subscription.xml
0 → 100644
View file @
db10d3cf
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"104dp"
android:background=
"?attr/colorPrimary"
android:elevation=
"8dp"
android:id=
"@+id/fake_toolbar"
>
<ImageView
android:id=
"@+id/avatar"
android:layout_width=
"@dimen/avatar_size_toolbar"
android:layout_height=
"@dimen/avatar_size_toolbar"
android:src=
"@drawable/ic_avatar_1"
android:layout_alignParentBottom=
"true"
android:layout_alignParentLeft=
"true"
android:layout_marginBottom=
"6dp"
android:layout_marginRight=
"8dp"
android:layout_marginLeft=
"6dp"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/avatar_size_toolbar"
android:id=
"@+id/dialog_message"
android:layout_toRightOf=
"@id/avatar"
android:layout_alignParentBottom=
"true"
android:gravity=
"center_vertical"
android:textColor=
"@color/white"
android:layout_marginBottom=
"6dp"
/>
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id=
"@+id/top_toolbar"
android:layout_width=
"match_parent"
android:layout_height=
"?attr/actionBarSize"
app:theme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
android:elevation=
"8dp"
android:background=
"@android:color/transparent"
android:layout_alignParentTop=
"true"
>
</android.support.v7.widget.Toolbar>
<ScrollView
android:id=
"@+id/scrollable_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@+id/fake_toolbar"
android:layout_above=
"@+id/bottom_bar"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:id=
"@+id/bottom_bar"
>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1px"
android:background=
"@color/grey_400"
android:layout_alignParentTop=
"true"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:gravity=
"right"
>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/decline_contact"
android:background=
"@android:color/transparent"
android:id=
"@+id/decline_button"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/accept_contact"
android:id=
"@+id/accept_button"
android:background=
"@android:color/transparent"
android:textColor=
"@color/green_500"
android:layout_marginRight=
"8dp"
android:layout_marginLeft=
"8dp"
/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/values-ru/contact_editor.xml
View file @
db10d3cf
...
...
@@ -21,7 +21,7 @@
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_add.png -->
<string
name=
"contact_name"
>
Псевдоним (не обязателен)
</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_add_confirm.png -->
<string
name=
"contact_subscribe_confirm"
>
Разрешить контакту
%1$s видеть статус вашей учетной записи %2
$s?
</string>
<string
name=
"contact_subscribe_confirm"
>
Разрешить контакту
видеть статус вашей учетной записи %1
$s?
</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_add.png -->
<string
name=
"contact_user"
>
Имя собеседника
</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_editor_error.png -->
...
...
@@ -42,4 +42,7 @@
<string
name=
"EMPTY_ACCOUNT"
>
Пожалуйста, выберите учетную запись
</string>
<string
name=
"add_new_group"
>
Добавить новую группу…
</string>
<string
name=
"accept_contact"
>
Разрешить
</string>
<string
name=
"decline_contact"
>
Отклонить
</string>
</resources>
\ No newline at end of file
app/src/main/res/values/contact_editor.xml
View file @
db10d3cf
...
...
@@ -21,7 +21,7 @@
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_add.png -->
<string
name=
"contact_name"
>
Alias (optional)
</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_add_confirm.png -->
<string
name=
"contact_subscribe_confirm"
>
Share your %
2$s account status with %1$s
?
</string>
<string
name=
"contact_subscribe_confirm"
>
Share your %
1$s account status with contact
?
</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_add.png -->
<string
name=
"contact_user"
>
Contact username
</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_editor_error.png -->
...
...
@@ -42,4 +42,7 @@
<string
name=
"EMPTY_ACCOUNT"
>
Please select an account
</string>
<string
name=
"add_new_group"
>
Add new group…
</string>
<string
name=
"accept_contact"
>
Authorize
</string>
<string
name=
"decline_contact"
>
Discard
</string>
</resources>
\ No newline at end of file
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