Support minSdk info in version list views
This commit is contained in:
parent
ab6f41ec68
commit
50f68d34b9
@ -47,7 +47,7 @@
|
||||
android:textSize="13sp"
|
||||
android:layout_below="@id/buildtype"
|
||||
android:layout_toLeftOf="@id/size"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="12sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" />
|
||||
|
||||
|
@ -163,5 +163,6 @@
|
||||
<string name="compactlayout_on">Show icons at a smaller size</string>
|
||||
<string name="compactlayout_off">Show icons at regular size</string>
|
||||
<string name="theme">Theme</string>
|
||||
<string name="minsdk_or_later">%s or later</string>
|
||||
|
||||
</resources>
|
||||
|
@ -140,10 +140,11 @@ public class AppDetails extends ListActivity {
|
||||
|
||||
tv = (TextView) v.findViewById(R.id.status);
|
||||
if (apk.vercode == app.installedVerCode
|
||||
&& apk.sig.equals(mInstalledSigID))
|
||||
&& apk.sig.equals(mInstalledSigID)) {
|
||||
tv.setText(getString(R.string.inst));
|
||||
else
|
||||
} else {
|
||||
tv.setText(getString(R.string.not_inst));
|
||||
}
|
||||
tv.setEnabled(apk.compatible);
|
||||
|
||||
tv = (TextView) v.findViewById(R.id.size);
|
||||
@ -153,6 +154,16 @@ public class AppDetails extends ListActivity {
|
||||
tv.setText(Utils.getFriendlySize(apk.detail_size));
|
||||
tv.setEnabled(apk.compatible);
|
||||
}
|
||||
|
||||
tv = (TextView) v.findViewById(R.id.api);
|
||||
if (apk.minSdkVersion == 0) {
|
||||
tv.setText("");
|
||||
} else {
|
||||
tv.setText(getString(R.string.minsdk_or_later,
|
||||
Utils.getAndroidVersionName(apk.minSdkVersion)));
|
||||
tv.setEnabled(apk.compatible);
|
||||
}
|
||||
|
||||
tv = (TextView) v.findViewById(R.id.buildtype);
|
||||
if (apk.srcname != null) {
|
||||
tv.setText("source");
|
||||
@ -160,6 +171,7 @@ public class AppDetails extends ListActivity {
|
||||
tv.setText("bin");
|
||||
}
|
||||
tv.setEnabled(apk.compatible);
|
||||
|
||||
tv = (TextView) v.findViewById(R.id.added);
|
||||
if (apk.added != null) {
|
||||
tv.setVisibility(View.VISIBLE);
|
||||
@ -168,6 +180,7 @@ public class AppDetails extends ListActivity {
|
||||
} else {
|
||||
tv.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
tv = (TextView) v.findViewById(R.id.nativecode);
|
||||
if (pref_expert && apk.nativecode != null) {
|
||||
tv.setVisibility(View.VISIBLE);
|
||||
@ -457,26 +470,6 @@ public class AppDetails extends ListActivity {
|
||||
|
||||
tv = (TextView) infoView.findViewById(R.id.description);
|
||||
|
||||
/*
|
||||
The following is a quick solution to enable both text selection and
|
||||
links. Causes glitches and crashes:
|
||||
java.lang.IndexOutOfBoundsException: setSpan (-1 ... -1) starts before 0
|
||||
|
||||
class CustomMovementMethod extends LinkMovementMethod {
|
||||
@Override
|
||||
public boolean canSelectArbitrarily () {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Utils.hasApi(11)) {
|
||||
tv.setTextIsSelectable(true);
|
||||
tv.setMovementMethod(new CustomMovementMethod());
|
||||
} else {
|
||||
tv.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
*/
|
||||
|
||||
tv.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
// Need this to add the unimplemented support for ordered and unordered
|
||||
|
@ -81,6 +81,31 @@ public final class Utils {
|
||||
return String.format(FRIENDLY_SIZE_FORMAT[i], s);
|
||||
}
|
||||
|
||||
public static String getAndroidVersionName(int sdkLevel) {
|
||||
switch (sdkLevel) {
|
||||
case 19: return "4.4";
|
||||
case 18: return "4.3";
|
||||
case 17: return "4.2";
|
||||
case 16: return "4.1";
|
||||
case 15: return "4.0.3";
|
||||
case 14: return "4.0";
|
||||
case 13: return "3.2";
|
||||
case 12: return "3.1";
|
||||
case 11: return "3.0";
|
||||
case 10: return "2.3.3";
|
||||
case 9: return "2.3";
|
||||
case 8: return "2.2";
|
||||
case 7: return "2.1";
|
||||
case 6: return "2.0.1";
|
||||
case 5: return "2.0";
|
||||
case 4: return "1.6";
|
||||
case 3: return "1.5";
|
||||
case 2: return "1.1";
|
||||
case 1: return "1.0";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
public static int countSubstringOccurrence(File file, String substring) throws IOException {
|
||||
int count = 0;
|
||||
BufferedReader reader = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user