Merge branch 'master' of gitorious.org:f-droid/fdroidclient

This commit is contained in:
Ciaran Gultnieks 2013-07-15 22:32:17 +01:00
commit 9941e543ed
5 changed files with 45 additions and 16 deletions

View File

@ -38,13 +38,6 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="market" android:host="details" />
</intent-filter>
<meta-data <meta-data
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
@ -56,6 +49,7 @@
android:name="AppDetails" android:name="AppDetails"
android:exported="true" android:exported="true"
android:parentActivityName="FDroid" > android:parentActivityName="FDroid" >
<intent-filter> <intent-filter>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@ -63,6 +57,21 @@
<data android:scheme="fdroid.app" /> <data android:scheme="fdroid.app" />
</intent-filter> </intent-filter>
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="market" android:host="details" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="fdroid" android:host="details" />
</intent-filter>
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value="FDroid" /> android:value="FDroid" />

View File

@ -108,6 +108,7 @@
<string name="menu_launch">Run</string> <string name="menu_launch">Run</string>
<string name="menu_share">Share</string>
<string name="menu_install">Install</string> <string name="menu_install">Install</string>
<string name="menu_uninstall">Uninstall</string> <string name="menu_uninstall">Uninstall</string>
<string name="menu_website">Website</string> <string name="menu_website">Website</string>

View File

@ -163,6 +163,7 @@ public class AppDetails extends ListActivity {
private static final int MARKET = Menu.FIRST + 5; private static final int MARKET = Menu.FIRST + 5;
private static final int DONATE = Menu.FIRST + 6; private static final int DONATE = Menu.FIRST + 6;
private static final int LAUNCH = Menu.FIRST + 7; private static final int LAUNCH = Menu.FIRST + 7;
private static final int SHARE = Menu.FIRST + 8;
private DB.App app; private DB.App app;
private int app_currentvercode; private int app_currentvercode;
@ -192,6 +193,12 @@ public class AppDetails extends ListActivity {
appid = ""; appid = "";
Uri data = getIntent().getData(); Uri data = getIntent().getData();
if (data != null) { if (data != null) {
if (data.isHierarchical())
// fdroid://details?id=app.id
// market://details?id=app.id
appid = data.getQueryParameter("id");
else
// fdroid.app:app.id (old scheme)
appid = data.getEncodedSchemeSpecificPart(); appid = data.getEncodedSchemeSpecificPart();
Log.d("FDroid", "AppDetails launched from link, for '" + appid Log.d("FDroid", "AppDetails launched from link, for '" + appid
+ "'"); + "'");
@ -552,10 +559,13 @@ public class AppDetails extends ListActivity {
android.R.drawable.ic_menu_delete)); android.R.drawable.ic_menu_delete));
if (mPm.getLaunchIntentForPackage(app.id) != null) { if (mPm.getLaunchIntentForPackage(app.id) != null) {
toShow.add(menu.add( Menu.NONE, LAUNCH, 1, R.string.menu_launch ).setIcon( toShow.add(menu.add( Menu.NONE, LAUNCH, 1, R.string.menu_launch).setIcon(
android.R.drawable.ic_media_play)); android.R.drawable.ic_media_play));
} }
} }
toShow.add(menu.add( Menu.NONE, SHARE, 1, R.string.menu_share).setIcon(
android.R.drawable.ic_menu_share));
if (app.detail_webURL.length() > 0) { if (app.detail_webURL.length() > 0) {
menu.add(Menu.NONE, WEBSITE, 2, R.string.menu_website).setIcon( menu.add(Menu.NONE, WEBSITE, 2, R.string.menu_website).setIcon(
android.R.drawable.ic_menu_view); android.R.drawable.ic_menu_view);
@ -602,6 +612,10 @@ public class AppDetails extends ListActivity {
launchApk(app.id); launchApk(app.id);
return true; return true;
case SHARE:
shareApp(app);
return true;
case INSTALL: case INSTALL:
// Note that this handles updating as well as installing. // Note that this handles updating as well as installing.
curapk = app.getCurrentVersion(); curapk = app.getCurrentVersion();
@ -728,6 +742,16 @@ public class AppDetails extends ListActivity {
startActivity(intent); startActivity(intent);
} }
private void shareApp(DB.App app) {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, app.name);
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "fdroid://details?id="+app.id);
startActivity(Intent.createChooser(shareIntent, getString(R.string.menu_share)));
}
private ProgressDialog createProgressDialog(String file, int p, int max) { private ProgressDialog createProgressDialog(String file, int p, int max) {
final ProgressDialog pd = new ProgressDialog(this); final ProgressDialog pd = new ProgressDialog(this);
pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);

View File

@ -83,12 +83,7 @@ public class FDroid extends FragmentActivity {
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
Intent i = getIntent(); Intent i = getIntent();
Uri data = i.getData(); if (i.hasExtra("uri")) {
if (data != null && data.getScheme().equals("market")) {
Intent call = new Intent(this, AppDetails.class);
call.putExtra("appid", data.getQueryParameter("id"));
startActivityForResult(call, REQUEST_APPDETAILS);
} else if (i.hasExtra("uri")) {
Intent call = new Intent(this, ManageRepo.class); Intent call = new Intent(this, ManageRepo.class);
call.putExtra("uri", i.getStringExtra("uri")); call.putExtra("uri", i.getStringExtra("uri"));
startActivityForResult(call, REQUEST_MANAGEREPOS); startActivityForResult(call, REQUEST_MANAGEREPOS);

View File

@ -49,7 +49,7 @@ abstract class AppListFragment extends Fragment implements AdapterView.OnItemCli
protected ListView createAppListView() { protected ListView createAppListView() {
ListView list = new ListView(getActivity()); ListView list = new ListView(getActivity());
list.setVerticalScrollBarEnabled(false); list.setFastScrollEnabled(true);
list.setOnItemClickListener(this); list.setOnItemClickListener(this);
list.setAdapter(getAppListAdapter()); list.setAdapter(getAppListAdapter());
return list; return list;