Add scroll view for choose_lock_pattern in land mode

Wrap the title and header with scroll view in case they are too
large to display

Bug: 32261616
Test: Visual
Change-Id: I61ce67c23e27177e2915df012c450f77b40a8fb2
This commit is contained in:
jackqdyulei
2016-10-21 10:50:34 -07:00
parent c33b78df9c
commit 011f0dbcdb
2 changed files with 49 additions and 24 deletions

View File

@@ -41,37 +41,46 @@
android:layout_marginBottom="@dimen/suw_content_frame_padding_bottom" android:layout_marginBottom="@dimen/suw_content_frame_padding_bottom"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <ImageView
android:layout_width="match_parent" android:id="@+id/suw_layout_icon"
style="@style/SuwGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:src="@drawable/ic_lock"/>
<ImageView <ScrollView
android:id="@+id/suw_layout_icon" android:id="@+id/scroll_layout_title_header"
style="@style/SuwGlifIcon" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="0dp"
android:layout_height="wrap_content" android:layout_weight="3.0">
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:src="@drawable/ic_lock" />
<TextView <LinearLayout
android:id="@+id/suw_layout_title"
style="@style/SuwGlifHeaderTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="0dp" android:orientation="vertical">
android:layout_marginEnd="0dp" />
</LinearLayout> <TextView
android:id="@+id/suw_layout_title"
style="@style/SuwGlifHeaderTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"/>
<!-- header message --> <!-- header message -->
<TextView android:id="@+id/headerText" <TextView
android:layout_width="match_parent" android:id="@+id/headerText"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:layout_marginTop="16dp" android:layout_height="wrap_content"
android:gravity="start|bottom" android:layout_marginTop="16dp"
android:textSize="18sp" /> android:gravity="start|bottom"
android:textSize="18sp"/>
</LinearLayout>
</ScrollView>
<!-- footer can show a message, or confirm / restart buttons --> <!-- footer can show a message, or confirm / restart buttons -->
<RelativeLayout <RelativeLayout

View File

@@ -27,6 +27,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
import com.android.internal.logging.MetricsProto.MetricsEvent; import com.android.internal.logging.MetricsProto.MetricsEvent;
@@ -152,6 +153,9 @@ public class ChooseLockPattern extends SettingsActivity {
protected List<LockPatternView.Cell> mChosenPattern = null; protected List<LockPatternView.Cell> mChosenPattern = null;
private boolean mHideDrawer = false; private boolean mHideDrawer = false;
// ScrollView that contains title and header, only exist in land mode
private ScrollView mTitleHeaderScrollView;
/** /**
* The patten used during the help screen to show how to draw a pattern. * The patten used during the help screen to show how to draw a pattern.
*/ */
@@ -237,6 +241,15 @@ public class ChooseLockPattern extends SettingsActivity {
mFooterText.setText(""); mFooterText.setText("");
mFooterLeftButton.setEnabled(false); mFooterLeftButton.setEnabled(false);
mFooterRightButton.setEnabled(false); mFooterRightButton.setEnabled(false);
if (mTitleHeaderScrollView != null) {
mTitleHeaderScrollView.post(new Runnable() {
@Override
public void run() {
mTitleHeaderScrollView.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
} }
}; };
@@ -415,6 +428,9 @@ public class ChooseLockPattern extends SettingsActivity {
mFooterLeftButton = (TextView) view.findViewById(R.id.footerLeftButton); mFooterLeftButton = (TextView) view.findViewById(R.id.footerLeftButton);
mFooterRightButton = (TextView) view.findViewById(R.id.footerRightButton); mFooterRightButton = (TextView) view.findViewById(R.id.footerRightButton);
mTitleHeaderScrollView = (ScrollView) view.findViewById(R.id
.scroll_layout_title_header);
mFooterLeftButton.setOnClickListener(this); mFooterLeftButton.setOnClickListener(this);
mFooterRightButton.setOnClickListener(this); mFooterRightButton.setOnClickListener(this);