Skip to content

Instantly share code, notes, and snippets.

View hndr91's full-sized avatar

Afif Hendrawan hndr91

  • Malang, ID
View GitHub Profile
@hndr91
hndr91 / activity_main.xml
Last active October 3, 2015 10:22
Simple Android WebView - activity_main.xml
<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"
android:padding="4dp"
tools:context=".MainActivity">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
@hndr91
hndr91 / MainActivityOnCreate.java
Last active October 3, 2015 10:31
Simple Android WebView - onCreate
//Define URL
private static final String URL = "http://updatesepati.blogspot.com/";
//Define WebView
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = (WebView)findViewById(R.id.webView); //get webView
@hndr91
hndr91 / MainActivityOnKeyDown.java
Created October 3, 2015 10:32
Simple Android WebView - onKeyDown
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK && webView.canGoBack()) {
//back to previous url
webView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
@hndr91
hndr91 / manu_main.xml
Created October 3, 2015 10:35
Simple Android WebView - main_menu.xml
<menu 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" tools:context=".MainActivity">
<item android:id="@+id/action_exit"
android:title="@string/action_exit"
android:orderInCategory="100"
app:showAsAction="never" />
</menu>
@hndr91
hndr91 / MainActivitiOnItem.java
Created October 3, 2015 10:43
Simple Android WebView - onOptionItemSelected
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_exit) {
@hndr91
hndr91 / AndroidManifest.xml
Created October 3, 2015 10:47
Simple Android WebView - AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.webview" >
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@hndr91
hndr91 / UNTUK_PATI_API.md
Last active October 25, 2015 09:04
Pati Directory Listing API

TYPE

/type

REST request for service type. Provides method for finding, creating, modifiying service type.

Method

  • POST

    Create new service type

    • acceptable request format: application/x-www-form-urlencoded
    • acceptable request params:
@hndr91
hndr91 / brosense-v2-remove-label.xml
Created November 18, 2015 14:54
Brosense V2 Custom
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html b:version='2' class='v2' expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"> </script>
<![endif]-->
<meta content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1' name='viewport'/>
<meta content='text/html;charset=UTF-8' http-equiv='Content-Type'/>
@hndr91
hndr91 / config.php
Last active December 9, 2015 09:41
slim-mongo config
<?php
//Database Constant
define('DB_NAME', 'test'); //db name
define('DB_COLLECTION','friends'); //collection name
//Return Paramater Constant
define('INSERT_COL_SUCCESS', 0);
define('INSERT_COL_FAILED', 1);
define('REMOVE_FRIEND_SUCCESS', 0);
define('REMOVE_FRIEND_FAILED', 1);
@hndr91
hndr91 / dbConnect.php
Last active December 9, 2015 09:44
slim mongo dbConnect
<?php
class dbConnect {
private $con;
private $db;
function __construct() {}
//connect to MongoDB function
function connect() {
include_once dirname(__FILE__) . '/config.php';