Handle long descriptions properly
This commit is contained in:
parent
647e230c9e
commit
006ee57bbf
@ -2,75 +2,67 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_margin="5dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout android:id="@+id/header"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView android:id="@+id/title"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:singleLine="false"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true" />
|
||||
|
||||
<ImageView android:id="@+id/icon"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_width="42dp"
|
||||
android:layout_below="@id/title" />
|
||||
|
||||
<TextView android:id="@+id/license"
|
||||
android:textSize="12sp"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_toRightOf="@id/icon"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" />
|
||||
|
||||
<TextView android:id="@+id/status"
|
||||
android:textSize="12sp"
|
||||
android:layout_below="@id/license"
|
||||
android:layout_toRightOf="@id/icon"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView android:id="@+id/signature"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" />
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/desc_scrollview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="0.5" >
|
||||
|
||||
<TextView android:id="@+id/description"
|
||||
<LinearLayout
|
||||
android:id="@+id/landleft"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/header"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:singleLine="false"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_marginRight="5dp"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/license"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_toRightOf="@id/icon"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/license"
|
||||
android:layout_toRightOf="@id/icon"
|
||||
android:textSize="12sp" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ListView android:id="@android:id/list"
|
||||
android:layout_width="0dp"
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="0.5" />
|
||||
|
||||
|
@ -51,40 +51,9 @@
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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:minHeight="80dp" />
|
||||
android:layout_height="fill_parent" />
|
||||
|
||||
</LinearLayout>
|
32
res/layout/appinfo.xml
Normal file
32
res/layout/appinfo.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/summary"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<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>
|
@ -36,6 +36,7 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@ -168,6 +169,7 @@ public class AppDetails extends ListActivity {
|
||||
|
||||
private Context mctx = this;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
@ -192,7 +194,7 @@ public class AppDetails extends ListActivity {
|
||||
|
||||
private boolean pref_cacheDownloaded;
|
||||
private boolean pref_expert;
|
||||
private boolean viewResetRequired;
|
||||
private boolean resetRequired;
|
||||
|
||||
// The signature of the installed version.
|
||||
private Signature mInstalledSignature;
|
||||
@ -211,19 +213,18 @@ public class AppDetails extends ListActivity {
|
||||
if (old != null) {
|
||||
copyState(old);
|
||||
} else {
|
||||
viewResetRequired = true;
|
||||
resetRequired = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (viewResetRequired) {
|
||||
if (resetRequired) {
|
||||
reset();
|
||||
viewResetRequired = false;
|
||||
} else {
|
||||
resetViews();
|
||||
resetRequired = false;
|
||||
}
|
||||
resetViews();
|
||||
if (downloadHandler != null) {
|
||||
downloadHandler.startUpdates();
|
||||
}
|
||||
@ -323,16 +324,33 @@ public class AppDetails extends ListActivity {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void resetViews() {
|
||||
|
||||
// Clear the listadapter, because we can't mess with the listview's
|
||||
// header view while it's set.
|
||||
setListAdapter(null);
|
||||
|
||||
// Insert the 'infoView' (which contains the summary, various odds and
|
||||
// ends, and the description) into the appropriate place, if we're in
|
||||
// landscape mode. In portrait mode, we put it in the listview's
|
||||
// header..
|
||||
View infoView = View.inflate(this, R.layout.appinfo, null);
|
||||
LinearLayout landparent = (LinearLayout) findViewById(R.id.landleft);
|
||||
ListView lv = (ListView) findViewById(android.R.id.list);
|
||||
if (landparent != null) {
|
||||
landparent.addView(infoView);
|
||||
} else {
|
||||
lv.addHeaderView(infoView);
|
||||
}
|
||||
|
||||
// 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() {
|
||||
// Set the icon...
|
||||
ImageView iv = (ImageView) findViewById(R.id.icon);
|
||||
File icon = new File(DB.getIconsPath(), app.icon);
|
||||
@ -353,9 +371,9 @@ public class AppDetails extends ListActivity {
|
||||
else
|
||||
tv.setText(String.format(getString(R.string.details_installed),
|
||||
app.installedVersion));
|
||||
tv = (TextView) findViewById(R.id.description);
|
||||
tv.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
tv = (TextView) infoView.findViewById(R.id.description);
|
||||
tv.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
// Need this to add the unimplemented support for ordered and unordered
|
||||
// lists to Html.fromHtml().
|
||||
class HtmlTagHandler implements TagHandler {
|
||||
@ -386,30 +404,25 @@ public class AppDetails extends ListActivity {
|
||||
tv.setText(Html.fromHtml(app.detail_description, null,
|
||||
new HtmlTagHandler()));
|
||||
|
||||
tv = (TextView) findViewById(R.id.summary);
|
||||
if (tv != null) {
|
||||
tv = (TextView) infoView.findViewById(R.id.summary);
|
||||
tv.setText(app.summary);
|
||||
}
|
||||
|
||||
if (tv != null) {
|
||||
tv = (TextView) findViewById(R.id.appid);
|
||||
tv = (TextView) infoView.findViewById(R.id.appid);
|
||||
if (pref_expert) {
|
||||
tv.setVisibility(View.VISIBLE);
|
||||
tv.setText(app.id);
|
||||
} else {
|
||||
tv.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
tv.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
tv = (TextView) findViewById(R.id.signature);
|
||||
if (tv != null) {
|
||||
tv = (TextView) infoView.findViewById(R.id.signature);
|
||||
if (pref_expert && mInstalledSignature != null) {
|
||||
tv.setVisibility(View.VISIBLE);
|
||||
tv.setText("Signed: " + mInstalledSigID);
|
||||
} else {
|
||||
tv.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
tv.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -700,10 +713,10 @@ public class AppDetails extends ListActivity {
|
||||
downloadHandler.cleanUp();
|
||||
downloadHandler = null;
|
||||
}
|
||||
viewResetRequired = true;
|
||||
resetRequired = true;
|
||||
break;
|
||||
case REQUEST_UNINSTALL:
|
||||
viewResetRequired = true;
|
||||
resetRequired = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user