summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/SaveToHomescreenDialog.java
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-10-21 15:17:10 -0400
committerLeon Scroggins <scroggo@google.com>2010-10-22 11:04:39 -0400
commit88d080394ca18120e05c6926b178fd6843ff9cec (patch)
tree0720a96b8658d58dec59581b7876c0f74b88b586 /src/com/android/browser/SaveToHomescreenDialog.java
parentfa6401f9759594b206e3b2effe2c3198a8b2449f (diff)
downloadpackages_apps_Browser-88d080394ca18120e05c6926b178fd6843ff9cec.zip
packages_apps_Browser-88d080394ca18120e05c6926b178fd6843ff9cec.tar.gz
packages_apps_Browser-88d080394ca18120e05c6926b178fd6843ff9cec.tar.bz2
Incorporate save to home screen with add bookmark dialog.
Bug:2953515 Remove the initial popup menu when pressing the star that selects between saving to home screen and saving to bookmarks. Instead, once the add bookmark dialog is open, the user can select between bookmarks and saving to home screen. Change-Id: I35e8590ff6a2a7c2058e45e4f77ec6b5d209b0f9
Diffstat (limited to 'src/com/android/browser/SaveToHomescreenDialog.java')
-rw-r--r--src/com/android/browser/SaveToHomescreenDialog.java127
1 files changed, 0 insertions, 127 deletions
diff --git a/src/com/android/browser/SaveToHomescreenDialog.java b/src/com/android/browser/SaveToHomescreenDialog.java
deleted file mode 100644
index 15f0aea..0000000
--- a/src/com/android/browser/SaveToHomescreenDialog.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.content.ComponentName;
-import android.content.ContentResolver;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.net.ParseException;
-import android.net.Uri;
-import android.net.WebAddress;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.provider.Browser;
-import android.util.Log;
-import android.view.View;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Date;
-
-public class SaveToHomescreenDialog extends Activity {
-
- private EditText mTitle;
- private String mUrl;
- private Bitmap mFavicon;
- private Bitmap mTouchIcon;
-
- private View.OnClickListener mOk = new View.OnClickListener() {
- public void onClick(View v) {
- if (save()) {
- finish();
- }
- }
- };
-
- private View.OnClickListener mCancel = new View.OnClickListener() {
- public void onClick(View v) {
- finish();
- }
- };
-
- protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- requestWindowFeature(Window.FEATURE_LEFT_ICON);
- setContentView(R.layout.browser_add_bookmark_const_url);
- setTitle(R.string.create_shortcut_bookmark);
- getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
- R.drawable.ic_list_bookmark);
-
- String title = null;
- String url = null;
- Bundle map = getIntent().getExtras();
- if (map != null) {
- title = map.getString("title");
- }
-
- mUrl = map.getString("url");
- mFavicon = (Bitmap)map.getParcelable("favicon");
- mTouchIcon = (Bitmap)map.getParcelable("touchIcon");
-
- Bitmap icon = BookmarkUtils.createIcon(this, mTouchIcon, mFavicon,
- BookmarkUtils.BookmarkIconType.ICON_HOME_SHORTCUT);
- getWindow().setFeatureDrawable(Window.FEATURE_LEFT_ICON, new BitmapDrawable(icon));
-
- mTitle = (EditText) findViewById(R.id.title);
- mTitle.setText(title);
-
- Button okButton = (Button) findViewById(R.id.OK);
- okButton.setOnClickListener(mOk);
-
- Button cancelButton = (Button) findViewById(R.id.cancel);
- cancelButton.setOnClickListener(mCancel);
-
- if (!getWindow().getDecorView().isInTouchMode()) {
- okButton.requestFocus();
- }
- }
-
- /**
- * Parse the data entered in the dialog and send an intent to create an
- * icon on the homescreen.
- */
- private boolean save() {
- String title = mTitle.getText().toString().trim();
- String unfilteredUrl = BrowserActivity.fixUrl(mUrl);
- if (title.length() == 0) {
- mTitle.setError(getResources().getText(R.string.bookmark_needs_title));
- return false;
- }
-
- String url = unfilteredUrl.trim();
-
- sendBroadcast(BookmarkUtils.createAddToHomeIntent(this, url, title,
- mTouchIcon, mFavicon));
- setResult(RESULT_OK);
- return true;
- }
-}