mirror of
https://github.com/ethauvin/Clever.git
synced 2025-04-24 08:27:11 -07:00
Initial commit. (yay!)
This commit is contained in:
commit
df7ba79871
13 changed files with 271 additions and 0 deletions
20
.gitignore
vendored
Normal file
20
.gitignore
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
# built application files
|
||||
*.apk
|
||||
*.ap_
|
||||
|
||||
# files for the dex VM
|
||||
*.dex
|
||||
|
||||
# Java class files
|
||||
*.class
|
||||
|
||||
# generated files
|
||||
bin/
|
||||
gen/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
|
||||
# Eclipse project files
|
||||
.classpath
|
||||
.project
|
30
AndroidManifest.xml
Normal file
30
AndroidManifest.xml
Normal file
|
@ -0,0 +1,30 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="io.clever"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="15"
|
||||
android:targetSdkVersion="15" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/title_activity_main"
|
||||
android:screenOrientation="landscape"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:immersive="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
BIN
assets/www/clever.png
Normal file
BIN
assets/www/clever.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
100
assets/www/index.html
Normal file
100
assets/www/index.html
Normal file
|
@ -0,0 +1,100 @@
|
|||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Clever</title>
|
||||
|
||||
<style>
|
||||
|
||||
body{
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.wrapper{
|
||||
margin: 150px auto;
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
}
|
||||
input{
|
||||
width: 500px;
|
||||
max-width: 100%;
|
||||
}
|
||||
input, button{
|
||||
font-size: 25px;
|
||||
border: 3px solid #333;
|
||||
border-radius: 10px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.logo{
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
width: 200px;
|
||||
opacity: .4;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
|
||||
window.onload = function(){
|
||||
|
||||
var loc = document.getElementById('loc');
|
||||
var url = document.getElementById('url');
|
||||
|
||||
|
||||
var prevUrl = localStorage.getItem('url');
|
||||
|
||||
if(prevUrl){
|
||||
url.value = prevUrl;
|
||||
}
|
||||
|
||||
url.onclick = function(){
|
||||
|
||||
this.select();
|
||||
|
||||
}
|
||||
|
||||
|
||||
loc.onsubmit = function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var urlval = url.value;
|
||||
|
||||
if(urlval){
|
||||
|
||||
if(urlval.substring(0,7) !== 'http://' && urlval.substring(0,8) !== 'https://'){
|
||||
urlval = 'http://' + urlval;
|
||||
}
|
||||
|
||||
localStorage.setItem('url', urlval);
|
||||
|
||||
document.location = urlval;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
|
||||
<form id="loc">
|
||||
<input placeholder="Enter URL" id="url" type="url" name="url" value=""/> <button>Go</button>
|
||||
</form>
|
||||
<img class="logo" src="file:///android_asset/www/clever.png"/>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
BIN
libs/android-support-v4.jar
Normal file
BIN
libs/android-support-v4.jar
Normal file
Binary file not shown.
4
lint.xml
Normal file
4
lint.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<lint>
|
||||
<issue id="SetJavaScriptEnabled" severity="ignore" />
|
||||
</lint>
|
20
proguard-project.txt
Normal file
20
proguard-project.txt
Normal file
|
@ -0,0 +1,20 @@
|
|||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
14
project.properties
Normal file
14
project.properties
Normal file
|
@ -0,0 +1,14 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-15
|
BIN
res/drawable/.DS_Store
vendored
Normal file
BIN
res/drawable/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
res/drawable/icon.png
Normal file
BIN
res/drawable/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
10
res/layout/activity_main.xml
Normal file
10
res/layout/activity_main.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<WebView android:id="@+id/webView1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
</LinearLayout>
|
6
res/values/strings.xml
Normal file
6
res/values/strings.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<resources>
|
||||
|
||||
<string name="app_name">Clever</string>
|
||||
<string name="title_activity_main">Clever</string>
|
||||
|
||||
</resources>
|
67
src/io/clever/MainActivity.java
Normal file
67
src/io/clever/MainActivity.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
package io.clever;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.webkit.*;
|
||||
import android.webkit.WebSettings.*;
|
||||
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
WebView webView;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
webView = (WebView) findViewById(R.id.webView1);
|
||||
|
||||
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
|
||||
webView.setWebChromeClient(new WebChromeClient());
|
||||
webView.setWebViewClient(new WebViewClient());
|
||||
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
//webSettings.setBuiltInZoomControls(false);
|
||||
//webSettings.setSupportZoom(false);
|
||||
//webSettings.setTextZoom(80);
|
||||
//webSettings.setDefaultZoom(ZoomDensity.FAR);
|
||||
webSettings.setSaveFormData(false);
|
||||
webSettings.setDatabaseEnabled(true);
|
||||
webSettings.setDatabasePath("/data/data/" + webView.getContext().getPackageName() + "/databases/");
|
||||
|
||||
webSettings.setLightTouchEnabled(false);
|
||||
webSettings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
|
||||
webSettings.setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.77 Large Screen Safari/534.24 GoogleTV");
|
||||
|
||||
webView.setInitialScale(90);
|
||||
|
||||
webView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
|
||||
|
||||
webView.loadUrl("file:///android_asset/www/index.html");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
{
|
||||
if(webView.canGoBack()){
|
||||
|
||||
webView.goBack();
|
||||
webView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
|
||||
|
||||
} else {
|
||||
|
||||
super.onBackPressed();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue