Handle long descriptions properly
This commit is contained in:
parent
647e230c9e
commit
006ee57bbf
@ -1,77 +1,69 @@
|
|||||||
<?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_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:orientation="horizontal">
|
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" />
|
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:id="@+id/desc_scrollview"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_weight="0.5" >
|
||||||
|
|
||||||
<TextView android:id="@+id/description"
|
<LinearLayout
|
||||||
android:singleLine="false"
|
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_width="fill_parent"
|
||||||
android:layout_height="wrap_content" />
|
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: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>
|
</ScrollView>
|
||||||
|
|
||||||
</LinearLayout>
|
<ListView
|
||||||
|
android:id="@android:id/list"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="0.5" />
|
||||||
|
|
||||||
<ListView android:id="@android:id/list"
|
</LinearLayout>
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_weight="0.5" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -51,40 +51,9 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</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
|
<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="fill_parent" />
|
||||||
android:minHeight="80dp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</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.os.Message;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -168,6 +169,7 @@ public class AppDetails extends ListActivity {
|
|||||||
|
|
||||||
private Context mctx = this;
|
private Context mctx = this;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
@ -192,7 +194,7 @@ public class AppDetails extends ListActivity {
|
|||||||
|
|
||||||
private boolean pref_cacheDownloaded;
|
private boolean pref_cacheDownloaded;
|
||||||
private boolean pref_expert;
|
private boolean pref_expert;
|
||||||
private boolean viewResetRequired;
|
private boolean resetRequired;
|
||||||
|
|
||||||
// The signature of the installed version.
|
// The signature of the installed version.
|
||||||
private Signature mInstalledSignature;
|
private Signature mInstalledSignature;
|
||||||
@ -211,19 +213,18 @@ public class AppDetails extends ListActivity {
|
|||||||
if (old != null) {
|
if (old != null) {
|
||||||
copyState(old);
|
copyState(old);
|
||||||
} else {
|
} else {
|
||||||
viewResetRequired = true;
|
resetRequired = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (viewResetRequired) {
|
if (resetRequired) {
|
||||||
reset();
|
reset();
|
||||||
viewResetRequired = false;
|
resetRequired = false;
|
||||||
} else {
|
|
||||||
resetViews();
|
|
||||||
}
|
}
|
||||||
|
resetViews();
|
||||||
if (downloadHandler != null) {
|
if (downloadHandler != null) {
|
||||||
downloadHandler.startUpdates();
|
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...
|
// 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() {
|
|
||||||
// Set the icon...
|
// Set the icon...
|
||||||
ImageView iv = (ImageView) findViewById(R.id.icon);
|
ImageView iv = (ImageView) findViewById(R.id.icon);
|
||||||
File icon = new File(DB.getIconsPath(), app.icon);
|
File icon = new File(DB.getIconsPath(), app.icon);
|
||||||
@ -353,9 +371,9 @@ public class AppDetails extends ListActivity {
|
|||||||
else
|
else
|
||||||
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.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
|
// Need this to add the unimplemented support for ordered and unordered
|
||||||
// lists to Html.fromHtml().
|
// lists to Html.fromHtml().
|
||||||
class HtmlTagHandler implements TagHandler {
|
class HtmlTagHandler implements TagHandler {
|
||||||
@ -386,30 +404,25 @@ public class AppDetails extends ListActivity {
|
|||||||
tv.setText(Html.fromHtml(app.detail_description, null,
|
tv.setText(Html.fromHtml(app.detail_description, null,
|
||||||
new HtmlTagHandler()));
|
new HtmlTagHandler()));
|
||||||
|
|
||||||
tv = (TextView) findViewById(R.id.summary);
|
tv = (TextView) infoView.findViewById(R.id.summary);
|
||||||
if (tv != null) {
|
tv.setText(app.summary);
|
||||||
tv.setText(app.summary);
|
|
||||||
|
tv = (TextView) infoView.findViewById(R.id.appid);
|
||||||
|
if (pref_expert) {
|
||||||
|
tv.setVisibility(View.VISIBLE);
|
||||||
|
tv.setText(app.id);
|
||||||
|
} else {
|
||||||
|
tv.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tv != null) {
|
tv = (TextView) infoView.findViewById(R.id.signature);
|
||||||
tv = (TextView) findViewById(R.id.appid);
|
if (pref_expert && mInstalledSignature != null) {
|
||||||
if (pref_expert) {
|
tv.setVisibility(View.VISIBLE);
|
||||||
tv.setVisibility(View.VISIBLE);
|
tv.setText("Signed: " + mInstalledSigID);
|
||||||
tv.setText(app.id);
|
} else {
|
||||||
} else {
|
tv.setVisibility(View.GONE);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -700,10 +713,10 @@ public class AppDetails extends ListActivity {
|
|||||||
downloadHandler.cleanUp();
|
downloadHandler.cleanUp();
|
||||||
downloadHandler = null;
|
downloadHandler = null;
|
||||||
}
|
}
|
||||||
viewResetRequired = true;
|
resetRequired = true;
|
||||||
break;
|
break;
|
||||||
case REQUEST_UNINSTALL:
|
case REQUEST_UNINSTALL:
|
||||||
viewResetRequired = true;
|
resetRequired = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user