Change 'Manual setup' into clickable text instead of a checkbox
b/13733521 Change-Id: I7f338cbfb8357c5e1a27c6e886ea96e5c6924d22
This commit is contained in:
parent
0db900d622
commit
392c263c19
@ -54,7 +54,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress" />
|
||||
</LinearLayout>
|
||||
<CheckBox
|
||||
<TextView
|
||||
android:id="@+id/manual_setup"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -63,6 +63,13 @@
|
||||
android:id="@+id/setup_fragment_content"
|
||||
style="@style/account_setup_fragment_container"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/manual_setup"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/account_setup_basics_manual_setup_action"
|
||||
android:visibility="gone"
|
||||
style="@style/account_setup_manual_button" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
<ImageButton
|
||||
|
@ -42,10 +42,4 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress" />
|
||||
<CheckBox
|
||||
android:id="@+id/manual_setup"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/account_setup_basics_manual_setup_action" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2011 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/setup_nav_button_padding_top"
|
||||
android:paddingLeft="@dimen/setup_nav_button_padding_side"
|
||||
android:paddingRight="@dimen/setup_nav_button_padding_side"
|
||||
android:paddingBottom="@dimen/setup_nav_button_padding_bottom"
|
||||
android:orientation="horizontal">
|
||||
<ImageButton
|
||||
style="@style/account_setup_nav_button"
|
||||
android:contentDescription="@string/previous_action"
|
||||
android:id="@+id/previous"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/ic_nav_arrow_previous_button"
|
||||
android:text="@string/next_action" />
|
||||
<View
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1" />
|
||||
<ImageButton
|
||||
style="@style/account_setup_nav_button"
|
||||
android:contentDescription="@string/next_action"
|
||||
android:id="@+id/next"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/ic_nav_arrow_next_button"
|
||||
android:text="@string/next_action" />
|
||||
</LinearLayout>
|
@ -48,6 +48,42 @@
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<!-- Buttons below that -->
|
||||
<include layout="@layout/account_setup_buttons"/>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/setup_nav_button_padding_top"
|
||||
android:paddingLeft="@dimen/setup_nav_button_padding_side"
|
||||
android:paddingRight="@dimen/setup_nav_button_padding_side"
|
||||
android:paddingBottom="@dimen/setup_nav_button_padding_bottom"
|
||||
android:orientation="horizontal">
|
||||
<ImageButton
|
||||
style="@style/account_setup_nav_button"
|
||||
android:contentDescription="@string/previous_action"
|
||||
android:id="@+id/previous"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/ic_nav_arrow_previous_button"
|
||||
android:text="@string/next_action" />
|
||||
<TextView
|
||||
android:id="@+id/manual_setup"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/account_setup_basics_manual_setup_action"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/account_setup_manual_button" />
|
||||
<View
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1" />
|
||||
<ImageButton
|
||||
style="@style/account_setup_nav_button"
|
||||
android:contentDescription="@string/next_action"
|
||||
android:id="@+id/next"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/ic_nav_arrow_next_button"
|
||||
android:text="@string/next_action" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
23
res/values-w800dp/constants.xml
Normal file
23
res/values-w800dp/constants.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2014 Google Inc.
|
||||
Licensed to The Android Open Source Project.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Int value for whether we want the 'previous' button on the Basics setup screen to be
|
||||
invisible or gone -->
|
||||
<bool name="setup_basics_prev_button_gone">false</bool>
|
||||
|
||||
</resources>
|
@ -23,6 +23,7 @@
|
||||
<color name="account_setup_label_text_color">#666666</color>
|
||||
<color name="account_setup_divider_color">#CCCCCC</color>
|
||||
<color name="account_setup_xlarge_background_color">#3b3b3b</color>
|
||||
<color name="account_setup_manual_button_color">#373737</color>
|
||||
|
||||
<!-- Standard text colors -->
|
||||
<color name="text_secondary_color">#666666</color>
|
||||
|
@ -18,4 +18,8 @@
|
||||
<resources>
|
||||
<!-- Boolean value indicating whether the feedback is supported. -->
|
||||
<bool name="feedback_supported">false</bool>
|
||||
|
||||
<!-- Int value for whether we want the 'previous' button on the Basics setup screen to be
|
||||
invisible or gone. See also w800dp -->
|
||||
<bool name="setup_basics_prev_button_gone">true</bool>
|
||||
</resources>
|
@ -66,6 +66,12 @@
|
||||
<item name="android:layout_marginBottom">@dimen/setup_info_text_margin_bottom</item>
|
||||
</style>
|
||||
|
||||
<style name="account_setup_manual_button">
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:textColor">@color/account_setup_manual_button_color</item>
|
||||
<item name="android:alpha">0.4</item>
|
||||
</style>
|
||||
|
||||
<!-- Account setup row label text -->
|
||||
<style name="account_setup_label_text">
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
|
@ -32,7 +32,8 @@ import com.android.emailcommon.mail.Address;
|
||||
|
||||
public class AccountSetupBasicsFragment extends AccountSetupFragment {
|
||||
private EditText mEmailView;
|
||||
private CheckBox mManualSetupView;
|
||||
private View mManualSetupView;
|
||||
private boolean mManualSetup;
|
||||
|
||||
public interface Callback extends AccountSetupFragment.Callback {
|
||||
}
|
||||
@ -51,6 +52,7 @@ public class AccountSetupBasicsFragment extends AccountSetupFragment {
|
||||
|
||||
mEmailView = UiUtilities.getView(view, R.id.account_email);
|
||||
mManualSetupView = UiUtilities.getView(view, R.id.manual_setup);
|
||||
mManualSetupView.setOnClickListener(this);
|
||||
|
||||
final TextWatcher textWatcher = new TextWatcher() {
|
||||
@Override
|
||||
@ -67,7 +69,17 @@ public class AccountSetupBasicsFragment extends AccountSetupFragment {
|
||||
|
||||
mEmailView.addTextChangedListener(textWatcher);
|
||||
|
||||
// On some layouts we want the button to only be invisible but still take up space, but on
|
||||
// others we need it to be completely gone. So we divert based on resources.
|
||||
final boolean prevButtonGone =
|
||||
getResources().getBoolean(R.bool.setup_basics_prev_button_gone);
|
||||
if (prevButtonGone) {
|
||||
setPreviousButtonVisibility(View.GONE);
|
||||
} else {
|
||||
setPreviousButtonVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
setManualSetupButtonVisibility(View.VISIBLE);
|
||||
|
||||
return view;
|
||||
}
|
||||
@ -78,6 +90,23 @@ public class AccountSetupBasicsFragment extends AccountSetupFragment {
|
||||
validateFields();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final int viewId = v.getId();
|
||||
final Callback callback = (Callback) getActivity();
|
||||
|
||||
if (viewId == R.id.next) {
|
||||
// Handle "Next" button here so we can reset the manual setup diversion
|
||||
mManualSetup = false;
|
||||
callback.onNextButton();
|
||||
} else if (viewId == R.id.manual_setup) {
|
||||
mManualSetup = true;
|
||||
callback.onNextButton();
|
||||
} else {
|
||||
super.onClick(v);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateFields() {
|
||||
final String emailField = getEmail();
|
||||
final Address[] addresses = Address.parse(emailField);
|
||||
@ -89,6 +118,21 @@ public class AccountSetupBasicsFragment extends AccountSetupFragment {
|
||||
setNextButtonEnabled(emailValid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set visibitlity of the "manual setup" button
|
||||
* @param visibility {@link View#INVISIBLE}, {@link View#VISIBLE}, {@link View#GONE}
|
||||
*/
|
||||
public void setManualSetupButtonVisibility(int visibility) {
|
||||
mManualSetupView.setVisibility(visibility);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNextButtonEnabled(boolean enabled) {
|
||||
super.setNextButtonEnabled(enabled);
|
||||
mManualSetupView.setEnabled(enabled);
|
||||
}
|
||||
|
||||
public void setEmail(final String email) {
|
||||
mEmailView.setText(email);
|
||||
}
|
||||
@ -98,6 +142,6 @@ public class AccountSetupBasicsFragment extends AccountSetupFragment {
|
||||
}
|
||||
|
||||
public boolean isManualSetup() {
|
||||
return mManualSetupView.isChecked();
|
||||
return mManualSetup;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user