-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
223 additions
and
52 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 44 additions & 1 deletion
45
app/src/main/java/co/dothq/browser/subactivities/AddressBar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,55 @@ | ||
package co.dothq.browser.subactivities | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.app.Activity | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.view.KeyEvent | ||
import android.view.View | ||
import android.widget.EditText | ||
import android.widget.Toast | ||
import androidx.appcompat.app.AppCompatActivity | ||
import co.dothq.browser.R | ||
import co.dothq.browser.managers.StorageManager | ||
|
||
|
||
class AddressBar : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_address_bar) | ||
val uri :String = intent.getStringExtra("currentURI").toString(); | ||
|
||
val editBox = findViewById<EditText>(R.id.urlEnterBox); | ||
editBox.setText(uri); | ||
|
||
editBox.requestFocus(); | ||
editBox.selectAll() | ||
|
||
editBox.setOnKeyListener(View.OnKeyListener { v, keyCode, event -> | ||
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) { | ||
|
||
var text = editBox.text.toString(); | ||
if (text.trim() == "") { | ||
setResult(Activity.RESULT_CANCELED) | ||
finish() | ||
overridePendingTransition(0, 0) | ||
} else { | ||
|
||
val data = Intent() | ||
data.putExtra("targetURI", text.trim()); | ||
// more handling here | ||
setResult(Activity.RESULT_OK, data); | ||
finish() | ||
overridePendingTransition(0, 0) | ||
} | ||
return@OnKeyListener true | ||
} | ||
false | ||
}) | ||
|
||
} | ||
|
||
override fun onBackPressed() { | ||
super.onBackPressed() | ||
overridePendingTransition(0, 0) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="?colorPrimaryVariant"/> | ||
<stroke android:width="0dp" android:color="?colorPrimaryVariant" /> | ||
<stroke android:width="0dp" android:color="?colorSecondary" /> | ||
<corners android:radius="10dp"/> | ||
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" /> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:drawable="@drawable/invisible_button_pressed" | ||
android:state_pressed="true"/> | ||
<item android:drawable="@drawable/invisible_button_normal" | ||
android:state_enabled="false"/> | ||
</selector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<stroke android:width="0dp" android:color="@color/blue" /> | ||
<corners android:radius="10dp"/> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="?colorSecondaryVariant" /> | ||
<stroke android:width="0dp" android:color="?colorSecondaryVariant" /> | ||
<corners android:radius="10dp"/> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.