LAMPIRAN 1
LAMPIRAN 2 SCREENSHOOT
LAMPIRAN 3 LISTING
FILE JAVA CLASS 1. main_activity.java packagecom.example.sig.sigrs; import android.content.intent; import android.net.uri; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.imagebutton; import android.widget.toast; import com.example.sig.sigrs.controller.profilactivity; public class MainActivity extends AppCompatActivity { Button btn_navigasi; String goolgemap = "com.google.android.apps.maps"; // identitas package aplikasi google masps android Uri gmmintenturi; Intent mapintent; //String masjid_agung_demak = "-6.894649906672214,110.63718136399984"; // koordinat Masjid Agung Demak /*Deklarasi variable*/ protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); ImageButton BtnMap = (ImageButton) findviewbyid(r.id.btnmap); BtnMap.setOnClickListener(new View.OnClickListener() { public void onclick(view v) { Intent intent = new Intent(MainActivity.this, MapsActivity.class); startactivity(intent); ); ImageButton BtnList = (ImageButton) findviewbyid(r.id.btndaftar); BtnList.setOnClickListener(new View.OnClickListener() { public void onclick(view v) { Intent intent = new Intent(MainActivity.this,ProfilActivity.class); startactivity(intent); ); // menyamakan variable pada layout activity_main.xml ImageButton BtnNavigasi = (ImageButton) findviewbyid(r.id.btnnavigasi); BtnNavigasi.setOnClickListener(new View.OnClickListener() { public void onclick(view v) { mapintent = new Intent(Intent.ACTION_VIEW, gmmintenturi); mapintent.setpackage(goolgemap); if (mapintent.resolveactivity(getpackagemanager())!= null) { startactivity(mapintent); else { Toast.makeText(MainActivity.this, "Google Maps Belum Terinstal. Instal Terlebih Dahulu.", Toast.LENGTH_LONG).show(); );
2. maps_activity packagecom.example.sig.sigrs; import android.location.geocoder; import android.support.v4.app.fragmentactivity; import android.os.bundle; import android.view.view; import android.widget.edittext; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions; import java.io.ioexception; import java.util.list; public class MapsActivityextends FragmentActivity implements OnMapReadyCallback { private GoogleMap mmap; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_maps); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapfragment = (SupportMapFragment) getsupportfragmentmanager().findfragmentbyid(r.id.map); mapfragment.getmapasync(this); /** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ public void onmapready(googlemap googlemap) { mmap = googlemap; //Sungailiat LatLng Medikastania = new LatLng(-1.875537, 106.115175); mmap.addmarker(new MarkerOptions().position(Medikastania).title("RS. Medika Stania")); mmap.movecamera(cameraupdatefactory.newlatlng(medikastania)); LatLng Soekarno = new LatLng(-2.007774, 106.142479); mmap.addmarker(new MarkerOptions().position(Soekarno).title("RSUP Ir. Soekarno")); mmap.movecamera(cameraupdatefactory.newlatlng(soekarno)); LatLng rsj = new LatLng(-1.900125, 106.110821); mmap.addmarker(new MarkerOptions().position(rsj).title("RSJ Sungailiat")); mmap.movecamera(cameraupdatefactory.newlatlng(rsj)); LatLng rsudsungailiat = new LatLng(-1.88331, 106.139); mmap.addmarker(new MarkerOptions().position(rsudSungailiat).title("RSUD Sungailiat")); mmap.movecamera(cameraupdatefactory.newlatlng(rsudsungailiat));
LatLng Arsani = new LatLng(-1.92137, 106.118); mmap.addmarker(new MarkerOptions().position(Arsani).title("RS Arsani")); mmap.movecamera(cameraupdatefactory.newlatlng(arsani)); //Pangkalpinang LatLng rsbt = new LatLng(-2.23079, 106.135); mmap.addmarker(new MarkerOptions().position(rsbt).title("RS. Bakti Timah")); mmap.movecamera(cameraupdatefactory.newlatlng(rsbt)); LatLng DepatiHamzah = new LatLng(-2.2308, 106.135); mmap.addmarker(new MarkerOptions().position(DepatiHamzah).title("RS. Depati Hamzah")); mmap.movecamera(cameraupdatefactory.newlatlng(depatihamzah)); LatLng Muhaya = new LatLng(-2.112544, 106.112215); mmap.addmarker(new MarkerOptions().position(Muhaya).title("RS. Muhaya")); mmap.movecamera(cameraupdatefactory.newlatlng(muhaya)); LatLng Baktiwara = new LatLng(-2.143689, 106.098083); mmap.addmarker(new MarkerOptions().position(Baktiwara).title("RSK. Bakti Wara")); mmap.movecamera(cameraupdatefactory.newlatlng(baktiwara)); LatLng Intanmedika = new LatLng(-2.138532, 106.115698); mmap.addmarker(new MarkerOptions().position(Intanmedika).title("RS. Intan Medika")); mmap.movecamera(cameraupdatefactory.newlatlng(intanmedika)); LatLng dkt = new LatLng(-2.12541, 106.107126); mmap.addmarker(new MarkerOptions().position(dkt).title("RS. DKT")); mmap.movecamera(cameraupdatefactory.newlatlng(dkt)); LatLng Baznas = new LatLng(-2.108386, 106.123676); mmap.addmarker(new MarkerOptions().position(Baznas).title("Rumah Sehat Baznas")); mmap.movecamera(cameraupdatefactory.newlatlng(baznas)); LatLng Lani = new LatLng(-2.131725, 106.117199); mmap.addmarker(new MarkerOptions().position(Lani).title("RS Bersalin Lani")); mmap.movecamera(cameraupdatefactory.newlatlng(lani)); //Bangka Barat LatLng Sejiransetason = new LatLng(-2.054612, 105.220401); mmap.addmarker(new MarkerOptions().position(Sejiransetason).title("RS. Sejiran Setason")); mmap.movecamera(cameraupdatefactory.newlatlng(sejiransetason)); //Belitung LatLng Almah = new LatLng(-2.86246, 107.939); mmap.addmarker(new MarkerOptions().position(Almah).title("RS. Almah")); mmap.movecamera(cameraupdatefactory.newlatlng(almah)); LatLng Manggar = new LatLng(-2.879631, 108.233876); mmap.addmarker(new MarkerOptions().position(Manggar).title("RSUD Manggar")); mmap.movecamera(cameraupdatefactory.newlatlng(manggar)); LatLng TanjungPandan = new LatLng(-2.671135, 107.68456); mmap.addmarker(new MarkerOptions().position(TanjungPandan).title("RSUD Tanjung Pandan")); mmap.movecamera(cameraupdatefactory.newlatlng(tanjungpandan)); //Bangka Tengah LatLng Koba = new LatLng(-2.512492, 106.413163); mmap.addmarker(new MarkerOptions().position(Koba).title("RSUD Koba")); mmap.movecamera(cameraupdatefactory.newlatlng(koba)); LatLng Siloam = new LatLng(-2.225044, 106.099711); mmap.addmarker(new MarkerOptions().position(Siloam).title("RS. Siloam")); mmap.movecamera(cameraupdatefactory.newlatlng(siloam));
//Bangka Selatan LatLng Toboali = new LatLng(-2.969731, 106.4725); mmap.addmarker(new MarkerOptions().position(Toboali).title("RSUD Toboali")); mmap.movecamera(cameraupdatefactory.newlatlng(toboali)); public void onsearch(view view ) { EditText Location_tf = (EditText) findviewbyid(r.id.tfadress); String location = Location_tf.getText().toString(); List<android.location.Address> addresslist=null; if(location!= null!location.equals("")) { Geocoder geocoder = new Geocoder(this); try { addresslist = geocoder.getfromlocationname(location, 1); catch (IOException e) { e.printstacktrace(); android.location.address address = addresslist.get(0); LatLng latlng = new LatLng(address.getLatitude(), address.getlongitude()); mmap.addmarker(new MarkerOptions().position(latLng).title("Location")); mmap.animatecamera(cameraupdatefactory.newlatlng(latlng)); 3. profil_activity.java packagecom.example.sig.sigrs.controller; import android.app.progressdialog; import android.os.bundle; import android.support.v4.widget.swiperefreshlayout; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.linearlayoutmanager; import android.support.v7.widget.recyclerview; import android.util.log; import android.view.view; import android.widget.textview; import android.widget.toast; import com.example.sig.sigrs.itemadapter; import com.example.sig.sigrs.r; import com.example.sig.sigrs.api.client; import com.example.sig.sigrs.api.service; import com.example.sig.sigrs.model.item; import com.example.sig.sigrs.model.itemresponse; import java.util.list; import retrofit2.call; import retrofit2.callback; import retrofit2.response; public class ProfilActivity extends AppCompatActivity { private RecyclerView recyclerview; TextView Disconnected; private Item item; ProgressDialog pd; private SwipeRefreshLayout swipecontainer;
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_profil); initviews(); swipecontainer = (SwipeRefreshLayout) findviewbyid(r.id.swipecontainer); swipecontainer.setcolorschemeresources(android.r.color.holo_orange_dark); swipecontainer.setonrefreshlistener(new SwipeRefreshLayout.OnRefreshListener(){ public void onrefresh(){ loadjson(); Toast.makeText(ProfilActivity.this, "Rumah Sakit", Toast.LENGTH_SHORT).show(); ); private void initviews(){ pd = new ProgressDialog(this); pd.setmessage("mengambil Data RS..."); pd.setcancelable(false); pd.show(); recyclerview = (RecyclerView) findviewbyid(r.id.recyclerview); recyclerview.setlayoutmanager(new LinearLayoutManager(getApplicationContext())); recyclerview.smoothscrolltoposition(0); loadjson(); private void loadjson(){ Disconnected = (TextView) findviewbyid(r.id.disconnected); try{ Client client= new Client(); Service apiservice = Client.getClient().create(Service.class); Call<ItemResponse> call = apiservice.getitems(); call.enqueue(new Callback<ItemResponse>() { public void onresponse(call<itemresponse> call, Response<ItemResponse> response) { List<Item> items = response.body().getitems(); recyclerview.setadapter(new ItemAdapter(getApplicationContext(), items)); recyclerview.smoothscrolltoposition(0); swipecontainer.setrefreshing(false); pd.hide(); public void onfailure(call<itemresponse> call, Throwable t) { Log.d("Error", t.getmessage()); Toast.makeText(ProfilActivity.this, "Error Fetching Data!", Toast.LENGTH_SHORT).show(); Disconnected.setVisibility(View.VISIBLE); pd.hide(); ); catch (Exception e){ Log.d("Error", e.getmessage()); Toast.makeText(this, e.tostring(), Toast.LENGTH_SHORT).show();
4. detail_activity.java packagecom.example.sig.sigrs.controller; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.widget.imageview; import android.widget.textview; import com.bumptech.glide.glide; import com.example.sig.sigrs.r; public class DetailActivity extends AppCompatActivity { TextView nama, alamat, profil; ImageView imageview; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_detail); getsupportactionbar().setdisplayhomeasupenabled(true); imageview = (ImageView) findviewbyid(r.id.user_image_header); nama = (TextView) findviewbyid(r.id.headernama); alamat = (TextView) findviewbyid(r.id.alamat); profil = (TextView) findviewbyid(r.id.profilrs); String Nama = getintent().getextras().getstring("nama"); String Alamat = getintent().getextras().getstring("alamat"); String Profil = getintent().getextras().getstring("profil"); String Gambar = getintent().getextras().getstring("gambar"); nama.settext(nama); alamat.settext(alamat); profil.settext(profil); Glide.with(this).load(Gambar).placeholder(R.drawable.load).into(imageView); getsupportactionbar().settitle("details Activity"); /* private Intent creareshareforecastintent(){ String Nama = getintent().getextras().getstring("nama"); String Alamat = getintent().getextras().getstring("alamat"); String Profil = getintent().getextras().getstring("profil"); Intent shareintent = ShareCompat.IntentBuilder.from(this).setType("text/plain") */ public boolean oncreateoptionsmenu(menu menu ){ MenuInflater inflater = getmenuinflater(); inflater.inflate(r.menu.detail, menu); MenuItem menuitem = menu.finditem(r.id.action_share); return true;
5. item_adapter.java packagecom.example.sig.sigrs; import android.content.context; import android.content.intent; import android.support.v7.widget.recyclerview; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.imageview; import android.widget.textview; import android.widget.toast; import com.example.sig.sigrs.controller.detailactivity; import com.example.sig.sigrs.model.item; import com.squareup.picasso.picasso; import java.util.list; public class ItemAdapter extends RecyclerView.Adapter<ItemAdapter.ViewHolder> { private List<Item>items; private Context context; public ItemAdapter(Context applicationcontext, List<Item> itemarraylist) { this.context = applicationcontext; this.items = itemarraylist; public ItemAdapter.ViewHolder oncreateviewholder(viewgroup viewgroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.row_user, viewgroup, false); return new ViewHolder(view); public void onbindviewholder(itemadapter.viewholder viewholder, int i) { viewholder.nama.settext(items.get(i).getnama()); viewholder.alamat.settext(items.get(i).getalamat()); viewholder.profil.settext(items.get(i).getprofil()); Picasso.with(context).load(items.get(i).getGambar()).placeholder(R.drawable.load).into(viewHolder.imageView); public int getitemcount() { return items.size(); public class ViewHolder extends RecyclerView.ViewHolder { private TextView nama, Alamat, Profil; private ImageView imageview; public ViewHolder(View view) { super(view); nama = (TextView) view.findviewbyid(r.id.nama); Alamat = (TextView) view.findviewbyid(r.id.alamat); Profil = (TextView) view.findviewbyid(r.id.profil); imageview = (ImageView) view.findviewbyid(r.id.cover); //on item itemview.setonclicklistener(new View.OnClickListener() {
public void onclick(view v) { int pos = getadapterposition(); if (pos!= RecyclerView.NO_POSITION) { Item clickeddataitem = items.get(pos); Intent intent = new Intent(context, DetailActivity.class); intent.putextra("nama", items.get(pos).getnama()); intent.putextra("alamat", items.get(pos).getalamat()); intent.putextra("profil", items.get(pos).getprofil()); intent.putextra("gambar", items.get(pos).getgambar()); intent.addflags(intent.flag_activity_new_task); context.startactivity(intent); Toast.makeText(v.getContext(), "Kamu Memilih" + clickeddataitem.getnama(), Toast.LENGTH_SHORT).show(); ); 6. item_response.java packagecom.example.sig.sigrs.model; import com.google.gson.annotations.expose; import com.google.gson.annotations.serializedname; import java.util.list; /** * Created by destyyani on 7/11/17. */ public class ItemResponse { @SerializedName("items") @Expose private List<Item>items; public List<Item> getitems(){ return items; public void setitems(list<item>items){ this.items = items; 7. item.java packagecom.example.sig.sigrs.model; import com.google.gson.annotations.expose; import com.google.gson.annotations.serializedname; /** * Created by destyyani on 7/11/17. */ public class Item { @SerializedName("Nama") @Expose private String Nama; @SerializedName("Alamat") @Expose private String Alamat; @SerializedName("Profil") @Expose private String Profil;
@SerializedName("Gambar") @Expose private String Gambar; public Item(String Nama, String Alamat, String Profil, String Gambar){ this.nama = Nama; this.alamat = Alamat; this.profil = Profil; this.gambar = Gambar; public String getnama(){ return Nama; public void setnama(string Nama){ this.nama = Nama; public String getalamat(){ return Alamat; public void setalamat(string Alamat){ this.alamat = Alamat; public String getprofil(){ return Profil; public void setprofil(string Profil){ this.profil = Profil; public String getgambar(){ return Gambar; public void setgambar(string Gambar){ this.gambar = Gambar; 8. service.java packagecom.example.sig.sigrs.api; import com.example.sig.sigrs.model.itemresponse; import retrofit2.call; import retrofit2.http.get; /** * Created by destyyani on 7/11/17. */ public interface Service { @GET("/getdata.php?Kode_RS") Call<ItemResponse> getitems();
9. client.java packagecom.example.sig.sigrs.api; import retrofit2.retrofit; import retrofit2.converter.gson.gsonconverterfactory; /** * Created by destyyani on 7/11/17. */ public class Client { public static final String BASE_URL = "https://sigrs.000webhostapp.com"; public static Retrofit retrofit = null; public static Retrofit getclient(){ if (retrofit==null){ retrofit = new Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create()).build(); return retrofit;
FILE.XML 1. Activity_main.xml <?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" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.example.sig.sigrs.mainactivity" android:background="#ffffff" android:contextclickable="false"> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/btndaftar" android:src="@drawable/list" android:baselinealignbottom="true" android:adjustviewbounds="true" android:background="#ffffff" android:layout_above="@+id/btnmap" android:layout_centerhorizontal="true" android:layout_marginbottom="35dp" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/btnmap" android:src="@drawable/map" android:croptopadding="true" android:background="#ffffff" android:layout_centervertical="true" android:layout_centerhorizontal="true" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/btnnavigasi" android:src="@drawable/navigasi" android:croptopadding="true" android:background="#ffffff" android:layout_below="@+id/btnmap" android:layout_alignleft="@+id/btndaftar" android:layout_alignstart="@+id/btndaftar" /> </RelativeLayout> 2. Activity_maps.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"> <EditText android:layout_width="450dp" android:layout_height="wrap_content" android:id="@+id/tfadress" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="search" android:id="@+id/bsearch" android:layout_gravity="right" android:onclick="onsearch" /> </LinearLayout> <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/map" android:name="com.google.android.gms.maps.supportmapfragment" android:layout_width="wrap_content" android:layout_height="wrap_content" tools:context="com.example.sig.sigrs.mapsactivity" tools:layout="@layout/abc_action_bar_title_item"/> </LinearLayout> 3. Activity Profil.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.swiperefreshlayout 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:id="@+id/swipecontainer"> <android.support.v7.widget.recyclerview android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="match_parent" tools:showin="@layout/activity_profil" android:backgroundtint="#f2f2f2" tools:context=".controller.profilactivity"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/disconnected" android:text="@string/internet" android:textstyle="bold" android:textsize="14sp"/> </android.support.v4.widget.swiperefreshlayout> 4. Activity_Detail.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView
android:layout_width="match_parent" android:layout_height="250dp" android:id="@+id/user_image_header" android:fitssystemwindows="true" android:scaletype="fitxy"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/headernama" android:layout_marginleft="10dp" android:textalignment="center" android:layout_margintop="10dp" android:textstyle="bold" android:textsize="20dp" android:layout_below="@+id/user_image_header"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/alamat" android:layout_marginleft="10dp" android:textsize="14dp" android:textalignment="center" android:layout_margintop="10dp" android:layout_below="@+id/headernama"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/profilrs" android:layout_marginleft="10dp" android:textsize="14dp" android:textalignment="center" android:layout_margintop="20dp" android:layout_below="@+id/alamat"/> </RelativeLayout> 5. Row_user.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.cardview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="150dp" android:layout_margintop="10dp" android:layout_marginleft="10dp" android:layout_marginright="10dp" android:clickable="true" android:focusable="true" android:elevation="60dp" android:foreground="?android:attr/selectableitembackground"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:layout_width="100dp" android:layout_height="100dp" android:id="@+id/cover" android:layout_marginleft="20dp" android:layout_margintop="10dp" android:scaletype="fitxy"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="rumah Sakit" android:id="@+id/nama" android:layout_torightof="@+id/cover" android:layout_marginleft="20dp" android:layout_margintop="5dp" android:textappearance="?android:textappearancemedium" android:textstyle="bold"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="alamat" android:id="@+id/alamat" android:layout_torightof="@+id/cover" android:layout_marginleft="20dp" android:layout_margintop="5dp" android:layout_below="@+id/nama" android:textappearance="?android:textappearancesmall" android:textstyle="italic"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="profil" android:id="@+id/profil" android:layout_torightof="@+id/cover" android:layout_marginleft="20dp" android:layout_margintop="5dp" android:layout_below="@+id/alamat" android:textsize="12dp" android:textstyle="normal"/> </RelativeLayout> </android.support.v7.widget.cardview>