Fix references to resources for Settings

Bug: 293810334
Test: m Settings
Change-Id: Ie140278f492ef7e1c062ec1ecae2866c521a86aa
This commit is contained in:
Chaohui Wang
2023-07-31 15:56:42 +08:00
parent ed505c25fa
commit 2541381259
247 changed files with 859 additions and 721 deletions

View File

@@ -83,7 +83,8 @@ public class BlobInfoListView extends ListActivity {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SharedDataUtils.LEASE_VIEW_REQUEST_CODE
&& resultCode == SharedDataUtils.LEASE_VIEW_RESULT_CODE_FAILURE) {
Toast.makeText(this, R.string.shared_data_delete_failure_text, Toast.LENGTH_LONG)
Toast.makeText(this, com.android.settingslib.R.string.shared_data_delete_failure_text,
Toast.LENGTH_LONG)
.show();
}
// do nothing on LEASE_VIEW_RESULT_CODE_SUCCESS since data is updated in onResume()
@@ -103,7 +104,7 @@ public class BlobInfoListView extends ListActivity {
private void showDeleteBlobDialog(BlobInfo blob) {
final AlertDialog dialog = new AlertDialog.Builder(mContext)
.setMessage(R.string.shared_data_no_accessors_dialog_text)
.setMessage(com.android.settingslib.R.string.shared_data_no_accessors_dialog_text)
.setPositiveButton(android.R.string.ok, getDialogOnClickListener(blob))
.setNegativeButton(android.R.string.cancel, null)
.create();
@@ -116,7 +117,9 @@ public class BlobInfoListView extends ListActivity {
mBlobStoreManager.deleteBlob(blob);
} catch (IOException e) {
Log.e(TAG, "Unable to delete blob: " + e.getMessage());
Toast.makeText(this, R.string.shared_data_delete_failure_text, Toast.LENGTH_LONG)
Toast.makeText(this,
com.android.settingslib.R.string.shared_data_delete_failure_text,
Toast.LENGTH_LONG)
.show();
}
queryBlobsAndUpdateList();
@@ -128,7 +131,8 @@ public class BlobInfoListView extends ListActivity {
mAdapter.updateList(mBlobStoreManager.queryBlobsForUser(UserHandle.CURRENT));
} catch (IOException e) {
Log.e(TAG, "Unable to fetch blobs for current user: " + e.getMessage());
Toast.makeText(this, R.string.shared_data_query_failure_text, Toast.LENGTH_LONG).show();
Toast.makeText(this, com.android.settingslib.R.string.shared_data_query_failure_text,
Toast.LENGTH_LONG).show();
finish();
}
}
@@ -155,7 +159,8 @@ public class BlobInfoListView extends ListActivity {
final BlobInfo blob = getItem(position);
holder.blobLabel.setText(blob.getLabel());
holder.blobId.setText(getString(R.string.blob_id_text, blob.getId()));
holder.blobId.setText(
getString(com.android.settingslib.R.string.blob_id_text, blob.getId()));
holder.blobExpiry.setText(formatExpiryTime(blob.getExpiryTimeMs()));
holder.blobSize.setText(SharedDataUtils.formatSize(blob.getSizeBytes()));
return convertView;
@@ -165,7 +170,8 @@ public class BlobInfoListView extends ListActivity {
if (expiryTimeMs == 0) {
return getString(R.string.blob_never_expires_text);
}
return getString(R.string.blob_expires_text, SharedDataUtils.formatTime(expiryTimeMs));
return getString(com.android.settingslib.R.string.blob_expires_text,
SharedDataUtils.formatTime(expiryTimeMs));
}
}
}

View File

@@ -100,7 +100,7 @@ public class LeaseInfoListView extends ListActivity {
blobLabel.setText(mBlobInfo.getLabel());
blobLabel.setTypeface(Typeface.DEFAULT_BOLD);
blobId.setText(getString(R.string.blob_id_text, mBlobInfo.getId()));
blobId.setText(getString(com.android.settingslib.R.string.blob_id_text, mBlobInfo.getId()));
blobExpiry.setVisibility(View.GONE);
blobSize.setText(SharedDataUtils.formatSize(mBlobInfo.getSizeBytes()));
return headerView;
@@ -110,7 +110,7 @@ public class LeaseInfoListView extends ListActivity {
final Button deleteButton = new Button(this);
deleteButton.setLayoutParams(
new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
deleteButton.setText(R.string.delete_blob_text);
deleteButton.setText(com.android.settingslib.R.string.delete_blob_text);
deleteButton.setOnClickListener(getButtonOnClickListener());
return deleteButton;
}
@@ -118,7 +118,7 @@ public class LeaseInfoListView extends ListActivity {
private View.OnClickListener getButtonOnClickListener() {
return v -> {
final AlertDialog dialog = new AlertDialog.Builder(mContext)
.setMessage(R.string.delete_blob_confirmation_text)
.setMessage(com.android.settingslib.R.string.delete_blob_confirmation_text)
.setPositiveButton(android.R.string.ok, getDialogOnClickListener())
.setNegativeButton(android.R.string.cancel, null)
.create();
@@ -185,7 +185,8 @@ public class LeaseInfoListView extends ListActivity {
}
} finally {
if (TextUtils.isEmpty(description)) {
description = getString(R.string.accessor_no_description_text);
description = getString(
com.android.settingslib.R.string.accessor_no_description_text);
}
}
return description;
@@ -195,7 +196,7 @@ public class LeaseInfoListView extends ListActivity {
if (expiryTimeMillis == 0) {
return getString(R.string.accessor_never_expires_text);
}
return getString(R.string.accessor_expires_text,
return getString(com.android.settingslib.R.string.accessor_expires_text,
SharedDataUtils.formatTime(expiryTimeMillis));
}
}

View File

@@ -23,7 +23,6 @@ import android.util.Log;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
@@ -52,12 +51,13 @@ public class SharedDataPreferenceController extends DeveloperOptionsPreferenceCo
final boolean showPref = mBlobStoreManager != null
&& !mBlobStoreManager.queryBlobsForUser(UserHandle.CURRENT).isEmpty();
preference.setEnabled(showPref);
preference.setSummary(showPref ? R.string.shared_data_summary
: R.string.shared_data_no_blobs_text);
preference.setSummary(
showPref ? com.android.settingslib.R.string.shared_data_summary
: com.android.settingslib.R.string.shared_data_no_blobs_text);
} catch (IOException e) {
Log.e(TAG, "Unable to fetch blobs for current user: " + e.getMessage());
preference.setEnabled(false);
preference.setSummary(R.string.shared_data_no_blobs_text);
preference.setSummary(com.android.settingslib.R.string.shared_data_no_blobs_text);
}
}
}