Commit 9aa71d49 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update layouts

parent 9a9f0c75
...@@ -3,10 +3,10 @@ package chat.rocket.android.fragment.add_server; ...@@ -3,10 +3,10 @@ package chat.rocket.android.fragment.add_server;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.constraint.ConstraintLayout;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import chat.rocket.android.BuildConfig; import chat.rocket.android.BuildConfig;
import chat.rocket.android.LaunchUtil; import chat.rocket.android.LaunchUtil;
import chat.rocket.android.R; import chat.rocket.android.R;
...@@ -21,6 +21,7 @@ import chat.rocket.android.service.ConnectivityManager; ...@@ -21,6 +21,7 @@ import chat.rocket.android.service.ConnectivityManager;
public class InputHostnameFragment extends AbstractFragment implements InputHostnameContract.View { public class InputHostnameFragment extends AbstractFragment implements InputHostnameContract.View {
private InputHostnameContract.Presenter presenter; private InputHostnameContract.Presenter presenter;
private ConstraintLayout container;
private View waitingView; private View waitingView;
public InputHostnameFragment() {} public InputHostnameFragment() {}
...@@ -29,11 +30,8 @@ public class InputHostnameFragment extends AbstractFragment implements InputHost ...@@ -29,11 +30,8 @@ public class InputHostnameFragment extends AbstractFragment implements InputHost
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
final Context appContext = getContext().getApplicationContext(); Context appContext = getContext().getApplicationContext();
presenter = new InputHostnamePresenter(new RocketChatCache(appContext), ConnectivityManager.getInstance(appContext));
presenter = new InputHostnamePresenter(
new RocketChatCache(appContext),
ConnectivityManager.getInstance(appContext));
} }
@Override @Override
...@@ -45,6 +43,7 @@ public class InputHostnameFragment extends AbstractFragment implements InputHost ...@@ -45,6 +43,7 @@ public class InputHostnameFragment extends AbstractFragment implements InputHost
protected void onSetupView() { protected void onSetupView() {
setupVersionInfo(); setupVersionInfo();
container = (ConstraintLayout) rootView.findViewById(R.id.container);
waitingView = rootView.findViewById(R.id.waiting); waitingView = rootView.findViewById(R.id.waiting);
rootView.findViewById(R.id.btn_connect).setOnClickListener(view -> handleConnect()); rootView.findViewById(R.id.btn_connect).setOnClickListener(view -> handleConnect());
} }
...@@ -82,14 +81,14 @@ public class InputHostnameFragment extends AbstractFragment implements InputHost ...@@ -82,14 +81,14 @@ public class InputHostnameFragment extends AbstractFragment implements InputHost
@Override @Override
public void showLoader() { public void showLoader() {
rootView.findViewById(R.id.btn_connect).setEnabled(false); container.setVisibility(View.GONE);
waitingView.setVisibility(View.VISIBLE); waitingView.setVisibility(View.VISIBLE);
} }
@Override @Override
public void hideLoader() { public void hideLoader() {
rootView.findViewById(R.id.btn_connect).setEnabled(true);
waitingView.setVisibility(View.GONE); waitingView.setVisibility(View.GONE);
container.setVisibility(View.VISIBLE);
} }
@Override @Override
......
...@@ -2,6 +2,7 @@ package chat.rocket.android.fragment.server_config; ...@@ -2,6 +2,7 @@ package chat.rocket.android.fragment.server_config;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.constraint.ConstraintLayout;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.View; import android.view.View;
...@@ -23,8 +24,7 @@ import chat.rocket.persistence.realm.repositories.RealmPublicSettingRepository; ...@@ -23,8 +24,7 @@ import chat.rocket.persistence.realm.repositories.RealmPublicSettingRepository;
public class LoginFragment extends AbstractServerConfigFragment implements LoginContract.View { public class LoginFragment extends AbstractServerConfigFragment implements LoginContract.View {
private LoginContract.Presenter presenter; private LoginContract.Presenter presenter;
private ConstraintLayout container;
private View btnEmail;
private View waitingView; private View waitingView;
private TextView txtUsername; private TextView txtUsername;
private TextView txtPasswd; private TextView txtPasswd;
...@@ -47,7 +47,9 @@ public class LoginFragment extends AbstractServerConfigFragment implements Login ...@@ -47,7 +47,9 @@ public class LoginFragment extends AbstractServerConfigFragment implements Login
@Override @Override
protected void onSetupView() { protected void onSetupView() {
btnEmail = rootView.findViewById(R.id.btn_login_with_email); container = (ConstraintLayout) rootView.findViewById(R.id.container);
View btnEmail = rootView.findViewById(R.id.btn_login_with_email);
txtUsername = (TextView) rootView.findViewById(R.id.editor_username); txtUsername = (TextView) rootView.findViewById(R.id.editor_username);
txtPasswd = (TextView) rootView.findViewById(R.id.editor_passwd); txtPasswd = (TextView) rootView.findViewById(R.id.editor_passwd);
waitingView = rootView.findViewById(R.id.waiting); waitingView = rootView.findViewById(R.id.waiting);
...@@ -62,14 +64,14 @@ public class LoginFragment extends AbstractServerConfigFragment implements Login ...@@ -62,14 +64,14 @@ public class LoginFragment extends AbstractServerConfigFragment implements Login
@Override @Override
public void showLoader() { public void showLoader() {
btnEmail.setEnabled(false); container.setVisibility(View.GONE);
waitingView.setVisibility(View.VISIBLE); waitingView.setVisibility(View.VISIBLE);
} }
@Override @Override
public void hideLoader() { public void hideLoader() {
btnEmail.setEnabled(true);
waitingView.setVisibility(View.GONE); waitingView.setVisibility(View.GONE);
container.setVisibility(View.VISIBLE);
} }
@Override @Override
......
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/white"/>
<corners android:radius="5dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorPrimaryDark" android:background="?attr/colorPrimaryDark"
tools:context="chat.rocket.android.fragment.add_server.InputHostnameFragment"> android:padding="@dimen/margin_8"
tools:context="chat.rocket.android.fragment.add_server.InputHostnameFragment">
<LinearLayout <android.support.constraint.ConstraintLayout
android:layout_width="wrap_content" android:id="@+id/container"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_gravity="center" android:minWidth="288dp"
android:minWidth="288dp" android:layout_height="wrap_content"
android:padding="@dimen/margin_24" android:padding="@dimen/margin_16"
android:background="@color/white" android:background="@drawable/container_bg"
android:orientation="vertical"> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/version_info"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent">
<LinearLayout <TextView
android:layout_width="match_parent" android:id="@+id/hostnameTextView"
android:layout_height="match_parent" android:layout_width="wrap_content"
android:orientation="horizontal"> android:layout_height="wrap_content"
android:paddingStart="4dp"
<LinearLayout android:paddingLeft="4dp"
android:layout_width="0px" android:text="@string/fragment_input_hostname_hostname"
android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:layout_weight="1" app:layout_constraintTop_toTopOf="parent"
android:orientation="vertical"> app:layout_constraintLeft_toLeftOf="@+id/editor_hostname"
app:layout_constraintBottom_toTopOf="@+id/editor_hostname" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="4dp"
android:paddingLeft="4dp"
android:text="@string/fragment_input_hostname_hostname"
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />
<EditText
android:id="@+id/editor_hostname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/fragment_input_hostname_server_hint"
android:imeOptions="actionGo"
android:inputType="textWebEditText"
android:singleLine="true" />
</LinearLayout>
<Space <EditText
android:layout_width="@dimen/margin_16" android:id="@+id/editor_hostname"
android:layout_height="wrap_content" /> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/fragment_input_hostname_server_hint"
android:imeOptions="actionSend"
android:inputType="textWebEditText"
android:maxLines="1"
app:layout_constraintTop_toBottomOf="@+id/hostnameTextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/btn_connect" />
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:id="@+id/btn_connect" android:id="@+id/btn_connect"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end|bottom" app:elevation="2dp"
app:elevation="2dp" app:fabSize="mini"
app:fabSize="mini" app:srcCompat="@drawable/ic_arrow_forward_white_24dp"
app:srcCompat="@drawable/ic_arrow_forward_white_24dp" /> app:layout_constraintBottom_toBottomOf="@+id/editor_hostname"
</LinearLayout> app:layout_constraintLeft_toRightOf="@+id/editor_hostname"
app:layout_constraintRight_toRightOf="parent" />
</android.support.constraint.ConstraintLayout>
<chat.rocket.android.widget.WaitingView <chat.rocket.android.widget.WaitingView
android:id="@+id/waiting" android:id="@+id/waiting"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_16" android:visibility="gone"
android:layout_gravity="center" app:layout_constraintTop_toTopOf="parent"
android:visibility="gone"/> app:layout_constraintBottom_toTopOf="@id/version_info"
</LinearLayout> app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
<TextView <TextView
android:id="@+id/version_info" android:id="@+id/version_info"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom" android:textColor="@android:color/white"
android:layout_margin="@dimen/margin_8" android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:textColor="@android:color/white" app:layout_constraintRight_toRightOf="parent"
android:textAppearance="@style/TextAppearance.AppCompat.Caption" /> app:layout_constraintLeft_toLeftOf="parent"
</FrameLayout> app:layout_constraintBottom_toBottomOf="parent" />
\ No newline at end of file </android.support.constraint.ConstraintLayout>
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment