diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 9f3ac262b..2086fd8e4 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,52 +1,83 @@ - - - - + package="org.fdroid.fdroid" + android:installLocation="auto" + android:versionCode="26" + android:versionName="0.35-test" > - - - - - - - - - - - - - - - - - + - - - - - - + - + - + + + - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/appdetails.xml b/res/layout/appdetails.xml index ee88f8e19..abb9b9804 100644 --- a/res/layout/appdetails.xml +++ b/res/layout/appdetails.xml @@ -1,45 +1,73 @@ + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="vertical" > - + - + - + - + - + - + - + + + - + - - - - - + \ No newline at end of file diff --git a/src/org/fdroid/fdroid/AppDetails.java b/src/org/fdroid/fdroid/AppDetails.java index 862bd6227..133180092 100644 --- a/src/org/fdroid/fdroid/AppDetails.java +++ b/src/org/fdroid/fdroid/AppDetails.java @@ -24,6 +24,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Vector; +import org.xml.sax.XMLReader; + import android.app.AlertDialog; import android.app.ListActivity; import android.app.ProgressDialog; @@ -45,7 +47,11 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.text.Editable; +import android.text.Html; +import android.text.Html.TagHandler; import android.text.format.DateFormat; +import android.text.method.LinkMovementMethod; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; @@ -171,7 +177,11 @@ public class AppDetails extends ListActivity { Intent i = getIntent(); appid = ""; - if (!i.hasExtra("appid")) { + Uri data = getIntent().getData(); + if(data != null) { + appid = data.getEncodedSchemeSpecificPart(); + Log.d("FDroid", "AppDetails launched from link, for '" + appid + "'"); + } else if (!i.hasExtra("appid")) { Log.d("FDroid", "No application ID in AppDetails!?"); } else { appid = i.getStringExtra("appid"); @@ -277,7 +287,7 @@ public class AppDetails extends ListActivity { finish(); return; } - + // Make sure the app is populated. try { DB db = DB.getDB(); @@ -343,7 +353,36 @@ public class AppDetails extends ListActivity { tv.setText(String.format(getString(R.string.details_installed), app.installedVersion)); tv = (TextView) findViewById(R.id.description); - tv.setText(app.detail_description); + tv.setMovementMethod(LinkMovementMethod.getInstance()); + + // Need this to add the unimplemented support for ordered and unordered + // lists to Html.fromHtml(). + class HtmlTagHandler implements TagHandler { + int listNum; + @Override + public void handleTag(boolean opening, String tag, Editable output, + XMLReader reader) { + if (opening && tag.equals("ul")) { + listNum = -1; + } else if (opening && tag.equals("ol")) { + listNum = 1; + } else if (tag.equals("li")) { + if (opening) { + if (listNum == -1) { + output.append("\t•"); + } else { + output.append("\t" + Integer.toString(listNum) + + ". "); + listNum++; + } + } else { + output.append('\n'); + } + } + } + } + tv.setText(Html.fromHtml(app.detail_description, null, new HtmlTagHandler())); + if (pref_expert && mInstalledSignature != null) { tv = (TextView) findViewById(R.id.signature); tv.setText("Signed: " + mInstalledSigID); @@ -367,6 +406,8 @@ public class AppDetails extends ListActivity { super.onCreateOptionsMenu(menu); menu.clear(); + if(app == null) + return true; DB.Apk curver = app.getCurrentVersion(); if (app.installedVersion != null && curver != null && !app.installedVersion.equals(curver.version)) { @@ -419,7 +460,8 @@ public class AppDetails extends ListActivity { return true; case WEBSITE: - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(app.detail_webURL))); + startActivity(new Intent(Intent.ACTION_VIEW, + Uri.parse(app.detail_webURL))); return true; case ISSUES: diff --git a/src/org/fdroid/fdroid/RepoXMLHandler.java b/src/org/fdroid/fdroid/RepoXMLHandler.java index 1fa2dc255..d19d68ca4 100644 --- a/src/org/fdroid/fdroid/RepoXMLHandler.java +++ b/src/org/fdroid/fdroid/RepoXMLHandler.java @@ -170,6 +170,12 @@ public class RepoXMLHandler extends DefaultHandler { } else if (curel.equals("icon")) { curapp.icon = str; } else if (curel.equals("description")) { + // This is the old-style description. We'll read it + // if present, to support old repos, but in newer + // repos it will get overwritten straight away! + curapp.detail_description = "

" + str + "

"; + } else if (curel.equals("desc")) { + // New-style description. curapp.detail_description = str; } else if (curel.equals("summary")) { curapp.summary = str;