Skip to content

Commit

Permalink
Web browsing now possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kjelldg committed May 15, 2018
1 parent f195347 commit a3a7176
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 21 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.kjell.browserproject">

<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,53 @@
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

Button go;
TextView text;
WebView webView_Browser;
EditText editText_Url;
Button forward_Button, backward_Button, refresh_Button, clear_Button, go_Button;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

go = (Button) findViewById(R.id.btn_go);
text = (TextView) findViewById(R.id.tv_text);

go.setOnClickListener(new View.OnClickListener() {

webView_Browser = (WebView) findViewById(R.id.webView_Browser);

webView_Browser.setWebViewClient(new WebViewClient());

editText_Url = (EditText) findViewById(R.id.editText_Url);

go_Button = (Button) findViewById(R.id.go_Button);
forward_Button = (Button) findViewById(R.id.forward_Button);
backward_Button = (Button) findViewById(R.id.backward_Button);
refresh_Button = (Button) findViewById(R.id.refresh_Button);
clear_Button = (Button) findViewById(R.id.clear_Button);

go_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

String editTextValue = editText_Url.getText().toString();
String url_String = editTextValue;
webView_Browser.loadUrl(url_String);
}
});


// webView_Browser.setWebViewClient(new WebViewClient());

//String url_String = "http://www.computersweden.idg.se";

//webView_Browser.loadUrl(url_String);
}


Expand Down
94 changes: 81 additions & 13 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum = "1"
tools:context=".MainActivity">

<TextView
android:id="@+id/tv_text"
android:textSize="30dp"
android:text="Dentium Browser"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:weightSum="1"
android:layout_weight="0.10"
android:id="@+id/ll_urlgo"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<Button
android:id="@+id/btn_go"
android:text="GO"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/editText_Url"
android:inputType="textNoSuggestions"
android:weightSum="0.90"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.95"/>

</android.support.constraint.ConstraintLayout>
<Button
android:background="@color/colorPrimary"
android:textColor="#FFFFFF"
android:id="@+id/go_Button"
android:weightSum="0.10"
android:text="Go"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.05"/>

</LinearLayout>


<WebView
android:id="@+id/webView_Browser"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.80">

</WebView>


<LinearLayout
android:id="@+id/linearLayout_Buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.10"
android:orientation="horizontal"
android:weightSum="1">


<Button
android:id="@+id/forward_Button"
android:text="Forward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"/>

<Button
android:id="@+id/backward_Button"
android:text="Backward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"/>

<Button
android:id="@+id/refresh_Button"
android:text="Refresh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"/>

<Button
android:id="@+id/clear_Button"
android:text="Clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"/>

</LinearLayout>



</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<resources>
<color name="colorPrimary">#406296</color>
<color name="colorPrimaryDark">#314a72</color>
<color name="colorAccent">#FF4081</color>
<color name="colorAccent">#FFFFFF</color>

</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand Down

0 comments on commit a3a7176

Please sign in to comment.