Skip to content

Commit a2833f8

Browse files
committed
Update
1 parent e088cb5 commit a2833f8

4 files changed

Lines changed: 21 additions & 22 deletions

File tree

app/src/main/java/com/tool/tree/TextEditorActivity.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,9 @@ class TextEditorActivity : AppCompatActivity() {
102102
absoluteFilePath = resolveAbsolutePath(configDir, filePath)
103103

104104
val extraTitle = intent.getStringExtra(EXTRA_TITLE).orEmpty()
105-
val extraDesc = intent.getStringExtra(EXTRA_DESC).orEmpty()
106105
wrapEnabled = intent.getBooleanExtra(EXTRA_WRAP, true)
107106

108107
title = extraTitle.ifEmpty { File(absoluteFilePath).name }
109-
supportActionBar?.subtitle = extraDesc.ifEmpty { null }
110108

111109
applyWrapState()
112110
setupFab()
@@ -127,11 +125,15 @@ class TextEditorActivity : AppCompatActivity() {
127125

128126
private fun setupFab() {
129127
val interpreter = RUNNABLE_EXTENSIONS[fileExtension()]
128+
binding.editorFabRun.visibility = View.VISIBLE
130129
if (interpreter != null) {
131-
binding.editorFabRun.visibility = View.VISIBLE
130+
binding.editorFabRun.contentDescription = getString(R.string.editor_run_test)
131+
binding.editorFabRun.setImageResource(R.drawable.kr_run)
132132
binding.editorFabRun.setOnClickListener { saveAndRun(interpreter) }
133133
} else {
134-
binding.editorFabRun.visibility = View.GONE
134+
binding.editorFabRun.contentDescription = getString(R.string.editor_save)
135+
binding.editorFabRun.setImageResource(android.R.drawable.ic_menu_save)
136+
binding.editorFabRun.setOnClickListener { saveFile() }
135137
}
136138
}
137139

741 Bytes
Loading

app/src/main/res/layout/activity_text_editor.xml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:app="http://schemas.android.com/apk/res-auto"
43
android:layout_width="match_parent"
54
android:layout_height="match_parent"
65
android:fitsSystemWindows="false">
@@ -21,20 +20,20 @@
2120
android:fillViewport="true"
2221
android:scrollbarStyle="insideOverlay">
2322

24-
<EditText
25-
android:id="@+id/editor_content"
26-
android:layout_width="wrap_content"
27-
android:layout_height="match_parent"
28-
android:background="@android:color/transparent"
29-
android:gravity="top|start"
30-
android:padding="16dp"
31-
android:fontFamily="monospace"
32-
android:textSize="14sp"
33-
android:hint="@string/editor_hint_empty"
34-
android:inputType="textMultiLine|textVisiblePassword|textNoSuggestions"
35-
android:imeOptions="flagNoExtractUi"
36-
android:textColor="?android:attr/textColorPrimary"
37-
android:textColorHint="?android:attr/textColorSecondary" />
23+
<EditText
24+
android:id="@+id/editor_content"
25+
android:layout_width="match_parent"
26+
android:layout_height="match_parent"
27+
android:background="@android:color/transparent"
28+
android:gravity="top|start"
29+
android:hint="@string/editor_hint_empty"
30+
android:inputType="textMultiLine|textNoSuggestions"
31+
android:imeOptions="flagNoExtractUi"
32+
android:padding="16dp"
33+
android:textColor="?android:attr/textColorPrimary"
34+
android:textColorHint="?android:attr/textColorSecondary"
35+
android:textSize="14sp"
36+
android:typeface="monospace" />
3837

3938
</HorizontalScrollView>
4039

@@ -55,7 +54,6 @@
5554
android:layout_marginEnd="32dp"
5655
android:contentDescription="@string/editor_run_test"
5756
android:src="@drawable/kr_run"
58-
app:tint="@color/kr_shortcut_color"
5957
android:visibility="gone" />
6058

6159
</RelativeLayout>

app/src/main/res/menu/menu_text_editor.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto">
44
<item
55
android:id="@+id/editor_menu_save"
6-
android:icon="@android:drawable/ic_menu_save"
76
android:orderInCategory="10"
87
android:title="@string/editor_save"
9-
app:showAsAction="ifRoom" />
8+
app:showAsAction="never" />
109
<item
1110
android:id="@+id/editor_menu_wrap"
1211
android:checkable="true"

0 commit comments

Comments
 (0)