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
822f8cb9
Commit
822f8cb9
authored
Apr 08, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Orbot install dialog implemented with Alert Dialog Builder
parent
07db7c83
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
42 deletions
+19
-42
AccountAdd.java
app/src/main/java/com/xabber/android/ui/AccountAdd.java
+1
-13
OrbotInstallerDialogBuilder.java
...xabber/android/ui/dialog/OrbotInstallerDialogBuilder.java
+17
-17
AccountEditor.java
...java/com/xabber/android/ui/preferences/AccountEditor.java
+1
-12
No files found.
app/src/main/java/com/xabber/android/ui/AccountAdd.java
View file @
822f8cb9
...
@@ -14,14 +14,12 @@
...
@@ -14,14 +14,12 @@
*/
*/
package
com
.
xabber
.
android
.
ui
;
package
com
.
xabber
.
android
.
ui
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.v7.widget.Toolbar
;
import
android.support.v7.widget.Toolbar
;
import
android.view.View
;
import
android.view.View
;
import
android.view.inputmethod.InputMethodManager
;
import
android.view.inputmethod.InputMethodManager
;
import
android.widget.AdapterView
;
import
android.widget.CheckBox
;
import
android.widget.CheckBox
;
import
android.widget.EditText
;
import
android.widget.EditText
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
...
@@ -40,8 +38,6 @@ import com.xabber.androiddev.R;
...
@@ -40,8 +38,6 @@ import com.xabber.androiddev.R;
public
class
AccountAdd
extends
ManagedActivity
implements
View
.
OnClickListener
{
public
class
AccountAdd
extends
ManagedActivity
implements
View
.
OnClickListener
{
private
static
final
int
ORBOT_DIALOG_ID
=
9050
;
private
CheckBox
storePasswordView
;
private
CheckBox
storePasswordView
;
private
CheckBox
useOrbotView
;
private
CheckBox
useOrbotView
;
private
CheckBox
createAccount
;
private
CheckBox
createAccount
;
...
@@ -98,7 +94,7 @@ public class AccountAdd extends ManagedActivity implements View.OnClickListener
...
@@ -98,7 +94,7 @@ public class AccountAdd extends ManagedActivity implements View.OnClickListener
private
void
addAccount
()
{
private
void
addAccount
()
{
if
(
useOrbotView
.
isChecked
()
&&
!
OrbotHelper
.
isOrbotInstalled
())
{
if
(
useOrbotView
.
isChecked
()
&&
!
OrbotHelper
.
isOrbotInstalled
())
{
showDialog
(
ORBOT_DIALOG_ID
);
OrbotInstallerDialogBuilder
.
show
(
this
);
return
;
return
;
}
}
...
@@ -128,14 +124,6 @@ public class AccountAdd extends ManagedActivity implements View.OnClickListener
...
@@ -128,14 +124,6 @@ public class AccountAdd extends ManagedActivity implements View.OnClickListener
finish
();
finish
();
}
}
@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
)
{
public
static
Intent
createIntent
(
Context
context
)
{
return
new
Intent
(
context
,
AccountAdd
.
class
);
return
new
Intent
(
context
,
AccountAdd
.
class
);
}
}
...
...
app/src/main/java/com/xabber/android/ui/dialog/OrbotInstallerDialogBuilder.java
View file @
822f8cb9
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
package
com
.
xabber
.
android
.
ui
.
dialog
;
package
com
.
xabber
.
android
.
ui
.
dialog
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.content.DialogInterface
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.net.Uri
;
...
@@ -27,26 +28,25 @@ import com.xabber.androiddev.R;
...
@@ -27,26 +28,25 @@ import com.xabber.androiddev.R;
*
*
* @author alexander.ivanov
* @author alexander.ivanov
*/
*/
public
class
OrbotInstallerDialogBuilder
extends
DialogBuilder
{
public
class
OrbotInstallerDialogBuilder
{
private
final
static
String
MARKET_SEARCH
=
"market://search?q=pname:%s"
;
private
final
static
String
MARKET_SEARCH
=
"market://search?q=pname:%s"
;
public
OrbotInstallerDialogBuilder
(
final
Activity
activity
,
int
dialogId
)
{
public
static
void
show
(
final
Activity
activity
)
{
super
(
activity
,
dialogId
);
new
AlertDialog
.
Builder
(
activity
)
setIcon
(
android
.
R
.
drawable
.
ic_dialog_alert
);
.
setTitle
(
R
.
string
.
orbot_required_title
)
setTitle
(
R
.
string
.
orbot_required_title
);
.
setMessage
(
R
.
string
.
orbot_required_message
)
setMessage
(
R
.
string
.
orbot_required_message
);
.
setPositiveButton
(
android
.
R
.
string
.
yes
,
setPositiveButton
(
android
.
R
.
string
.
yes
,
new
DialogInterface
.
OnClickListener
()
{
new
DialogInterface
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
w
)
{
public
void
onClick
(
DialogInterface
dialog
,
int
w
)
{
Uri
uri
=
Uri
.
parse
(
String
.
format
(
MARKET_SEARCH
,
Uri
uri
=
Uri
.
parse
(
String
.
format
(
MARKET_SEARCH
,
OrbotHelper
.
URI_ORBOT
));
OrbotHelper
.
URI_ORBOT
));
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
uri
);
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
uri
);
activity
.
startActivity
(
intent
);
activity
.
startActivity
(
intent
);
}
}
});
})
setNegativeButton
(
android
.
R
.
string
.
no
,
null
);
.
setNegativeButton
(
android
.
R
.
string
.
no
,
null
)
.
show
();
}
}
}
}
app/src/main/java/com/xabber/android/ui/preferences/AccountEditor.java
View file @
822f8cb9
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
*/
*/
package
com
.
xabber
.
android
.
ui
.
preferences
;
package
com
.
xabber
.
android
.
ui
.
preferences
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
...
@@ -41,8 +40,6 @@ public class AccountEditor extends ManagedActivity implements
...
@@ -41,8 +40,6 @@ public class AccountEditor extends ManagedActivity implements
public
static
final
String
INVALIDATED_TOKEN
=
"com.xabber.android.ui.preferences.AccountEditor.INVALIDATED"
;
public
static
final
String
INVALIDATED_TOKEN
=
"com.xabber.android.ui.preferences.AccountEditor.INVALIDATED"
;
private
static
final
int
ORBOT_DIALOG_ID
=
9050
;
private
String
account
;
private
String
account
;
private
AccountItem
accountItem
;
private
AccountItem
accountItem
;
...
@@ -122,14 +119,6 @@ public class AccountEditor extends ManagedActivity implements
...
@@ -122,14 +119,6 @@ public class AccountEditor extends ManagedActivity implements
return
false
;
return
false
;
}
}
@Override
protected
Dialog
onCreateDialog
(
int
id
)
{
if
(
id
==
ORBOT_DIALOG_ID
)
{
return
new
OrbotInstallerDialogBuilder
(
this
,
ORBOT_DIALOG_ID
).
create
();
}
return
super
.
onCreateDialog
(
id
);
}
private
static
String
getAccount
(
Intent
intent
)
{
private
static
String
getAccount
(
Intent
intent
)
{
return
AccountIntentBuilder
.
getAccount
(
intent
);
return
AccountIntentBuilder
.
getAccount
(
intent
);
}
}
...
@@ -161,7 +150,7 @@ public class AccountEditor extends ManagedActivity implements
...
@@ -161,7 +150,7 @@ public class AccountEditor extends ManagedActivity implements
@Override
@Override
public
void
showOrbotDialog
()
{
public
void
showOrbotDialog
()
{
showDialog
(
ORBOT_DIALOG_ID
);
OrbotInstallerDialogBuilder
.
show
(
this
);
}
}
@Override
@Override
...
...
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