diff options
author | Michael Kolb <kolby@google.com> | 2010-08-25 12:57:38 -0700 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2010-08-25 13:00:32 -0700 |
commit | 801ecb73006a3062cdfeacf7ad6016e0a358671c (patch) | |
tree | fdada90c88698f5ea20f0a2bcaa40e13262da655 /src/com/android/browser/ShortcutActivity.java | |
parent | 0998b0a02bcb8606881df8ed6ae204b5367ca4f9 (diff) | |
download | packages_apps_Browser-801ecb73006a3062cdfeacf7ad6016e0a358671c.zip packages_apps_Browser-801ecb73006a3062cdfeacf7ad6016e0a358671c.tar.gz packages_apps_Browser-801ecb73006a3062cdfeacf7ad6016e0a358671c.tar.bz2 |
fixed adding bookmark shortcut from home screen
bug: http://b/issue?id=2948937
added shortcut activity to host bookmarks page fragment
Change-Id: I39db8985b3c07fae6ca800cc57da3747040cb814
Diffstat (limited to 'src/com/android/browser/ShortcutActivity.java')
-rw-r--r-- | src/com/android/browser/ShortcutActivity.java | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/com/android/browser/ShortcutActivity.java b/src/com/android/browser/ShortcutActivity.java new file mode 100644 index 0000000..7994d0a --- /dev/null +++ b/src/com/android/browser/ShortcutActivity.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.browser; + +import android.app.Activity; +import android.app.Fragment; +import android.app.FragmentManager; +import android.app.FragmentTransaction; +import android.content.Intent; +import android.os.Bundle; + +public class ShortcutActivity extends Activity + implements BookmarksHistoryCallbacks { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); + FragmentManager fm = getFragmentManager(); + FragmentTransaction transaction = fm.openTransaction(); + Bundle extras = new Bundle(); + extras.putBoolean(BrowserBookmarksPage.EXTRA_SHORTCUT, true); + extras.putBoolean(BrowserBookmarksPage.EXTRA_DISABLE_WINDOW, true); + Fragment frag = Fragment.instantiate(this, BrowserBookmarksPage.class.getName(), extras); + transaction.add(android.R.id.content, frag); + transaction.commit(); + } + + /** + * not used for shortcuts + */ + @Override + public void onRemoveParentChildRelationShips() {} + + /** + * handle fragment startActivity + */ + @Override + public void startActivityFromFragment(Fragment f, Intent intent, int requestCode) { + setResult(RESULT_OK, intent); + finish(); + } + + @Override + public void finish() { + super.finish(); + } + + /** + * not used for shortcuts + */ + @Override + public void onUrlSelected(String url, boolean newWindow) {} + +} |