AppDetails Apk layout tweaks, show ABIs in expert mode

This commit is contained in:
Daniel Martí 2013-10-11 18:20:23 +02:00
parent 36ecacc021
commit 31afbe0423
2 changed files with 55 additions and 41 deletions

View File

@ -9,42 +9,47 @@
android:paddingLeft="2dp" android:paddingLeft="2dp"
android:paddingRight="2dp"> android:paddingRight="2dp">
<TextView android:id="@+id/buildtype"
android:textSize="12sp"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<TextView android:id="@+id/version" <TextView android:id="@+id/version"
android:textStyle="bold" android:textStyle="bold"
android:maxLines="2" android:maxLines="2"
android:ellipsize="end" android:ellipsize="end"
android:layout_width="fill_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toLeftOf="@id/buildtype"
android:textSize="18sp" /> android:textSize="18sp" />
<TextView android:id="@+id/size"
android:textSize="12sp"
android:layout_below="@id/version"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<TextView android:id="@+id/status" <TextView android:id="@+id/status"
android:textSize="12sp" android:textSize="12sp"
android:maxLines="2" android:maxLines="2"
android:ellipsize="end" android:ellipsize="end"
android:layout_below="@id/version" android:layout_below="@id/version"
android:layout_toLeftOf="@id/size"
android:layout_alignParentLeft="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" /> android:layout_width="wrap_content" />
<TextView android:id="@+id/added" <TextView android:id="@+id/added"
android:textSize="12sp" android:textSize="12sp"
android:layout_below="@id/status" android:layout_below="@id/status"
android:layout_alignParentLeft="true" android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<TextView android:id="@+id/buildtype"
android:textSize="12sp"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginBottom="4sp" />
<TextView android:id="@+id/size"
android:textSize="12sp"
android:layout_below="@id/buildtype"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginBottom="4sp" />
<TextView android:id="@+id/nativecode"
android:textSize="12sp"
android:layout_below="@id/size"
android:layout_alignParentRight="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" /> android:layout_width="wrap_content" />

View File

@ -113,49 +113,58 @@ public class AppDetails extends ListActivity {
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
java.text.DateFormat df = DateFormat.getDateFormat(mctx); java.text.DateFormat df = DateFormat.getDateFormat(mctx);
DB.Apk apk = items.get(position);
View v = convertView; View v = convertView;
if (v == null) { if (v == null) {
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.apklistitem, null); v = vi.inflate(R.layout.apklistitem, null);
} }
DB.Apk apk = items.get(position); v.setEnabled(apk.compatible);
TextView version = (TextView) v.findViewById(R.id.version);
boolean iscurrent = apk.vercode == app_currentvercode;
version.setText(getString(R.string.version) + " " + apk.version
+ (iscurrent ? " *" : ""));
TextView status = (TextView) v.findViewById(R.id.status); TextView tv = (TextView) v.findViewById(R.id.version);
boolean iscurrent = apk.vercode == app_currentvercode;
tv.setText(getString(R.string.version) + " " + apk.version
+ (iscurrent ? " *" : ""));
tv.setEnabled(apk.compatible);
tv = (TextView) v.findViewById(R.id.status);
if (apk.vercode == app.installedVerCode if (apk.vercode == app.installedVerCode
&& apk.sig.equals(mInstalledSigID)) && apk.sig.equals(mInstalledSigID))
status.setText(getString(R.string.inst)); tv.setText(getString(R.string.inst));
else else
status.setText(getString(R.string.not_inst)); tv.setText(getString(R.string.not_inst));
tv.setEnabled(apk.compatible);
TextView size = (TextView) v.findViewById(R.id.size); tv = (TextView) v.findViewById(R.id.size);
if (apk.detail_size == 0) { if (apk.detail_size == 0) {
size.setText(""); tv.setText("");
} else { } else {
size.setText(Utils.getFriendlySize(apk.detail_size)); tv.setText(Utils.getFriendlySize(apk.detail_size));
tv.setEnabled(apk.compatible);
} }
TextView buildtype = (TextView) v.findViewById(R.id.buildtype); tv = (TextView) v.findViewById(R.id.buildtype);
if (apk.srcname != null) { if (apk.srcname != null) {
buildtype.setText("source"); tv.setText("source");
} else { } else {
buildtype.setText("bin"); tv.setText("bin");
} }
TextView added = (TextView) v.findViewById(R.id.added); tv.setEnabled(apk.compatible);
tv = (TextView) v.findViewById(R.id.added);
if (apk.added != null) { if (apk.added != null) {
added.setVisibility(View.VISIBLE); tv.setVisibility(View.VISIBLE);
added.setText(getString(R.string.added_on, df.format(apk.added))); tv.setText(getString(R.string.added_on, df.format(apk.added)));
tv.setEnabled(apk.compatible);
} else { } else {
added.setVisibility(View.GONE); tv.setVisibility(View.GONE);
} }
tv = (TextView) v.findViewById(R.id.nativecode);
// Disable it all if it isn't compatible... if (pref_expert && apk.nativecode != null) {
View[] views = { v, version, status, size, buildtype, added }; tv.setVisibility(View.VISIBLE);
for (View view : views) { tv.setText(apk.nativecode.toString().replaceAll(","," "));
view.setEnabled(apk.compatible); tv.setEnabled(apk.compatible);
} else {
tv.setVisibility(View.GONE);
} }
return v; return v;