Tidies up app details view a bit and adds summary/package id

The package ID is shown only in expert mode.
This commit is contained in:
Ciaran Gultnieks 2012-09-18 20:59:00 +01:00
parent 111ac731dc
commit 14cdf092d3
3 changed files with 69 additions and 30 deletions

View File

@ -12,11 +12,11 @@
<ImageView
android:id="@+id/icon"
android:layout_width="50px"
android:layout_height="50px"
android:layout_width="50dp"
android:layout_height="50dp"
android:cropToPadding="true"
android:padding="4px"
android:scaleType="centerInside" />
android:padding="4dp"
android:scaleType="fitCenter" />
<RelativeLayout
android:layout_width="fill_parent"
@ -48,26 +48,43 @@
android:layout_below="@id/title"
android:layout_toLeftOf="@id/license"
android:textSize="12sp" />
<TextView
android:id="@+id/signature"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/status"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/description"
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="false" />
android:orientation="vertical" >
<TextView
android:id="@+id/summary"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="14sp" />
<TextView
android:id="@+id/appid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12sp" />
<TextView
android:id="@+id/signature"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12sp" />
<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"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:minHeight="80dp" />
</LinearLayout>

View File

@ -9,7 +9,7 @@
android:paddingRight="10dp">
<ImageView android:id="@+id/icon"
android:scaleType="centerInside"
android:scaleType="fitCenter"
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="4dp"/>

View File

@ -178,9 +178,10 @@ public class AppDetails extends ListActivity {
Intent i = getIntent();
appid = "";
Uri data = getIntent().getData();
if(data != null) {
if (data != null) {
appid = data.getEncodedSchemeSpecificPart();
Log.d("FDroid", "AppDetails launched from link, for '" + appid + "'");
Log.d("FDroid", "AppDetails launched from link, for '" + appid
+ "'");
} else if (!i.hasExtra("appid")) {
Log.d("FDroid", "No application ID in AppDetails!?");
} else {
@ -216,14 +217,16 @@ public class AppDetails extends ListActivity {
@Override
protected void onResume() {
super.onResume();
if (viewResetRequired) {
reset();
viewResetRequired = false;
} else {
resetViews();
}
if (downloadHandler != null) {
downloadHandler.startUpdates();
}
super.onResume();
}
@Override
@ -267,7 +270,6 @@ public class AppDetails extends ListActivity {
app_currentvercode = old.app_currentvercode;
mInstalledSignature = old.mInstalledSignature;
mInstalledSigID = old.mInstalledSigID;
resetViews();
}
// Reset the display and list contents. Used when entering the activity, and
@ -321,14 +323,13 @@ public class AppDetails extends ListActivity {
}
}
// Set up various parts of the UI
resetViews();
// Set up the list...
ApkListAdapter la = new ApkListAdapter(this, null);
for (DB.Apk apk : app.apks)
la.addItem(apk);
setListAdapter(la);
resetViews();
}
private void resetViews() {
@ -359,6 +360,7 @@ public class AppDetails extends ListActivity {
// lists to Html.fromHtml().
class HtmlTagHandler implements TagHandler {
int listNum;
@Override
public void handleTag(boolean opening, String tag, Editable output,
XMLReader reader) {
@ -381,12 +383,32 @@ public class AppDetails extends ListActivity {
}
}
}
tv.setText(Html.fromHtml(app.detail_description, null, new HtmlTagHandler()));
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);
tv.setVisibility(View.VISIBLE);
tv = (TextView) findViewById(R.id.summary);
if (tv != null) {
tv.setText(app.summary);
}
if (tv != null) {
tv = (TextView) findViewById(R.id.appid);
if (pref_expert) {
tv.setVisibility(View.VISIBLE);
tv.setText(app.id);
} else {
tv.setVisibility(View.INVISIBLE);
}
}
tv = (TextView) findViewById(R.id.signature);
if (tv != null) {
if (pref_expert && mInstalledSignature != null) {
tv.setVisibility(View.VISIBLE);
tv.setText("Signed: " + mInstalledSigID);
} else {
tv.setVisibility(View.INVISIBLE);
}
}
}
@ -406,7 +428,7 @@ public class AppDetails extends ListActivity {
super.onCreateOptionsMenu(menu);
menu.clear();
if(app == null)
if (app == null)
return true;
DB.Apk curver = app.getCurrentVersion();
if (app.installedVersion != null && curver != null