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
3671697f
Commit
3671697f
authored
Apr 18, 2017
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some work on interfaces
parent
349f73a3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
157 additions
and
4 deletions
+157
-4
AbstractServerConfigFragment.java
.../fragment/server_config/AbstractServerConfigFragment.java
+3
-2
LoginFragment.java
.../rocket/android/fragment/server_config/LoginFragment.java
+2
-2
TwoStepAuthContract.java
...t/android/fragment/server_config/TwoStepAuthContract.java
+20
-0
TwoStepAuthFragment.java
...t/android/fragment/server_config/TwoStepAuthFragment.java
+52
-0
TwoStepAuthPresenter.java
.../android/fragment/server_config/TwoStepAuthPresenter.java
+11
-0
fragment_two_step_auth.xml
app/src/main/res/layout/fragment_two_step_auth.xml
+66
-0
strings.xml
app/src/main/res/values/strings.xml
+3
-0
No files found.
app/src/main/java/chat/rocket/android/fragment/server_config/AbstractServerConfigFragment.java
View file @
3671697f
...
...
@@ -5,11 +5,12 @@ import android.support.annotation.Nullable;
import
android.support.v4.app.Fragment
;
import
chat.rocket.android.R
;
import
chat.rocket.android.activity.LoginActivity
;
import
chat.rocket.android.fragment.AbstractFragment
;
import
chat.rocket.android.helper.TextUtils
;
abstract
class
AbstractServerConfigFragment
extends
AbstractFragment
{
public
static
final
String
KEY_HOSTNAME
=
"hostname"
;
protected
String
hostname
;
@Override
...
...
@@ -22,7 +23,7 @@ abstract class AbstractServerConfigFragment extends AbstractFragment {
return
;
}
hostname
=
args
.
getString
(
LoginActivity
.
KEY_HOSTNAME
);
hostname
=
args
.
getString
(
KEY_HOSTNAME
);
if
(
TextUtils
.
isEmpty
(
hostname
))
{
finish
();
}
...
...
app/src/main/java/chat/rocket/android/fragment/server_config/LoginFragment.java
View file @
3671697f
...
...
@@ -55,7 +55,7 @@ public class LoginFragment extends AbstractServerConfigFragment implements Login
final
View
btnUserRegistration
=
rootView
.
findViewById
(
R
.
id
.
btn_user_registration
);
btnUserRegistration
.
setOnClickListener
(
view
->
UserRegistrationDialogFragment
.
create
(
hostname
,
txtUsername
.
getText
().
toString
(),
txtPasswd
.
getText
().
toString
())
.
show
(
getFragmentManager
(),
UserRegistrationDialogFragment
.
class
.
getSimpleName
()
));
.
show
(
getFragmentManager
(),
"UserRegistrationDialogFragment"
));
}
@Override
...
...
@@ -117,7 +117,7 @@ public class LoginFragment extends AbstractServerConfigFragment implements Login
@Override
public
void
showTwoStepAuth
()
{
//
showFragmentWithBackStack
(
TwoStepAuthFragment
.
create
(
hostname
));
}
@Override
...
...
app/src/main/java/chat/rocket/android/fragment/server_config/TwoStepAuthContract.java
0 → 100644
View file @
3671697f
package
chat
.
rocket
.
android
.
fragment
.
server_config
;
import
chat.rocket.android.shared.BaseContract
;
public
interface
TwoStepAuthContract
{
interface
View
extends
BaseContract
.
View
{
void
showLoading
();
void
hideLoading
();
void
showError
(
String
message
);
}
interface
Presenter
extends
BaseContract
.
Presenter
<
View
>
{
void
onCode
(
String
twoStepAuthCode
);
}
}
app/src/main/java/chat/rocket/android/fragment/server_config/TwoStepAuthFragment.java
0 → 100644
View file @
3671697f
package
chat
.
rocket
.
android
.
fragment
.
server_config
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.TextView
;
import
chat.rocket.android.R
;
public
class
TwoStepAuthFragment
extends
AbstractServerConfigFragment
implements
TwoStepAuthContract
.
View
{
private
View
waitingView
;
private
TwoStepAuthContract
.
Presenter
presenter
;
public
static
TwoStepAuthFragment
create
(
String
hostname
)
{
Bundle
args
=
new
Bundle
();
args
.
putString
(
AbstractServerConfigFragment
.
KEY_HOSTNAME
,
hostname
);
TwoStepAuthFragment
fragment
=
new
TwoStepAuthFragment
();
fragment
.
setArguments
(
args
);
return
fragment
;
}
@Override
public
void
showLoading
()
{
}
@Override
public
void
hideLoading
()
{
}
@Override
public
void
showError
(
String
message
)
{
}
@Override
protected
int
getLayout
()
{
return
R
.
layout
.
fragment_two_step_auth
;
}
@Override
protected
void
onSetupView
()
{
waitingView
=
rootView
.
findViewById
(
R
.
id
.
waiting
);
final
TextView
twoStepCodeTextView
=
(
TextView
)
rootView
.
findViewById
(
R
.
id
.
two_step_code
);
final
View
submit
=
rootView
.
findViewById
(
R
.
id
.
btn_two_step_login
);
submit
.
setOnClickListener
(
view
->
{});
}
}
app/src/main/java/chat/rocket/android/fragment/server_config/TwoStepAuthPresenter.java
0 → 100644
View file @
3671697f
package
chat
.
rocket
.
android
.
fragment
.
server_config
;
import
chat.rocket.android.shared.BasePresenter
;
public
class
TwoStepAuthPresenter
extends
BasePresenter
<
TwoStepAuthContract
.
View
>
implements
TwoStepAuthContract
.
Presenter
{
@Override
public
void
onCode
(
String
twoStepAuthCode
)
{
}
}
app/src/main/res/layout/fragment_two_step_auth.xml
0 → 100644
View file @
3671697f
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
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"
android:background=
"?attr/colorPrimaryDark"
>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:background=
"@color/white"
android:minWidth=
"288dp"
android:orientation=
"vertical"
android:padding=
"@dimen/margin_24"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
style=
"@style/Base.TextAppearance.AppCompat.Large"
android:text=
"@string/two_factor_authentication_title"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
style=
"@style/Base.TextAppearance.AppCompat.Body1"
android:text=
"@string/open_your_authentication_app_and_enter_the_code"
/>
<android.support.design.widget.TextInputLayout
android:id=
"@+id/text_input_two_step_code"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<android.support.design.widget.TextInputEditText
android:id=
"@+id/two_step_code"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/two_factor_code"
android:imeOptions=
"actionNext"
android:inputType=
"textWebEmailAddress"
android:maxLines=
"1"
/>
</android.support.design.widget.TextInputLayout>
<Space
android:layout_width=
"wrap_content"
android:layout_height=
"@dimen/margin_16"
/>
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/btn_two_step_login"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"end|bottom"
app:elevation=
"2dp"
app:fabSize=
"normal"
app:srcCompat=
"@drawable/ic_arrow_forward_white_24dp"
/>
<chat.rocket.android.widget.WaitingView
android:id=
"@+id/waiting"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:visibility=
"gone"
/>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
3671697f
...
...
@@ -47,4 +47,7 @@
<string
name=
"connection_error_try_later"
>
There\'s a connection error. Please try later.
</string>
<string
name=
"version_info_text"
>
Version: %s
</string>
<string
name=
"two_factor_authentication_title"
>
Two-factor authentication
</string>
<string
name=
"open_your_authentication_app_and_enter_the_code"
>
Open your authentication app and enter the code
</string>
<string
name=
"two_factor_code"
>
Two-factor code
</string>
</resources>
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