LAMPIRAN
1.
Script
Halaman
Splash Screen
Gambar
Splash Screen
File xml :
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:padding="10dip"
android:gravity="center"
android:id="@+id/main_layout"
android:background="@drawable/splash"> </RelativeLayout>
File Java :
package org.wisata.klaten;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
logoTimer = logoTimer + 100; }
startActivity(new Intent(
"org.wisata.klaten.CLEARSCREEN"));
} catch (InterruptedException e) {
// TODO Auto-generated catch block e.printStackTrace();
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
2.
Script
Halaman Awal
Gambar Halaman Awal
File xml :
<?xml version="1.0" encoding="utf-8"?> <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent" android:gravity="center"
android:background="@drawable/bgdpn" android:orientation="vertical" > <Button
android:id="@+id/jelajah"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Mulai Jelajah Klaten" />
</LinearLayout>
File Java :
package org.wisata.klaten;
import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_jelajah); View jelajah = findViewById(R.id.jelajah); jelajah.setOnClickListener(this);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.jelajah:
Intent jelajah = new Intent(this, MainActivity.class);
startActivity(jelajah); break;
} }
}
3.
Script
Halaman Utama
Gambar Halaman Utama
File xml :
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout
android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android" android:background="@drawable/border"
<ImageView
android:layout_height="90dp" android:id="@+id/imageView1" android:layout_width="90dp" android:src="@drawable/icon"
android:layout_alignParentTop="true" android:layout_centerHorizontal="true"> </ImageView> </RelativeLayout>
File Java :
package org.wisata.klaten;
import java.util.ArrayList;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
private GridviewAdapter mAdapter;
private ArrayList<String> listWisata; private ArrayList<Integer> listIcon;
private GridView gridView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
prepareList();
// prepared arraylist and passed it to the Adapter class
// Set custom adapter to gridview
gridView = (GridView) findViewById(R.id.gridView1); gridView.setAdapter(mAdapter);
// Implement On Item click listener gridView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0,
View arg1,
int position, long arg3) {
switch (position) {
case 0:
Intent cokro = new Intent(MainActivity.this,
CokroTabsHost.class); startActivity(cokro);
break;
case 1:
Intent delesindah = new Intent(MainActivity.this,
DelesIndahTabsHost.class);
startActivity(delesindah); break;
case 2:
Intent jolotundo = new Intent(MainActivity.this,
JolotundoTabsHost.class);
startActivity(jolotundo); break;
case 3:
Intent museumgula = new Intent(MainActivity.this,
MuseumGulaTabsHost.class);
startActivity(museumgula); break;
case 4:
Intent candiplaosan = new Intent(MainActivity.this,
CandiPlaosanTabsHost.class);
startActivity(candiplaosan); break;
case 5:
Intent rowojombor = new Intent(MainActivity.this,
RowoJomborTabsHost.class);
startActivity(rowojombor); break;
Intent janti = new Intent(MainActivity.this,
JantiTabsHost.class); startActivity(janti);
break;
case 7:
Intent candisewu = new Intent(MainActivity.this,
CandiSewuTabsHost.class);
startActivity(candisewu);
public void prepareList() {
listWisata = new ArrayList<String>();
listWisata.add("Cokro");
listWisata.add("Deles Indah"); listWisata.add("Jolotundo"); listWisata.add("Museum Gula"); listWisata.add("Candi Plaosan"); listWisata.add("Rowo Jombor"); listWisata.add("Janti");
listWisata.add("Candi Sewu");
listIcon = new ArrayList<Integer>();
listIcon.add(R.drawable.wisata_01);
public void onBackPressed() {
new AlertDialog.Builder(this) .setTitle("Keluar")
.setMessage("Apakah anda ingin keluar dari aplikasi?")
.setPositiveButton("Ya", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface
dlg, int sumthin) {
"android.intent.action.MAIN");
startMain.addCategory("android.intent.category.HOME"); startActivity(startMain); finish();
} })
.setNegativeButton("Tidak", new
DialogInterface.OnClickListener() {
public void
onClick(DialogInterface dlg, int sumthin) {
// do nothing -- it will close on its own
} }).show(); }
}
4.
Script
Halaman Sub Menu Gallery
Gambar Halaman Sub Menu Gallery
File xml :
<?xml version="1.0" encoding="utf-8"?> <ScrollView
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content"
android:orientation="vertical" > <LinearLayout
android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/bggallery" android:orientation="vertical"
android:weightSum="1" >
package org.wisata.klaten;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
public class CokroGallery extends Activity {
// ---the images to display---
Integer[] imageIDs = { R.drawable.cokro1, R.drawable.cokro2, R.drawable.cokro3, R.drawable.cokro4,
R.drawable.cokro5 }; @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cokrogallery); Gallery gallery = (Gallery)
findViewById(R.id.gallerycokro);
gallery.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent,
View v,
int position, long id) { ImageView imageView = (ImageView) findViewById(R.id.imgcokro);
imageView.setImageResource(imageIDs[position]); }
}); }
public class ImageAdapter extends BaseAdapter {
private Context context;
private int itemBackground;
public ImageAdapter(Context c) {
context = c; TypedArray a =
obtainStyledAttributes(R.styleable.style_gallery); itemBackground = a.getResourceId(
R.styleable.style_gallery_android_galleryItemBackground, 0); a.recycle();
}
// ---returns the number of images---
public int getCount() {
return imageIDs.length;
}
// ---returns the ID of an item---
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
// ---returns an ImageView view---
public View getView(int position, View convertView,
ViewGroup parent) {
ImageView imageView = new ImageView(context); imageView.setImageResource(imageIDs[position]);
imageView.setScaleType(ImageView.ScaleType.FIT_XY); imageView.setLayoutParams(new
Gallery.LayoutParams(150, 120));
imageView.setBackgroundResource(itemBackground);
return imageView;
} }
5.
Script
Halaman Menu Map
Gambar Halaman Sub Menu Map
File xml :
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical" > <com.google.android.maps.MapView android:id="@+id/mapViewc"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:apiKey="0oq6ZpqFFrMgujpomOBCimmXqS7FQF4M-4LajNA"
android:clickable="true" android:enabled="true" /> <LinearLayout
android:id="@+id/zoom"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" />
</RelativeLayout>
File Java :
package org.wisata.klaten;
import java.util.List;
import android.graphics.drawable.Drawable;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;
public class CokroMap extends MapActivity {
MapView mapView;
List<Overlay> mapOverlays; Drawable lokasiwisata;
MyItemizedOverlay itemizedOverlay;
MapController controlMap = null; MyLocationOverlay akuDimana = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cokromap);
mapView = (MapView) findViewById(R.id.mapViewc); mapView.setBuiltInZoomControls(true);
mapView.setSatellite(false);
controlMap = mapView.getController(); controlMap.setZoom(15);
mapOverlays = mapView.getOverlays();
akuDimana = new NodeInfoOverlay(this, mapView); mapView.getOverlays().add(akuDimana);
mapView.postInvalidate();
lokasiwisata =
getResources().getDrawable(R.drawable.shop);
itemizedOverlay = new MyItemizedOverlay(lokasiwisata, mapView);
GeoPoint point1 = new GeoPoint((int) (-7.58773 * 1E6), (int) (110.629184 * 1E6));
OverlayItem overlayItem1 = new OverlayItem(point1, "Lokasi Wisata Cokro",
"Alamat : Desa Tulung, Kabupaten Klaten, Jawa Tengah.");
GeoPoint point2 = new GeoPoint((int) (-7.748754 * 1E6),
(int) (110.491533 * 1E6));
OverlayItem overlayItem2 = new OverlayItem(point2, "Lokasi Wisata Candi Plaosan",
"Alamat : Dukuh Plaosan, Desa Bugisan, Kecamatan Prambanan, Kabupaten Klaten.");
itemizedOverlay.addOverlay(overlayItem2);
GeoPoint point3 = new GeoPoint((int) (-7.75105 * 1E6),
(int) (110.491383 * 1E6));
OverlayItem overlayItem3 = new OverlayItem(point3, "Lokasi Wisata Candi Sewu",
"Alamat : Dukuh Bener, Desa Bugisan Kecamatan Prambanan, Klaten.");
itemizedOverlay.addOverlay(overlayItem3);
GeoPoint point4 = new GeoPoint((int) (-7.710907 * 1E6),
(int) (110.56313 * 1E6));
OverlayItem overlayItem4 = new OverlayItem(point4, "Lokasi Wisata Deles Indah",
"Alamat : Desa Sidorejo Kecamatan Kemalang, Mangkrak, Klaten.");
itemizedOverlay.addOverlay(overlayItem4);
GeoPoint point5 = new GeoPoint((int) (-7.596833 * 1E6),
(int) (110.653818 * 1E6));
OverlayItem overlayItem5 = new OverlayItem(point5, "Lokasi Wisata Janti",
"Alamat : Desa Janti, Kecamatan Polanharjo, Klaten.");
itemizedOverlay.addOverlay(overlayItem5);
GeoPoint point6 = new GeoPoint((int) (-7.647196 * 1E6),
(int) (110.605409 * 1E6));
OverlayItem overlayItem6 = new OverlayItem(point6, "Lokasi Wisata Jolotundo",
"Alamat : Desa Jambeyan, Kecamatan Karanganom, Klaten.");
itemizedOverlay.addOverlay(overlayItem6);
GeoPoint point7 = new GeoPoint((int) (-7.720263 * 1E6),
(int) (110.560813 * 1E6));
OverlayItem overlayItem7 = new OverlayItem(point7, "Lokasi Wisata Museum Gula",
"Alamat : Kompleks Pabrik Gula Gondang Baru, Klaten.");
itemizedOverlay.addOverlay(overlayItem7);
(int) (110.626566 * 1E6));
OverlayItem overlayItem8 = new OverlayItem(point8, "Lokasi Wisata Rowo Jombor",
"Alamat : Desa Krakitan, Kecamatan Bayat, Klaten.");
itemizedOverlay.addOverlay(overlayItem8);
mapOverlays.add(itemizedOverlay);
final MapController mc = mapView.getController();
mc.animateTo(point1); mc.setZoom(16);
}
@Override
protected boolean isLocationDisplayed() {
return akuDimana.isMyLocationEnabled();
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
@Override
public void onResume() {
super.onResume();
akuDimana.enableMyLocation(); akuDimana.enableCompass();
}
@Override
public void onPause() {
super.onPause();
akuDimana.disableMyLocation(); akuDimana.disableCompass(); }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.jalan:
Toast.makeText(CokroMap.this, "Map dilihar berdasarkan jalan",
Toast.LENGTH_SHORT).show(); if (mapView.isSatellite() == true) {
}
return true;
case R.id.satelit:
Toast.makeText(CokroMap.this, "Map dilihat dari satelit",
Toast.LENGTH_SHORT).show(); if (mapView.isSatellite() == false) {
mapView.setSatellite(true); }
Balloon_overlay.xml :
<?xml version="1.0" encoding="utf-8"?> <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/balloon_main_layout"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/balloon_overlay_bg_selector" android:minWidth="200dip"
android:orientation="horizontal" android:paddingBottom="35dip" android:paddingLeft="10dip" android:paddingRight="0dip" android:paddingTop="0dip" > <LinearLayout
android:id="@+id/balloon_inner_layout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"
android:orientation="vertical" android:paddingTop="10dip" >
android:textColor="@android:color/primary_text_light" android:textSize="16dip" />
android:textColor="@android:color/secondary_text_light" android:textSize="12dip" />
</LinearLayout> <ImageView
android:paddingBottom="10dip" android:paddingLeft="10dip" android:paddingRight="8dip" android:paddingTop="8dip"
android:src="@drawable/balloon_overlay_close" /> </LinearLayout>
BalloonOverlayView.java :
package org.wisata.klaten;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.android.maps.OverlayItem;
public class BalloonOverlayView<Item extends OverlayItem>
extends FrameLayout {
private LinearLayout layout;
private TextView title;
private TextView snippet;
public BalloonOverlayView(Context context, int
balloonBottomOffset) {
super(context);
setPadding(10, 0, 10, balloonBottomOffset); layout = new LinearLayout(context);
layout.setVisibility(VISIBLE); setupView(context, layout);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.NO_GRAVITY;
addView(layout, params); }
protected void setupView(Context context, final ViewGroup
parent) {
LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.balloon_overlay, parent);
title = (TextView)
v.findViewById(R.id.balloon_item_title); snippet = (TextView)
ImageView close = (ImageView) v.findViewById(R.id.balloon_close);
close.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
parent.setVisibility(GONE); }
});
}
public void setData(Item item) {
layout.setVisibility(VISIBLE); setBalloonData(item, layout); }
protected void setBalloonData(Item item, ViewGroup parent) {
if (item.getTitle() != null) { title.setVisibility(VISIBLE); title.setText(item.getTitle()); } else {
title.setText("");
title.setVisibility(INVISIBLE); }
if (item.getSnippet() != null) { snippet.setVisibility(VISIBLE); snippet.setText(item.getSnippet()); } else {
snippet.setText("");
snippet.setVisibility(INVISIBLE); }
}
}
6. Halaman Menu Info
File xml :
<?xml version="1.0" encoding="utf-8"?> <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/cokroinfo"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center"
android:background="@drawable/bginfo" android:orientation="vertical" > <ViewFlipper
File Java :
package org.wisata.klaten;
import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.LinearLayout;
import android.widget.ViewFlipper;
public class CokroInfo extends Activity implements
OnTouchListener { ViewFlipper vf;
float nilai_axis_down_X;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cokroinfo);
LinearLayout layout_main = (LinearLayout) findViewById(R.id.cokroinfo);
layout_main.setOnTouchListener((OnTouchListener) this);
}
public boolean onTouch(View arg0, MotionEvent arg1) {
vf = (ViewFlipper) findViewById(R.id.flipcokroinfo);
switch (arg1.getAction()) {
case MotionEvent.ACTION_DOWN: {
nilai_axis_down_X = arg1.getX(); break;
}
case MotionEvent.ACTION_UP: {
float nilai_axis_current_X = arg1.getX();
if (nilai_axis_down_X > nilai_axis_current_X) { vf.setInAnimation(inFromRightAnimation()); vf.setOutAnimation(outToLeftAnimation()); vf.showNext();
}
if (nilai_axis_down_X < nilai_axis_current_X) { vf.setInAnimation(inFromLeftAnimation());
// for the previous movement
Animation inFromRight = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromRight.setDuration(350);
inFromRight.setInterpolator(new AccelerateInterpolator());
return inFromRight;
}
public static Animation outToLeftAnimation() {
Animation outtoLeft = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); outtoLeft.setDuration(350);
outtoLeft.setInterpolator(new AccelerateInterpolator());
return outtoLeft;
}
// for the next movement
public static Animation inFromLeftAnimation() {
Animation inFromLeft = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromLeft.setDuration(350);
inFromLeft.setInterpolator(new AccelerateInterpolator());
return inFromLeft;
}
public static Animation outToRightAnimation() {
Animation outtoRight = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); outtoRight.setDuration(350);
outtoRight.setInterpolator(new AccelerateInterpolator());
return outtoRight;