Implement Tabs and Spaces identation

This commit is contained in:
M M Arif 2023-06-11 11:56:05 +05:00
parent f93fdf9a1a
commit 1e16505414
4 changed files with 26 additions and 6 deletions

View File

@ -73,8 +73,25 @@ public class CodeEditorActivity extends BaseActivity {
binding.codeView.setLineNumberTextSize(32f);
// Setup Auto indenting feature
binding.codeView.setTabLength(4);
binding.codeView.setEnableAutoIndentation(true);
if (tinyDB.getInt("ceIndentationId") == 0) {
binding.codeView.setEnableAutoIndentation(true);
switch (tinyDB.getInt("ceIndentationTabsId")) {
case 0:
binding.codeView.setTabLength(2);
break;
case 1:
binding.codeView.setTabLength(4);
break;
case 2:
binding.codeView.setTabLength(6);
break;
case 3:
binding.codeView.setTabLength(8);
break;
}
} else {
binding.codeView.setEnableAutoIndentation(false);
}
// Set up the language and theme with SyntaxManager helper class
currentLanguage.applyTheme(this, binding.codeView, currentTheme);

View File

@ -35,6 +35,7 @@ public class SettingsCodeEditorActivity extends BaseActivity {
// color selector dialog
colorList = getResources().getStringArray(R.array.ceColors);
colorSelectedChoice = tinyDB.getInt("ceColorId");
activitySettingsCodeEditorBinding.ceColorSelected.setText(colorList[colorSelectedChoice]);
activitySettingsCodeEditorBinding.ceColorSelectionFrame.setOnClickListener(
@ -66,6 +67,7 @@ public class SettingsCodeEditorActivity extends BaseActivity {
// indentation selector dialog
indentationList = getResources().getStringArray(R.array.ceIndentation);
indentationSelectedChoice = tinyDB.getInt("ceIndentationId");
activitySettingsCodeEditorBinding.indentationSelected.setText(
indentationList[indentationSelectedChoice]);
@ -107,6 +109,7 @@ public class SettingsCodeEditorActivity extends BaseActivity {
}
indentationTabsList = getResources().getStringArray(R.array.ceIndentationTabsWidth);
indentationTabsSelectedChoice = tinyDB.getInt("ceIndentationTabsId");
activitySettingsCodeEditorBinding.indentationTabsSelected.setText(
indentationTabsList[indentationTabsSelectedChoice]);

View File

@ -7,13 +7,13 @@
android:icon="@drawable/ic_branch"
android:orderInCategory="1"
android:title="@string/strSwitchBranches"
app:showAsAction="ifRoom|withText" />
app:showAsAction="ifRoom" />
<item
android:id="@+id/branchCommits"
android:icon="@drawable/ic_commit"
android:orderInCategory="2"
android:title="@string/commitTitle"
app:showAsAction="ifRoom|withText" />
app:showAsAction="ifRoom" />
</menu>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="versionLow" translatable="false">1.17</string>
<string name="versionHigh" translatable="false">1.19</string>
<string name="versionLow" translatable="false">1.18</string>
<string name="versionHigh" translatable="false">1.20</string>
</resources>