packages/apps/Superuser
リビジョン | 17113ea29a0a57ddc4ab5b060751e792a99f7404 (tree) |
---|---|
日時 | 2011-11-21 01:30:04 |
作者 | Adam Shanks <chainsdd@gmai...> |
コミッター | Adam Shanks |
Show a toast if only preferences are restored
@@ -150,6 +150,7 @@ | ||
150 | 150 | <item quantity="one">One app and preferences restored</item> |
151 | 151 | <item quantity="other">%1$d apps and preferences restored</item> |
152 | 152 | </plurals> |
153 | + <string name="restore_complete_prefs_only">Preferences restored</string> | |
153 | 154 | <string name="pref_category_info_title">General</string> |
154 | 155 | <string name="pref_version_title">Superuser v%1$s (%2$d)</string> |
155 | 156 | <string name="pref_version_summary">Database version %s</string> |
@@ -464,8 +464,11 @@ public class PreferencesActivity extends PreferenceActivity implements OnClickLi | ||
464 | 464 | protected void onPostExecute(Integer result) { |
465 | 465 | ((ProgressBar)findViewById(R.id.title_refresh_progress)).setVisibility(View.GONE); |
466 | 466 | if (result > -1) { |
467 | + String message = result > 0 ? | |
468 | + getResources().getQuantityString(R.plurals.restore_complete, result, result): | |
469 | + getString(R.string.restore_complete_prefs_only); | |
467 | 470 | Toast.makeText(getApplicationContext(), |
468 | - getResources().getQuantityString(R.plurals.restore_complete, result, result), | |
471 | + message, | |
469 | 472 | Toast.LENGTH_SHORT).show(); |
470 | 473 | Intent intent = getIntent(); |
471 | 474 | finish(); |
@@ -146,7 +146,7 @@ public class BackupUtil { | ||
146 | 146 | public static int restoreBackup(Context context) { |
147 | 147 | XmlPullParser parser = Xml.newPullParser(); |
148 | 148 | FileInputStream file = null; |
149 | - int appsRestored = -1; | |
149 | + int appsRestored = 0; | |
150 | 150 | try { |
151 | 151 | file = new FileInputStream( |
152 | 152 | new File(Environment.getExternalStorageDirectory().getAbsolutePath() |
@@ -174,7 +174,7 @@ public class BackupUtil { | ||
174 | 174 | Log.e(TAG, "Error restoring backup", e); |
175 | 175 | return -1; |
176 | 176 | } |
177 | - return appsRestored; | |
177 | + return appsRestored; | |
178 | 178 | } |
179 | 179 | |
180 | 180 | private static int restoreApps(Context context, XmlPullParser parser) |