1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Updated Debug screen to pull version number from the package info.

Fixed "loading more messages" to use the cleaner String.format way of doing things, and changed the corresponding entries in strings.xml.
Deleted the now-unused build_number.xml file.
This commit is contained in:
Brock Tice 2009-01-07 05:20:03 +00:00
parent 0ac17da6cd
commit efb2801bab
4 changed files with 25 additions and 12 deletions

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="build_number">279</string>
</resources>

View File

@ -71,8 +71,8 @@
<string name="status_sending">Sending\u2026</string> <!-- Used in Outbox when a message is currently sending -->
<string name="status_loading_more_failed">Retry loading more messages</string>
<string name="load_more_before_number">Load up to\u0020</string>
<string name="load_more_after_number">\u0020more</string>
<string name="load_more_messages_fmt">Load up
to <xliff:g id="messages_to_load">%d</xliff:g> more</string>
<string name="notification_new_title">New email</string>
<string name="notification_new_scrolling">New email from <xliff:g id="sender">%s</xliff:g></string>

View File

@ -2,7 +2,10 @@
package com.android.email.activity;
import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.CheckBox;
@ -14,6 +17,8 @@ import com.android.email.Email;
import com.android.email.Preferences;
import com.android.email.R;
import java.lang.Integer;
public class Debug extends Activity implements OnCheckedChangeListener {
private TextView mVersionView;
private CheckBox mEnableDebugLoggingView;
@ -35,9 +40,8 @@ public class Debug extends Activity implements OnCheckedChangeListener {
mEnableDebugLoggingView.setOnCheckedChangeListener(this);
mEnableSensitiveLoggingView.setOnCheckedChangeListener(this);
mVersionView.setText(String.format(getString(R.string.debug_version_fmt).toString(),
getString(R.string.build_number)));
mVersionView.setText(String.format(getString(R.string.debug_version_fmt).toString(), getVersionNumber()));
mEnableDebugLoggingView.setChecked(Email.DEBUG);
mEnableSensitiveLoggingView.setChecked(Email.DEBUG_SENSITIVE);
@ -70,4 +74,18 @@ public class Debug extends Activity implements OnCheckedChangeListener {
return true;
}
private String getVersionNumber() {
String version = "?";
int vnum;
try {
PackageInfo pi =
getPackageManager().getPackageInfo(getPackageName(), 0);
version = Integer.toString(pi.versionCode);
} catch (PackageManager.NameNotFoundException e){
Log.e(Email.LOG_TAG, "Package name not found: " + e.getMessage());
};
return version;
}
}

View File

@ -1635,9 +1635,8 @@ public class FolderMessageList extends ExpandableListActivity
{
if (folder.lastCheckFailed == false)
{
holder.main.setText(getString(R.string.load_more_before_number)
+ mAccount.getDisplayCount()
+ getString(R.string.load_more_after_number));
holder.main.setText(String.format(getString(R.string.load_more_messages_fmt).toString(),
mAccount.getDisplayCount()));
} else
{
holder.main.setText(getString(R.string.status_loading_more_failed));