Fix string resources naming convention

This commit is contained in:
agnostic-apollo
2021-03-24 06:15:45 +05:00
parent 4eced52c5f
commit eeb8554535
15 changed files with 149 additions and 114 deletions

View File

@@ -15,9 +15,9 @@
<permission <permission
android:name="${TERMUX_PACKAGE_NAME}.permission.RUN_COMMAND" android:name="${TERMUX_PACKAGE_NAME}.permission.RUN_COMMAND"
android:description="@string/run_command_permission_description" android:description="@string/permission_run_command_description"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/run_command_permission_label" android:label="@string/permission_run_command_label"
android:protectionLevel="dangerous" /> android:protectionLevel="dangerous" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

View File

@@ -186,13 +186,13 @@ public class RunCommandService extends Service {
runStartForeground(); runStartForeground();
ExecutionCommand executionCommand = new ExecutionCommand(); ExecutionCommand executionCommand = new ExecutionCommand();
executionCommand.pluginAPIHelp = this.getString(R.string.run_command_service_api_help); executionCommand.pluginAPIHelp = this.getString(R.string.error_run_command_service_api_help);
String errmsg; String errmsg;
// If invalid action passed, then just return // If invalid action passed, then just return
if (!RUN_COMMAND_SERVICE.ACTION_RUN_COMMAND.equals(intent.getAction())) { if (!RUN_COMMAND_SERVICE.ACTION_RUN_COMMAND.equals(intent.getAction())) {
errmsg = this.getString(R.string.run_command_service_invalid_action, intent.getAction()); errmsg = this.getString(R.string.error_run_command_service_invalid_intent_action, intent.getAction());
executionCommand.setStateFailed(1, errmsg, null); executionCommand.setStateFailed(1, errmsg, null);
PluginUtils.processPluginExecutionCommandError(this, LOG_TAG, executionCommand); PluginUtils.processPluginExecutionCommandError(this, LOG_TAG, executionCommand);
return Service.START_NOT_STICKY; return Service.START_NOT_STICKY;
@@ -227,7 +227,7 @@ public class RunCommandService extends Service {
null, PluginUtils.PLUGIN_EXECUTABLE_FILE_PERMISSIONS, null, PluginUtils.PLUGIN_EXECUTABLE_FILE_PERMISSIONS,
false, false); false, false);
if (errmsg != null) { if (errmsg != null) {
errmsg += "\n" + this.getString(R.string.executable_absolute_path, executionCommand.executable); errmsg += "\n" + this.getString(R.string.msg_executable_absolute_path, executionCommand.executable);
executionCommand.setStateFailed(1, errmsg, null); executionCommand.setStateFailed(1, errmsg, null);
PluginUtils.processPluginExecutionCommandError(this, LOG_TAG, executionCommand); PluginUtils.processPluginExecutionCommandError(this, LOG_TAG, executionCommand);
return Service.START_NOT_STICKY; return Service.START_NOT_STICKY;
@@ -248,7 +248,7 @@ public class RunCommandService extends Service {
true, true, false, true, true, false,
true); true);
if (errmsg != null) { if (errmsg != null) {
errmsg += "\n" + this.getString(R.string.working_directory_absolute_path, executionCommand.workingDirectory); errmsg += "\n" + this.getString(R.string.msg_working_directory_absolute_path, executionCommand.workingDirectory);
executionCommand.setStateFailed(1, errmsg, null); executionCommand.setStateFailed(1, errmsg, null);
PluginUtils.processPluginExecutionCommandError(this, LOG_TAG, executionCommand); PluginUtils.processPluginExecutionCommandError(this, LOG_TAG, executionCommand);
return Service.START_NOT_STICKY; return Service.START_NOT_STICKY;

View File

@@ -395,8 +395,8 @@ public final class TermuxActivity extends Activity implements ServiceConnection
View newSessionButton = findViewById(R.id.new_session_button); View newSessionButton = findViewById(R.id.new_session_button);
newSessionButton.setOnClickListener(v -> mTermuxSessionClient.addNewSession(false, null)); newSessionButton.setOnClickListener(v -> mTermuxSessionClient.addNewSession(false, null));
newSessionButton.setOnLongClickListener(v -> { newSessionButton.setOnLongClickListener(v -> {
DialogUtils.textInput(TermuxActivity.this, R.string.session_new_named_title, null, R.string.session_new_named_positive_button, DialogUtils.textInput(TermuxActivity.this, R.string.title_create_named_session, null, R.string.action_create_named_session_confirm,
text -> mTermuxSessionClient.addNewSession(false, text), R.string.new_session_failsafe, text -> mTermuxSessionClient.addNewSession(true, text) text -> mTermuxSessionClient.addNewSession(false, text), R.string.action_new_session_failsafe, text -> mTermuxSessionClient.addNewSession(true, text)
, -1, null, null); , -1, null, null);
return true; return true;
}); });
@@ -489,15 +489,15 @@ public final class TermuxActivity extends Activity implements ServiceConnection
} }
} }
menu.add(Menu.NONE, CONTEXT_MENU_SELECT_URL_ID, Menu.NONE, R.string.select_url); menu.add(Menu.NONE, CONTEXT_MENU_SELECT_URL_ID, Menu.NONE, R.string.action_select_url);
menu.add(Menu.NONE, CONTEXT_MENU_SHARE_TRANSCRIPT_ID, Menu.NONE, R.string.select_all_and_share); menu.add(Menu.NONE, CONTEXT_MENU_SHARE_TRANSCRIPT_ID, Menu.NONE, R.string.action_share_transcript);
if (addAutoFillMenu) menu.add(Menu.NONE, CONTEXT_MENU_AUTOFILL_ID, Menu.NONE, R.string.autofill_password); if (addAutoFillMenu) menu.add(Menu.NONE, CONTEXT_MENU_AUTOFILL_ID, Menu.NONE, R.string.action_autofill_password);
menu.add(Menu.NONE, CONTEXT_MENU_RESET_TERMINAL_ID, Menu.NONE, R.string.reset_terminal); menu.add(Menu.NONE, CONTEXT_MENU_RESET_TERMINAL_ID, Menu.NONE, R.string.action_reset_terminal);
menu.add(Menu.NONE, CONTEXT_MENU_KILL_PROCESS_ID, Menu.NONE, getResources().getString(R.string.kill_process, getCurrentSession().getPid())).setEnabled(currentSession.isRunning()); menu.add(Menu.NONE, CONTEXT_MENU_KILL_PROCESS_ID, Menu.NONE, getResources().getString(R.string.action_kill_process, getCurrentSession().getPid())).setEnabled(currentSession.isRunning());
menu.add(Menu.NONE, CONTEXT_MENU_STYLING_ID, Menu.NONE, R.string.style_terminal); menu.add(Menu.NONE, CONTEXT_MENU_STYLING_ID, Menu.NONE, R.string.action_style_terminal);
menu.add(Menu.NONE, CONTEXT_MENU_TOGGLE_KEEP_SCREEN_ON, Menu.NONE, R.string.toggle_keep_screen_on).setCheckable(true).setChecked(mPreferences.getKeepScreenOn()); menu.add(Menu.NONE, CONTEXT_MENU_TOGGLE_KEEP_SCREEN_ON, Menu.NONE, R.string.action_toggle_keep_screen_on).setCheckable(true).setChecked(mPreferences.getKeepScreenOn());
menu.add(Menu.NONE, CONTEXT_MENU_HELP_ID, Menu.NONE, R.string.help); menu.add(Menu.NONE, CONTEXT_MENU_HELP_ID, Menu.NONE, R.string.action_open_help);
menu.add(Menu.NONE, CONTEXT_MENU_SETTINGS_ID, Menu.NONE, R.string.settings); menu.add(Menu.NONE, CONTEXT_MENU_SETTINGS_ID, Menu.NONE, R.string.action_open_settings);
} }
/** Hook system menu to show context menu instead. */ /** Hook system menu to show context menu instead. */
@@ -552,7 +552,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection
final AlertDialog.Builder b = new AlertDialog.Builder(this); final AlertDialog.Builder b = new AlertDialog.Builder(this);
b.setIcon(android.R.drawable.ic_dialog_alert); b.setIcon(android.R.drawable.ic_dialog_alert);
b.setMessage(R.string.confirm_kill_process); b.setMessage(R.string.title_confirm_kill_process);
b.setPositiveButton(android.R.string.yes, (dialog, id) -> { b.setPositiveButton(android.R.string.yes, (dialog, id) -> {
dialog.dismiss(); dialog.dismiss();
session.finishIfRunning(); session.finishIfRunning();
@@ -564,7 +564,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection
private void resetSession(TerminalSession session) { private void resetSession(TerminalSession session) {
if (session != null) { if (session != null) {
session.reset(); session.reset();
showToast(getResources().getString(R.string.reset_toast_notification), true); showToast(getResources().getString(R.string.msg_terminal_reset), true);
} }
} }
@@ -576,8 +576,8 @@ public final class TermuxActivity extends Activity implements ServiceConnection
} catch (ActivityNotFoundException | IllegalArgumentException e) { } catch (ActivityNotFoundException | IllegalArgumentException e) {
// The startActivity() call is not documented to throw IllegalArgumentException. // The startActivity() call is not documented to throw IllegalArgumentException.
// However, crash reporting shows that it sometimes does, so catch it here. // However, crash reporting shows that it sometimes does, so catch it here.
new AlertDialog.Builder(this).setMessage(getString(R.string.styling_not_installed)) new AlertDialog.Builder(this).setMessage(getString(R.string.error_styling_not_installed))
.setPositiveButton(R.string.styling_install, (dialog, which) -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://f-droid.org/en/packages/" + TermuxConstants.TERMUX_STYLING_PACKAGE_NAME + " /")))).setNegativeButton(android.R.string.cancel, null).show(); .setPositiveButton(R.string.action_styling_install, (dialog, which) -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://f-droid.org/en/packages/" + TermuxConstants.TERMUX_STYLING_PACKAGE_NAME + " /")))).setNegativeButton(android.R.string.cancel, null).show();
} }
} }
private void toggleKeepScreenOn() { private void toggleKeepScreenOn() {

View File

@@ -129,7 +129,7 @@ public class ReportActivity extends AppCompatActivity {
int id = item.getItemId(); int id = item.getItemId();
if (id == R.id.menu_item_share_report) { if (id == R.id.menu_item_share_report) {
if (mReportInfo != null) if (mReportInfo != null)
ShareUtils.shareText(this, getString(R.string.report_text), mReportInfo.reportString); ShareUtils.shareText(this, getString(R.string.title_report_text), mReportInfo.reportString);
} else if (id == R.id.menu_item_copy_report) { } else if (id == R.id.menu_item_copy_report) {
if (mReportInfo != null) if (mReportInfo != null)
ShareUtils.copyTextToClipboard(this, mReportInfo.reportString, null); ShareUtils.copyTextToClipboard(this, mReportInfo.reportString, null);

View File

@@ -176,7 +176,7 @@ public class TermuxSessionClient extends TermuxSessionClientBase {
public void renameSession(final TerminalSession sessionToRename) { public void renameSession(final TerminalSession sessionToRename) {
if (sessionToRename == null) return; if (sessionToRename == null) return;
DialogUtils.textInput(mActivity, R.string.session_rename_title, sessionToRename.mSessionName, R.string.session_rename_positive_button, text -> { DialogUtils.textInput(mActivity, R.string.title_rename_session, sessionToRename.mSessionName, R.string.action_rename_session_confirm, text -> {
sessionToRename.mSessionName = text; sessionToRename.mSessionName = text;
terminalSessionListNotifyUpdated(); terminalSessionListNotifyUpdated();
}, -1, null, -1, null, null); }, -1, null, -1, null, null);
@@ -184,7 +184,7 @@ public class TermuxSessionClient extends TermuxSessionClientBase {
public void addNewSession(boolean isFailSafe, String sessionName) { public void addNewSession(boolean isFailSafe, String sessionName) {
if (mActivity.getTermuxService().getSessions().size() >= MAX_SESSIONS) { if (mActivity.getTermuxService().getSessions().size() >= MAX_SESSIONS) {
new AlertDialog.Builder(mActivity).setTitle(R.string.max_terminals_reached_title).setMessage(R.string.max_terminals_reached_message) new AlertDialog.Builder(mActivity).setTitle(R.string.title_max_terminals_reached).setMessage(R.string.msg_max_terminals_reached)
.setPositiveButton(android.R.string.ok, null).show(); .setPositiveButton(android.R.string.ok, null).show();
} else { } else {
TerminalSession currentSession = mActivity.getCurrentSession(); TerminalSession currentSession = mActivity.getCurrentSession();

View File

@@ -346,8 +346,8 @@ public class TermuxViewClient implements TerminalViewClient {
intent.setType("text/plain"); intent.setType("text/plain");
transcriptText = TextDataUtils.getTruncatedCommandOutput(transcriptText, 100_000); transcriptText = TextDataUtils.getTruncatedCommandOutput(transcriptText, 100_000);
intent.putExtra(Intent.EXTRA_TEXT, transcriptText); intent.putExtra(Intent.EXTRA_TEXT, transcriptText);
intent.putExtra(Intent.EXTRA_SUBJECT, mActivity.getString(R.string.share_transcript_title)); intent.putExtra(Intent.EXTRA_SUBJECT, mActivity.getString(R.string.title_share_transcript));
mActivity.startActivity(Intent.createChooser(intent, mActivity.getString(R.string.share_transcript_chooser_title))); mActivity.startActivity(Intent.createChooser(intent, mActivity.getString(R.string.title_share_transcript_with)));
} catch (Exception e) { } catch (Exception e) {
Logger.logStackTraceWithMessage("Failed to get share session transcript of length " + transcriptText.length(), e); Logger.logStackTraceWithMessage("Failed to get share session transcript of length " + transcriptText.length(), e);
} }
@@ -361,7 +361,7 @@ public class TermuxViewClient implements TerminalViewClient {
LinkedHashSet<CharSequence> urlSet = TextDataUtils.extractUrls(text); LinkedHashSet<CharSequence> urlSet = TextDataUtils.extractUrls(text);
if (urlSet.isEmpty()) { if (urlSet.isEmpty()) {
new AlertDialog.Builder(mActivity).setMessage(R.string.select_url_no_found).show(); new AlertDialog.Builder(mActivity).setMessage(R.string.title_select_url_none_found).show();
return; return;
} }
@@ -373,8 +373,8 @@ public class TermuxViewClient implements TerminalViewClient {
String url = (String) urls[which]; String url = (String) urls[which];
ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setPrimaryClip(new ClipData(null, new String[]{"text/plain"}, new ClipData.Item(url))); clipboard.setPrimaryClip(new ClipData(null, new String[]{"text/plain"}, new ClipData.Item(url)));
Toast.makeText(mActivity, R.string.select_url_copied_to_clipboard, Toast.LENGTH_LONG).show(); Toast.makeText(mActivity, R.string.msg_select_url_copied_to_clipboard, Toast.LENGTH_LONG).show();
}).setTitle(R.string.select_url_dialog_title).create(); }).setTitle(R.string.title_select_url_dialog).create();
// Long press to open URL: // Long press to open URL:
dialog.setOnShowListener(di -> { dialog.setOnShowListener(di -> {

View File

@@ -156,14 +156,14 @@ public class FileUtils {
* failed, otherwise {@code null}. * failed, otherwise {@code null}.
*/ */
public static String validateRegularFileExistenceAndPermissions(final Context context, final String path, final String parentDirPath, String permissionsToCheck, final boolean setMissingPermissions, final boolean ignoreErrorsIfPathIsUnderParentDirPath) { public static String validateRegularFileExistenceAndPermissions(final Context context, final String path, final String parentDirPath, String permissionsToCheck, final boolean setMissingPermissions, final boolean ignoreErrorsIfPathIsUnderParentDirPath) {
if (path == null || path.isEmpty()) return context.getString(R.string.null_or_empty_file); if (path == null || path.isEmpty()) return context.getString(R.string.error_null_or_empty_file);
try { try {
File file = new File(path); File file = new File(path);
// If file exits but not a regular file // If file exits but not a regular file
if (file.exists() && !file.isFile()) { if (file.exists() && !file.isFile()) {
return context.getString(R.string.non_regular_file_found); return context.getString(R.string.error_non_regular_file_found);
} }
boolean isPathUnderParentDirPath = false; boolean isPathUnderParentDirPath = false;
@@ -183,7 +183,7 @@ public class FileUtils {
// If path is not a regular file // If path is not a regular file
// Regular files cannot be automatically created so we do not ignore if missing // Regular files cannot be automatically created so we do not ignore if missing
if (!file.isFile()) { if (!file.isFile()) {
return context.getString(R.string.no_regular_file_found); return context.getString(R.string.error_no_regular_file_found);
} }
// If there is not parentDirPath restriction or path is not under parentDirPath or // If there is not parentDirPath restriction or path is not under parentDirPath or
@@ -197,7 +197,7 @@ public class FileUtils {
} }
// Some function calls may throw SecurityException, etc // Some function calls may throw SecurityException, etc
catch (Exception e) { catch (Exception e) {
return context.getString(R.string.validate_file_existence_and_permissions_failed_with_exception, path, e.getMessage()); return context.getString(R.string.error_validate_file_existence_and_permissions_failed_with_exception, path, e.getMessage());
} }
return null; return null;
@@ -230,14 +230,14 @@ public class FileUtils {
* failed, otherwise {@code null}. * failed, otherwise {@code null}.
*/ */
public static String validateDirectoryExistenceAndPermissions(final Context context, final String path, final String parentDirPath, String permissionsToCheck, final boolean createDirectoryIfMissing, final boolean setMissingPermissions, final boolean ignoreErrorsIfPathIsInParentDirPath, final boolean ignoreIfNotExecutable) { public static String validateDirectoryExistenceAndPermissions(final Context context, final String path, final String parentDirPath, String permissionsToCheck, final boolean createDirectoryIfMissing, final boolean setMissingPermissions, final boolean ignoreErrorsIfPathIsInParentDirPath, final boolean ignoreIfNotExecutable) {
if (path == null || path.isEmpty()) return context.getString(R.string.null_or_empty_directory); if (path == null || path.isEmpty()) return context.getString(R.string.error_null_or_empty_directory);
try { try {
File file = new File(path); File file = new File(path);
// If file exits but not a directory file // If file exits but not a directory file
if (file.exists() && !file.isDirectory()) { if (file.exists() && !file.isDirectory()) {
return context.getString(R.string.non_directory_file_found); return context.getString(R.string.error_non_directory_file_found);
} }
boolean isPathInParentDirPath = false; boolean isPathInParentDirPath = false;
@@ -254,7 +254,7 @@ public class FileUtils {
Logger.logVerbose(LOG_TAG, "Creating missing directory at path: \"" + path + "\""); Logger.logVerbose(LOG_TAG, "Creating missing directory at path: \"" + path + "\"");
// If failed to create directory // If failed to create directory
if (!file.mkdirs()) { if (!file.mkdirs()) {
return context.getString(R.string.creating_missing_directory_failed, path); return context.getString(R.string.error_creating_missing_directory_failed, path);
} }
} }
@@ -271,7 +271,7 @@ public class FileUtils {
// If path is not a directory // If path is not a directory
// Directories can be automatically created so we can ignore if missing with above check // Directories can be automatically created so we can ignore if missing with above check
if (!file.isDirectory()) { if (!file.isDirectory()) {
return context.getString(R.string.no_directory_found); return context.getString(R.string.error_no_directory_found);
} }
if (permissionsToCheck != null) { if (permissionsToCheck != null) {
@@ -282,7 +282,7 @@ public class FileUtils {
} }
// Some function calls may throw SecurityException, etc // Some function calls may throw SecurityException, etc
catch (Exception e) { catch (Exception e) {
return context.getString(R.string.validate_directory_existence_and_permissions_failed_with_exception, path, e.getMessage()); return context.getString(R.string.error_validate_directory_existence_and_permissions_failed_with_exception, path, e.getMessage());
} }
return null; return null;
@@ -332,11 +332,11 @@ public class FileUtils {
* @return Returns the {@code errmsg} if validating permissions failed, otherwise {@code null}. * @return Returns the {@code errmsg} if validating permissions failed, otherwise {@code null}.
*/ */
public static String checkMissingFilePermissions(Context context, String path, String permissionsToCheck, String fileType, boolean ignoreIfNotExecutable) { public static String checkMissingFilePermissions(Context context, String path, String permissionsToCheck, String fileType, boolean ignoreIfNotExecutable) {
if (path == null || path.isEmpty()) return context.getString(R.string.null_or_empty_path); if (path == null || path.isEmpty()) return context.getString(R.string.error_null_or_empty_path);
if (!isValidPermissingString(permissionsToCheck)) { if (!isValidPermissingString(permissionsToCheck)) {
Logger.logError(LOG_TAG, "Invalid permissionsToCheck passed to checkMissingFilePermissions: \"" + permissionsToCheck + "\""); Logger.logError(LOG_TAG, "Invalid permissionsToCheck passed to checkMissingFilePermissions: \"" + permissionsToCheck + "\"");
return context.getString(R.string.invalid_file_permissions_string_to_check); return context.getString(R.string.error_invalid_file_permissions_string_to_check);
} }
if (fileType == null || fileType.isEmpty()) fileType = "File"; if (fileType == null || fileType.isEmpty()) fileType = "File";
@@ -345,17 +345,17 @@ public class FileUtils {
// If file is not readable // If file is not readable
if (permissionsToCheck.contains("r") && !file.canRead()) { if (permissionsToCheck.contains("r") && !file.canRead()) {
return context.getString(R.string.file_not_readable, fileType); return context.getString(R.string.error_file_not_readable, fileType);
} }
// If file is not writable // If file is not writable
if (permissionsToCheck.contains("w") && !file.canWrite()) { if (permissionsToCheck.contains("w") && !file.canWrite()) {
return context.getString(R.string.file_not_writable, fileType); return context.getString(R.string.error_file_not_writable, fileType);
} }
// If file is not executable // If file is not executable
// This canExecute() will give "avc: granted { execute }" warnings for target sdk 29 // This canExecute() will give "avc: granted { execute }" warnings for target sdk 29
else if (permissionsToCheck.contains("x") && !file.canExecute() && !ignoreIfNotExecutable) { else if (permissionsToCheck.contains("x") && !file.canExecute() && !ignoreIfNotExecutable) {
return context.getString(R.string.file_not_executable, fileType); return context.getString(R.string.error_file_not_executable, fileType);
} }
return null; return null;

View File

@@ -96,7 +96,7 @@ public class PluginUtils {
public static String checkIfRunCommandServiceAllowExternalAppsPolicyIsViolated(final Context context) { public static String checkIfRunCommandServiceAllowExternalAppsPolicyIsViolated(final Context context) {
String errmsg = null; String errmsg = null;
if (!SharedProperties.isPropertyValueTrue(context, TermuxPropertyConstants.getTermuxPropertiesFile(), TermuxConstants.PROP_ALLOW_EXTERNAL_APPS)) { if (!SharedProperties.isPropertyValueTrue(context, TermuxPropertyConstants.getTermuxPropertiesFile(), TermuxConstants.PROP_ALLOW_EXTERNAL_APPS)) {
errmsg = context.getString(R.string.run_command_service_allow_external_apps_ungranted_warning); errmsg = context.getString(R.string.error_run_command_service_allow_external_apps_ungranted);
} }
return errmsg; return errmsg;

View File

@@ -43,7 +43,7 @@ public class ShareUtils {
shareTextIntent.putExtra(Intent.EXTRA_SUBJECT, subject); shareTextIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
shareTextIntent.putExtra(Intent.EXTRA_TEXT, text); shareTextIntent.putExtra(Intent.EXTRA_TEXT, text);
openSystemAppChooser(context, shareTextIntent, context.getString(R.string.share_with)); openSystemAppChooser(context, shareTextIntent, context.getString(R.string.title_share_with));
} }
/** /**

View File

@@ -22,7 +22,7 @@ import java.util.LinkedList;
/** /**
* A document provider for the Storage Access Framework which exposes the files in the * A document provider for the Storage Access Framework which exposes the files in the
* $HOME/ folder to other apps. * $HOME/ directory to other apps.
* <p/> * <p/>
* Note that this replaces providing an activity matching the ACTION_GET_CONTENT intent: * Note that this replaces providing an activity matching the ACTION_GET_CONTENT intent:
* <p/> * <p/>
@@ -167,7 +167,7 @@ public class TermuxDocumentsProvider extends DocumentsProvider {
final int MAX_SEARCH_RESULTS = 50; final int MAX_SEARCH_RESULTS = 50;
while (!pending.isEmpty() && result.getCount() < MAX_SEARCH_RESULTS) { while (!pending.isEmpty() && result.getCount() < MAX_SEARCH_RESULTS) {
final File file = pending.removeFirst(); final File file = pending.removeFirst();
// Avoid folders outside the $HOME folders linked in to symlinks (to avoid e.g. search // Avoid directories outside the $HOME directory linked with symlinks (to avoid e.g. search
// through the whole SD card). // through the whole SD card).
boolean isInsideHome; boolean isInsideHome;
try { try {

View File

@@ -118,7 +118,7 @@ public class TermuxFileReceiverActivity extends Activity {
} }
void promptNameAndSave(final InputStream in, final String attachmentFileName) { void promptNameAndSave(final InputStream in, final String attachmentFileName) {
DialogUtils.textInput(this, R.string.file_received_title, attachmentFileName, R.string.file_received_edit_button, text -> { DialogUtils.textInput(this, R.string.title_file_received, attachmentFileName, R.string.action_file_received_edit, text -> {
File outFile = saveStreamWithName(in, text); File outFile = saveStreamWithName(in, text);
if (outFile == null) return; if (outFile == null) return;
@@ -141,7 +141,7 @@ public class TermuxFileReceiverActivity extends Activity {
startService(executeIntent); startService(executeIntent);
finish(); finish();
}, },
R.string.file_received_open_folder_button, text -> { R.string.action_file_received_open_directory, text -> {
if (saveStreamWithName(in, text) == null) return; if (saveStreamWithName(in, text) == null) return;
Intent executeIntent = new Intent(TERMUX_SERVICE.ACTION_SERVICE_EXECUTE); Intent executeIntent = new Intent(TERMUX_SERVICE.ACTION_SERVICE_EXECUTE);

View File

@@ -56,7 +56,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/toggle_soft_keyboard" /> android:text="@string/action_toggle_soft_keyboard" />
<Button <Button
android:id="@+id/new_session_button" android:id="@+id/new_session_button"
@@ -64,7 +64,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/new_session" /> android:text="@string/acton_new_session" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@@ -5,11 +5,11 @@
<item <item
android:id="@+id/menu_item_share_report" android:id="@+id/menu_item_share_report"
android:icon="@drawable/ic_share" android:icon="@drawable/ic_share"
android:title="@string/share" android:title="@string/action_share"
app:showAsAction="never" /> app:showAsAction="never" />
<item <item
android:id="@+id/menu_item_copy_report" android:id="@+id/menu_item_copy_report"
android:icon="@drawable/ic_copy" android:icon="@drawable/ic_copy"
android:title="@string/copy" android:title="@string/action_copy"
app:showAsAction="never" /> app:showAsAction="never" />
</menu> </menu>

View File

@@ -15,19 +15,17 @@
<resources> <resources>
<string name="application_name">&TERMUX_APP_NAME;</string> <string name="application_name">&TERMUX_APP_NAME;</string>
<string name="shared_user_label">&TERMUX_APP_NAME; user</string> <string name="shared_user_label">&TERMUX_APP_NAME; user</string>
<string name="run_command_permission_label">Run commands in &TERMUX_APP_NAME; environment</string>
<string name="run_command_permission_description">execute arbitrary commands within &TERMUX_APP_NAME;
environment</string>
<string name="new_session">New session</string>
<string name="new_session_failsafe">Failsafe</string>
<string name="toggle_soft_keyboard">Keyboard</string>
<string name="reset_terminal">Reset</string>
<string name="style_terminal">Style</string>
<string name="share_transcript_title">Terminal transcript</string>
<string name="help">Help</string>
<string name="toggle_keep_screen_on">Keep screen on</string>
<string name="autofill_password">Autofill password</string>
<!-- Termux RUN_COMMAND permission -->
<string name="permission_run_command_label">Run commands in &TERMUX_APP_NAME; environment</string>
<string name="permission_run_command_description">execute arbitrary commands within &TERMUX_APP_NAME;
environment</string>
<!-- Termux Bootstrap Packages Installation -->
<string name="bootstrap_installer_body">Installing bootstrap packages…</string> <string name="bootstrap_installer_body">Installing bootstrap packages…</string>
<string name="bootstrap_error_title">Unable to install bootstrap</string> <string name="bootstrap_error_title">Unable to install bootstrap</string>
<string name="bootstrap_error_body">&TERMUX_APP_NAME; was unable to install the bootstrap packages.</string> <string name="bootstrap_error_body">&TERMUX_APP_NAME; was unable to install the bootstrap packages.</string>
@@ -35,71 +33,108 @@
<string name="bootstrap_error_try_again">Try again</string> <string name="bootstrap_error_try_again">Try again</string>
<string name="bootstrap_error_not_primary_user_message">&TERMUX_APP_NAME; can only be run as the primary user.\nBootstrap binaries compiled for &TERMUX_APP_NAME; have hardcoded $PREFIX path and cannot be installed under any path other than \"%1$s\".</string> <string name="bootstrap_error_not_primary_user_message">&TERMUX_APP_NAME; can only be run as the primary user.\nBootstrap binaries compiled for &TERMUX_APP_NAME; have hardcoded $PREFIX path and cannot be installed under any path other than \"%1$s\".</string>
<string name="max_terminals_reached_title">Max terminals reached</string>
<string name="max_terminals_reached_message">Close down existing ones before creating new.</string>
<string name="reset_toast_notification">Terminal reset.</string>
<string name="select_url">Select URL</string> <!-- Terminal Sidebar and Shortcuts -->
<string name="select_url_dialog_title">Click URL to copy or long press to open</string> <string name="acton_new_session">New session</string>
<string name="select_all_and_share">Share transcript</string> <string name="action_new_session_failsafe">Failsafe</string>
<string name="select_url_no_found">No URL found in the terminal.</string> <string name="title_max_terminals_reached">Max terminals reached</string>
<string name="select_url_copied_to_clipboard">URL copied to clipboard</string> <string name="msg_max_terminals_reached">Close down existing ones before creating new.</string>
<string name="share_transcript_chooser_title">Send text to:</string>
<string name="kill_process">Kill process (%d)</string> <string name="title_rename_session">Set session name</string>
<string name="confirm_kill_process">Really kill this session?</string> <string name="action_rename_session_confirm">Set</string>
<string name="title_create_named_session">New named session</string>
<string name="action_create_named_session_confirm">Create</string>
<string name="session_rename_title">Set session name</string> <string name="action_toggle_soft_keyboard">Keyboard</string>
<string name="session_rename_positive_button">Set</string>
<string name="session_new_named_title">New named session</string>
<string name="session_new_named_positive_button">Create</string>
<string name="styling_not_installed">The &TERMUX_STYLING_APP_NAME; Plugin App is not installed.</string>
<string name="styling_install">Install</string>
<!-- Terminal Popup -->
<string name="action_select_url">Select URL</string>
<string name="title_select_url_dialog">Click URL to copy or long press to open</string>
<string name="title_select_url_none_found">No URL found in the terminal.</string>
<string name="msg_select_url_copied_to_clipboard">URL copied to clipboard</string>
<string name="action_share_transcript">Share transcript</string>
<string name="title_share_transcript">Terminal transcript</string>
<string name="title_share_transcript_with">Send transcript to:</string>
<string name="action_autofill_password">Autofill password</string>
<string name="action_reset_terminal">Reset</string>
<string name="msg_terminal_reset">Terminal reset.</string>
<string name="action_kill_process">Kill process (%d)</string>
<string name="title_confirm_kill_process">Really kill this session?</string>
<string name="action_style_terminal">Style</string>
<string name="action_toggle_keep_screen_on">Keep screen on</string>
<string name="action_open_help">Help</string>
<string name="action_open_settings">Settings</string>
<string name="error_styling_not_installed">The &TERMUX_STYLING_APP_NAME; Plugin App is not installed.</string>
<string name="action_styling_install">Install</string>
<!-- Termux Notifications -->
<string name="notification_action_exit">Exit</string> <string name="notification_action_exit">Exit</string>
<string name="notification_action_wake_lock">Acquire wakelock</string> <string name="notification_action_wake_lock">Acquire wakelock</string>
<string name="notification_action_wake_unlock">Release wakelock</string> <string name="notification_action_wake_unlock">Release wakelock</string>
<string name="file_received_title">Save file in ~/downloads/</string>
<string name="file_received_edit_button">Edit</string>
<string name="file_received_open_folder_button">Open folder</string>
<string name="executable_absolute_path">Executable Absolute Path: \"%1$s\"</string>
<string name="working_directory_absolute_path">Working Directory Absolute Path: \"%1$s\"</string>
<string name="executable_required">Executable required.</string> <!-- Termux RunCommandService -->
<string name="null_or_empty_path">The path is null or empty.</string> <string name="error_run_command_service_invalid_intent_action">Invalid intent action to RunCommandService: `%1$s`</string>
<string name="null_or_empty_file">The file is null or empty.</string> <string name="error_run_command_service_allow_external_apps_ungranted">RunCommandService require `allow-external-apps` property to be set to `true` in `&TERMUX_PROPERTIES_PRIMARY_PATH_SHORT;` file.</string>
<string name="null_or_empty_executable">The executable is null or empty.</string> <string name="error_run_command_service_api_help">Visit https://github.com/termux/termux-app/blob/master/app/src/main/java/com/termux/app/RunCommandService.java for more info on RUN_COMMAND Intent usage.</string>
<string name="null_or_empty_directory">The directory is null or empty.</string>
<string name="invalid_file_permissions_string_to_check">The file permission string to check is invalid.</string>
<string name="no_regular_file_found">Regular file not found at path.</string>
<string name="no_directory_found">Directory not found at path.</string>
<string name="file_not_readable">%1$s at path is not readable. Permission Denied.</string>
<string name="file_not_writable">%1$s at path is not writable. Permission Denied.</string>
<string name="file_not_executable">%1$s at path is not executable. Permission Denied.</string>
<string name="non_regular_file_found">Non-regular file found at path.</string>
<string name="non_directory_file_found">Non-directory file found at path.</string>
<string name="creating_missing_directory_failed">Failed to create missing directory at path: \"%1$s\"</string>
<string name="validate_file_existence_and_permissions_failed_with_exception">Validating file existence and permissions fafiled: \"%1$s\"\nException: %2$s</string>
<string name="validate_directory_existence_and_permissions_failed_with_exception">Validating directory existence and permissions fafiled: \"%1$s\"\nException: %2$s</string>
<string name="run_command_service_invalid_action">Invalid intent action to RunCommandService: `%1$s`</string>
<string name="run_command_service_invalid_command_path">Invalid coommand path to RunCommandService: `%1$s`</string>
<string name="run_command_service_allow_external_apps_ungranted_warning">RunCommandService require `allow-external-apps` property to be set to `true` in `&TERMUX_PROPERTIES_PRIMARY_PATH_SHORT;` file.</string>
<string name="run_command_service_api_help">Visit https://github.com/termux/termux-app/blob/master/app/src/main/java/com/termux/app/RunCommandService.java for more info on RUN_COMMAND Intent usage.</string>
<string name="share">Share</string>
<string name="share_with">Share With</string> <!-- Termux Execution Commands -->
<string name="copy">Copy</string> <string name="msg_executable_absolute_path">Executable Absolute Path: \"%1$s\"</string>
<string name="report_text">Report Text</string> <string name="msg_working_directory_absolute_path">Working Directory Absolute Path: \"%1$s\"</string>
<!-- Termux FileUtils -->
<string name="error_executable_required">Executable required.</string>
<string name="error_null_or_empty_path">The path is null or empty.</string>
<string name="error_null_or_empty_file">The file is null or empty.</string>
<string name="error_null_or_empty_executable">The executable is null or empty.</string>
<string name="error_null_or_empty_directory">The directory is null or empty.</string>
<string name="error_invalid_file_permissions_string_to_check">The file permission string to check is invalid.</string>
<string name="error_no_regular_file_found">Regular file not found at path.</string>
<string name="error_no_directory_found">Directory not found at path.</string>
<string name="error_file_not_readable">%1$s at path is not readable. Permission Denied.</string>
<string name="error_file_not_writable">%1$s at path is not writable. Permission Denied.</string>
<string name="error_file_not_executable">%1$s at path is not executable. Permission Denied.</string>
<string name="error_non_regular_file_found">Non-regular file found at path.</string>
<string name="error_non_directory_file_found">Non-directory file found at path.</string>
<string name="error_creating_missing_directory_failed">Failed to create missing directory at path: \"%1$s\"</string>
<string name="error_validate_file_existence_and_permissions_failed_with_exception">Validating file existence and permissions fafiled: \"%1$s\"\nException: %2$s</string>
<string name="error_validate_directory_existence_and_permissions_failed_with_exception">Validating directory existence and permissions fafiled: \"%1$s\"\nException: %2$s</string>
<!-- Termux Report And ShareUtils -->
<string name="action_copy">Copy</string>
<string name="action_share">Share</string>
<string name="title_share_with">Share With</string>
<string name="title_report_text">Report Text</string>
<!-- Termux File Receiver -->
<string name="title_file_received">Save file in ~/downloads/</string>
<string name="action_file_received_edit">Edit</string>
<string name="action_file_received_open_directory">Open directory</string>
<!-- Termux Settings --> <!-- Termux Settings -->
<string name="settings">Settings</string>
<string name="title_activity_termux_settings">&TERMUX_APP_NAME; Settings</string> <string name="title_activity_termux_settings">&TERMUX_APP_NAME; Settings</string>
<!-- Debugging Preferences --> <!-- Debugging Preferences -->

View File

@@ -13,7 +13,7 @@
android:shortcutId="new_session" android:shortcutId="new_session"
android:enabled="true" android:enabled="true"
android:icon="@drawable/ic_new_session" android:icon="@drawable/ic_new_session"
android:shortcutShortLabel="@string/new_session" android:shortcutShortLabel="@string/acton_new_session"
tools:targetApi="n_mr1"> tools:targetApi="n_mr1">
<intent <intent
android:action="android.intent.action.RUN" android:action="android.intent.action.RUN"
@@ -25,7 +25,7 @@
android:shortcutId="new_failsafe_session" android:shortcutId="new_failsafe_session"
android:enabled="true" android:enabled="true"
android:icon="@drawable/ic_new_session" android:icon="@drawable/ic_new_session"
android:shortcutShortLabel="@string/new_session_failsafe" android:shortcutShortLabel="@string/action_new_session_failsafe"
tools:targetApi="n_mr1"> tools:targetApi="n_mr1">
<intent <intent
android:action="android.intent.action.RUN" android:action="android.intent.action.RUN"