Skip to content

Commit

Permalink
Merge pull request #50 from hidroh/api-24
Browse files Browse the repository at this point in the history
Color prompt for run commands
  • Loading branch information
hidroh authored Aug 20, 2016
2 parents 544a32c + 8664e72 commit af4027a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
4 changes: 4 additions & 0 deletions app/src/main/kotlin/io/github/hidroh/tldroid/RunActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.databinding.DataBindingUtil
import android.databinding.ViewDataBinding
import android.os.AsyncTask
import android.os.Bundle
import android.support.design.widget.Snackbar
import android.support.v4.util.Pair
import android.text.TextUtils
import android.view.View
Expand All @@ -25,6 +26,9 @@ class RunActivity : ThemedActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
DataBindingUtil.setContentView<ViewDataBinding>(this, R.layout.activity_run)
val snackbar = Snackbar.make(findViewById(android.R.id.content),
R.string.run_warning, Snackbar.LENGTH_INDEFINITE)
snackbar.setAction(android.R.string.ok, { snackbar.dismiss() }).show()
mOutput = findViewById(R.id.output) as TextView?
mError = findViewById(R.id.error) as TextView?
val command = intent.getStringExtra(EXTRA_COMMAND)
Expand Down
31 changes: 16 additions & 15 deletions app/src/main/res/layout/activity_run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,40 @@
android:layout_height="match_parent">

<TextView
android:id="@+id/warning"
android:text="@string/run_warning"
android:textColor="?android:attr/textColorSecondary"
android:id="@+id/sign"
android:text=">"
android:textSize="@dimen/text_size_medium"
android:textColor="?android:attr/textColorHint"
app:monospace="@{true}"
android:textSize="@dimen/text_size"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="?attr/listPreferredItemHeightSmall"
app:layout_constraintTop_toTopOf="@id/constraintLayout"
app:layout_constraintLeft_toLeftOf="@id/constraintLayout"
app:layout_constraintRight_toRightOf="@id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
tools:ignore="HardcodedText" />

<TextView
android:id="@+id/prompt"
android:text="> "
tools:text="echo"
android:textSize="@dimen/text_size_medium"
android:textColor="?android:attr/textColorHint"
android:textColor="?attr/colorDefinition"
app:monospace="@{true}"
android:gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="?attr/listPreferredItemHeightSmall"
app:layout_constraintTop_toBottomOf="@id/warning"
app:layout_constraintLeft_toLeftOf="@id/constraintLayout"
app:layout_constraintTop_toTopOf="@id/constraintLayout"
app:layout_constraintLeft_toRightOf="@id/sign"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
tools:ignore="HardcodedText" />

<EditText
android:id="@id/edit_text"
tools:hint="ls"
tools:text="hello world"
android:textSize="@dimen/text_size_medium"
android:textColor="?attr/colorLiteral"
app:monospace="@{true}"
android:inputType="textNoSuggestions"
android:imeOptions="actionGo"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<string name="info">Information</string>
<string name="never">Never</string>
<string name="run">Run</string>
<string name="run_warning">* Not all commands are available on Android. Run at your own risk.</string>
<string name="run_warning">Command may work differently on Android; run at your own risk.</string>
<string name="all_commands">All commands</string>
<string name="settings">Settings</string>
<string name="solarized">Solarized</string>
Expand Down

0 comments on commit af4027a

Please sign in to comment.