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
0d25b7fd
Commit
0d25b7fd
authored
Aug 25, 2013
by
Alexander Ivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to use Orbot in account add activity.
parent
60825441
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
6 deletions
+39
-6
account_add.xml
res/layout/account_add.xml
+7
-0
account_editor.xml
res/values/account_editor.xml
+1
-0
AccountManager.java
src/com/xabber/android/data/account/AccountManager.java
+7
-4
AccountAdd.java
src/com/xabber/android/ui/AccountAdd.java
+24
-2
No files found.
res/layout/account_add.xml
View file @
0d25b7fd
...
...
@@ -76,6 +76,13 @@
android:checked=
"true"
android:text=
"@string/account_syncable"
/>
<CheckBox
android:id=
"@+id/use_orbot"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:checked=
"false"
android:text=
"@string/account_use_orbot"
/>
<LinearLayout
android:orientation=
"horizontal"
android:layout_width=
"fill_parent"
...
...
res/values/account_editor.xml
View file @
0d25b7fd
...
...
@@ -114,6 +114,7 @@
<string
name=
"account_proxy_port"
>
Proxy port
</string>
<string
name=
"account_proxy_user"
>
Proxy user
</string>
<string
name=
"account_proxy_password"
>
Proxy password
</string>
<string
name=
"account_use_orbot"
>
Chat through TOR anonymity network and force TLS cryptographic protocol\nNot recommended for Google Talk
</string>
<string
name=
"orbot_required_title"
>
Install Orbot?
</string>
<string
name=
"orbot_required_message"
>
In order to process using TOR you must have Orbot installed and activated to proxy traffic through it. Would you like to install it from Google Play?
</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/account_editor_02.png -->
...
...
src/com/xabber/android/data/account/AccountManager.java
View file @
0d25b7fd
...
...
@@ -368,13 +368,14 @@ public class AccountManager implements OnLoadListener, OnWipeListener {
* xmpp account type can be replaced depend on server part.
* @param syncable
* @param storePassword
* @param useOrbot
* @return assigned account name.
* @throws NetworkException
* if user or server part are invalid.
*/
public
String
addAccount
(
String
user
,
String
password
,
AccountType
accountType
,
boolean
syncable
,
boolean
storePassword
)
throws
NetworkException
{
AccountType
accountType
,
boolean
syncable
,
boolean
storePassword
,
boolean
useOrbot
)
throws
NetworkException
{
if
(
accountType
.
getProtocol
().
isOAuth
())
{
int
index
=
1
;
while
(
true
)
{
...
...
@@ -410,6 +411,8 @@ public class AccountManager implements OnLoadListener, OnWipeListener {
String
host
=
accountType
.
getHost
();
int
port
=
accountType
.
getPort
();
boolean
tlsRequired
=
accountType
.
isTLSRequired
();
if
(
useOrbot
)
tlsRequired
=
true
;
if
(
""
.
equals
(
serverName
))
{
throw
new
NetworkException
(
R
.
string
.
EMPTY_SERVER_NAME
);
...
...
@@ -446,8 +449,8 @@ public class AccountManager implements OnLoadListener, OnWipeListener {
getNextColorIndex
(),
0
,
StatusMode
.
available
,
SettingsManager
.
statusText
(),
true
,
true
,
tlsRequired
?
TLSMode
.
required
:
TLSMode
.
enabled
,
false
,
ProxyType
.
none
,
"localhost"
,
8080
,
""
,
""
,
syncable
,
null
,
null
,
ArchiveMode
.
available
);
useOrbot
?
ProxyType
.
orbot
:
ProxyType
.
none
,
"localhost"
,
8080
,
""
,
""
,
syncable
,
null
,
null
,
ArchiveMode
.
available
);
onAccountChanged
(
accountItem
.
getAccount
());
if
(
accountItems
.
size
()
>
1
&&
SettingsManager
.
contactsEnableShowAccounts
())
...
...
src/com/xabber/android/ui/AccountAdd.java
View file @
0d25b7fd
...
...
@@ -14,6 +14,7 @@
*/
package
com
.
xabber
.
android
.
ui
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
...
...
@@ -33,7 +34,9 @@ import com.xabber.android.data.account.AccountManager;
import
com.xabber.android.data.account.AccountType
;
import
com.xabber.android.data.intent.AccountIntentBuilder
;
import
com.xabber.android.ui.adapter.AccountTypeAdapter
;
import
com.xabber.android.ui.dialog.OrbotInstallerDialogBuilder
;
import
com.xabber.android.ui.helper.ManagedActivity
;
import
com.xabber.android.ui.helper.OrbotHelper
;
import
com.xabber.androiddev.R
;
public
class
AccountAdd
extends
ManagedActivity
implements
...
...
@@ -43,7 +46,10 @@ public class AccountAdd extends ManagedActivity implements
private
static
final
int
OAUTH_WML_REQUEST_CODE
=
1
;
private
static
final
int
ORBOT_DIALOG_ID
=
9050
;
private
CheckBox
storePasswordView
;
private
CheckBox
useOrbotView
;
private
CheckBox
syncableView
;
private
Spinner
accountTypeView
;
...
...
@@ -56,6 +62,7 @@ public class AccountAdd extends ManagedActivity implements
setContentView
(
R
.
layout
.
account_add
);
storePasswordView
=
(
CheckBox
)
findViewById
(
R
.
id
.
store_password
);
useOrbotView
=
(
CheckBox
)
findViewById
(
R
.
id
.
use_orbot
);
syncableView
=
(
CheckBox
)
findViewById
(
R
.
id
.
syncable
);
if
(!
Application
.
getInstance
().
isContactsSupported
())
{
syncableView
.
setVisibility
(
View
.
GONE
);
...
...
@@ -111,7 +118,8 @@ public class AccountAdd extends ManagedActivity implements
(
AccountType
)
accountTypeView
.
getSelectedItem
(),
syncableView
.
isChecked
(),
storePasswordView
.
isChecked
());
storePasswordView
.
isChecked
(),
useOrbotView
.
isChecked
());
}
catch
(
NetworkException
e
)
{
Application
.
getInstance
().
onError
(
e
);
return
;
...
...
@@ -128,6 +136,10 @@ public class AccountAdd extends ManagedActivity implements
public
void
onClick
(
View
view
)
{
switch
(
view
.
getId
())
{
case
R
.
id
.
ok
:
if
(
useOrbotView
.
isChecked
()
&&
!
OrbotHelper
.
isOrbotInstalled
())
{
showDialog
(
ORBOT_DIALOG_ID
);
return
;
}
AccountType
accountType
=
(
AccountType
)
accountTypeView
.
getSelectedItem
();
if
(
accountType
.
getProtocol
().
isOAuth
())
{
...
...
@@ -144,7 +156,8 @@ public class AccountAdd extends ManagedActivity implements
userView
.
getText
().
toString
(),
passwordView
.
getText
().
toString
(),
accountType
,
syncableView
.
isChecked
(),
storePasswordView
.
isChecked
());
storePasswordView
.
isChecked
(),
useOrbotView
.
isChecked
());
}
catch
(
NetworkException
e
)
{
Application
.
getInstance
().
onError
(
e
);
return
;
...
...
@@ -178,6 +191,15 @@ public class AccountAdd extends ManagedActivity implements
accountTypeView
.
setSelection
(
0
);
}
@Override
protected
Dialog
onCreateDialog
(
int
id
)
{
if
(
id
==
ORBOT_DIALOG_ID
)
{
return
new
OrbotInstallerDialogBuilder
(
this
,
ORBOT_DIALOG_ID
)
.
create
();
}
return
super
.
onCreateDialog
(
id
);
}
public
static
Intent
createIntent
(
Context
context
)
{
return
new
Intent
(
context
,
AccountAdd
.
class
);
}
...
...
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