Commit 571ce25c authored by ankit2.kumar's avatar ankit2.kumar Committed by Commit bot

Adding option for Stop/Reload in location bar.

Currently reload/stop button is not present in content shell. If user
has to do reload operation then only option to do that is select
the url bar and click go button.Similarly stop button is not present. To stop loading of page only option is to press back button.
Added code to support stop/reload option.

BUG=

Review URL: https://codereview.chromium.org/513183002

Cr-Commit-Position: refs/heads/master@{#292778}
parent 6ef3c555
...@@ -17,6 +17,16 @@ ...@@ -17,6 +17,16 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:background="@drawable/progress"> android:background="@drawable/progress">
<ImageButton android:id="@+id/stop"
android:layout_width="38dp"
android:layout_height="38dp"
android:src="@android:drawable/ic_menu_close_clear_cancel"
android:scaleType="center" />
<ImageButton android:id="@+id/reload"
android:layout_width="38dp"
android:layout_height="38dp"
android:src="@drawable/ic_refresh"
android:scaleType="centerCrop" />
<EditText android:id="@+id/url" <EditText android:id="@+id/url"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
...@@ -49,6 +49,8 @@ public class Shell extends LinearLayout { ...@@ -49,6 +49,8 @@ public class Shell extends LinearLayout {
private EditText mUrlTextView; private EditText mUrlTextView;
private ImageButton mPrevButton; private ImageButton mPrevButton;
private ImageButton mNextButton; private ImageButton mNextButton;
private ImageButton mStopButton;
private ImageButton mReloadButton;
private ClipDrawable mProgressDrawable; private ClipDrawable mProgressDrawable;
...@@ -213,6 +215,20 @@ public class Shell extends LinearLayout { ...@@ -213,6 +215,20 @@ public class Shell extends LinearLayout {
if (mContentViewCore.canGoForward()) mContentViewCore.goForward(); if (mContentViewCore.canGoForward()) mContentViewCore.goForward();
} }
}); });
mStopButton = (ImageButton)findViewById(R.id.stop);
mStopButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mLoading) mContentViewCore.stopLoading();
}
});
mReloadButton = (ImageButton)findViewById(R.id.reload);
mReloadButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mContentViewCore.reload(true);
}
});
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
...@@ -277,6 +293,10 @@ public class Shell extends LinearLayout { ...@@ -277,6 +293,10 @@ public class Shell extends LinearLayout {
private void enableUiControl(int controlId, boolean enabled) { private void enableUiControl(int controlId, boolean enabled) {
if (controlId == 0) mPrevButton.setEnabled(enabled); if (controlId == 0) mPrevButton.setEnabled(enabled);
else if (controlId == 1) mNextButton.setEnabled(enabled); else if (controlId == 1) mNextButton.setEnabled(enabled);
else if (controlId == 2) {
mStopButton.setVisibility(enabled ? VISIBLE : GONE);
mReloadButton.setVisibility(enabled ? GONE : VISIBLE);
}
} }
/** /**
......
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