changed terminal design
This commit is contained in:
parent
1920afac33
commit
36d8f5f512
5 changed files with 74 additions and 69 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -6,4 +6,4 @@
|
||||||
/build
|
/build
|
||||||
/captures
|
/captures
|
||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
benchmark
|
/benchmark
|
||||||
|
|
@ -57,8 +57,8 @@ class TerminalActivity : AppCompatActivity() {
|
||||||
input!!.requestFocus()
|
input!!.requestFocus()
|
||||||
fab = findViewById(R.id.command_fab)
|
fab = findViewById(R.id.command_fab)
|
||||||
fab!!.setOnClickListener {
|
fab!!.setOnClickListener {
|
||||||
input!!.isEnabled = false
|
input!!.visibility = View.GONE
|
||||||
output!!.text = ""
|
output!!.text = "${output!!.text}\n~ $ ${input!!.text}\n";
|
||||||
swapFabs()
|
swapFabs()
|
||||||
startDownload(
|
startDownload(
|
||||||
input!!.text.toString()
|
input!!.text.toString()
|
||||||
|
|
@ -67,7 +67,7 @@ class TerminalActivity : AppCompatActivity() {
|
||||||
cancelFab = findViewById(R.id.cancel_command_fab)
|
cancelFab = findViewById(R.id.cancel_command_fab)
|
||||||
cancelFab!!.setOnClickListener {
|
cancelFab!!.setOnClickListener {
|
||||||
cancelDownload()
|
cancelDownload()
|
||||||
input!!.isEnabled = true
|
input!!.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
notificationUtil = NotificationUtil(this)
|
notificationUtil = NotificationUtil(this)
|
||||||
handleIntent(intent)
|
handleIntent(intent)
|
||||||
|
|
@ -166,7 +166,7 @@ class TerminalActivity : AppCompatActivity() {
|
||||||
output!!.scrollTo(0, output!!.height)
|
output!!.scrollTo(0, output!!.height)
|
||||||
scrollView!!.fullScroll(View.FOCUS_DOWN)
|
scrollView!!.fullScroll(View.FOCUS_DOWN)
|
||||||
|
|
||||||
input!!.isEnabled = true
|
input!!.visibility = View.VISIBLE
|
||||||
|
|
||||||
cancelFab!!.visibility = View.GONE
|
cancelFab!!.visibility = View.GONE
|
||||||
fab!!.visibility = View.VISIBLE
|
fab!!.visibility = View.VISIBLE
|
||||||
|
|
@ -177,9 +177,10 @@ class TerminalActivity : AppCompatActivity() {
|
||||||
.subscribeOn(Schedulers.newThread())
|
.subscribeOn(Schedulers.newThread())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe({
|
.subscribe({
|
||||||
scrollView!!.scrollTo(0, scrollView!!.maxScrollAmount)
|
output!!.scrollTo(0, output!!.height)
|
||||||
|
scrollView!!.fullScroll(View.FOCUS_DOWN)
|
||||||
input!!.setText("yt-dlp ")
|
input!!.setText("yt-dlp ")
|
||||||
input!!.isEnabled = true
|
input!!.visibility = View.VISIBLE
|
||||||
|
|
||||||
cancelFab!!.visibility = View.GONE
|
cancelFab!!.visibility = View.GONE
|
||||||
fab!!.visibility = View.VISIBLE
|
fab!!.visibility = View.VISIBLE
|
||||||
|
|
@ -193,9 +194,10 @@ class TerminalActivity : AppCompatActivity() {
|
||||||
notificationUtil.cancelDownloadNotification(downloadID)
|
notificationUtil.cancelDownloadNotification(downloadID)
|
||||||
}) { e ->
|
}) { e ->
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
scrollView!!.scrollTo(0, scrollView!!.maxScrollAmount)
|
output!!.scrollTo(0, output!!.height)
|
||||||
|
scrollView!!.fullScroll(View.FOCUS_DOWN)
|
||||||
input!!.setText("yt-dlp ")
|
input!!.setText("yt-dlp ")
|
||||||
input!!.isEnabled = true
|
input!!.visibility = View.VISIBLE
|
||||||
|
|
||||||
cancelFab!!.visibility = View.GONE
|
cancelFab!!.visibility = View.GONE
|
||||||
fab!!.visibility = View.VISIBLE
|
fab!!.visibility = View.VISIBLE
|
||||||
|
|
|
||||||
|
|
@ -69,9 +69,7 @@ class DownloadWorker(
|
||||||
val downloadLocation = downloadItem.downloadPath
|
val downloadLocation = downloadItem.downloadPath
|
||||||
|
|
||||||
val titleRegex = Regex("[^A-Za-z\\d ]")
|
val titleRegex = Regex("[^A-Za-z\\d ]")
|
||||||
val tempFolder = StringBuilder(context.cacheDir.absolutePath + """/${titleRegex.replace(downloadItem.title, "")}##${downloadItem.type}""")
|
val tempFileDir = File(context.cacheDir.absolutePath + downloadItem.id)
|
||||||
tempFolder.append("##${downloadItem.format.format_id}")
|
|
||||||
val tempFileDir = File(tempFolder.toString())
|
|
||||||
tempFileDir.delete()
|
tempFileDir.delete()
|
||||||
tempFileDir.mkdir()
|
tempFileDir.mkdir()
|
||||||
|
|
||||||
|
|
@ -115,6 +113,8 @@ class DownloadWorker(
|
||||||
request.addOption("--restrict-filenames")
|
request.addOption("--restrict-filenames")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
request.addOption("--trim-filenames", 100)
|
||||||
|
|
||||||
when(type){
|
when(type){
|
||||||
DownloadViewModel.Type.audio -> {
|
DownloadViewModel.Type.audio -> {
|
||||||
request.addOption("-x")
|
request.addOption("-x")
|
||||||
|
|
|
||||||
|
|
@ -22,31 +22,40 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/command_edittext"
|
|
||||||
android:background="@android:color/transparent"
|
|
||||||
android:text="yt-dlp "
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="textMultiLine"
|
|
||||||
android:gravity="start"
|
|
||||||
android:maxLines="10" />
|
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:id="@+id/custom_command_scrollview"
|
android:id="@+id/custom_command_scrollview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:paddingBottom="150dp"
|
android:paddingBottom="100dp"
|
||||||
>
|
>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/custom_command_output"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:textIsSelectable="true"
|
android:layout_height="wrap_content"
|
||||||
android:fontFamily="monospace"
|
android:orientation="vertical">
|
||||||
android:gravity="bottom"
|
|
||||||
android:layout_height="wrap_content" />
|
<TextView
|
||||||
|
android:id="@+id/custom_command_output"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:textIsSelectable="true"
|
||||||
|
android:fontFamily="monospace"
|
||||||
|
android:gravity="bottom"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/command_edittext"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:fontFamily="monospace"
|
||||||
|
android:text="yt-dlp "
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textMultiLine"
|
||||||
|
android:gravity="start"
|
||||||
|
android:maxLines="100" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,64 +13,58 @@
|
||||||
android:hint="@string/search_hint"
|
android:hint="@string/search_hint"
|
||||||
app:layout_anchor="@id/search_bar">
|
app:layout_anchor="@id/search_bar">
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
|
android:id="@+id/search_history_scroll_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ScrollView
|
<LinearLayout
|
||||||
android:id="@+id/search_history_scroll_view"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<include
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:layout_marginBottom="-10dp"
|
||||||
|
android:visibility="gone"
|
||||||
<include
|
android:id="@+id/link_you_copied"
|
||||||
android:layout_width="match_parent"
|
layout="@layout/search_suggestion_item"
|
||||||
android:layout_height="wrap_content"
|
/>
|
||||||
android:layout_marginBottom="-10dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/link_you_copied"
|
|
||||||
layout="@layout/search_suggestion_item"
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/search_history_linear_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:id="@+id/search_suggestions_scroll_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/search_suggestions_linear_layout"
|
android:id="@+id/search_history_linear_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/search_suggestions_scroll_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/search_suggestions_linear_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
|
||||||
|
|
||||||
</com.google.android.material.search.SearchView>
|
</com.google.android.material.search.SearchView>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue