Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
cdb60db5
Commit
cdb60db5
authored
Dec 27, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add WebViewActivity.kt
parent
638664d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
2 deletions
+83
-2
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+5
-2
WebViewActivity.kt
.../main/java/chat/rocket/android/webview/WebViewActivity.kt
+61
-0
activity_web_view.xml
app/src/main/res/layout/activity_web_view.xml
+17
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
cdb60db5
...
...
@@ -34,8 +34,11 @@
<activity
android:name=
".app.ChatRoomActivity"
android:theme=
"@style/AppTheme"
>
</activity>
android:theme=
"@style/AppTheme"
/>
<activity
android:name=
".webview.WebViewActivity"
android:theme=
"@style/AppTheme"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/chat/rocket/android/webview/WebViewActivity.kt
0 → 100644
View file @
cdb60db5
package
chat.rocket.android.webview
import
android.annotation.SuppressLint
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.support.v7.app.AppCompatActivity
import
android.webkit.WebViewClient
import
chat.rocket.android.R
import
kotlinx.android.synthetic.main.activity_web_view.*
import
kotlinx.android.synthetic.main.app_bar.*
fun
Context
.
webViewIntent
(
webPageUrl
:
String
):
Intent
{
return
Intent
(
this
,
WebViewActivity
::
class
.
java
).
apply
{
putExtra
(
INTENT_WEB_PAGE_URL
,
webPageUrl
)
}
}
private
const
val
INTENT_WEB_PAGE_URL
=
"web_page_url"
class
WebViewActivity
:
AppCompatActivity
()
{
private
lateinit
var
webPageUrl
:
String
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_web_view
)
webPageUrl
=
intent
.
getStringExtra
(
INTENT_WEB_PAGE_URL
)
requireNotNull
(
webPageUrl
)
{
"no web_page_url provided in Intent extras"
}
setupToolbar
()
}
override
fun
onResume
()
{
super
.
onResume
()
setupWebView
()
}
override
fun
onBackPressed
()
{
if
(
web_view
.
canGoBack
())
{
web_view
.
goBack
()
}
else
{
super
.
onBackPressed
()
}
}
private
fun
setupToolbar
()
{
toolbar
.
title
=
getString
(
R
.
string
.
title_legal_terms
)
toolbar
.
setNavigationIcon
(
R
.
drawable
.
ic_close_white_24dp
)
toolbar
.
setNavigationOnClickListener
{
finish
()
}
}
@SuppressLint
(
"SetJavaScriptEnabled"
)
private
fun
setupWebView
()
{
web_view
.
settings
.
javaScriptEnabled
=
true
web_view
.
webViewClient
=
WebViewClient
()
web_view
.
loadUrl
(
webPageUrl
)
}
}
\ No newline at end of file
app/src/main/res/layout/activity_web_view.xml
0 → 100644
View file @
cdb60db5
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".webview.WebViewActivity"
>
<include
android:id=
"@+id/layout_app_bar"
layout=
"@layout/app_bar"
/>
<WebView
android:id=
"@+id/web_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@+id/layout_app_bar"
/>
</RelativeLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment