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 <ImageView
android:id="@+id/icon" android:id="@+id/icon"
android:layout_width="50px" android:layout_width="50dp"
android:layout_height="50px" android:layout_height="50dp"
android:cropToPadding="true" android:cropToPadding="true"
android:padding="4px" android:padding="4dp"
android:scaleType="centerInside" /> android:scaleType="fitCenter" />
<RelativeLayout <RelativeLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -48,26 +48,43 @@
android:layout_below="@id/title" android:layout_below="@id/title"
android:layout_toLeftOf="@id/license" android:layout_toLeftOf="@id/license"
android:textSize="12sp" /> 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> </RelativeLayout>
</LinearLayout> </LinearLayout>
<TextView <LinearLayout
android:id="@+id/description"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" 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 <ListView
android:id="@android:id/list" android:id="@android:id/list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:minHeight="80dp" />
</LinearLayout> </LinearLayout>

View File

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

View File

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