Skip to content

Commit

Permalink
Put su binary version in its own block on the preference screen.
Browse files Browse the repository at this point in the history
Also assigned a click listener to check for updates. I had to remove some strings from other localizations because the meanings changed.
  • Loading branch information
ChainsDD committed Aug 22, 2010
1 parent 7b30cb5 commit e1171db
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 12 deletions.
3 changes: 1 addition & 2 deletions res/values-da/strings.xml
Expand Up @@ -56,7 +56,6 @@
<string name="pref_notification_summary">Måden hvorpå der meddeles, når et program får superbruger tilladelse</string>
<string name="pref_category_info_title">Superbruger information</string>
<string name="pref_version_title">Superbruger v%s</string>
<string name="pref_version_summary">su v%s</string>


<string name="notification_text">%s er blevet tildelt Superbruger tilladelser</string>
</resources>
2 changes: 1 addition & 1 deletion res/values-de/strings.xml
Expand Up @@ -63,7 +63,7 @@
<string name="pref_notification_title">Benachrichtigungstyp</string>
<string name="pref_notification_summary">Art der Benachrichtigung, wenn einer App su-Rechte gewährt wurden</string>
<string name="pref_category_info_title">Superuser Information</string>
<string name="pref_version_summary">su v%s, Datenbank-Version %s</string>
<string name="pref_version_summary">Datenbank-Version %s</string>

<string name="notification_text">%s wurden su-Rechte gewährt</string>
</resources>
2 changes: 1 addition & 1 deletion res/values-it/strings.xml
Expand Up @@ -61,7 +61,7 @@
<string name="pref_notification_summary">Scegli come vuoi che ti venga notificato quando un\'app ottiene i permessi di root </string>
<string name="pref_category_info_title">Informazioni Superuser</string>
<string name="pref_version_title">Superuser v%s</string>
<string name="pref_version_summary">su v%s, Versione Database %s</string>
<string name="pref_version_summary">Versione Database %s</string>

<string name="notification_text">%s ha ottenuto i permessi di root</string>
</resources>
1 change: 0 additions & 1 deletion res/values-pt-rBR/strings.xml
Expand Up @@ -56,7 +56,6 @@
<string name="pref_notification_summary">Tipo de notificação quando um aplicativo receber as permissões SU</string>
<string name="pref_category_info_title">Informação do Superuser</string>
<string name="pref_version_title">Superuser v%s</string>
<string name="pref_version_summary">su v%s</string>

<string name="notification_text">%s recebeu as permissões de Superuser</string>
</resources>
2 changes: 1 addition & 1 deletion res/values-ru/strings.xml
Expand Up @@ -60,7 +60,7 @@
<string name="pref_notification_summary">Тип уведомления, показываемый когда приложению предоставлены права Суперпользователя</string>
<string name="pref_category_info_title">Информация о приложении</string>
<string name="pref_version_title">Суперпользователь v%s</string>
<string name="pref_version_summary">su v%s, Версия БД %s</string>
<string name="pref_version_summary">Версия БД %s</string>

<string name="notification_text">Приложению %s были предоставлены права Суперпользователя</string>
</resources>
7 changes: 5 additions & 2 deletions res/values/strings.xml
Expand Up @@ -4,7 +4,6 @@
<string name="app_name_request">Superuser Request</string>

<!-- Do not translate -->
<string name="expected_su_version">2.3.1</string>
<string name="update_filename">su-2.3.1-bin-signed.zip</string>

<string name="permlab_respond">respond to superuser requests</string>
Expand All @@ -15,6 +14,8 @@
<string name="su_updated">su binary updated successfully</string>
<string name="su_not_updated_title">Automatic update failed</string>
<string name="su_not_updated">An error occurred and su was not updated. A zip file (su-2.3.1-bin-signed.zip) has been placed on your sdcard, please reboot into recovery mode and flash it to update your su binary.</string>
<string name="su_up_to_date">su is up to date</string>
<string name="checking">Checking...</string>

<string name="tab_apps">Apps</string>
<string name="tab_log">Log</string>
Expand Down Expand Up @@ -70,7 +71,9 @@
<string name="pref_notification_summary">Type of notification to show when an app is granted SU permissions</string>
<string name="pref_category_info_title">Superuser information</string>
<string name="pref_version_title">Superuser v%s</string>
<string name="pref_version_summary">su v%s, Database version %s</string>
<string name="pref_version_summary">Database version %s</string>
<string name="pref_bin_version_title">su binary v%s</string>
<string name="pref_bin_version_summary">Tap to check for updates</string>

<string name="notification_text">%s has been granted Superuser permissions</string>
</resources>
5 changes: 5 additions & 0 deletions res/xml/preferences.xml
Expand Up @@ -76,6 +76,11 @@
android:key="pref_version"
android:title="@string/pref_version_title"
android:summary="@string/pref_version_summary" />

<Preference
android:key="pref_bin_version"
android:title="@string/pref_bin_version_title"
android:summary="@string/pref_bin_version_summary" />

</PreferenceCategory>
</PreferenceScreen>
25 changes: 21 additions & 4 deletions src/com/noshufou/android/su/SuPreferences.java
Expand Up @@ -8,20 +8,26 @@
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.Preference.OnPreferenceClickListener;
import android.widget.Toast;

public class SuPreferences extends PreferenceActivity implements OnSharedPreferenceChangeListener {
public class SuPreferences extends PreferenceActivity implements OnSharedPreferenceChangeListener,
OnPreferenceClickListener {
// private static final String TAG = "Su.SuPreferences";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);

Preference versionPreference = (Preference)getPreferenceScreen().findPreference("pref_version");
Preference versionPreference = getPreferenceScreen().findPreference("pref_version");
versionPreference.setTitle(getString(R.string.pref_version_title, getSuperuserVersion()));
DBHelper db = new DBHelper(this);
versionPreference.setSummary(getString(R.string.pref_version_summary, Su.getSuVersion(), db.getDBVersion()));
versionPreference.setSummary(getString(R.string.pref_version_summary, db.getDBVersion()));
db.close();
Preference binVersionPreference = getPreferenceScreen().findPreference("pref_bin_version");
binVersionPreference.setTitle(getString(R.string.pref_bin_version_title, Su.getSuVersion()));
binVersionPreference.setOnPreferenceClickListener(this);
}

@Override
Expand All @@ -46,7 +52,18 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
}
}

private String getSuperuserVersion()
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference.getKey().equals("pref_bin_version")) {
Toast.makeText(this, R.string.checking, Toast.LENGTH_SHORT).show();
new Updater(this, Su.getSuVersion()).doUpdate();
return true;
} else {
return false;
}
}

private String getSuperuserVersion()
{
String versionName = "";

Expand Down

0 comments on commit e1171db

Please sign in to comment.