Adds handling of formatted descriptions
This commit is contained in:
parent
a06d18b029
commit
0d0c65fb0e
@ -1,52 +1,83 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.fdroid.fdroid" android:versionCode="26"
|
package="org.fdroid.fdroid"
|
||||||
android:versionName="0.35-test" android:installLocation="auto">
|
android:installLocation="auto"
|
||||||
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="15" />
|
android:versionCode="26"
|
||||||
<supports-screens
|
android:versionName="0.35-test" >
|
||||||
android:anyDensity="true"
|
|
||||||
android:largeScreens="true"
|
|
||||||
android:normalScreens="true"
|
|
||||||
android:xlargeScreens="true"
|
|
||||||
android:resizeable="true"
|
|
||||||
android:smallScreens="true" />
|
|
||||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
|
||||||
<application android:name="FDroidApp" android:label="@string/app_name"
|
|
||||||
android:icon="@drawable/ic_launcher">
|
|
||||||
|
|
||||||
<activity android:name="FDroid" android:configChanges="keyboardHidden|orientation">
|
<uses-sdk
|
||||||
<intent-filter>
|
android:minSdkVersion="3"
|
||||||
<action android:name="android.intent.action.MAIN" />
|
android:targetSdkVersion="15" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
<meta-data android:name="android.app.default_searchable"
|
|
||||||
android:value=".SearchResults" />
|
|
||||||
</activity>
|
|
||||||
<activity android:name="ManageRepo" />
|
|
||||||
<activity android:name="Settings" />
|
|
||||||
<activity android:name="AppDetails" />
|
|
||||||
<activity android:name="Preferences" />
|
|
||||||
<activity android:name="SearchResults" android:launchMode="singleTop" android:exported="false">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.SEARCH" />
|
|
||||||
</intent-filter>
|
|
||||||
<meta-data android:name="android.app.searchable"
|
|
||||||
android:resource="@xml/searchable" />
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<receiver android:name="StartupReceiver">
|
<supports-screens
|
||||||
<intent-filter>
|
android:anyDensity="true"
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
android:largeScreens="true"
|
||||||
<category android:name="android.intent.category.HOME" />
|
android:normalScreens="true"
|
||||||
</intent-filter>
|
android:resizeable="true"
|
||||||
</receiver>
|
android:smallScreens="true"
|
||||||
|
android:xlargeScreens="true" />
|
||||||
|
|
||||||
<service android:name="UpdateService" />
|
<uses-feature
|
||||||
|
android:name="android.hardware.touchscreen"
|
||||||
|
android:required="false" />
|
||||||
|
|
||||||
</application>
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<application
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
android:name="FDroidApp"
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
android:icon="@drawable/ic_launcher"
|
||||||
|
android:label="@string/app_name" >
|
||||||
|
<activity
|
||||||
|
android:name="FDroid"
|
||||||
|
android:configChanges="keyboardHidden|orientation" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
</manifest>
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.default_searchable"
|
||||||
|
android:value=".SearchResults" />
|
||||||
|
</activity>
|
||||||
|
<activity android:name="ManageRepo" />
|
||||||
|
<activity android:name="Settings" />
|
||||||
|
<activity
|
||||||
|
android:name="AppDetails"
|
||||||
|
android:exported="true" >
|
||||||
|
<intent-filter>
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<data android:scheme="fdroid.app" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="Preferences" />
|
||||||
|
<activity
|
||||||
|
android:name="SearchResults"
|
||||||
|
android:exported="true"
|
||||||
|
android:launchMode="singleTop" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEARCH" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.searchable"
|
||||||
|
android:resource="@xml/searchable" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<receiver android:name="StartupReceiver" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.HOME" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<service android:name="UpdateService" />
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
@ -1,45 +1,73 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="vertical">
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/header"
|
<LinearLayout
|
||||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
android:id="@+id/header"
|
||||||
android:orientation="horizontal">
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
<ImageView android:id="@+id/icon" android:cropToPadding="true"
|
<ImageView
|
||||||
android:padding="4px" android:scaleType="centerInside"
|
android:id="@+id/icon"
|
||||||
android:layout_height="50px" android:layout_width="50px" />
|
android:layout_width="50px"
|
||||||
|
android:layout_height="50px"
|
||||||
|
android:cropToPadding="true"
|
||||||
|
android:padding="4px"
|
||||||
|
android:scaleType="centerInside" />
|
||||||
|
|
||||||
<RelativeLayout android:layout_width="fill_parent"
|
<RelativeLayout
|
||||||
android:layout_height="wrap_content" android:orientation="vertical">
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TextView android:id="@+id/title" android:textStyle="bold"
|
<TextView
|
||||||
android:singleLine="true" android:ellipsize="marquee"
|
android:id="@+id/title"
|
||||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:textSize="18sp" />
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView android:id="@+id/license" android:textSize="12sp"
|
<TextView
|
||||||
android:layout_below="@id/title" android:layout_alignParentRight="true"
|
android:id="@+id/license"
|
||||||
android:layout_height="wrap_content" android:layout_width="wrap_content" />
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_below="@id/title"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView android:id="@+id/status" android:layout_toLeftOf="@id/license"
|
<TextView
|
||||||
android:layout_below="@id/title" android:layout_alignParentLeft="true"
|
android:id="@+id/status"
|
||||||
android:textSize="12sp" android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:layout_width="fill_parent" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_below="@id/title"
|
||||||
|
android:layout_toLeftOf="@id/license"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView android:id="@+id/signature" android:layout_below="@id/status"
|
<TextView
|
||||||
android:layout_alignParentLeft="true" android:textSize="12sp"
|
android:id="@+id/signature"
|
||||||
android:layout_height="wrap_content" android:layout_width="fill_parent" />
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_below="@id/status"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
<TextView
|
||||||
|
android:id="@+id/description"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="false" />
|
||||||
|
|
||||||
</LinearLayout>
|
<ListView
|
||||||
|
android:id="@android:id/list"
|
||||||
<TextView android:id="@+id/description" android:singleLine="false"
|
android:layout_width="fill_parent"
|
||||||
android:layout_width="fill_parent" android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<ListView android:id="@android:id/list" android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -24,6 +24,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.xml.sax.XMLReader;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
@ -45,7 +47,11 @@ import android.content.Context;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
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.format.DateFormat;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@ -171,7 +177,11 @@ public class AppDetails extends ListActivity {
|
|||||||
|
|
||||||
Intent i = getIntent();
|
Intent i = getIntent();
|
||||||
appid = "";
|
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!?");
|
Log.d("FDroid", "No application ID in AppDetails!?");
|
||||||
} else {
|
} else {
|
||||||
appid = i.getStringExtra("appid");
|
appid = i.getStringExtra("appid");
|
||||||
@ -277,7 +287,7 @@ public class AppDetails extends ListActivity {
|
|||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the app is populated.
|
// Make sure the app is populated.
|
||||||
try {
|
try {
|
||||||
DB db = DB.getDB();
|
DB db = DB.getDB();
|
||||||
@ -343,7 +353,36 @@ public class AppDetails extends ListActivity {
|
|||||||
tv.setText(String.format(getString(R.string.details_installed),
|
tv.setText(String.format(getString(R.string.details_installed),
|
||||||
app.installedVersion));
|
app.installedVersion));
|
||||||
tv = (TextView) findViewById(R.id.description);
|
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) {
|
if (pref_expert && mInstalledSignature != null) {
|
||||||
tv = (TextView) findViewById(R.id.signature);
|
tv = (TextView) findViewById(R.id.signature);
|
||||||
tv.setText("Signed: " + mInstalledSigID);
|
tv.setText("Signed: " + mInstalledSigID);
|
||||||
@ -367,6 +406,8 @@ public class AppDetails extends ListActivity {
|
|||||||
|
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
menu.clear();
|
menu.clear();
|
||||||
|
if(app == null)
|
||||||
|
return true;
|
||||||
DB.Apk curver = app.getCurrentVersion();
|
DB.Apk curver = app.getCurrentVersion();
|
||||||
if (app.installedVersion != null && curver != null
|
if (app.installedVersion != null && curver != null
|
||||||
&& !app.installedVersion.equals(curver.version)) {
|
&& !app.installedVersion.equals(curver.version)) {
|
||||||
@ -419,7 +460,8 @@ public class AppDetails extends ListActivity {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case WEBSITE:
|
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;
|
return true;
|
||||||
|
|
||||||
case ISSUES:
|
case ISSUES:
|
||||||
|
@ -170,6 +170,12 @@ public class RepoXMLHandler extends DefaultHandler {
|
|||||||
} else if (curel.equals("icon")) {
|
} else if (curel.equals("icon")) {
|
||||||
curapp.icon = str;
|
curapp.icon = str;
|
||||||
} else if (curel.equals("description")) {
|
} 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 = "<p>" + str + "</p>";
|
||||||
|
} else if (curel.equals("desc")) {
|
||||||
|
// New-style description.
|
||||||
curapp.detail_description = str;
|
curapp.detail_description = str;
|
||||||
} else if (curel.equals("summary")) {
|
} else if (curel.equals("summary")) {
|
||||||
curapp.summary = str;
|
curapp.summary = str;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user