Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-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
AloqaIM-Android
Commits
59049f54
Commit
59049f54
authored
Jan 25, 2017
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop using raw string "hostname" passing directly to param for Activity/Fragment
parent
38486d85
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
13 deletions
+27
-13
LaunchUtil.java
app/src/main/java/chat/rocket/android/LaunchUtil.java
+1
-1
LoginActivity.java
...main/java/chat/rocket/android/activity/LoginActivity.java
+3
-2
AbstractServerConfigFragment.java
.../fragment/server_config/AbstractServerConfigFragment.java
+2
-1
SidebarMainFragment.java
.../rocket/android/fragment/sidebar/SidebarMainFragment.java
+2
-5
AbstractAddRoomDialogFragment.java
...ragment/sidebar/dialog/AbstractAddRoomDialogFragment.java
+1
-3
AddChannelDialogFragment.java
...oid/fragment/sidebar/dialog/AddChannelDialogFragment.java
+10
-0
AddDirectMessageDialogFragment.java
...agment/sidebar/dialog/AddDirectMessageDialogFragment.java
+8
-1
No files found.
app/src/main/java/chat/rocket/android/LaunchUtil.java
View file @
59049f54
...
@@ -36,7 +36,7 @@ public class LaunchUtil {
...
@@ -36,7 +36,7 @@ public class LaunchUtil {
public
static
void
showLoginActivity
(
Context
context
,
String
hostname
)
{
public
static
void
showLoginActivity
(
Context
context
,
String
hostname
)
{
Intent
intent
=
new
Intent
(
context
,
LoginActivity
.
class
);
Intent
intent
=
new
Intent
(
context
,
LoginActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
|
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
|
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
intent
.
putExtra
(
"hostname"
,
hostname
);
intent
.
putExtra
(
LoginActivity
.
KEY_HOSTNAME
,
hostname
);
context
.
startActivity
(
intent
);
context
.
startActivity
(
intent
);
}
}
}
}
app/src/main/java/chat/rocket/android/activity/LoginActivity.java
View file @
59049f54
...
@@ -18,6 +18,7 @@ import chat.rocket.android.service.ConnectivityManager;
...
@@ -18,6 +18,7 @@ import chat.rocket.android.service.ConnectivityManager;
* Activity for Login, Sign-up, and Retry connecting...
* Activity for Login, Sign-up, and Retry connecting...
*/
*/
public
class
LoginActivity
extends
AbstractFragmentActivity
{
public
class
LoginActivity
extends
AbstractFragmentActivity
{
public
static
final
String
KEY_HOSTNAME
=
"hostname"
;
private
String
hostname
;
private
String
hostname
;
private
RealmObjectObserver
<
Session
>
sessionObserver
;
private
RealmObjectObserver
<
Session
>
sessionObserver
;
...
@@ -37,7 +38,7 @@ public class LoginActivity extends AbstractFragmentActivity {
...
@@ -37,7 +38,7 @@ public class LoginActivity extends AbstractFragmentActivity {
return
;
return
;
}
}
hostname
=
intent
.
getStringExtra
(
"hostname"
);
hostname
=
intent
.
getStringExtra
(
KEY_HOSTNAME
);
if
(
TextUtils
.
isEmpty
(
hostname
))
{
if
(
TextUtils
.
isEmpty
(
hostname
))
{
finish
();
finish
();
return
;
return
;
...
@@ -98,7 +99,7 @@ public class LoginActivity extends AbstractFragmentActivity {
...
@@ -98,7 +99,7 @@ public class LoginActivity extends AbstractFragmentActivity {
if
(
args
==
null
)
{
if
(
args
==
null
)
{
args
=
new
Bundle
();
args
=
new
Bundle
();
}
}
args
.
putString
(
"hostname"
,
hostname
);
args
.
putString
(
LoginActivity
.
KEY_HOSTNAME
,
hostname
);
fragment
.
setArguments
(
args
);
fragment
.
setArguments
(
args
);
}
}
...
...
app/src/main/java/chat/rocket/android/fragment/server_config/AbstractServerConfigFragment.java
View file @
59049f54
...
@@ -5,6 +5,7 @@ import android.support.annotation.Nullable;
...
@@ -5,6 +5,7 @@ import android.support.annotation.Nullable;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
chat.rocket.android.R
;
import
chat.rocket.android.R
;
import
chat.rocket.android.activity.LoginActivity
;
import
chat.rocket.android.fragment.AbstractFragment
;
import
chat.rocket.android.fragment.AbstractFragment
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.helper.TextUtils
;
...
@@ -21,7 +22,7 @@ abstract class AbstractServerConfigFragment extends AbstractFragment {
...
@@ -21,7 +22,7 @@ abstract class AbstractServerConfigFragment extends AbstractFragment {
return
;
return
;
}
}
hostname
=
args
.
getString
(
"hostname"
);
hostname
=
args
.
getString
(
LoginActivity
.
KEY_HOSTNAME
);
if
(
TextUtils
.
isEmpty
(
hostname
))
{
if
(
TextUtils
.
isEmpty
(
hostname
))
{
finish
();
finish
();
return
;
return
;
...
...
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainFragment.java
View file @
59049f54
...
@@ -179,11 +179,11 @@ public class SidebarMainFragment extends AbstractFragment {
...
@@ -179,11 +179,11 @@ public class SidebarMainFragment extends AbstractFragment {
private
void
setupAddChannelButton
()
{
private
void
setupAddChannelButton
()
{
rootView
.
findViewById
(
R
.
id
.
btn_add_channel
).
setOnClickListener
(
view
->
{
rootView
.
findViewById
(
R
.
id
.
btn_add_channel
).
setOnClickListener
(
view
->
{
showAddRoomDialog
(
new
AddChannelDialogFragment
(
));
showAddRoomDialog
(
AddChannelDialogFragment
.
create
(
hostname
));
});
});
rootView
.
findViewById
(
R
.
id
.
btn_add_direct_message
).
setOnClickListener
(
view
->
{
rootView
.
findViewById
(
R
.
id
.
btn_add_direct_message
).
setOnClickListener
(
view
->
{
showAddRoomDialog
(
new
AddDirectMessageDialogFragment
(
));
showAddRoomDialog
(
AddDirectMessageDialogFragment
.
create
(
hostname
));
});
});
}
}
...
@@ -193,9 +193,6 @@ public class SidebarMainFragment extends AbstractFragment {
...
@@ -193,9 +193,6 @@ public class SidebarMainFragment extends AbstractFragment {
}
}
private
void
showAddRoomDialog
(
DialogFragment
dialog
)
{
private
void
showAddRoomDialog
(
DialogFragment
dialog
)
{
Bundle
args
=
new
Bundle
();
args
.
putString
(
"hostname"
,
hostname
);
dialog
.
setArguments
(
args
);
dialog
.
show
(
getFragmentManager
(),
AbstractAddRoomDialogFragment
.
class
.
getSimpleName
());
dialog
.
show
(
getFragmentManager
(),
AbstractAddRoomDialogFragment
.
class
.
getSimpleName
());
}
}
...
...
app/src/main/java/chat/rocket/android/fragment/sidebar/dialog/AbstractAddRoomDialogFragment.java
View file @
59049f54
...
@@ -21,9 +21,7 @@ public abstract class AbstractAddRoomDialogFragment extends RxAppCompatDialogFra
...
@@ -21,9 +21,7 @@ public abstract class AbstractAddRoomDialogFragment extends RxAppCompatDialogFra
protected
MethodCallHelper
methodCall
;
protected
MethodCallHelper
methodCall
;
protected
String
hostname
;
protected
String
hostname
;
protected
protected
@LayoutRes
abstract
int
getLayout
();
@LayoutRes
abstract
int
getLayout
();
protected
abstract
void
onSetupDialog
();
protected
abstract
void
onSetupDialog
();
...
...
app/src/main/java/chat/rocket/android/fragment/sidebar/dialog/AddChannelDialogFragment.java
View file @
59049f54
package
chat
.
rocket
.
android
.
fragment
.
sidebar
.
dialog
;
package
chat
.
rocket
.
android
.
fragment
.
sidebar
.
dialog
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.CompoundButton
;
import
android.widget.CompoundButton
;
import
android.widget.TextView
;
import
android.widget.TextView
;
...
@@ -17,6 +18,15 @@ public class AddChannelDialogFragment extends AbstractAddRoomDialogFragment {
...
@@ -17,6 +18,15 @@ public class AddChannelDialogFragment extends AbstractAddRoomDialogFragment {
public
AddChannelDialogFragment
()
{
public
AddChannelDialogFragment
()
{
}
}
public
static
AddChannelDialogFragment
create
(
String
hostname
)
{
Bundle
args
=
new
Bundle
();
args
.
putString
(
"hostname"
,
hostname
);
AddChannelDialogFragment
fragment
=
new
AddChannelDialogFragment
();
fragment
.
setArguments
(
args
);
return
fragment
;
}
@Override
@Override
protected
int
getLayout
()
{
protected
int
getLayout
()
{
return
R
.
layout
.
dialog_add_channel
;
return
R
.
layout
.
dialog_add_channel
;
...
...
app/src/main/java/chat/rocket/android/fragment/sidebar/dialog/AddDirectMessageDialogFragment.java
View file @
59049f54
package
chat
.
rocket
.
android
.
fragment
.
sidebar
.
dialog
;
package
chat
.
rocket
.
android
.
fragment
.
sidebar
.
dialog
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.AutoCompleteTextView
;
import
android.widget.AutoCompleteTextView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
...
@@ -18,7 +19,13 @@ import chat.rocket.android.realm_helper.RealmAutoCompleteAdapter;
...
@@ -18,7 +19,13 @@ import chat.rocket.android.realm_helper.RealmAutoCompleteAdapter;
* add Direct Message.
* add Direct Message.
*/
*/
public
class
AddDirectMessageDialogFragment
extends
AbstractAddRoomDialogFragment
{
public
class
AddDirectMessageDialogFragment
extends
AbstractAddRoomDialogFragment
{
public
AddDirectMessageDialogFragment
()
{
public
static
AddDirectMessageDialogFragment
create
(
String
hostname
)
{
Bundle
args
=
new
Bundle
();
args
.
putString
(
"hostname"
,
hostname
);
AddDirectMessageDialogFragment
fragment
=
new
AddDirectMessageDialogFragment
();
fragment
.
setArguments
(
args
);
return
fragment
;
}
}
@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