Backout b4da81723e56, 616986a1819a, Bad checkin comment

This commit is contained in:
Mark Finkle 2011-10-06 00:11:31 -04:00
Родитель b272d29b8c
Коммит 037497a4f2
5 изменённых файлов: 31 добавлений и 58 удалений

Просмотреть файл

@ -115,8 +115,7 @@
#endif
<activity android:name="LauncherShortcuts"
android:label="@string/launcher_shortcuts_title"
android:theme="@android:style/Theme.Translucent">
android:label="@string/launcher_shortcuts_title">
<!-- This intent-filter allows your shortcuts to be created in the launcher. -->
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />

Просмотреть файл

@ -60,7 +60,7 @@ import android.net.Uri;
import android.graphics.*;
public class LauncherShortcuts extends Activity {
public class LauncherShortcuts extends ListActivity {
private ArrayList <HashMap<String, String>> mWebappsList;
private File mWebappsFolder;
@ -69,7 +69,6 @@ public class LauncherShortcuts extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.launch_app_list);
final Intent intent = getIntent();
@ -81,8 +80,9 @@ public class LauncherShortcuts extends Activity {
}
}
public void onListItemClick(int id) {
HashMap<String, String> map = mWebappsList.get(id);
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
HashMap<String, String> map = mWebappsList.get((int) id);
String uri = map.get("uri").toString();
String title = map.get("title").toString();
@ -129,11 +129,8 @@ public class LauncherShortcuts extends Activity {
size = 72;
}
Bitmap bitmap = BitmapFactory.decodeFile(favicon);
if (bitmap != null) {
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, size, size, true);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, scaledBitmap);
}
Bitmap bitmap = Bitmap.createScaledBitmap(BitmapFactory.decodeFile(favicon), size, size, true);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, bitmap);
// Now, return the result to the launcher
setResult(RESULT_OK, intent);
@ -219,42 +216,16 @@ public class LauncherShortcuts extends Activity {
@Override
protected void onPostExecute(Void unused) {
if (mWebappsList != null) {
AlertDialog.Builder builder;
if (android.os.Build.VERSION.SDK_INT >= 11) {
builder = new AlertDialog.Builder(LauncherShortcuts.this, AlertDialog.THEME_HOLO_LIGHT);
} else {
builder = new AlertDialog.Builder(LauncherShortcuts.this);
}
builder.setTitle(R.string.launcher_shortcuts_title);
builder.setAdapter(new SimpleAdapter(
TextView emptyText = (TextView)findViewById(android.R.id.empty);
emptyText.setText("");
setListAdapter(new SimpleAdapter(
LauncherShortcuts.this,
mWebappsList,
R.layout.launch_app_listitem,
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);
finish();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
dialog.dismiss();
finish();
}
});
builder.create().show();
} else {
Toast.makeText(LauncherShortcuts.this, R.string.launcher_shortcuts_empty, Toast.LENGTH_LONG).show();
finish();
));
}
}
}

Просмотреть файл

@ -5,4 +5,16 @@
android:padding="3dip"
android:orientation="vertical"
android:windowIsFloating="true">
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"/>
<TextView android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/launcher_shortcuts_empty"/>
</LinearLayout>

Просмотреть файл

@ -2,24 +2,16 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:orientation="horizontal"
android:gravity="left">
android:padding="6dip"
android:orientation="horizontal">
<ImageView
android:id="@+id/favicon"
android:layout_width="48dip"
android:layout_height="48dip"
android:layout_marginRight="12dip"
android:layout_gravity="center_vertical"
android:adjustViewBounds="true"
android:scaleType="fitCenter"/>
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="6dip"/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceLargeInverse"
android:ellipsize="marquee"
android:fadingEdge="horizontal"/>
android:gravity="center_vertical"/>
</LinearLayout>

Просмотреть файл

@ -141,10 +141,9 @@ let OpenWebapps = {
this._writeFile(this.appsFile, JSON.stringify(this.webapps));
// now save the icon as icon.png in the app directory
let iconURI = aApplication.iconURI ? aApplication.iconURI : "chrome://browser/skin/images/homescreen-default-hdpi.png";
let iconFile = dir.clone();
iconFile.append("icon.png");
let uri = Services.io.newURI(iconURI, null, null);
let uri = Services.io.newURI(aApplication.iconURI, null, null);
let persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Ci.nsIWebBrowserPersist);
persist.persistFlags = persist.PERSIST_FLAGS_REPLACE_EXISTING_FILES | persist.PERSIST_FLAGS_BYPASS_CACHE;
persist.saveURI(uri, null, null, null, "", iconFile);