mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 845612 - Add @Override annotations for implemented interfaces. r=kats
This commit is contained in:
parent
ecbec88fd7
commit
09bb93a1e8
@ -171,6 +171,7 @@ public class AboutHomeContent extends ScrollView
|
||||
|
||||
mTopSitesGrid = (TopSitesGridView)findViewById(R.id.top_sites_grid);
|
||||
mTopSitesGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
|
||||
TopSitesViewHolder holder = (TopSitesViewHolder) v.getTag();
|
||||
String spec = holder.getUrl();
|
||||
@ -187,6 +188,7 @@ public class AboutHomeContent extends ScrollView
|
||||
});
|
||||
|
||||
mTopSitesGrid.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)menuInfo;
|
||||
mTopSitesGrid.setSelectedPosition(info.position);
|
||||
@ -217,6 +219,7 @@ public class AboutHomeContent extends ScrollView
|
||||
mRemoteTabs = (AboutHomeSection) findViewById(R.id.remote_tabs);
|
||||
|
||||
mAddons.setOnMoreTextClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mUriLoadCallback != null)
|
||||
mUriLoadCallback.callback("https://addons.mozilla.org/android");
|
||||
@ -224,6 +227,7 @@ public class AboutHomeContent extends ScrollView
|
||||
});
|
||||
|
||||
mRemoteTabs.setOnMoreTextClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mActivity.showRemoteTabs();
|
||||
}
|
||||
@ -281,6 +285,7 @@ public class AboutHomeContent extends ScrollView
|
||||
final GeckoApp.StartupMode startupMode = mActivity.getStartupMode();
|
||||
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// The listener might run before the UI is initially updated.
|
||||
// In this case, we should simply wait for the initial setup
|
||||
@ -302,6 +307,7 @@ public class AboutHomeContent extends ScrollView
|
||||
final Cursor newCursor = BrowserDB.getTopSites(resolver, mNumberOfTopSites);
|
||||
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mTopSitesAdapter == null) {
|
||||
mTopSitesAdapter = new TopSitesCursorAdapter(mActivity,
|
||||
@ -437,6 +443,7 @@ public class AboutHomeContent extends ScrollView
|
||||
|
||||
void update(final EnumSet<UpdateFlags> flags) {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (flags.contains(UpdateFlags.TOP_SITES))
|
||||
loadTopSites();
|
||||
@ -575,6 +582,7 @@ public class AboutHomeContent extends ScrollView
|
||||
|
||||
final JSONArray array = addonsArray;
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (array == null || array.length() == 0) {
|
||||
@ -603,6 +611,7 @@ public class AboutHomeContent extends ScrollView
|
||||
|
||||
final String homepageUrl = jsonobj.getString("homepageURL");
|
||||
row.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mUriLoadCallback != null)
|
||||
mUriLoadCallback.callback(homepageUrl);
|
||||
@ -612,6 +621,7 @@ public class AboutHomeContent extends ScrollView
|
||||
Favicons favicons = Favicons.getInstance();
|
||||
favicons.loadFavicon(pageUrl, iconUrl, true,
|
||||
new Favicons.OnFaviconLoadedListener() {
|
||||
@Override
|
||||
public void onFaviconLoaded(String url, Bitmap favicon) {
|
||||
if (favicon != null) {
|
||||
Drawable drawable = new BitmapDrawable(favicon);
|
||||
@ -654,6 +664,7 @@ public class AboutHomeContent extends ScrollView
|
||||
lastTabUrlsList.add(url);
|
||||
|
||||
AboutHomeContent.this.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
View container = mInflater.inflate(R.layout.abouthome_last_tabs_row, mLastTabs.getItemsContainer(), false);
|
||||
((TextView) container.findViewById(R.id.last_tab_title)).setText(tab.getSelectedTitle());
|
||||
@ -663,6 +674,7 @@ public class AboutHomeContent extends ScrollView
|
||||
}
|
||||
|
||||
container.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int flags = Tabs.LOADURL_NEW_TAB;
|
||||
if (Tabs.getInstance().getSelectedTab().isPrivate())
|
||||
@ -680,10 +692,12 @@ public class AboutHomeContent extends ScrollView
|
||||
final int numLastTabs = lastTabUrlsList.size();
|
||||
if (numLastTabs >= 1) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (numLastTabs > 1) {
|
||||
mLastTabs.showMoreText();
|
||||
mLastTabs.setOnMoreTextClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int flags = Tabs.LOADURL_NEW_TAB;
|
||||
if (Tabs.getInstance().getSelectedTab().isPrivate())
|
||||
@ -705,6 +719,7 @@ public class AboutHomeContent extends ScrollView
|
||||
private void loadRemoteTabs() {
|
||||
if (!SyncAccounts.syncAccountsExist(mActivity)) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mRemoteTabs.hide();
|
||||
}
|
||||
@ -1043,6 +1058,7 @@ public class AboutHomeContent extends ScrollView
|
||||
}
|
||||
|
||||
int requestCode = GeckoAppShell.sActivityHelper.makeRequestCode(new ActivityResultHandler() {
|
||||
@Override
|
||||
public void onActivityResult(int resultCode, Intent data) {
|
||||
if (resultCode == Activity.RESULT_CANCELED || data == null)
|
||||
return;
|
||||
|
@ -66,6 +66,7 @@ public class AboutHomePromoBox extends TextView implements View.OnClickListener
|
||||
super(aText, aBoldText, aImage);
|
||||
// The listener will run on the background thread (see 2nd argument)
|
||||
mAccountListener = new OnAccountsUpdateListener() {
|
||||
@Override
|
||||
public void onAccountsUpdated(Account[] accounts) {
|
||||
showRandomPromo();
|
||||
}
|
||||
@ -125,6 +126,7 @@ public class AboutHomePromoBox extends TextView implements View.OnClickListener
|
||||
// if the user visits the marketplace through some other means, we'll have to wait
|
||||
// until we are refreshed or restarted to get the correct value
|
||||
v.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showRandomPromo();
|
||||
}
|
||||
@ -149,6 +151,7 @@ public class AboutHomePromoBox extends TextView implements View.OnClickListener
|
||||
*/
|
||||
public void showRandomPromo() {
|
||||
getAvailableTypes(new GetTypesCallback() {
|
||||
@Override
|
||||
public void onGotTypes(ArrayList<Type> types) {
|
||||
if (types.size() == 0) {
|
||||
hide();
|
||||
|
@ -240,6 +240,7 @@ class ActivityHandlerHelper {
|
||||
mItems = aItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
GeckoApp.mAppContext.getPromptService().show(mTitle, "", mItems, false);
|
||||
}
|
||||
|
@ -74,8 +74,10 @@ class AndroidImportPreference extends MultiChoicePreference {
|
||||
true);
|
||||
|
||||
final Runnable stopCallback = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
@ -87,6 +89,7 @@ class AndroidImportPreference extends MultiChoicePreference {
|
||||
// Constructing AndroidImport may need finding the profile,
|
||||
// which hits disk, so it needs to go into a Runnable too.
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AndroidImport(mContext, stopCallback, doBookmarks, doHistory).run();
|
||||
}
|
||||
|
@ -34,10 +34,14 @@ public class AnimatedHeightLayout extends RelativeLayout {
|
||||
anim.setDuration(ANIMATION_DURATION);
|
||||
anim.setInterpolator(new DecelerateInterpolator());
|
||||
anim.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {}
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {}
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finishAnimation();
|
||||
}
|
||||
|
@ -88,16 +88,20 @@ public class AwesomeBar extends GeckoActivity {
|
||||
|
||||
mAwesomeTabs = (AwesomeBarTabs) findViewById(R.id.awesomebar_tabs);
|
||||
mAwesomeTabs.setOnUrlOpenListener(new AwesomeBarTabs.OnUrlOpenListener() {
|
||||
@Override
|
||||
public void onUrlOpen(String url, String title) {
|
||||
openUrlAndFinish(url, title, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSearch(String engine, String text) {
|
||||
openSearchAndFinish(text, engine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEditSuggestion(final String text) {
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mText.setText(text);
|
||||
mText.setSelection(mText.getText().length());
|
||||
@ -110,6 +114,7 @@ public class AwesomeBar extends GeckoActivity {
|
||||
});
|
||||
|
||||
mGoButton.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openUserEnteredAndFinish(mText.getText().toString());
|
||||
}
|
||||
@ -139,6 +144,7 @@ public class AwesomeBar extends GeckoActivity {
|
||||
mAwesomeTabs.setTarget(mTarget);
|
||||
|
||||
mText.setOnKeyPreImeListener(new CustomEditText.OnKeyPreImeListener() {
|
||||
@Override
|
||||
public boolean onKeyPreIme(View v, int keyCode, KeyEvent event) {
|
||||
// We only want to process one event per tap
|
||||
if (event.getAction() != KeyEvent.ACTION_DOWN)
|
||||
@ -175,6 +181,7 @@ public class AwesomeBar extends GeckoActivity {
|
||||
});
|
||||
|
||||
mText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
String text = s.toString();
|
||||
mAwesomeTabs.filter(text);
|
||||
@ -190,11 +197,13 @@ public class AwesomeBar extends GeckoActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before,
|
||||
int count) {
|
||||
// do nothing
|
||||
@ -202,6 +211,7 @@ public class AwesomeBar extends GeckoActivity {
|
||||
});
|
||||
|
||||
mText.setOnKeyListener(new View.OnKeyListener() {
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
if (event.getAction() != KeyEvent.ACTION_DOWN)
|
||||
@ -216,6 +226,7 @@ public class AwesomeBar extends GeckoActivity {
|
||||
});
|
||||
|
||||
mText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (v == null || hasFocus) {
|
||||
return;
|
||||
@ -565,6 +576,7 @@ public class AwesomeBar extends GeckoActivity {
|
||||
keywordText.setText(keyword);
|
||||
|
||||
editPrompt.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
(new UiAsyncTask<Void, Void, Void>(GeckoAppShell.getHandler()) {
|
||||
@Override
|
||||
@ -584,7 +596,8 @@ public class AwesomeBar extends GeckoActivity {
|
||||
});
|
||||
|
||||
editPrompt.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
// do nothing
|
||||
}
|
||||
});
|
||||
@ -595,10 +608,13 @@ public class AwesomeBar extends GeckoActivity {
|
||||
locationText.addTextChangedListener(new TextWatcher() {
|
||||
private boolean mEnabled = true;
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
boolean enabled = (s.toString().trim().length() > 0);
|
||||
if (mEnabled != enabled) {
|
||||
|
@ -130,6 +130,7 @@ public class AwesomeBarTabs extends TabHost
|
||||
setup();
|
||||
|
||||
mListTouchListener = new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent event) {
|
||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN)
|
||||
hideSoftInput(view);
|
||||
@ -264,6 +265,7 @@ public class AwesomeBarTabs extends TabHost
|
||||
// this MUST be done after tw.addView to overwrite the listener added by tabWidget
|
||||
// which delegates to TabHost (which we don't have)
|
||||
indicatorView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mViewPager.setCurrentItem(contentId, true);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import android.content.Intent;
|
||||
class AwesomebarResultHandler implements ActivityResultHandler {
|
||||
private static final String LOGTAG = "GeckoAwesomebarResultHandler";
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int resultCode, Intent data) {
|
||||
if (data != null) {
|
||||
String url = data.getStringExtra(AwesomeBar.URL_KEY);
|
||||
|
@ -75,6 +75,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
private PropertyAnimator mMainLayoutAnimator;
|
||||
|
||||
private static final Interpolator sTabsInterpolator = new Interpolator() {
|
||||
@Override
|
||||
public float getInterpolation(float t) {
|
||||
t -= 1.0f;
|
||||
return t * t * t * t * t + 1.0f;
|
||||
@ -110,6 +111,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
// Delay calling showTabs so that it does not modify the mTabsChangedListeners
|
||||
// array while we are still iterating through the array.
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (areTabsShown() && mTabsPanel.getCurrentPanel() != panel)
|
||||
showTabs(panel);
|
||||
@ -154,6 +156,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
}
|
||||
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BrowserDB.addReadingListItem(getContentResolver(), title, url);
|
||||
showToast(R.string.reading_list_added, Toast.LENGTH_SHORT);
|
||||
@ -163,6 +166,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
|
||||
void handleReaderRemoved(final String url) {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BrowserDB.removeReadingListItemWithURL(getContentResolver(), url);
|
||||
showToast(R.string.reading_list_removed, Toast.LENGTH_SHORT);
|
||||
@ -173,6 +177,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
@Override
|
||||
void onStatePurged() {
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mAboutHomeContent != null)
|
||||
mAboutHomeContent.setLastTabsVisibility(false);
|
||||
@ -276,6 +281,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
@Override
|
||||
void toggleChrome(final boolean aShow) {
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (aShow) {
|
||||
mBrowserToolbar.show();
|
||||
@ -294,6 +300,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
@Override
|
||||
void focusChrome() {
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mBrowserToolbar.show();
|
||||
mBrowserToolbar.requestFocusFromTouch();
|
||||
@ -421,6 +428,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
} catch (Exception ex) { }
|
||||
final MenuItemInfo menuItemInfo = info;
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
addAddonMenuItem(menuItemInfo);
|
||||
}
|
||||
@ -428,6 +436,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
} else if (event.equals("Menu:Remove")) {
|
||||
final int id = message.getInt("id") + ADDON_MENU_OFFSET;
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
removeAddonMenuItem(id);
|
||||
}
|
||||
@ -436,6 +445,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
final int id = message.getInt("id") + ADDON_MENU_OFFSET;
|
||||
final JSONObject options = message.getJSONObject("options");
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateAddonMenuItem(id, options);
|
||||
}
|
||||
@ -453,6 +463,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
|
||||
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
|
||||
dialogBuilder.setSingleChoiceItems(titleArray, selected, new AlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
try {
|
||||
JSONObject charset = charsets.getJSONObject(which);
|
||||
@ -464,11 +475,13 @@ abstract public class BrowserApp extends GeckoApp
|
||||
}
|
||||
});
|
||||
dialogBuilder.setNegativeButton(R.string.button_cancel, new AlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dialogBuilder.show();
|
||||
}
|
||||
@ -478,6 +491,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
GeckoPreferences.setCharEncodingState(visible);
|
||||
final Menu menu = mMenu;
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (menu != null)
|
||||
menu.findItem(R.id.char_encoding).setVisible(visible);
|
||||
@ -497,6 +511,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
super.handleMessage(event, message);
|
||||
final Menu menu = mMenu;
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (menu != null)
|
||||
menu.findItem(R.id.settings).setEnabled(true);
|
||||
@ -663,6 +678,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
long id = Favicons.getInstance().loadFavicon(tab.getURL(), tab.getFaviconURL(), !tab.isPrivate(),
|
||||
new Favicons.OnFaviconLoadedListener() {
|
||||
|
||||
@Override
|
||||
public void onFaviconLoaded(String pageUrl, Bitmap favicon) {
|
||||
// Leave favicon UI untouched if we failed to load the image
|
||||
// for some reason.
|
||||
@ -735,6 +751,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
mShow = show;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (mShow) {
|
||||
if (mAboutHomeContent == null) {
|
||||
@ -742,12 +759,14 @@ abstract public class BrowserApp extends GeckoApp
|
||||
mAboutHomeContent.init();
|
||||
mAboutHomeContent.update(AboutHomeContent.UpdateFlags.ALL);
|
||||
mAboutHomeContent.setUriLoadCallback(new AboutHomeContent.UriLoadCallback() {
|
||||
@Override
|
||||
public void callback(String url) {
|
||||
mBrowserToolbar.setProgressVisibility(true);
|
||||
Tabs.getInstance().loadUrl(url);
|
||||
}
|
||||
});
|
||||
mAboutHomeContent.setLoadCompleteCallback(new AboutHomeContent.VoidCallback() {
|
||||
@Override
|
||||
public void callback() {
|
||||
mAboutHomeStartupTimer.stop();
|
||||
}
|
||||
@ -852,6 +871,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
}
|
||||
else if (info.icon.startsWith("jar:") || info.icon.startsWith("file://")) {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
URL url = new URL(info.icon);
|
||||
@ -991,15 +1011,16 @@ abstract public class BrowserApp extends GeckoApp
|
||||
|
||||
@Override
|
||||
public void setFullScreen(final boolean fullscreen) {
|
||||
super.setFullScreen(fullscreen);
|
||||
mMainHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
if (fullscreen)
|
||||
mBrowserToolbar.hide();
|
||||
else
|
||||
mBrowserToolbar.show();
|
||||
}
|
||||
});
|
||||
super.setFullScreen(fullscreen);
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (fullscreen)
|
||||
mBrowserToolbar.hide();
|
||||
else
|
||||
mBrowserToolbar.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,6 +127,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
}
|
||||
mLayout = layout;
|
||||
mLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
}
|
||||
});
|
||||
@ -153,12 +154,14 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
|
||||
mAwesomeBar = mLayout.findViewById(R.id.awesome_bar);
|
||||
mAwesomeBar.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mActivity.autoHideTabs();
|
||||
onAwesomeBarSearch();
|
||||
}
|
||||
});
|
||||
mAwesomeBar.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
MenuInflater inflater = mActivity.getMenuInflater();
|
||||
inflater.inflate(R.menu.titlebar_contextmenu, menu);
|
||||
@ -188,6 +191,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
|
||||
mTabs = (TabsButton) mLayout.findViewById(R.id.tabs);
|
||||
mTabs.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
toggleTabs();
|
||||
}
|
||||
@ -213,11 +217,13 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
|
||||
mBack = (ImageButton) mLayout.findViewById(R.id.back);
|
||||
mBack.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Tabs.getInstance().getSelectedTab().doBack();
|
||||
}
|
||||
});
|
||||
mBack.setOnLongClickListener(new Button.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
return Tabs.getInstance().getSelectedTab().showBackHistory();
|
||||
}
|
||||
@ -226,17 +232,20 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
mForward = (ImageButton) mLayout.findViewById(R.id.forward);
|
||||
mForward.setEnabled(false); // initialize the forward button to not be enabled
|
||||
mForward.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Tabs.getInstance().getSelectedTab().doForward();
|
||||
}
|
||||
});
|
||||
mForward.setOnLongClickListener(new Button.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
return Tabs.getInstance().getSelectedTab().showForwardHistory();
|
||||
}
|
||||
});
|
||||
|
||||
Button.OnClickListener faviconListener = new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mSiteSecurity.getVisibility() != View.VISIBLE)
|
||||
return;
|
||||
@ -259,6 +268,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
|
||||
mStop = (ImageButton) mLayout.findViewById(R.id.stop);
|
||||
mStop.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
if (tab != null)
|
||||
@ -269,6 +279,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
|
||||
mReader = (ImageButton) mLayout.findViewById(R.id.reader);
|
||||
mReader.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
if (tab != null)
|
||||
@ -317,6 +328,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
if (mHasSoftMenuButton) {
|
||||
mMenu.setVisibility(View.VISIBLE);
|
||||
mMenu.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
mActivity.openOptionsMenu();
|
||||
}
|
||||
@ -353,6 +365,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
mMenuPopup.setPanelView(panel);
|
||||
|
||||
mMenuPopup.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
mActivity.onOptionsMenuClosed(null);
|
||||
}
|
||||
@ -375,6 +388,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
mAwesomeBarRightEdge.requestLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
|
||||
switch(msg) {
|
||||
case TITLE:
|
||||
@ -630,6 +644,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
});
|
||||
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
contentAnimator.start();
|
||||
}
|
||||
@ -748,6 +763,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
mActivity.getString(R.string.one_tab));
|
||||
mCount = count;
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GeckoTextView view = (GeckoTextView) mTabsCount.getCurrentView();
|
||||
view.setSelected(true);
|
||||
@ -755,6 +771,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
}, mDuration);
|
||||
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GeckoTextView view = (GeckoTextView) mTabsCount.getCurrentView();
|
||||
view.setSelected(false);
|
||||
|
@ -24,6 +24,7 @@ class CameraImageResultHandler implements ActivityResultHandler {
|
||||
mFilePickerResult = resultQueue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int resultCode, Intent data) {
|
||||
try {
|
||||
if (resultCode != Activity.RESULT_OK) {
|
||||
|
@ -23,6 +23,7 @@ class CameraVideoResultHandler implements ActivityResultHandler {
|
||||
mFilePickerResult = resultQueue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int resultCode, Intent data) {
|
||||
try {
|
||||
if (data == null || resultCode != Activity.RESULT_OK) {
|
||||
|
@ -15,15 +15,18 @@ public class CheckableLinearLayout extends LinearLayout implements Checkable {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return mCheckBox != null ? mCheckBox.isChecked() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChecked(boolean isChecked) {
|
||||
if (mCheckBox != null)
|
||||
mCheckBox.setChecked(isChecked);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggle() {
|
||||
if (mCheckBox != null)
|
||||
mCheckBox.toggle();
|
||||
|
@ -84,6 +84,7 @@ public class CrashReporter extends Activity
|
||||
private void doFinish() {
|
||||
if (mHandler != null) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finish();
|
||||
}
|
||||
@ -147,6 +148,7 @@ public class CrashReporter extends Activity
|
||||
|
||||
mProgressDialog.show();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sendReport(mPendingMinidumpFile, mExtrasStringMap, mPendingExtrasFile);
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ public final class Distribution {
|
||||
public static void init(final Context context, final String packagePath) {
|
||||
// Read/write preferences and files on the background thread.
|
||||
GeckoBackgroundThread.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Bail if we've already initialized the distribution.
|
||||
SharedPreferences settings = context.getSharedPreferences(GeckoApp.PREFS_NAME, Activity.MODE_PRIVATE);
|
||||
|
@ -106,6 +106,7 @@ public class DoorHanger extends LinearLayout implements Button.OnClickListener {
|
||||
mChoicesLayout.addView(mButton, mLayoutParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
JSONObject response = new JSONObject();
|
||||
try {
|
||||
|
@ -63,6 +63,7 @@ public class DoorHangerPopup extends PopupWindow
|
||||
mAnchor = aAnchor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, JSONObject geckoObject) {
|
||||
try {
|
||||
if (event.equals("Doorhanger:Add")) {
|
||||
@ -73,6 +74,7 @@ public class DoorHangerPopup extends PopupWindow
|
||||
final JSONObject options = geckoObject.getJSONObject("options");
|
||||
|
||||
mActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
addDoorHanger(tabId, value, message, buttons, options);
|
||||
}
|
||||
@ -82,6 +84,7 @@ public class DoorHangerPopup extends PopupWindow
|
||||
final String value = geckoObject.getString("value");
|
||||
|
||||
mActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
DoorHanger doorHanger = getDoorHanger(tabId, value);
|
||||
if (doorHanger == null)
|
||||
@ -98,6 +101,7 @@ public class DoorHangerPopup extends PopupWindow
|
||||
}
|
||||
|
||||
// This callback is automatically executed on the UI thread.
|
||||
@Override
|
||||
public void onTabChanged(final Tab tab, final Tabs.TabEvents msg, final Object data) {
|
||||
switch(msg) {
|
||||
case CLOSED:
|
||||
|
@ -85,6 +85,7 @@ public class Favicons {
|
||||
|
||||
// We want to always run the listener on UI thread
|
||||
GeckoAppShell.getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (listener != null)
|
||||
listener.onFaviconLoaded(pageUrl, image);
|
||||
|
@ -16,6 +16,7 @@ class FilePickerResultHandlerSync extends FilePickerResultHandler {
|
||||
super(resultQueue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int resultCode, Intent data) {
|
||||
try {
|
||||
mFilePickerResult.put(handleActivityResult(resultCode, data));
|
||||
|
@ -42,6 +42,7 @@ public class FindInPageBar extends RelativeLayout implements TextWatcher, View.O
|
||||
mFindText = (CustomEditText) content.findViewById(R.id.find_text);
|
||||
mFindText.addTextChangedListener(this);
|
||||
mFindText.setOnKeyPreImeListener(new CustomEditText.OnKeyPreImeListener() {
|
||||
@Override
|
||||
public boolean onKeyPreIme(View v, int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
hide();
|
||||
@ -67,7 +68,8 @@ public class FindInPageBar extends RelativeLayout implements TextWatcher, View.O
|
||||
} else {
|
||||
// showSoftInput won't work until after the window is focused.
|
||||
mFindText.setOnWindowFocusChangeListener(new CustomEditText.OnWindowFocusChangeListener() {
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
if (!hasFocus)
|
||||
return;
|
||||
mFindText.setOnWindowFocusChangeListener(null);
|
||||
@ -90,20 +92,24 @@ public class FindInPageBar extends RelativeLayout implements TextWatcher, View.O
|
||||
|
||||
// TextWatcher implementation
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("FindInPage:Find", s.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
// View.OnClickListener implementation
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.find_prev:
|
||||
|
@ -80,6 +80,7 @@ class FontSizePreference extends DialogPreference {
|
||||
mIncreaseFontButton = (Button) dialogView.findViewById(R.id.increase_preview_font_button);
|
||||
setButtonState(mPreviewFontIndex);
|
||||
mDecreaseFontButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mPreviewFontIndex = Math.max(mPreviewFontIndex - 1, 0);
|
||||
updatePreviewFontSize(mFontTwipValues[mPreviewFontIndex]);
|
||||
@ -91,6 +92,7 @@ class FontSizePreference extends DialogPreference {
|
||||
}
|
||||
});
|
||||
mIncreaseFontButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mPreviewFontIndex = Math.min(mPreviewFontIndex + 1, mFontTwipValues.length - 1);
|
||||
updatePreviewFontSize(mFontTwipValues[mPreviewFontIndex]);
|
||||
|
@ -82,6 +82,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
||||
unregisterEventListener("FormAssist:Hide");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
try {
|
||||
if (event.equals("FormAssist:AutoComplete")) {
|
||||
@ -101,6 +102,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
||||
final JSONArray rect = message.getJSONArray("rect");
|
||||
final double zoom = message.getDouble("zoom");
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showAutoCompleteSuggestions(suggestions, rect, zoom);
|
||||
}
|
||||
@ -112,6 +114,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
||||
final JSONArray rect = message.getJSONArray("rect");
|
||||
final double zoom = message.getDouble("zoom");
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showValidationMessage(validationMessage, rect, zoom);
|
||||
}
|
||||
@ -120,6 +123,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
||||
|
||||
private void handleHideMessage(JSONObject message) {
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
hide();
|
||||
}
|
||||
@ -132,6 +136,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
||||
mAutoCompleteList = (ListView) inflater.inflate(R.layout.autocomplete_list, null);
|
||||
|
||||
mAutoCompleteList.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parentView, View view, int position, long id) {
|
||||
// Use the value stored with the autocomplete view, not the label text,
|
||||
// since they can be different.
|
||||
|
@ -43,6 +43,7 @@ public class GeckoAccessibility {
|
||||
|
||||
public static void updateAccessibilitySettings () {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
JSONObject ret = new JSONObject();
|
||||
sEnabled = false;
|
||||
@ -129,6 +130,7 @@ public class GeckoAccessibility {
|
||||
// Before Jelly Bean we send events directly from here while spoofing the source by setting
|
||||
// the package and class name manually.
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sendDirectAccessibilityEvent(eventType, message);
|
||||
}
|
||||
@ -160,6 +162,7 @@ public class GeckoAccessibility {
|
||||
// Store the JSON message and use it to populate the event later in the code path.
|
||||
sEventMessage = message;
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// If this is an accessibility focus, a lot of internal voodoo happens so we perform an
|
||||
// accessibility focus action on the view, and it in turn sends the right events.
|
||||
|
@ -78,6 +78,7 @@ public class GeckoActivity extends Activity implements GeckoActivityStatus {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGeckoActivityOpened() {
|
||||
return mGeckoActivityOpened;
|
||||
}
|
||||
|
@ -197,6 +197,7 @@ abstract public class GeckoApp
|
||||
|
||||
void focusChrome() { }
|
||||
|
||||
@Override
|
||||
public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
|
||||
// When a tab is closed, it is always unselected first.
|
||||
// When a tab is unselected, another tab is always selected first.
|
||||
@ -738,6 +739,7 @@ abstract public class GeckoApp
|
||||
return hasMenu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
try {
|
||||
if (event.equals("Toast:Show")) {
|
||||
@ -795,9 +797,11 @@ abstract public class GeckoApp
|
||||
final String url = message.getString("url");
|
||||
final String title = message.getString("title");
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(GeckoApp.mAppContext, R.string.bookmark_added, Toast.LENGTH_SHORT).show();
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BrowserDB.addBookmark(GeckoApp.mAppContext.getContentResolver(), title, url);
|
||||
}
|
||||
@ -859,6 +863,7 @@ abstract public class GeckoApp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResponse() {
|
||||
String res = mCurrentResponse;
|
||||
mCurrentResponse = "";
|
||||
@ -908,10 +913,12 @@ abstract public class GeckoApp
|
||||
new String[] { "setting", "value" },
|
||||
new int[] { R.id.setting, R.id.value }
|
||||
), -1, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) { }
|
||||
});
|
||||
|
||||
builder.setPositiveButton(R.string.site_settings_clear, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
ListView listView = ((AlertDialog) dialog).getListView();
|
||||
SparseBooleanArray checkedItemPositions = listView.getCheckedItemPositions();
|
||||
@ -929,12 +936,14 @@ abstract public class GeckoApp
|
||||
}
|
||||
|
||||
builder.setNegativeButton(R.string.site_settings_cancel, new DialogInterface.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Dialog dialog = builder.create();
|
||||
dialog.show();
|
||||
@ -952,6 +961,7 @@ abstract public class GeckoApp
|
||||
|
||||
public void showToast(final int resId, final int duration) {
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(mAppContext, resId, duration).show();
|
||||
}
|
||||
@ -960,6 +970,7 @@ abstract public class GeckoApp
|
||||
|
||||
void handleShowToast(final String message, final String duration) {
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast toast;
|
||||
if (duration.equals("long"))
|
||||
@ -1001,6 +1012,7 @@ abstract public class GeckoApp
|
||||
|
||||
void addPluginView(final View view, final Rect rect, final boolean isFullScreen) {
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Tabs tabs = Tabs.getInstance();
|
||||
Tab tab = tabs.getSelectedTab();
|
||||
@ -1040,6 +1052,7 @@ abstract public class GeckoApp
|
||||
// We need do do this on the next iteration in order to avoid
|
||||
// a deadlock, see comment below in FullScreenHolder
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mLayerView.show();
|
||||
}
|
||||
@ -1056,6 +1069,7 @@ abstract public class GeckoApp
|
||||
|
||||
void removePluginView(final View view, final boolean isFullScreen) {
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Tabs tabs = Tabs.getInstance();
|
||||
Tab tab = tabs.getSelectedTab();
|
||||
@ -1279,6 +1293,7 @@ abstract public class GeckoApp
|
||||
|
||||
public void setFullScreen(final boolean fullscreen) {
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Hide/show the system notification bar
|
||||
Window window = getWindow();
|
||||
@ -1404,6 +1419,7 @@ abstract public class GeckoApp
|
||||
}
|
||||
|
||||
GeckoBackgroundThread.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SharedPreferences prefs =
|
||||
GeckoApp.mAppContext.getSharedPreferences(PREFS_NAME, 0);
|
||||
@ -1601,6 +1617,7 @@ abstract public class GeckoApp
|
||||
} else if (ACTION_DEBUG.equals(action) &&
|
||||
GeckoThread.checkAndSetLaunchState(GeckoThread.LaunchState.Launching, GeckoThread.LaunchState.WaitForDebugger)) {
|
||||
mMainHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GeckoThread.setLaunchState(GeckoThread.LaunchState.Launching);
|
||||
sGeckoThread.start();
|
||||
@ -1667,6 +1684,7 @@ abstract public class GeckoApp
|
||||
mJavaUiStartupTimer.stop();
|
||||
|
||||
GeckoAppShell.getHandler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Sync settings need Gecko to be loaded, so
|
||||
// no hurry in starting this.
|
||||
@ -1910,6 +1928,7 @@ abstract public class GeckoApp
|
||||
GeckoAccessibility.updateAccessibilitySettings();
|
||||
|
||||
GeckoBackgroundThread.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SharedPreferences prefs =
|
||||
GeckoApp.mAppContext.getSharedPreferences(GeckoApp.PREFS_NAME, 0);
|
||||
@ -1955,6 +1974,7 @@ abstract public class GeckoApp
|
||||
// here as the whole point is to save to disk while the activity is not
|
||||
// interacting with the user.
|
||||
GeckoBackgroundThread.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SharedPreferences prefs =
|
||||
GeckoApp.mAppContext.getSharedPreferences(GeckoApp.PREFS_NAME, 0);
|
||||
@ -1976,6 +1996,7 @@ abstract public class GeckoApp
|
||||
public void onRestart()
|
||||
{
|
||||
GeckoBackgroundThread.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SharedPreferences prefs =
|
||||
GeckoApp.mAppContext.getSharedPreferences(GeckoApp.PREFS_NAME, 0);
|
||||
@ -2169,6 +2190,7 @@ abstract public class GeckoApp
|
||||
final GeckoApp app = GeckoApp.mAppContext;
|
||||
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ProfileMigrator profileMigrator = new ProfileMigrator(app);
|
||||
|
||||
@ -2186,8 +2208,10 @@ abstract public class GeckoApp
|
||||
final SetupScreen[] setupScreenHolder = new SetupScreen[1];
|
||||
|
||||
final Runnable startCallback = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setupScreenHolder[0] = new SetupScreen(app);
|
||||
setupScreenHolder[0].show();
|
||||
@ -2197,8 +2221,10 @@ abstract public class GeckoApp
|
||||
};
|
||||
|
||||
final Runnable stopCallback = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SetupScreen screen = setupScreenHolder[0];
|
||||
// screen will never be null if this code runs, but
|
||||
@ -2354,27 +2380,33 @@ abstract public class GeckoApp
|
||||
public AbsoluteLayout getPluginContainer() { return mPluginContainer; }
|
||||
|
||||
// Accelerometer.
|
||||
@Override
|
||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
GeckoAppShell.sendEventToGecko(GeckoEvent.createSensorEvent(event));
|
||||
}
|
||||
|
||||
// Geolocation.
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
// No logging here: user-identifying information.
|
||||
GeckoAppShell.sendEventToGecko(GeckoEvent.createLocationEvent(location));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras)
|
||||
{
|
||||
}
|
||||
@ -2490,6 +2522,7 @@ abstract public class GeckoApp
|
||||
super.addView(view, index);
|
||||
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mLayerView.hide();
|
||||
}
|
||||
|
@ -178,6 +178,7 @@ public class GeckoAppShell
|
||||
|
||||
public static void registerGlobalExceptionHandler() {
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread thread, Throwable e) {
|
||||
Log.e(LOGTAG, ">>> REPORTING UNCAUGHT EXCEPTION FROM THREAD "
|
||||
+ thread.getId() + " (\"" + thread.getName() + "\")", e);
|
||||
@ -250,10 +251,12 @@ public class GeckoAppShell
|
||||
mScanner.connect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMediaScannerConnected() {
|
||||
mScanner.scanFile(mFile, mMimeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScanCompleted(String path, Uri uri) {
|
||||
if(path.equals(mFile)) {
|
||||
mScanner.disconnect();
|
||||
@ -298,6 +301,7 @@ public class GeckoAppShell
|
||||
combinedArgs += " -width " + metrics.widthPixels + " -height " + metrics.heightPixels;
|
||||
|
||||
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
geckoLoaded();
|
||||
}
|
||||
@ -417,6 +421,7 @@ public class GeckoAppShell
|
||||
|
||||
public static void enableLocation(final boolean enable) {
|
||||
getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LocationManager lm = (LocationManager)
|
||||
GeckoApp.mAppContext.getSystemService(Context.LOCATION_SERVICE);
|
||||
@ -626,6 +631,7 @@ public class GeckoAppShell
|
||||
final Bitmap aIcon, final String aType)
|
||||
{
|
||||
getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// the intent to be launched by the shortcut
|
||||
Intent shortcutIntent;
|
||||
@ -662,6 +668,7 @@ public class GeckoAppShell
|
||||
|
||||
public static void removeShortcut(final String aTitle, final String aURI, final String aUniqueURI, final String aType) {
|
||||
getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// the intent to be launched by the shortcut
|
||||
Intent shortcutIntent;
|
||||
@ -696,6 +703,7 @@ public class GeckoAppShell
|
||||
// 1. nuke the running app process.
|
||||
// 2. nuke the profile that was assigned to that webapp
|
||||
getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int index = WebAppAllocator.getInstance(GeckoApp.mAppContext).releaseIndexForApp(uniqueURI);
|
||||
|
||||
@ -1132,6 +1140,7 @@ public class GeckoAppShell
|
||||
// gecko thread, which is most likely this thread
|
||||
static String getClipboardText() {
|
||||
getHandler().post(new Runnable() {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void run() {
|
||||
Context context = GeckoApp.mAppContext;
|
||||
@ -1165,6 +1174,7 @@ public class GeckoAppShell
|
||||
|
||||
static void setClipboardText(final String text) {
|
||||
getHandler().post(new Runnable() {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void run() {
|
||||
Context context = GeckoApp.mAppContext;
|
||||
@ -1367,6 +1377,7 @@ public class GeckoAppShell
|
||||
|
||||
public static void setKeepScreenOn(final boolean on) {
|
||||
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO
|
||||
}
|
||||
@ -1375,6 +1386,7 @@ public class GeckoAppShell
|
||||
|
||||
public static void notifyDefaultPrevented(final boolean defaultPrevented) {
|
||||
getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LayerView view = GeckoApp.mAppContext.getLayerView();
|
||||
PanZoomController controller = (view == null ? null : view.getPanZoomController());
|
||||
@ -1471,6 +1483,7 @@ public class GeckoAppShell
|
||||
|
||||
public static void killAnyZombies() {
|
||||
GeckoProcessesVisitor visitor = new GeckoProcessesVisitor() {
|
||||
@Override
|
||||
public boolean callback(int pid) {
|
||||
if (pid != android.os.Process.myPid())
|
||||
android.os.Process.killProcess(pid);
|
||||
@ -1485,6 +1498,7 @@ public class GeckoAppShell
|
||||
|
||||
class GeckoPidCallback implements GeckoProcessesVisitor {
|
||||
public boolean otherPidExist = false;
|
||||
@Override
|
||||
public boolean callback(int pid) {
|
||||
if (pid != android.os.Process.myPid()) {
|
||||
otherPidExist = true;
|
||||
@ -1797,6 +1811,7 @@ public class GeckoAppShell
|
||||
sCameraBuffer = new byte[(bufferSize * 12) / 8];
|
||||
sCamera.addCallbackBuffer(sCameraBuffer);
|
||||
sCamera.setPreviewCallbackWithBuffer(new android.hardware.Camera.PreviewCallback() {
|
||||
@Override
|
||||
public void onPreviewFrame(byte[] data, android.hardware.Camera camera) {
|
||||
cameraCallbackBridge(data);
|
||||
if (sCamera != null)
|
||||
@ -1888,6 +1903,7 @@ public class GeckoAppShell
|
||||
|
||||
static void markUriVisited(final String uri) { // invoked from native JNI code
|
||||
getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GlobalHistory.getInstance().add(uri);
|
||||
}
|
||||
@ -1896,6 +1912,7 @@ public class GeckoAppShell
|
||||
|
||||
static void setUriTitle(final String uri, final String title) { // invoked from native JNI code
|
||||
getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GlobalHistory.getInstance().update(uri, title);
|
||||
}
|
||||
@ -2138,6 +2155,7 @@ public class GeckoAppShell
|
||||
mId = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int resultCode, Intent data) {
|
||||
GeckoAppShell.notifyFilePickerResult(handleActivityResult(resultCode, data), mId);
|
||||
}
|
||||
@ -2165,6 +2183,7 @@ public class GeckoAppShell
|
||||
|
||||
public static void registerSurfaceTextureFrameListener(Object surfaceTexture, final int id) {
|
||||
((SurfaceTexture)surfaceTexture).setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() {
|
||||
@Override
|
||||
public void onFrameAvailable(SurfaceTexture surfaceTexture) {
|
||||
GeckoAppShell.onSurfaceTextureFrameAvailable(surfaceTexture, id);
|
||||
}
|
||||
|
@ -318,6 +318,7 @@ final class GeckoEditable
|
||||
final int seqnoWhenPosted = mGeckoUpdateSeqno;
|
||||
|
||||
geckoPostToIc(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mActionQueue.syncWithGecko();
|
||||
if (seqnoWhenPosted == mGeckoUpdateSeqno) {
|
||||
@ -620,6 +621,7 @@ final class GeckoEditable
|
||||
}
|
||||
Selection.setSelection(mText, selStart, selEnd);
|
||||
geckoPostToIc(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mActionQueue.syncWithGecko();
|
||||
final int start = Selection.getSelectionStart(mText);
|
||||
@ -673,6 +675,7 @@ final class GeckoEditable
|
||||
return;
|
||||
}
|
||||
geckoPostToIc(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (type == NOTIFY_IME_FOCUSCHANGE) {
|
||||
if (state == IME_FOCUS_STATE_BLUR) {
|
||||
@ -703,6 +706,7 @@ final class GeckoEditable
|
||||
", \"" + typeHint + "\", \"" + modeHint + "\", \"" + actionHint + "\")");
|
||||
}
|
||||
geckoPostToIc(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Make sure there are no other things going on
|
||||
mActionQueue.syncWithGecko();
|
||||
@ -741,6 +745,7 @@ final class GeckoEditable
|
||||
}
|
||||
|
||||
geckoPostToIc(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mActionQueue.syncWithGecko();
|
||||
/* check to see there has not been another action that potentially changed the
|
||||
@ -840,6 +845,7 @@ final class GeckoEditable
|
||||
geckoReplaceText(start, oldEnd, mChangedText);
|
||||
}
|
||||
geckoPostToIc(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mListener.onTextChange(text, start, oldEnd, newEnd);
|
||||
}
|
||||
|
@ -395,6 +395,7 @@ class GeckoInputConnection
|
||||
// Do not reset mIMEState here; see comments in notifyIMEEnabled
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChange(String text, int start, int oldEnd, int newEnd) {
|
||||
|
||||
if (mUpdateRequest == null) {
|
||||
@ -432,6 +433,7 @@ class GeckoInputConnection
|
||||
mUpdateExtract);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSelectionChange(int start, int end) {
|
||||
|
||||
if (mBatchEditCount > 0) {
|
||||
@ -523,6 +525,7 @@ class GeckoInputConnection
|
||||
return mEditableClient.getInputConnectionHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||
if (mIMEState == IME_STATE_DISABLED) {
|
||||
return null;
|
||||
@ -653,10 +656,12 @@ class GeckoInputConnection
|
||||
return false; // seems to always return false
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return processKeyDown(keyCode, event);
|
||||
}
|
||||
@ -706,6 +711,7 @@ class GeckoInputConnection
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
return processKeyUp(keyCode, event);
|
||||
}
|
||||
@ -747,6 +753,7 @@ class GeckoInputConnection
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
|
||||
while ((repeatCount--) != 0) {
|
||||
if (!processKeyDown(keyCode, event) ||
|
||||
@ -757,6 +764,7 @@ class GeckoInputConnection
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
|
||||
View v = getView();
|
||||
switch (keyCode) {
|
||||
@ -771,11 +779,13 @@ class GeckoInputConnection
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIMEEnabled() {
|
||||
// make sure this picks up PASSWORD and PLUGIN states as well
|
||||
return mIMEState != IME_STATE_DISABLED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyIME(final int type, final int state) {
|
||||
switch (type) {
|
||||
|
||||
@ -803,6 +813,7 @@ class GeckoInputConnection
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyIMEEnabled(final int state, final String typeHint,
|
||||
final String modeHint, final String actionHint) {
|
||||
// For some input type we will use a widget to display the ui, for those we must not
|
||||
@ -843,6 +854,7 @@ class GeckoInputConnection
|
||||
}
|
||||
restartInput();
|
||||
GeckoApp.mAppContext.mMainHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mIMEState == IME_STATE_DISABLED) {
|
||||
hideSoftInput();
|
||||
@ -880,6 +892,7 @@ final class DebugGeckoInputConnection
|
||||
return (GeckoEditableListener)dgic.mProxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args)
|
||||
throws Throwable {
|
||||
|
||||
|
@ -103,6 +103,7 @@ public class GeckoPreferences
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
try {
|
||||
if (event.equals("Sanitize:Finished")) {
|
||||
@ -110,6 +111,7 @@ public class GeckoPreferences
|
||||
final int stringRes = success ? R.string.private_data_success : R.string.private_data_fail;
|
||||
final Context context = this;
|
||||
GeckoAppShell.getMainHandler().post(new Runnable () {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(context, stringRes, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -275,6 +277,7 @@ public class GeckoPreferences
|
||||
dialog = aDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (dialog == null)
|
||||
return;
|
||||
@ -285,7 +288,9 @@ public class GeckoPreferences
|
||||
dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(!disabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) { }
|
||||
}
|
||||
|
||||
@ -298,6 +303,7 @@ public class GeckoPreferences
|
||||
dialog = aDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (dialog == null)
|
||||
return;
|
||||
@ -307,7 +313,9 @@ public class GeckoPreferences
|
||||
dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(!disabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) { }
|
||||
}
|
||||
|
||||
@ -327,6 +335,7 @@ public class GeckoPreferences
|
||||
builder.setTitle(R.string.masterpassword_create_title)
|
||||
.setView((View)linearLayout)
|
||||
.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
JSONObject jsonPref = new JSONObject();
|
||||
try {
|
||||
@ -343,12 +352,14 @@ public class GeckoPreferences
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
dialog = builder.create();
|
||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
input1.setText("");
|
||||
input2.setText("");
|
||||
@ -368,22 +379,26 @@ public class GeckoPreferences
|
||||
builder.setTitle(R.string.masterpassword_remove_title)
|
||||
.setView((View)linearLayout)
|
||||
.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PrefsHelper.setPref(PREFS_MP_ENABLED, input.getText().toString());
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
dialog = builder.create();
|
||||
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
input.setText("");
|
||||
}
|
||||
});
|
||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
input.setText("");
|
||||
}
|
||||
@ -409,6 +424,7 @@ public class GeckoPreferences
|
||||
final Preference pref = getField(prefName);
|
||||
if (pref instanceof CheckBoxPreference) {
|
||||
GeckoAppShell.getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (((CheckBoxPreference)pref).isChecked() != value)
|
||||
((CheckBoxPreference)pref).setChecked(value);
|
||||
@ -421,12 +437,14 @@ public class GeckoPreferences
|
||||
final Preference pref = getField(prefName);
|
||||
if (pref instanceof EditTextPreference) {
|
||||
GeckoAppShell.getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
((EditTextPreference)pref).setText(value);
|
||||
}
|
||||
});
|
||||
} else if (pref instanceof ListPreference) {
|
||||
GeckoAppShell.getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
((ListPreference)pref).setValue(value);
|
||||
// Set the summary string to the current entry
|
||||
@ -439,6 +457,7 @@ public class GeckoPreferences
|
||||
fontSizePref.setSavedFontSize(value);
|
||||
final String fontSizeName = fontSizePref.getSavedFontSizeName();
|
||||
GeckoAppShell.getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fontSizePref.setSummary(fontSizeName); // Ex: "Small".
|
||||
}
|
||||
@ -449,6 +468,7 @@ public class GeckoPreferences
|
||||
@Override public void finish() {
|
||||
// enable all preferences once we have them from gecko
|
||||
GeckoAppShell.getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mPreferenceScreen.setEnabled(true);
|
||||
}
|
||||
@ -465,6 +485,7 @@ public class GeckoPreferences
|
||||
GeckoAppShell.getEventDispatcher().unregisterEventListener(event, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGeckoActivityOpened() {
|
||||
return false;
|
||||
}
|
||||
|
@ -352,6 +352,7 @@ public class GeckoSmsManager
|
||||
SmsIOThread.getInstance().start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
IntentFilter smsFilter = new IntentFilter();
|
||||
smsFilter.addAction(GeckoSmsManager.ACTION_SMS_RECEIVED);
|
||||
@ -485,6 +486,7 @@ public class GeckoSmsManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(String aNumber, String aMessage, int aRequestId) {
|
||||
int envelopeId = Postman.kUnknownEnvelopeId;
|
||||
|
||||
@ -600,6 +602,7 @@ public class GeckoSmsManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getMessage(int aMessageId, int aRequestId) {
|
||||
class GetMessageRunnable implements Runnable {
|
||||
private int mMessageId;
|
||||
@ -684,6 +687,7 @@ public class GeckoSmsManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMessage(int aMessageId, int aRequestId) {
|
||||
class DeleteMessageRunnable implements Runnable {
|
||||
private int mMessageId;
|
||||
@ -723,6 +727,7 @@ public class GeckoSmsManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, int aDeliveryState, boolean aReverse, int aRequestId) {
|
||||
class CreateMessageListRunnable implements Runnable {
|
||||
private long mStartDate;
|
||||
@ -845,6 +850,7 @@ public class GeckoSmsManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNextMessageInList(int aListId, int aRequestId) {
|
||||
class GetNextMessageInListRunnable implements Runnable {
|
||||
private int mListId;
|
||||
@ -904,14 +910,17 @@ public class GeckoSmsManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearMessageList(int aListId) {
|
||||
MessagesListManager.getInstance().remove(aListId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
GeckoApp.mAppContext.unregisterReceiver(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
SmsIOThread.getInstance().interrupt();
|
||||
MessagesListManager.getInstance().clear();
|
||||
|
@ -114,6 +114,7 @@ public class GeckoThread extends Thread implements GeckoEventListener {
|
||||
GeckoAppShell.runGecko(path, args, mUri, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
if ("Gecko:Ready".equals(event)) {
|
||||
GeckoAppShell.getEventDispatcher().unregisterEventListener(event, this);
|
||||
|
@ -44,6 +44,7 @@ class GlobalHistory {
|
||||
mPendingUris = new LinkedList<String>();
|
||||
mVisitedCache = new SoftReference<Set<String>>(null);
|
||||
mNotifierRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Set<String> visitedSet = mVisitedCache.get();
|
||||
if (visitedSet == null) {
|
||||
@ -132,6 +133,7 @@ class GlobalHistory {
|
||||
|
||||
public void checkUriVisited(final String uri) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// this runs on the same handler thread as the processing loop,
|
||||
// so no synchronization needed
|
||||
|
@ -81,6 +81,7 @@ class JavaAddonManager implements GeckoEventListener {
|
||||
mDispatcher.registerEventListener("Dex:Unload", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
try {
|
||||
if (event.equals("Dex:Load")) {
|
||||
@ -173,6 +174,7 @@ class JavaAddonManager implements GeckoEventListener {
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, JSONObject json) {
|
||||
try {
|
||||
if (mBundle != null) {
|
||||
@ -187,6 +189,7 @@ class JavaAddonManager implements GeckoEventListener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResponse() {
|
||||
String response = mBundle.getString("response");
|
||||
mBundle = null;
|
||||
|
@ -182,6 +182,7 @@ public class LauncherShortcuts extends Activity {
|
||||
new String[] { "favicon", "title" },
|
||||
new int[] { R.id.favicon, R.id.title }
|
||||
), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
onListItemClick(id);
|
||||
@ -190,6 +191,7 @@ public class LauncherShortcuts extends Activity {
|
||||
});
|
||||
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
finish();
|
||||
|
@ -90,6 +90,7 @@ public class LightweightTheme implements GeckoEventListener {
|
||||
final Bitmap bitmap = BitmapFactory.decodeStream(stream);
|
||||
stream.close();
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setLightweightTheme(bitmap);
|
||||
}
|
||||
@ -99,6 +100,7 @@ public class LightweightTheme implements GeckoEventListener {
|
||||
}
|
||||
} else if (event.equals("LightweightTheme:Disable")) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
resetLightweightTheme();
|
||||
}
|
||||
|
@ -149,6 +149,7 @@ class MultiChoicePreference extends DialogPreference {
|
||||
}
|
||||
|
||||
builder.setMultiChoiceItems(mEntries, mValues, new DialogInterface.OnMultiChoiceClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which, boolean val) {
|
||||
// mValues is automatically updated when checkboxes are clicked
|
||||
|
||||
@ -184,6 +185,7 @@ class MultiChoicePreference extends DialogPreference {
|
||||
}
|
||||
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < mEntryKeys.length; i++) {
|
||||
String key = mEntryKeys[i].toString();
|
||||
@ -232,6 +234,7 @@ class MultiChoicePreference extends DialogPreference {
|
||||
|
||||
mValues = new boolean[entryCount];
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < entryCount; i++) {
|
||||
String key = mEntryKeys[i].toString();
|
||||
|
@ -150,18 +150,22 @@ public final class PrefsHelper {
|
||||
}
|
||||
|
||||
public static abstract class PrefHandlerBase implements PrefHandler {
|
||||
@Override
|
||||
public void prefValue(String pref, boolean value) {
|
||||
Log.w(LOGTAG, "Unhandled boolean value for pref [" + pref + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prefValue(String pref, int value) {
|
||||
Log.w(LOGTAG, "Unhandled int value for pref [" + pref + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prefValue(String pref, String value) {
|
||||
Log.w(LOGTAG, "Unhandled String value for pref [" + pref + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
}
|
||||
}
|
||||
|
@ -610,6 +610,7 @@ public class ProfileMigrator {
|
||||
final String clientGuid = mSyncSettingsMap.get("services.sync.client.GUID");
|
||||
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (userName == null || syncKey == null || syncPass == null) {
|
||||
// This isn't going to work. Give up.
|
||||
@ -637,6 +638,7 @@ public class ProfileMigrator {
|
||||
|
||||
protected void registerAndRequest() {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
requestValues();
|
||||
}
|
||||
@ -651,6 +653,7 @@ public class ProfileMigrator {
|
||||
protected void onPostExecute(Boolean result) {
|
||||
if (result.booleanValue()) {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i(LOGTAG, "Sync account already configured, skipping.");
|
||||
setMigratedSync();
|
||||
@ -931,6 +934,7 @@ public class ProfileMigrator {
|
||||
// GlobalHistory access communicates with Gecko
|
||||
// and must run on its thread.
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (String url : placesHistory) {
|
||||
GlobalHistory.getInstance().addToGeckoOnly(url);
|
||||
|
@ -184,6 +184,7 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
|
||||
|
||||
if (mAutofocus) {
|
||||
input.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (hasFocus) {
|
||||
((InputMethodManager) GeckoApp.mAppContext.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(v, 0);
|
||||
@ -264,9 +265,11 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
|
||||
}
|
||||
|
||||
// GeckoEventListener implementation
|
||||
@Override
|
||||
public void handleMessage(String event, final JSONObject message) {
|
||||
// The dialog must be created on the UI thread.
|
||||
GeckoAppShell.getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
processMessage(message);
|
||||
}
|
||||
@ -274,6 +277,7 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
|
||||
}
|
||||
|
||||
// GeckoEventResponder implementation
|
||||
@Override
|
||||
public String getResponse() {
|
||||
// we only handle one kind of message in handleMessage, and this is the
|
||||
// response we provide for that message
|
||||
@ -384,6 +388,7 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
|
||||
mDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface aDialog, int aWhich) {
|
||||
GeckoApp.assertOnUiThread();
|
||||
JSONObject ret = new JSONObject();
|
||||
@ -425,11 +430,13 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
|
||||
finishDialog(ret.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
GeckoApp.assertOnUiThread();
|
||||
mSelected[position] = !mSelected[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface aDialog) {
|
||||
GeckoApp.assertOnUiThread();
|
||||
JSONObject ret = new JSONObject();
|
||||
|
@ -21,7 +21,9 @@ public abstract class ShapedButton extends GeckoImageButton
|
||||
|
||||
protected enum CurveTowards { NONE, LEFT, RIGHT };
|
||||
|
||||
@Override
|
||||
abstract public void onLightweightThemeChanged();
|
||||
@Override
|
||||
abstract public void onLightweightThemeReset();
|
||||
|
||||
public ShapedButton(Context context, AttributeSet attrs) {
|
||||
|
@ -164,6 +164,7 @@ public class Tab {
|
||||
|
||||
public void updateThumbnail(final Bitmap b) {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (b != null) {
|
||||
try {
|
||||
@ -321,6 +322,7 @@ public class Tab {
|
||||
|
||||
void updateBookmark() {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final String url = getURL();
|
||||
if (url == null)
|
||||
@ -338,6 +340,7 @@ public class Tab {
|
||||
|
||||
public void addBookmark() {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String url = getURL();
|
||||
if (url == null)
|
||||
@ -350,6 +353,7 @@ public class Tab {
|
||||
|
||||
public void removeBookmark() {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String url = getURL();
|
||||
if (url == null)
|
||||
@ -546,6 +550,7 @@ public class Tab {
|
||||
final String oldURL = getURL();
|
||||
final Tab tab = this;
|
||||
GeckoAppShell.getHandler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// tab.getURL() may return null
|
||||
if (!TextUtils.equals(oldURL, getURL()))
|
||||
|
@ -87,6 +87,7 @@ public class Tabs implements GeckoEventListener {
|
||||
|
||||
// The listener will run on the background thread (see 2nd argument)
|
||||
mAccountManager.addOnAccountsUpdatedListener(mAccountListener = new OnAccountsUpdateListener() {
|
||||
@Override
|
||||
public void onAccountsUpdated(Account[] accounts) {
|
||||
persistAllTabs();
|
||||
}
|
||||
@ -161,6 +162,7 @@ public class Tabs implements GeckoEventListener {
|
||||
|
||||
mSelectedTab = tab;
|
||||
mActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isSelectedTab(tab)) {
|
||||
notifyListeners(tab, TabEvents.SELECTED);
|
||||
@ -281,6 +283,7 @@ public class Tabs implements GeckoEventListener {
|
||||
|
||||
// GeckoEventListener implementation
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
try {
|
||||
if (event.equals("Session:RestoreEnd")) {
|
||||
@ -382,6 +385,7 @@ public class Tabs implements GeckoEventListener {
|
||||
while (iterator.hasNext()) {
|
||||
final Tab tab = iterator.next();
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
helper.getAndProcessThumbnailFor(tab);
|
||||
}
|
||||
@ -437,6 +441,7 @@ public class Tabs implements GeckoEventListener {
|
||||
|
||||
public void notifyListeners(final Tab tab, final TabEvents msg, final Object data) {
|
||||
mActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onTabChanged(tab, msg, data);
|
||||
|
||||
@ -481,6 +486,7 @@ public class Tabs implements GeckoEventListener {
|
||||
public void persistAllTabs() {
|
||||
final Iterable<Tab> tabs = getTabsInOrder();
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
boolean syncIsSetup = SyncAccounts.syncAccountsExist(mActivity);
|
||||
if (syncIsSetup)
|
||||
|
@ -100,6 +100,7 @@ public class TabsPanel extends LinearLayout
|
||||
|
||||
mAddTab = (ImageButton) findViewById(R.id.add_tab);
|
||||
mAddTab.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TabsPanel.this.addTab();
|
||||
}
|
||||
|
@ -145,6 +145,7 @@ public class TabsTray extends TwoWayView
|
||||
mIsPrivate = isPrivate;
|
||||
|
||||
mOnCloseClickListener = new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TabRow tab = (TabRow) v.getTag();
|
||||
final int pos = (isVertical() ? tab.info.getWidth() : tab.info.getHeight());
|
||||
@ -153,6 +154,7 @@ public class TabsTray extends TwoWayView
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
|
||||
switch (msg) {
|
||||
case ADDED:
|
||||
@ -211,14 +213,17 @@ public class TabsTray extends TwoWayView
|
||||
notifyDataSetChanged(); // Be sure to call this whenever mTabs changes.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return (mTabs == null ? 0 : mTabs.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tab getItem(int position) {
|
||||
return mTabs.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
@ -256,6 +261,7 @@ public class TabsTray extends TwoWayView
|
||||
row.close.setTag(row);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
TabRow row;
|
||||
|
||||
@ -292,7 +298,9 @@ public class TabsTray extends TwoWayView
|
||||
mPendingClosedTabs.add(view);
|
||||
|
||||
animator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
|
||||
@Override
|
||||
public void onPropertyAnimationStart() { }
|
||||
@Override
|
||||
public void onPropertyAnimationEnd() {
|
||||
mCloseAnimationCount--;
|
||||
if (mCloseAnimationCount > 0)
|
||||
@ -326,7 +334,9 @@ public class TabsTray extends TwoWayView
|
||||
final int originalSize = (isVertical ? view.getHeight() : view.getWidth());
|
||||
|
||||
animator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
|
||||
@Override
|
||||
public void onPropertyAnimationStart() { }
|
||||
@Override
|
||||
public void onPropertyAnimationEnd() {
|
||||
// Reset view presentation as it will be recycled in the
|
||||
// list view by the adapter.
|
||||
@ -361,7 +371,9 @@ public class TabsTray extends TwoWayView
|
||||
|
||||
|
||||
animator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
|
||||
@Override
|
||||
public void onPropertyAnimationStart() { }
|
||||
@Override
|
||||
public void onPropertyAnimationEnd() {
|
||||
TabRow tab = (TabRow) view.getTag();
|
||||
tab.close.setVisibility(View.VISIBLE);
|
||||
|
@ -69,8 +69,10 @@ class TextSelection extends Layer implements GeckoEventListener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(final String event, final JSONObject message) {
|
||||
mActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (event.equals("TextSelection:ShowHandles")) {
|
||||
@ -133,6 +135,7 @@ class TextSelection extends Layer implements GeckoEventListener {
|
||||
mViewZoom = context.zoomFactor;
|
||||
|
||||
mActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mStartHandle.repositionWithViewport(context.viewport.left, context.viewport.top, context.zoomFactor);
|
||||
mMiddleHandle.repositionWithViewport(context.viewport.left, context.viewport.top, context.zoomFactor);
|
||||
|
@ -68,6 +68,7 @@ class TextSelectionHandle extends ImageView implements View.OnTouchListener {
|
||||
mShadow = getResources().getDimensionPixelSize(R.dimen.text_selection_handle_shadow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
switch (event.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
|
@ -43,10 +43,12 @@ public abstract class UiAsyncTask<Params, Progress, Result> {
|
||||
mParams = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Result result = doInBackground(mParams);
|
||||
|
||||
getUiHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mCancelled)
|
||||
onCancelled();
|
||||
@ -59,6 +61,7 @@ public abstract class UiAsyncTask<Params, Progress, Result> {
|
||||
|
||||
public final void execute(final Params... params) {
|
||||
getUiHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onPreExecute();
|
||||
mBackgroundThreadHandler.post(new BackgroundTaskRunnable(params));
|
||||
|
@ -236,10 +236,13 @@ public class WebApp extends GeckoApp {
|
||||
if (mSplashscreen.getVisibility() == View.VISIBLE) {
|
||||
Animation fadeout = AnimationUtils.loadAnimation(this, android.R.anim.fade_out);
|
||||
fadeout.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
mSplashscreen.setVisibility(View.GONE);
|
||||
}
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) { }
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) { }
|
||||
});
|
||||
mSplashscreen.startAnimation(fadeout);
|
||||
|
@ -71,6 +71,7 @@ public class WebAppAllocator {
|
||||
// found unused index i
|
||||
final int foundIndex = i;
|
||||
GeckoBackgroundThread.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int color = 0;
|
||||
try {
|
||||
@ -118,6 +119,7 @@ public class WebAppAllocator {
|
||||
|
||||
public synchronized void releaseIndex(final int index) {
|
||||
GeckoBackgroundThread.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mPrefs.edit()
|
||||
.remove(appKey(index))
|
||||
|
@ -128,6 +128,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
list.setTag(TAG);
|
||||
((Activity)mContext).registerForContextMenu(list);
|
||||
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
handleItemClick(parent, view, position, id);
|
||||
}
|
||||
@ -176,6 +177,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
*/
|
||||
private void primeSuggestions() {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mSuggestClient.query(mSearchTerm);
|
||||
}
|
||||
@ -210,6 +212,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
mCursorAdapter = new AwesomeBarCursorAdapter(mContext);
|
||||
|
||||
mCursorAdapter.setFilterQueryProvider(new FilterQueryProvider() {
|
||||
@Override
|
||||
public Cursor runQuery(CharSequence constraint) {
|
||||
long start = SystemClock.uptimeMillis();
|
||||
|
||||
@ -245,6 +248,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
mCursor = cursor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick() {
|
||||
AwesomeBarTabs.OnUrlOpenListener listener = getUrlListener();
|
||||
if (listener == null)
|
||||
@ -255,6 +259,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
listener.onUrlOpen(url, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContextMenuSubject getSubject() {
|
||||
// Use the history id in order to allow removing history entries
|
||||
int id = mCursor.getInt(mCursor.getColumnIndexOrThrow(Combined.HISTORY_ID));
|
||||
@ -289,12 +294,14 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
mSearchEngine = searchEngine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick() {
|
||||
AwesomeBarTabs.OnUrlOpenListener listener = getUrlListener();
|
||||
if (listener != null)
|
||||
listener.onSearch(mSearchEngine, mSearchTerm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContextMenuSubject getSubject() {
|
||||
// Do not show context menu for search engine items
|
||||
return null;
|
||||
@ -458,6 +465,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
private void bindSearchEngineView(final SearchEngine engine, final SearchEntryViewHolder viewHolder) {
|
||||
// when a suggestion is clicked, do a search
|
||||
OnClickListener clickListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AwesomeBarTabs.OnUrlOpenListener listener = getUrlListener();
|
||||
if (listener != null) {
|
||||
@ -478,6 +486,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
|
||||
// when a suggestion is long-clicked, copy the suggestion into the URL EditText
|
||||
OnLongClickListener longClickListener = new OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
AwesomeBarTabs.OnUrlOpenListener listener = getUrlListener();
|
||||
if (listener != null) {
|
||||
@ -625,6 +634,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
final View yesButton = mSuggestionsOptInPrompt.findViewById(R.id.suggestions_prompt_yes);
|
||||
final View noButton = mSuggestionsOptInPrompt.findViewById(R.id.suggestions_prompt_no);
|
||||
OnClickListener listener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// Prevent the buttons from being clicked multiple times (bug 816902)
|
||||
yesButton.setOnClickListener(null);
|
||||
@ -667,19 +677,23 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
anim2.setStartOffset(anim1.getDuration());
|
||||
final LinearLayout view = (LinearLayout)getView();
|
||||
anim2.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation a) {
|
||||
// Increase the height of the view so a gap isn't shown during animation
|
||||
view.getLayoutParams().height = view.getHeight() +
|
||||
mSuggestionsOptInPrompt.getHeight();
|
||||
view.requestLayout();
|
||||
}
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation a) {}
|
||||
@Override
|
||||
public void onAnimationEnd(Animation a) {
|
||||
// Removing the view immediately results in a NPE in
|
||||
// dispatchDraw(), possibly because this callback executes
|
||||
// before drawing is finished. Posting this as a Runnable fixes
|
||||
// the issue.
|
||||
view.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
view.removeView(mSuggestionsOptInPrompt);
|
||||
getListView().clearAnimation();
|
||||
@ -703,9 +717,11 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
getListView().startAnimation(anim2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, final JSONObject message) {
|
||||
if (event.equals("SearchEngines:Data")) {
|
||||
GeckoAppShell.getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setSearchEngines(message);
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ public class BookmarksTab extends AwesomeBarTab {
|
||||
list.setAdapter(null);
|
||||
list.setAdapter(getCursorAdapter());
|
||||
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
handleItemClick(parent, view, position, id);
|
||||
}
|
||||
@ -368,6 +369,7 @@ public class BookmarksTab extends AwesomeBarTab {
|
||||
protected void onPostExecute(final Cursor cursor) {
|
||||
// Hack: force this to the main thread, even though it should already be on it
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// this will update the cursorAdapter to use the new one if it already exists
|
||||
// We need to add the header before we set the adapter, hence make it null
|
||||
|
@ -73,6 +73,7 @@ public class HistoryTab extends AwesomeBarTab {
|
||||
|
||||
ExpandableListView list = (ExpandableListView)mView;
|
||||
list.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
||||
@Override
|
||||
public boolean onChildClick(ExpandableListView parent, View view,
|
||||
int groupPosition, int childPosition, long id) {
|
||||
return handleItemClick(groupPosition, childPosition);
|
||||
@ -83,7 +84,8 @@ public class HistoryTab extends AwesomeBarTab {
|
||||
// history expandable list view to mimic simpler sections. We should
|
||||
// Remove this if we decide to allow expanding/collapsing groups.
|
||||
list.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
|
||||
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
|
||||
@Override
|
||||
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@ -367,6 +369,7 @@ public class HistoryTab extends AwesomeBarTab {
|
||||
|
||||
// Hack: force this to the main thread, even though it should already be on it
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
historyList.setAdapter(mCursorAdapter);
|
||||
expandAllGroups(historyList);
|
||||
|
@ -328,6 +328,7 @@ public class BrowserProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
private class BookmarkMigrator3to4 implements BookmarkMigrator {
|
||||
@Override
|
||||
public void updateForNewTable(ContentValues bookmark) {
|
||||
Integer isFolder = bookmark.getAsInteger("folder");
|
||||
if (isFolder == null || isFolder != 1) {
|
||||
@ -1029,6 +1030,7 @@ public class BrowserProvider extends ContentProvider {
|
||||
|
||||
// create icons in a separate thread to avoid blocking about:home on startup
|
||||
GeckoBackgroundThread.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String iconData = bookmark.getString("icon");
|
||||
@ -1071,6 +1073,7 @@ public class BrowserProvider extends ContentProvider {
|
||||
|
||||
// create icons in a separate thread to avoid blocking about:home on startup
|
||||
GeckoBackgroundThread.getHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Bitmap icon = getDefaultFaviconFromPath(name);
|
||||
if (icon == null) {
|
||||
|
@ -97,6 +97,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
}
|
||||
|
||||
// Invalidate cached data
|
||||
@Override
|
||||
public void invalidateCachedState() {
|
||||
mDesktopBookmarksExist = null;
|
||||
mReadingListItemsExist = null;
|
||||
@ -182,6 +183,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
return new LocalDBCursor(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount(ContentResolver cr, String database) {
|
||||
Cursor cursor = null;
|
||||
int count = 0;
|
||||
@ -217,6 +219,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor filter(ContentResolver cr, CharSequence constraint, int limit) {
|
||||
return filterAllSites(cr,
|
||||
new String[] { Combined._ID,
|
||||
@ -230,6 +233,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor getTopSites(ContentResolver cr, int limit) {
|
||||
// Filter out sites that are pinned
|
||||
String selection = DBUtils.concatenateWhere("", Combined.URL + " NOT IN (SELECT " +
|
||||
@ -247,6 +251,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
selectionArgs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateVisitedHistory(ContentResolver cr, String uri) {
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
@ -262,6 +267,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
new String[] { uri });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateHistoryTitle(ContentResolver cr, String uri, String title) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(History.TITLE, title);
|
||||
@ -272,6 +278,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
new String[] { uri });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateHistoryEntry(ContentResolver cr, String uri, String title,
|
||||
long date, int visits) {
|
||||
int oldVisits = 0;
|
||||
@ -304,6 +311,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
new String[] { uri });
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor getAllVisitedHistory(ContentResolver cr) {
|
||||
Cursor c = cr.query(mHistoryUriWithProfile,
|
||||
new String[] { History.URL },
|
||||
@ -314,6 +322,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
return new LocalDBCursor(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor getRecentHistory(ContentResolver cr, int limit) {
|
||||
Cursor c = cr.query(combinedUriWithLimit(limit),
|
||||
new String[] { Combined._ID,
|
||||
@ -332,28 +341,33 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
return new LocalDBCursor(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expireHistory(ContentResolver cr, ExpirePriority priority) {
|
||||
Uri url = mHistoryExpireUriWithProfile;
|
||||
url = url.buildUpon().appendQueryParameter(BrowserContract.PARAM_EXPIRE_PRIORITY, priority.toString()).build();
|
||||
cr.delete(url, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeHistoryEntry(ContentResolver cr, int id) {
|
||||
cr.delete(mHistoryUriWithProfile,
|
||||
History._ID + " = ?",
|
||||
new String[] { String.valueOf(id) });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeHistoryEntry(ContentResolver cr, String url) {
|
||||
int deleted = cr.delete(mHistoryUriWithProfile,
|
||||
History.URL + " = ?",
|
||||
new String[] { url });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearHistory(ContentResolver cr) {
|
||||
cr.delete(mHistoryUriWithProfile, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor getBookmarksInFolder(ContentResolver cr, long folderId) {
|
||||
Cursor c = null;
|
||||
boolean addDesktopFolder = false;
|
||||
@ -457,6 +471,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
return mReadingListItemsExist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookmark(ContentResolver cr, String uri) {
|
||||
// This method is about normal bookmarks, not the Reading List
|
||||
int count = 0;
|
||||
@ -479,6 +494,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
return (count > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadingListItem(ContentResolver cr, String uri) {
|
||||
int count = 0;
|
||||
try {
|
||||
@ -499,6 +515,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
return (count > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUrlForKeyword(ContentResolver cr, String keyword) {
|
||||
Cursor cursor = cr.query(mBookmarksUriWithProfile,
|
||||
new String[] { Bookmarks.URL },
|
||||
@ -601,11 +618,13 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
debug("Updated " + updated + " rows to new modified time.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBookmark(ContentResolver cr, String title, String uri) {
|
||||
long folderId = getFolderIdFromGuid(cr, Bookmarks.MOBILE_FOLDER_GUID);
|
||||
addBookmarkItem(cr, title, uri, folderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBookmark(ContentResolver cr, int id) {
|
||||
Uri contentUri = mBookmarksUriWithProfile;
|
||||
|
||||
@ -618,6 +637,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
cr.delete(contentUri, idEquals, idArgs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBookmarksWithURL(ContentResolver cr, String uri) {
|
||||
Uri contentUri = mBookmarksUriWithProfile;
|
||||
|
||||
@ -631,10 +651,12 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
cr.delete(contentUri, urlEquals, urlArgs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addReadingListItem(ContentResolver cr, String title, String uri) {
|
||||
addBookmarkItem(cr, title, uri, Bookmarks.FIXED_READING_LIST_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeReadingListItemWithURL(ContentResolver cr, String uri) {
|
||||
Uri contentUri = mBookmarksUriWithProfile;
|
||||
|
||||
@ -647,14 +669,17 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
cr.delete(contentUri, urlEquals, urlArgs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBookmarkObserver(ContentResolver cr, ContentObserver observer) {
|
||||
cr.registerContentObserver(mBookmarksUriWithProfile, false, observer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerHistoryObserver(ContentResolver cr, ContentObserver observer) {
|
||||
cr.registerContentObserver(mHistoryUriWithProfile, false, observer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBookmark(ContentResolver cr, int id, String uri, String title, String keyword) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(Browser.BookmarkColumns.TITLE, title);
|
||||
@ -668,6 +693,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
new String[] { String.valueOf(id) });
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap getFaviconForUrl(ContentResolver cr, String uri) {
|
||||
Cursor c = cr.query(mCombinedUriWithProfile,
|
||||
new String[] { Combined.FAVICON },
|
||||
@ -691,6 +717,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
return BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaviconUrlForHistoryUrl(ContentResolver cr, String uri) {
|
||||
Cursor c = cr.query(mHistoryUriWithProfile,
|
||||
new String[] { History.FAVICON_URL },
|
||||
@ -709,6 +736,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
return faviconUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor getFaviconsForUrls(ContentResolver cr, List<String> urls) {
|
||||
StringBuffer selection = new StringBuffer();
|
||||
String[] selectionArgs = new String[urls.size()];
|
||||
@ -730,6 +758,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFaviconForUrl(ContentResolver cr, String pageUri,
|
||||
Bitmap favicon, String faviconUri) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
@ -753,6 +782,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
cr.insert(mFaviconsUriWithProfile, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateThumbnailForUrl(ContentResolver cr, String uri,
|
||||
BitmapDrawable thumbnail) {
|
||||
Bitmap bitmap = thumbnail.getBitmap();
|
||||
@ -773,6 +803,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
cr.insert(mThumbnailsUriWithProfile, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getThumbnailForUrl(ContentResolver cr, String uri) {
|
||||
Cursor c = cr.query(mThumbnailsUriWithProfile,
|
||||
new String[] { Thumbnails.DATA },
|
||||
@ -793,6 +824,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor getThumbnailsForUrls(ContentResolver cr, List<String> urls) {
|
||||
StringBuffer selection = new StringBuffer();
|
||||
String[] selectionArgs = new String[urls.size()];
|
||||
@ -814,6 +846,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeThumbnails(ContentResolver cr) {
|
||||
cr.delete(mThumbnailsUriWithProfile, null, null);
|
||||
}
|
||||
@ -1108,6 +1141,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void pinSite(ContentResolver cr, String url, String title, int position) {
|
||||
ContentValues values = new ContentValues();
|
||||
final long now = System.currentTimeMillis();
|
||||
@ -1140,6 +1174,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor getPinnedSites(ContentResolver cr, int limit) {
|
||||
return cr.query(bookmarksUriWithLimit(limit),
|
||||
new String[] { Bookmarks._ID,
|
||||
@ -1151,6 +1186,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
Bookmarks.POSITION + " ASC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpinSite(ContentResolver cr, int position) {
|
||||
cr.delete(mBookmarksUriWithProfile,
|
||||
Bookmarks.PARENT + " == ? AND " + Bookmarks.POSITION + " = ?",
|
||||
@ -1160,6 +1196,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpinAllSites(ContentResolver cr) {
|
||||
cr.delete(mBookmarksUriWithProfile,
|
||||
Bookmarks.PARENT + " == ?",
|
||||
@ -1168,6 +1205,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisited(ContentResolver cr, String uri) {
|
||||
int count = 0;
|
||||
try {
|
||||
|
@ -294,6 +294,7 @@ public class TabsProvider extends ContentProvider {
|
||||
debug("Creating TabsProvider");
|
||||
|
||||
GeckoBackgroundThread.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Kick this off early. It is synchronized so that other callers will wait
|
||||
try {
|
||||
|
@ -91,6 +91,7 @@ public class GLController {
|
||||
// updating the state in the view/controller/client should be
|
||||
// done on the main UI thread, not the GL renderer thread
|
||||
mView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mView.setViewportSize(mWidth, mHeight);
|
||||
}
|
||||
|
@ -237,6 +237,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
// this change.
|
||||
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mPanZoomController.pageRectUpdated();
|
||||
mView.requestRender();
|
||||
@ -266,6 +267,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
private void abortPanZoomAnimation() {
|
||||
if (mPanZoomController != null) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mPanZoomController.abortAnimation();
|
||||
}
|
||||
@ -309,6 +311,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
|
||||
final ImmutableViewportMetrics newMetrics = metrics;
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mGeckoViewport = newMetrics;
|
||||
}
|
||||
@ -456,6 +459,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
// mViewportMetrics. Usually this information is updated via handleViewportMessage
|
||||
// while we remain on the same document.
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mGeckoViewport = newMetrics;
|
||||
}
|
||||
@ -579,6 +583,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
}
|
||||
|
||||
/** Implementation of LayerView.Listener */
|
||||
@Override
|
||||
public void renderRequested() {
|
||||
try {
|
||||
GeckoAppShell.scheduleComposite();
|
||||
@ -590,6 +595,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
}
|
||||
|
||||
/** Implementation of LayerView.Listener */
|
||||
@Override
|
||||
public void compositionPauseRequested() {
|
||||
// We need to coordinate with Gecko when pausing composition, to ensure
|
||||
// that Gecko never executes a draw event while the compositor is paused.
|
||||
@ -605,6 +611,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
}
|
||||
|
||||
/** Implementation of LayerView.Listener */
|
||||
@Override
|
||||
public void compositionResumeRequested(int width, int height) {
|
||||
// Asking Gecko to resume the compositor takes too long (see
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=735230#c23), so we
|
||||
@ -617,6 +624,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
}
|
||||
|
||||
/** Implementation of LayerView.Listener */
|
||||
@Override
|
||||
public void sizeChanged(int width, int height) {
|
||||
// We need to make sure a draw happens synchronously at this point,
|
||||
// but resizing the surface before the SurfaceView has resized will
|
||||
@ -625,6 +633,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
}
|
||||
|
||||
/** Implementation of LayerView.Listener */
|
||||
@Override
|
||||
public void surfaceChanged(int width, int height) {
|
||||
setViewportSize(width, height);
|
||||
|
||||
@ -635,26 +644,31 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
}
|
||||
|
||||
/** Implementation of LayerView.Listener */
|
||||
@Override
|
||||
public void compositorCreated() {
|
||||
mCompositorCreated = true;
|
||||
}
|
||||
|
||||
/** Implementation of PanZoomTarget */
|
||||
@Override
|
||||
public ImmutableViewportMetrics getViewportMetrics() {
|
||||
return mViewportMetrics;
|
||||
}
|
||||
|
||||
/** Implementation of PanZoomTarget */
|
||||
@Override
|
||||
public ZoomConstraints getZoomConstraints() {
|
||||
return mZoomConstraints;
|
||||
}
|
||||
|
||||
/** Implementation of PanZoomTarget */
|
||||
@Override
|
||||
public boolean isFullScreen() {
|
||||
return mView.isFullScreen();
|
||||
}
|
||||
|
||||
/** Implementation of PanZoomTarget */
|
||||
@Override
|
||||
public void setAnimationTarget(ImmutableViewportMetrics metrics) {
|
||||
if (mGeckoIsReady) {
|
||||
// We know what the final viewport of the animation is going to be, so
|
||||
@ -669,6 +683,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
/** Implementation of PanZoomTarget
|
||||
* You must hold the monitor while calling this.
|
||||
*/
|
||||
@Override
|
||||
public void setViewportMetrics(ImmutableViewportMetrics metrics) {
|
||||
setViewportMetrics(metrics, true);
|
||||
}
|
||||
@ -684,6 +699,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
|
||||
private void setShadowVisibility() {
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (BrowserApp.mBrowserToolbar == null) {
|
||||
return;
|
||||
@ -695,6 +711,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
}
|
||||
|
||||
/** Implementation of PanZoomTarget */
|
||||
@Override
|
||||
public void forceRedraw() {
|
||||
mForceRedraw = true;
|
||||
if (mGeckoIsReady) {
|
||||
@ -703,11 +720,13 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
}
|
||||
|
||||
/** Implementation of PanZoomTarget */
|
||||
@Override
|
||||
public boolean post(Runnable action) {
|
||||
return mView.post(action);
|
||||
}
|
||||
|
||||
/** Implementation of PanZoomTarget */
|
||||
@Override
|
||||
public Object getLock() {
|
||||
return this;
|
||||
}
|
||||
@ -719,6 +738,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
* events being sent to Gecko are processed in FIFO order, this calculation should always be
|
||||
* correct.
|
||||
*/
|
||||
@Override
|
||||
public PointF convertViewPointToLayerPoint(PointF viewPoint) {
|
||||
if (!mGeckoIsReady) {
|
||||
return null;
|
||||
|
@ -122,6 +122,7 @@ class JavaPanZoomController
|
||||
Axis.initPrefs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
unregisterEventListener(MESSAGE_ZOOM_RECT);
|
||||
unregisterEventListener(MESSAGE_ZOOM_PAGE);
|
||||
@ -164,6 +165,7 @@ class JavaPanZoomController
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
try {
|
||||
if (MESSAGE_ZOOM_RECT.equals(event)) {
|
||||
@ -173,6 +175,7 @@ class JavaPanZoomController
|
||||
x + (float)message.getDouble("w"),
|
||||
y + (float)message.getDouble("h"));
|
||||
mTarget.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
animatedZoomTo(zoomRect);
|
||||
}
|
||||
@ -191,6 +194,7 @@ class JavaPanZoomController
|
||||
cssPageRect.width(),
|
||||
y + dh/2 + newHeight);
|
||||
mTarget.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
animatedZoomTo(r);
|
||||
}
|
||||
@ -200,6 +204,7 @@ class JavaPanZoomController
|
||||
final Tab tab = Tabs.getInstance().getTab(tabId);
|
||||
tab.setHasTouchListeners(true);
|
||||
mTarget.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Tabs.getInstance().isSelectedTab(tab))
|
||||
mTouchEventHandler.setWaitForTouchListeners(true);
|
||||
@ -212,6 +217,7 @@ class JavaPanZoomController
|
||||
}
|
||||
|
||||
/** This function MUST be called on the UI thread */
|
||||
@Override
|
||||
public boolean onMotionEvent(MotionEvent event) {
|
||||
if (Build.VERSION.SDK_INT <= 11) {
|
||||
return false;
|
||||
@ -228,6 +234,7 @@ class JavaPanZoomController
|
||||
}
|
||||
|
||||
/** This function MUST be called on the UI thread */
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return mTouchEventHandler.handleEvent(event);
|
||||
}
|
||||
@ -243,11 +250,13 @@ class JavaPanZoomController
|
||||
}
|
||||
|
||||
/** This function MUST be called on the UI thread */
|
||||
@Override
|
||||
public void notifyDefaultActionPrevented(boolean prevented) {
|
||||
mTouchEventHandler.handleEventListenerAction(!prevented);
|
||||
}
|
||||
|
||||
/** This function must be called from the UI thread. */
|
||||
@Override
|
||||
public void abortAnimation() {
|
||||
checkMainThread();
|
||||
// this happens when gecko changes the viewport on us or if the device is rotated.
|
||||
@ -300,6 +309,7 @@ class JavaPanZoomController
|
||||
}
|
||||
|
||||
/** This must be called on the UI thread. */
|
||||
@Override
|
||||
public void pageRectUpdated() {
|
||||
if (mState == PanZoomState.NOTHING) {
|
||||
synchronized (mTarget.getLock()) {
|
||||
@ -617,6 +627,7 @@ class JavaPanZoomController
|
||||
return FloatMath.sqrt(xvel * xvel + yvel * yvel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointF getVelocityVector() {
|
||||
return new PointF(mX.getRealVelocity(), mY.getRealVelocity());
|
||||
}
|
||||
@ -647,6 +658,7 @@ class JavaPanZoomController
|
||||
private boolean mAnimationTerminated;
|
||||
|
||||
/* This should always run on the UI thread */
|
||||
@Override
|
||||
public final void run() {
|
||||
/*
|
||||
* Since the animation timer queues this runnable on the UI thread, it
|
||||
@ -996,6 +1008,7 @@ class JavaPanZoomController
|
||||
mTarget.setViewportMetrics(viewportMetrics);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getRedrawHint() {
|
||||
switch (mState) {
|
||||
case PINCHING:
|
||||
@ -1112,16 +1125,19 @@ class JavaPanZoomController
|
||||
}
|
||||
|
||||
/** This function must be called from the UI thread. */
|
||||
@Override
|
||||
public void abortPanning() {
|
||||
checkMainThread();
|
||||
bounce();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverScrollMode(int overscrollMode) {
|
||||
mX.setOverScrollMode(overscrollMode);
|
||||
mY.setOverScrollMode(overscrollMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOverScrollMode() {
|
||||
return mX.getOverScrollMode();
|
||||
}
|
||||
|
@ -385,6 +385,7 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
|
||||
return !mStarted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
long timeDelta = mRunAt - SystemClock.elapsedRealtime();
|
||||
if (timeDelta > 0) {
|
||||
@ -630,6 +631,7 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
|
||||
// composited.
|
||||
if (mView.getPaintState() == LayerView.PAINT_BEFORE_FIRST) {
|
||||
mView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mView.getChildAt(0).setBackgroundColor(Color.TRANSPARENT);
|
||||
}
|
||||
|
@ -132,6 +132,7 @@ public class LayerView extends FrameLayout {
|
||||
// this gets run on the gecko thread, but for thread safety we want the assignment
|
||||
// on the UI thread.
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mTouchIntercepter = touchIntercepter;
|
||||
}
|
||||
@ -428,14 +429,17 @@ public class LayerView extends FrameLayout {
|
||||
}
|
||||
|
||||
private class SurfaceListener implements SurfaceHolder.Callback {
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int width,
|
||||
int height) {
|
||||
onSizeChanged(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||
onDestroyed();
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ public class PluginLayer extends TileLayer {
|
||||
private void hideView() {
|
||||
if (mViewVisible) {
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mView.setVisibility(View.GONE);
|
||||
mViewVisible = false;
|
||||
@ -71,6 +72,7 @@ public class PluginLayer extends TileLayer {
|
||||
|
||||
public void showView() {
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mContainer.indexOfChild(mView) < 0) {
|
||||
mContainer.addView(mView, mLayoutParams);
|
||||
|
@ -118,9 +118,11 @@ class SubdocumentScrollHelper implements GeckoEventListener {
|
||||
|
||||
// GeckoEventListener implementation
|
||||
|
||||
@Override
|
||||
public void handleMessage(final String event, final JSONObject message) {
|
||||
// this comes in on the gecko thread; hand off the handling to the UI thread
|
||||
mUiHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i(LOGTAG, "Got message: " + event);
|
||||
try {
|
||||
|
@ -299,6 +299,7 @@ final class TouchEventHandler implements Tabs.OnTabsChangedListener {
|
||||
|
||||
private class ListenerTimeoutProcessor implements Runnable {
|
||||
/* This MUST be run on the UI thread */
|
||||
@Override
|
||||
public void run() {
|
||||
if (mProcessingBalance < 0) {
|
||||
// gecko already responded with default-prevented notification, and so
|
||||
@ -313,6 +314,7 @@ final class TouchEventHandler implements Tabs.OnTabsChangedListener {
|
||||
|
||||
// Tabs.OnTabsChangedListener implementation
|
||||
|
||||
@Override
|
||||
public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
|
||||
if ((Tabs.getInstance().isSelectedTab(tab) && msg == Tabs.TabEvents.STOP) || msg == Tabs.TabEvents.SELECTED) {
|
||||
mWaitForTouchListeners = tab.getHasTouchListeners();
|
||||
|
@ -243,6 +243,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
mUrlbar = urlbar;
|
||||
mUrl = url;
|
||||
}
|
||||
@Override
|
||||
public boolean test() {
|
||||
String urlbarText = mUrlbar.getText();
|
||||
if (urlbarText.equals(mUrl)) {
|
||||
@ -377,6 +378,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
mAwesomebar = awesomebar;
|
||||
mTitle = title;
|
||||
}
|
||||
@Override
|
||||
public boolean test() {
|
||||
String pageTitle = mAwesomebar.getText();
|
||||
if (pageTitle.equals(mTitle)) {
|
||||
@ -523,6 +525,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
|
||||
// wait for addTab to appear (this is usually immediate)
|
||||
boolean success = waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
View addTabView = getActivity().findViewById(addTabId);
|
||||
if (addTabView == null) {
|
||||
|
@ -113,6 +113,7 @@ public class testBookmark extends PixelTest {
|
||||
|
||||
private boolean waitForBookmarked(final boolean isBookmarked) {
|
||||
waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
try {
|
||||
return isBookmarked == (Boolean)mIsBookmarked.invoke(null, getActivity().getContentResolver(), BOOKMARK_URL);
|
||||
|
@ -31,6 +31,7 @@ public class testBookmarklets extends PixelTest {
|
||||
enterUrl(js);
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.ENTER);
|
||||
alerted = waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
return mSolo.searchButton("OK", true) || mSolo.searchText("12.34", true);
|
||||
}
|
||||
@ -65,6 +66,7 @@ public class testBookmarklets extends PixelTest {
|
||||
}
|
||||
|
||||
alerted = waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
return mSolo.searchButton("OK", true) && mSolo.searchText("12.34", true);
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ public class testBookmarksTab extends BaseTest {
|
||||
View child;
|
||||
mFirstChild = null;
|
||||
boolean success = waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
mFirstChild = list.getChildAt(1);
|
||||
if (mFirstChild == null) {
|
||||
|
@ -377,6 +377,7 @@ public class testBrowserProvider extends ContentProviderTest {
|
||||
}
|
||||
|
||||
abstract class Test implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
test();
|
||||
|
@ -40,6 +40,7 @@ public class testHistory extends PixelTest {
|
||||
// wait for the history list to be populated
|
||||
mFirstChild = null;
|
||||
boolean success = waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
mFirstChild = hList.getChildAt(1);
|
||||
if (mFirstChild == null) {
|
||||
|
@ -166,6 +166,7 @@ public class testHistoryTab extends PixelTest {
|
||||
// wait for the history list to be populated
|
||||
mFirstChild = null;
|
||||
boolean success = waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
mFirstChild = listview.getChildAt(1);
|
||||
if (mFirstChild == null) {
|
||||
@ -223,6 +224,7 @@ public class testHistoryTab extends PixelTest {
|
||||
Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
|
||||
mFirstChild = null;
|
||||
boolean success = waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
mFirstChild = listview.getChildAt(1);
|
||||
if (mFirstChild == null) {
|
||||
|
@ -66,6 +66,7 @@ public class testNewTab extends BaseTest {
|
||||
|
||||
// wait for closeTab to appear (this is usually immediate)
|
||||
boolean success = waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
View closeTabView = getActivity().findViewById(closeTabId);
|
||||
if (closeTabView == null) {
|
||||
@ -88,6 +89,7 @@ public class testNewTab extends BaseTest {
|
||||
}
|
||||
|
||||
success = waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
String newTabCountText = tabCount.getText();
|
||||
int newTabCount = Integer.parseInt(newTabCountText);
|
||||
|
@ -55,6 +55,7 @@ public class testSearchSuggestions extends BaseTest {
|
||||
|
||||
final String query = TEST_QUERY.substring(0, i+1);
|
||||
boolean success = waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
// get the first suggestion row
|
||||
ViewGroup suggestionGroup = (ViewGroup) awesomeBarActivity.findViewById(suggestionLayoutId);
|
||||
@ -117,6 +118,7 @@ public class testSearchSuggestions extends BaseTest {
|
||||
final Object allPagesTab = getAllPagesTabMethod.invoke(awesomeBarTabs);
|
||||
suggestClientField.setAccessible(true);
|
||||
waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
// wait for mSuggestClient to be set before we replace it
|
||||
try {
|
||||
|
@ -164,6 +164,7 @@ public class testShareLink extends BaseTest {
|
||||
|
||||
list = null;
|
||||
boolean success = waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
for (ListView view : views) {
|
||||
list = view;
|
||||
|
@ -101,6 +101,7 @@ public class testThumbnails extends BaseTest {
|
||||
mColor = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test() {
|
||||
return getTopSiteThumbnailColor(mTitle) == mColor;
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ public class DateTimePicker extends FrameLayout {
|
||||
public static enum PickersState { DATE, MONTH, WEEK, TIME, DATETIME };
|
||||
|
||||
public class OnValueChangeListener implements NumberPicker.OnValueChangeListener {
|
||||
@Override
|
||||
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
|
||||
updateInputState();
|
||||
mTempDate.setTimeInMillis(mCurrentDate.getTimeInMillis());
|
||||
@ -202,6 +203,7 @@ public class DateTimePicker extends FrameLayout {
|
||||
|
||||
final Object[] mArgs = new Object[1];
|
||||
|
||||
@Override
|
||||
public String format(int value) {
|
||||
mArgs[0] = value;
|
||||
mBuilder.delete(0, mBuilder.length());
|
||||
@ -275,6 +277,7 @@ public class DateTimePicker extends FrameLayout {
|
||||
mCalendar.setMinDate(mMinDate.getTimeInMillis());
|
||||
|
||||
mCalendar.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
|
||||
@Override
|
||||
public void onSelectedDayChange(
|
||||
CalendarView view, int year, int month, int monthDay) {
|
||||
mTempDate.set(year, month, monthDay);
|
||||
|
Loading…
Reference in New Issue
Block a user