Browse Source

Fixed problem where progress bar didn't display on 4.0 and 4.1

master v4.0.3a-beta
Anthony Restaino 10 years ago
parent
commit
db20a4eeac
  1. 4
      AndroidManifest.xml
  2. 1
      src/acr/browser/lightning/AnimatedProgressBar.java
  3. 177
      src/acr/browser/lightning/BrowserActivity.java

4
AndroidManifest.xml

@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="acr.browser.lightning"
android:versionCode="70"
android:versionName="4.0.2a" >
android:versionCode="71"
android:versionName="4.0.3a" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />

1
src/acr/browser/lightning/AnimatedProgressBar.java

@ -98,7 +98,6 @@ public class AnimatedProgressBar extends LinearLayout { @@ -98,7 +98,6 @@ public class AnimatedProgressBar extends LinearLayout {
mProgressView.getLayoutParams().width = width;
mProgressView.requestLayout();
}
mProgressView.invalidate();
}
@Override

177
src/acr/browser/lightning/BrowserActivity.java

@ -40,6 +40,7 @@ import android.util.Log; @@ -40,6 +40,7 @@ import android.util.Log;
import android.util.TypedValue;
import android.view.*;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.View.OnKeyListener;
import android.view.View.OnLongClickListener;
import android.view.View.OnTouchListener;
@ -87,6 +88,8 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -87,6 +88,8 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
private LightningViewAdapter mTitleAdapter;
private List<HistoryItem> mBookmarkList;
private BookmarkViewAdapter mBookmarkAdapter;
private DrawerArrowDrawable mArrowDrawable;
private ImageView mArrowImage;
private AutoCompleteTextView mSearch;
private ClickHandler mClickHandler;
private AnimatedProgressBar mProgressBar;
@ -227,9 +230,9 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -227,9 +230,9 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
// TODO
final DrawerArrowDrawable drawable = new DrawerArrowDrawable(this);
final ImageView arrow = (ImageView) mActionBar.getCustomView().findViewById(R.id.arrow);
arrow.setImageDrawable(drawable);
mArrowDrawable = new DrawerArrowDrawable(this);
mArrowImage = (ImageView) mActionBar.getCustomView().findViewById(R.id.arrow);
mArrowImage.setImageDrawable(mArrowDrawable);
LinearLayout arrowButton = (LinearLayout) mActionBar.getCustomView().findViewById(
R.id.arrow_button);
arrowButton.setOnClickListener(new OnClickListener() {
@ -290,8 +293,65 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -290,8 +293,65 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
mCopyIcon.setBounds(0, 0, Utils.convertDpiToPixels(mContext, 24),
Utils.convertDpiToPixels(mContext, 24));
mIcon = mRefreshIcon;
SearchClass search = new SearchClass();
mSearch.setCompoundDrawables(null, null, mRefreshIcon, null);
mSearch.setOnKeyListener(new OnKeyListener() {
mSearch.setOnKeyListener(search.new KeyListener());
mSearch.setOnFocusChangeListener(search.new FocusChangeListener());
mSearch.setOnEditorActionListener(search.new EditorActionListener());
mSearch.setOnTouchListener(search.new TouchListener());
mSystemBrowser = getSystemBrowser();
Thread initialize = new Thread(new Runnable() {
@Override
public void run() {
initializeSearchSuggestions(mSearch);
}
});
initialize.run();
mNewTab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
newTab(null, true);
}
});
mNewTab.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
String url = mPreferences.getString(PreferenceConstants.SAVE_URL, null);
if (url != null) {
newTab(url, true);
Toast.makeText(mContext, R.string.deleted_tab, Toast.LENGTH_SHORT).show();
}
mEditPrefs.putString(PreferenceConstants.SAVE_URL, null).apply();
return true;
}
});
// mDrawerLayout.setDrawerListener(mDrawerToggle);
mDrawerLayout.setDrawerShadow(R.drawable.drawer_right_shadow, GravityCompat.END);
mDrawerLayout.setDrawerShadow(R.drawable.drawer_left_shadow, GravityCompat.START);
initializePreferences();
initializeTabs();
if (API <= Build.VERSION_CODES.JELLY_BEAN_MR2) {
WebIconDatabase.getInstance().open(getDir("icons", MODE_PRIVATE).getPath());
}
checkForTor();
}
private class SearchClass {
public class KeyListener implements OnKeyListener {
@Override
public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
@ -311,9 +371,31 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -311,9 +371,31 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
return false;
}
});
mSearch.setOnFocusChangeListener(new View.OnFocusChangeListener() {
}
public class EditorActionListener implements OnEditorActionListener {
@Override
public boolean onEditorAction(TextView arg0, int actionId, KeyEvent arg2) {
// hide the keyboard and search the web when the enter key
// button is pressed
if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_ACTION_NEXT
|| actionId == EditorInfo.IME_ACTION_SEND
|| actionId == EditorInfo.IME_ACTION_SEARCH
|| (arg2.getAction() == KeyEvent.KEYCODE_ENTER)) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
searchTheWeb(mSearch.getText().toString());
if (mCurrentView != null) {
mCurrentView.requestFocus();
}
return true;
}
return false;
}
}
public class FocusChangeListener implements OnFocusChangeListener {
@Override
public void onFocusChange(View v, final boolean hasFocus) {
if (!hasFocus && mCurrentView != null) {
@ -336,9 +418,9 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -336,9 +418,9 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (!hasFocus) {
drawable.setProgress(1.0f - interpolatedTime);
mArrowDrawable.setProgress(1.0f - interpolatedTime);
} else {
drawable.setProgress(interpolatedTime);
mArrowDrawable.setProgress(interpolatedTime);
}
}
@ -359,9 +441,9 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -359,9 +441,9 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
@Override
public void onAnimationEnd(Animation animation) {
if (!hasFocus) {
drawable.setProgress(0.0f);
mArrowDrawable.setProgress(0.0f);
} else {
drawable.setProgress(1.0f);
mArrowDrawable.setProgress(1.0f);
}
}
@ -374,7 +456,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -374,7 +456,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
@Override
public void run() {
arrow.startAnimation(anim);
mArrowImage.startAnimation(anim);
}
}, 100);
@ -384,32 +466,9 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -384,32 +466,9 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
}
}
});
mSearch.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView arg0, int actionId, KeyEvent arg2) {
// hide the keyboard and search the web when the enter key
// button is pressed
if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_ACTION_NEXT
|| actionId == EditorInfo.IME_ACTION_SEND
|| actionId == EditorInfo.IME_ACTION_SEARCH
|| (arg2.getAction() == KeyEvent.KEYCODE_ENTER)) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
searchTheWeb(mSearch.getText().toString());
if (mCurrentView != null) {
mCurrentView.requestFocus();
}
return true;
}
return false;
}
});
mSearch.setOnTouchListener(new OnTouchListener() {
public class TouchListener implements OnTouchListener {
@SuppressLint("ClickableViewAccessibility")
@Override
@ -438,55 +497,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -438,55 +497,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
return false;
}
});
mSystemBrowser = getSystemBrowser();
Thread initialize = new Thread(new Runnable() {
@Override
public void run() {
initializeSearchSuggestions(mSearch);
}
});
initialize.run();
mNewTab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
newTab(null, true);
}
});
mNewTab.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
String url = mPreferences.getString(PreferenceConstants.SAVE_URL, null);
if (url != null) {
newTab(url, true);
Toast.makeText(mContext, R.string.deleted_tab, Toast.LENGTH_SHORT).show();
}
mEditPrefs.putString(PreferenceConstants.SAVE_URL, null).apply();
return true;
}
});
// mDrawerLayout.setDrawerListener(mDrawerToggle);
mDrawerLayout.setDrawerShadow(R.drawable.drawer_right_shadow, GravityCompat.END);
mDrawerLayout.setDrawerShadow(R.drawable.drawer_left_shadow, GravityCompat.START);
initializePreferences();
initializeTabs();
if (API <= Build.VERSION_CODES.JELLY_BEAN_MR2) {
WebIconDatabase.getInstance().open(getDir("icons", MODE_PRIVATE).getPath());
}
checkForTor();
}
private class DrawerLocker implements DrawerListener {

Loading…
Cancel
Save