• Tidak ada hasil yang ditemukan

Aplikasi Transfusi dan Donor Darah Berbasis Android

N/A
N/A
Protected

Academic year: 2017

Membagikan "Aplikasi Transfusi dan Donor Darah Berbasis Android"

Copied!
107
0
0

Teks penuh

(1)

Android Manifest.Xml

<?xml version="1.0" encoding="utf-8"?> <manifest

xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.root.bloodjobs">

<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CALL_PHONE" />

<supports-screens>

android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" </supports-screens>

<application

android:allowBackup="true" android:icon="@drawable/darah" android:label="@string/app_name" android:supportsRtl="true"

android:theme="@style/AppTheme">

<activity android:name=".SplashScreen"> <intent-filter>

<action android:name="android.intent.action.MAIN" />

<category

android:name="android.intent.category.LAUNCHER" /> </intent-filter>

</activity>

<activity android:name=".Home" /> <activity

android:name=".Daftar"

(2)

android:name=".login"

android:screenOrientation="portrait" /> <activity android:name=".HomeRelawan" /> <activity

android:name=".Donor"

android:label="@string/title_activity_donor" android:theme="@style/AppTheme" />

<activity android:name=".profil" />

<activity android:name=".kontak_relawan" /> <activity android:name=".Bdarah" /> <activity android:name=".khemoglobin" /> <activity android:name=".krhesus" /> <activity android:name=".kplasma" />

<activity android:name=".kseldarahmerah" /> <activity android:name=".kseldarahputih" /> <activity android:name=".ktransfusi" /> <activity android:name=".kdonor" />

<activity android:name=".google"></activity> </application>

</manifest>

Activity_awal.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"

(3)

android:layout_width="match_parent" android:layout_height="match_parent"

tools:context="com.example.root.bloodjobs.Awal">

<android.support.v4.view.ViewPager android:id="@+id/view_pager"

android:layout_width="match_parent" android:layout_height="match_parent" />

<LinearLayout

android:id="@+id/layoutDots"

android:layout_width="match_parent"

android:layout_height="@dimen/dots_height" android:layout_alignParentBottom="true"

android:layout_marginBottom="@dimen/dots_bottom_margin" android:gravity="center"

android:orientation="horizontal"></LinearLayout>

<View

android:layout_width="match_parent" android:layout_height="1dp"

android:alpha=".5"

android:layout_above="@id/layoutDots" android:background="#100b0b" />

<Button

android:id="@+id/btn_next"

android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:background="@null"

android:text="@string/next" android:textStyle="bold"

(4)

<Button

android:id="@+id/btn_skip"

android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:background="@null"

android:text="@string/skip" android:textStyle="bold"

android:onClick="btnSkipClick" android:textColor="#161515" />

</RelativeLayout>

awal.java

package com.example.root.bloodjobs;

import android.content.Context; import android.content.Intent; import android.os.Bundle;

import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager;

import android.support.v7.app.AppCompatActivity; import android.text.Html;

import android.view.LayoutInflater; import android.view.View;

import android.view.ViewGroup; import android.widget.Button;

import android.widget.LinearLayout; import android.widget.TextView;

public class Awal extends AppCompatActivity {

(5)

private ViewPagerAdapter viewPagerAdapter; private LinearLayout dotsLayout;

private TextView[] dots; private int[] layouts;

private Button btnSkip, btnNext;

@Override

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setContentView(R.layout.activity_awal);

viewPager = (ViewPager) findViewById(R.id.view_pager); dotsLayout = (LinearLayout) findViewById(R.id.layoutDots); btnSkip = (Button) findViewById(R.id.btn_skip);

btnNext = (Button) findViewById(R.id.btn_next);

layouts = new int[]{

R.layout.activity_layar1, R.layout.activity_layar2};

// adding bottom dots addBottomDots(0);

viewPagerAdapter = new ViewPagerAdapter(); viewPager.setAdapter(viewPagerAdapter);

viewPager.addOnPageChangeListener(viewPagerPageChangeListener);

}

public void btnSkipClick(View v) {

(6)

public void btnNextClick(View v) {

// checking for last page

// if last page home screen will be launched int current = getItem(1);

if (current < layouts.length) { // move to next screen

viewPager.setCurrentItem(current); } else {

launchHomeScreen(); }

}

ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {

@Override

public void onPageSelected(int position) { addBottomDots(position);

// changing the next button text 'NEXT' / 'GOT IT' if (position == layouts.length - 1) {

// last page. make button text to GOT IT btnNext.setText(getString(R.string.Start)); btnSkip.setVisibility(View.GONE);

} else {

// still pages are left

btnNext.setText(getString(R.string.next)); btnSkip.setVisibility(View.VISIBLE);

} }

@Override

(7)

}

@Override

public void onPageScrollStateChanged(int arg0) {

} };

private void addBottomDots(int currentPage) { dots = new TextView[layouts.length];

dotsLayout.removeAllViews();

for (int i = 0; i < dots.length; i++) { dots[i] = new TextView(this);

dots[i].setText(Html.fromHtml("&#8226;")); dots[i].setTextSize(35);

dots[i].setTextColor(getResources().getColor(R.color.dot_inactive) );

dotsLayout.addView(dots[i]); }

if (dots.length > 0)

dots[currentPage].setTextColor(getResources().getColor(R.color.dot

_active));

}

private int getItem(int i) {

return viewPager.getCurrentItem() + i; }

private void launchHomeScreen() {

(8)

}

public class ViewPagerAdapter extends PagerAdapter { private LayoutInflater layoutInflater;

public ViewPagerAdapter() {

}

@Override

public Object instantiateItem(ViewGroup container, int position) {

layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

View view = layoutInflater.inflate(layouts[position], container, false);

container.addView(view);

return view; }

@Override

public int getCount() { return layouts.length; }

@Override

public boolean isViewFromObject(View view, Object obj) { return view == obj;

}

@Override

(9)

View view = (View) object; container.removeView(view); }

} }

Bdarah.java

package com.example.root.bloodjobs;

import android.content.Intent; import android.graphics.Paint;

import android.support.v7.app.AppCompatActivity; import android.os.Bundle;

import android.view.View;

import android.widget.TextView;

public class Bdarah extends AppCompatActivity {

TextView tvsk;

@Override

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setContentView(R.layout.activity_bdarah);

tvsk = (TextView)findViewById(R.id.sk);

tvsk.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG); }

public void bdarah (View view){

Intent intent = new Intent(Bdarah.this,skbdarah.class); startActivity(intent);

} }

(10)

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout

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:id="@+id/activity_daftar"

android:layout_width="match_parent" android:layout_height="match_parent"

tools:context="com.example.root.bloodjobs.Daftar" android:weightSum="1">

<ScrollView

android:layout_width="match_parent" android:layout_height="match_parent">

<LinearLayout

android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">

<FrameLayout

android:layout_width="match_parent" android:layout_height="200dp"

android:background="#e20514"

android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:id="@+id/frameLayout">

<ImageView

android:layout_width="match_parent" android:layout_height="150dp"

android:gravity="center"

android:layout_marginTop="10dp" android:src="@drawable/newsplashi"/> </FrameLayout>

(11)

android:background="#ffffff"

android:layout_width="match_parent" android:layout_height="match_parent" >

<LinearLayout

android:layout_marginLeft="20dp" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">

<TextView

android:text="BIODATA DIRI" android:layout_gravity="center" android:textAlignment="center" android:textStyle="bold"

android:textColor="#000" android:textSize="25dp"

android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/textView" />

<EditText

android:layout_marginTop="20dp" android:textColorHint="#c31720" android:layout_width="match_parent" android:layout_height="match_parent" android:inputType="textPersonName" android:ems="10"

android:textColor="#000" android:shadowColor="#000"

android:layout_marginRight="30dp" android:id="@+id/edtnama"

android:hint="Nama Lengkap" />

(12)
(13)

android:maxLength="8"

android:inputType="date" /> <LinearLayout

android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText

android:layout_marginTop="4dp" android:textColor="#000"

android:textColorHint="#c31720" android:shadowColor="#000" android:layout_width="100dp"

android:layout_height="wrap_content" android:id="@+id/edtusia"

android:hint="Usia"

android:inputType="number" android:maxLength="3" /> <TextView

android:layout_width="match_parent" android:textSize="20dp"

android:textStyle="bold"

android:layout_marginLeft="10dp" android:paddingTop="10dp"

android:textColor="#000000"

(14)

android:id="@+id/edtrhesus" android:hint="Rhesus +/-" android:maxLength="5" />

<EditText

android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10"

android:textColorHint="#c31720" android:id="@+id/edtgoldar" android:hint="Golongan darah" android:maxLength="3"

android:inputType="text" />

<EditText

android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textEmailAddress" android:ems="10"

android:textColorHint="#c31720" android:id="@+id/edtemail" android:hint="Email" />

<EditText

android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPassword" android:ems="10"

android:textColorHint="#c31720" android:id="@+id/edtpassword" android:hint="Password" />

<TextView

android:text="KONTAK"

(15)
(16)

android:inputType="textPersonName" />

<EditText

android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10"

android:textColorHint="#c31720" android:id="@+id/edtbbm"

android:hint="Blackberry Massager" android:inputType="textLongMessage" />

<EditText

android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10"

android:textColorHint="#c31720" android:id="@+id/edtlain"

android:hint="Lainnya"

android:inputType="textLongMessage" />

<TextView

android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Syarat dan Ketentuan" android:onClick="bdarah"

android:id="@+id/sk"

android:layout_marginTop="10dp" android:layout_gravity="center" android:textColor="#c31922" android:textStyle="bold"/>

<Button

android:layout_marginTop="20dp" android:text="Daftar"

(17)

android:background="#c31720" android:textStyle="bold"

android:layout_marginBottom="5dp" android:layout_marginRight="60dp" android:layout_marginLeft="60dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/btndaftar"

android:textColorHint="#c31720" android:onClick="daftar" />

</LinearLayout> </FrameLayout> <FrameLayout

android:layout_width="match_parent" android:layout_height="70dp"

android:background="#e20716" android:layout_weight="1"

android:layout_marginTop="10dp"

android:layout_alignParentBottom="true" android:layout_alignParentStart="true" android:id="@+id/frameLayout2">

<ImageView

android:layout_width="170dp"

android:layout_height="match_parent" android:layout_gravity="left"

android:src="@drawable/newbg1"/>

<ImageView

android:layout_width="150dp"

android:layout_height="match_parent" android:src="@drawable/pm"

android:layout_gravity="right"/> </FrameLayout>

(18)

</ScrollView> </RelativeLayout>

Daftar.java

package com.example.root.bloodjobs;

import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle;

import android.os.Handler;

import android.support.v7.app.AppCompatActivity; import android.view.View;

import android.widget.Button; import android.widget.EditText; import android.widget.TextView;

public class Daftar extends AppCompatActivity {

TextView textView,textView2,textView9,sk;

EditText

edtnama,edtalamat,edtjk,edttgl,edtusia,edtnotelp,edtrhesus,edtgold ar

,edtemail,edtpassword,edtline,edtwa,edtbbm,edtlain; Button btndaftar;

String

snama,salamat,sjk,stgl,susia,snotelp,srhesus,sgoldar,semail,spassw ord,sline,swa,sbbm,slain;

@Override

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setContentView(R.layout.activity_daftar);

(19)

edtjk=(EditText)findViewById(R.id.edtjk); edttgl=(EditText)findViewById(R.id.edttgl); edtusia=(EditText)findViewById(R.id.edtusia); edtnotelp=(EditText)findViewById(R.id.edtnotelp); edtrhesus=(EditText)findViewById(R.id.edtrhesus); edtgoldar=(EditText)findViewById(R.id.edtgoldar); edtemail=(EditText)findViewById(R.id.edtemail);

edtpassword=(EditText)findViewById(R.id.edtpassword); edtline=(EditText)findViewById(R.id.edtline);

edtwa=(EditText)findViewById(R.id.edtwa); edtbbm=(EditText)findViewById(R.id.edtbbm); edtlain=(EditText)findViewById(R.id.edtlain); btndaftar=(Button)findViewById(R.id.btndaftar);

String customFont = "Alegreya.ttf"; String customBold ="Alegreya-Bold.ttf";

Typeface typeface = Typeface.createFromAsset(getAssets(), customFont);

Typeface typeface1 = Typeface.createFromAsset(getAssets(), customBold);

textView=(TextView)findViewById(R.id.textView); textView.setTypeface(typeface1);

textView2=(TextView)findViewById(R.id.textView2); textView2.setTypeface(typeface1);

textView9=(TextView)findViewById(R.id.textView9); textView9.setTypeface(typeface1);

sk=(TextView)findViewById(R.id.sk); sk.setTypeface(typeface1);

(20)

public void daftar (View view){

snama=edtnama.getText().toString(); salamat=edtalamat.getText().toString(); sjk=edtjk.getText().toString();

stgl=edttgl.getText().toString(); susia=edtusia.getText().toString(); snotelp=edtnotelp.getText().toString(); srhesus=edtrhesus.getText().toString(); sgoldar=edtgoldar.getText().toString(); semail=edtemail.getText().toString();

spassword=edtpassword.getText().toString(); sline=edtline.getText().toString();

swa=edtwa.getText().toString(); sbbm=edtline.getText().toString(); slain=edtlain.getText().toString();

String method ="register";

Proses proses = new Proses(this);

proses.execute(method,snama,salamat,sjk,stgl,susia,snotelp,srhesus ,sgoldar,semail,

spassword,sline,swa,sbbm,slain); }

boolean doubleBackToExitPressedOnce = false; @Override

public void onBackPressed() {

if (doubleBackToExitPressedOnce) {

Intent intent = new Intent(Daftar.this,HomeRelawan.class); startActivity(intent);

return; }

(21)

public void run() {

doubleBackToExitPressedOnce = false; }

}, 2000); }

public void bdarah (View view){

Intent intent = new Intent(Daftar.this,skbdarah.class); startActivity(intent);

} }

Activity_donor.xml

<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout

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:id="@+id/drawer_layout"

android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:openDrawer="start">

<include

layout="@layout/app_bar_donor" android:layout_width="match_parent" android:layout_height="match_parent" />

<android.support.design.widget.NavigationView android:id="@+id/nav_view"

android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start"

android:fitsSystemWindows="true"

(22)

app:menu="@menu/activity_donor_drawer" />

</android.support.v4.widget.DrawerLayout>

Donor.java

package com.example.root.bloodjobs;

import android.content.Intent; import android.os.Bundle;

import android.support.design.widget.NavigationView; import android.support.v4.app.FragmentManager;

import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout;

import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar;

import android.view.Menu; import android.view.MenuItem;

public class Donor extends AppCompatActivity

implements NavigationView.OnNavigationItemSelectedListener {

NavigationView navigationView = null; Toolbar toolbar = null;

@Override

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setContentView(R.layout.activity_donor);

//set initial fragment

(23)

android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager() .beginTransaction();

fragmentTransaction.replace(R.id.content_donor,tampilanContent); fragmentTransaction.commit();

toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);

ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);

drawer.setDrawerListener(toggle); toggle.syncState();

navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }

@Override

public void onBackPressed() {

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);

if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else {

finish(); }

}

@Override

public boolean onCreateOptionsMenu(Menu menu) {

(24)

getMenuInflater().inflate(R.menu.donor, menu); return true;

}

@Override

public boolean onOptionsItemSelected(MenuItem item) {

// Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId();

//noinspection SimplifiableIfStatement if (id == R.id.action_settings) {

Intent intent = new Intent(Donor.this,Daftar.class); startActivity(intent);

}

return super.onOptionsItemSelected(item); }

@SuppressWarnings("StatementWithEmptyBody") @Override

public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here.

int id = item.getItemId();

if (id == R.id.nav_donor) {

DonorDarah donorDarah = new DonorDarah();

FragmentManager manager = getSupportFragmentManager();

manager.beginTransaction().replace(R.id.content_donor,donorDarah,d onorDarah.getTag()).commit();

} else if (id == R.id.nav_transfusi) { Transfusi transfusi = new Transfusi();

FragmentManager manager = getSupportFragmentManager();

(25)

ansfusi.getTag()).commit();

} else if (id == R.id.nav_about) { tentang tentang = new tentang();

FragmentManager manager = getSupportFragmentManager();

manager.beginTransaction().replace(R.id.content_donor,tentang,tent ang.getTag()).commit();

} else if (id == R.id.nav_kontak) { kontak kontak = new kontak();

FragmentManager manager = getSupportFragmentManager();

manager.beginTransaction().replace(R.id.content_donor,kontak,konta k.getTag()).commit();

} else if (id == R.id.nav_goldar) {

tampilanContent tampilanContent = new tampilanContent(); FragmentManager manager = getSupportFragmentManager();

manager.beginTransaction().replace(R.id.content_donor,tampilanCont ent,tampilanContent.getTag()).commit();

} else if (id == R.id.nav_kamus) {

Intent intent = new Intent(Donor.this,kamus.class); startActivity(intent);

}

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);

drawer.closeDrawer(GravityCompat.START); return true;

}

}

(26)

<RelativeLayout

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"

tools:context="com.example.root.bloodjobs.DonorDarah">

<ScrollView

android:layout_width="match_parent" android:layout_height="match_parent">

(27)

android:id="@+id/textView4" /> membuat darah mengalir lebih lancar"

(28)

<TextView

android:layout_marginRight="20dp" android:layout_marginLeft="10dp" android:text="3.Mengecek kesehatan" android:textSize="15dp"

android:textColor="#000"

android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/txtm3" />

<TextView

android:layout_marginRight="20dp" android:layout_marginLeft="10dp" android:text="4.Memperpanjang usia" android:textSize="15dp"

android:textColor="#000"

android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/txtm4" />

<TextView

android:layout_marginRight="20dp" android:layout_marginLeft="10dp"

android:text="5.Membantu menyelamatkan nyawa orang yang membutuhkan darah"

android:textSize="15dp" android:textColor="#000"

android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/txtm5" />

<FrameLayout

(29)
(30)
(31)
(32)

android:layout_marginLeft="10dp"

android:text="8.Selesai (pulang), dan bisa kembali menyumbangkan darahnya setelah 75 hari(2,5 bulan)"

android:textSize="15dp" android:textColor="#000"

android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/txtme8" />

<TextView

android:layout_marginRight="20dp" android:layout_marginLeft="10dp"

android:text="Syarat Dasar Donor Darah" android:textSize="20dp"

android:textColor="#000"

android:layout_marginTop="25dp" android:textStyle="bold"

android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/textView6" />

<TextView

android:layout_marginRight="20dp" android:layout_marginLeft="10dp"

android:text="1.Usia minimal 17 tahun" android:textSize="15dp"

android:textColor="#000"

android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/txts1" />

<TextView

(33)
(34)

minimal 12 gram%, pria minimal 13 gram%" android:textSize="15dp" android:textColor="#000"

android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/txts5" />

<FrameLayout

android:layout_width="match_parent" android:layout_height="40dp"

android:layout_marginTop="30dp" android:background="#d22229">

<ImageView

android:layout_width="match_parent" android:layout_marginTop="3dp" android:layout_marginBottom="3dp" android:layout_height="wrap_content" android:src="@drawable/logo"/>

</FrameLayout> </LinearLayout> </ScrollView> </RelativeLayout>

DonorDarah.java

package com.example.root.bloodjobs;

import android.graphics.Typeface; import android.os.Bundle;

import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View;

(35)

import android.widget.TextView;

/**

* A simple {@link Fragment} subclass. */

public class DonorDarah extends Fragment {

public DonorDarah() {

// Required empty public construct }

@Override

public View onCreateView(LayoutInflater inflater, ViewGroup container,

Bundle savedInstanceState) {

View view = inflater.inflate(R.layout.fragment_donor_darah, container, false);

Typeface myTypeface =

Typeface.createFromAsset(getActivity().getAssets(), "Alegreya.ttf");

Typeface myTypeface1 =

Typeface.createFromAsset(getActivity().getAssets(), "Alegreya-Bold.ttf");

TextView tv = (TextView) view.findViewById(R.id.textView4); tv.setTypeface(myTypeface);

TextView tv1 = (TextView) view.findViewById(R.id.textView5); tv1.setTypeface(myTypeface1);

TextView tv61 = (TextView) view.findViewById(R.id.textView61); tv61.setTypeface(myTypeface1);

(36)

TextView tme2 = (TextView) view.findViewById(R.id.txtme2); tme2.setTypeface(myTypeface);

TextView tme3 = (TextView) view.findViewById(R.id.txtme3); tme3.setTypeface(myTypeface);

TextView tme4 = (TextView) view.findViewById(R.id.txtme4); tme4.setTypeface(myTypeface);

TextView tme5 = (TextView) view.findViewById(R.id.txtme5); tme5.setTypeface(myTypeface);

TextView tme6 = (TextView) view.findViewById(R.id.txtme6); tme6.setTypeface(myTypeface);

TextView tme7 = (TextView) view.findViewById(R.id.txtme7); tme7.setTypeface(myTypeface);

TextView tme8 = (TextView) view.findViewById(R.id.txtme8); tme8.setTypeface(myTypeface);

TextView tv2 = (TextView) view.findViewById(R.id.txtm1); tv2.setTypeface(myTypeface);

TextView tv3 = (TextView) view.findViewById(R.id.txtm2); tv3.setTypeface(myTypeface);

TextView tv4 = (TextView) view.findViewById(R.id.txtm3); tv4.setTypeface(myTypeface);

TextView tv5 = (TextView) view.findViewById(R.id.txtm4); tv5.setTypeface(myTypeface);

TextView tv6 = (TextView) view.findViewById(R.id.txtm5); tv6.setTypeface(myTypeface);

TextView tv7 = (TextView) view.findViewById(R.id.textView6); tv7.setTypeface(myTypeface1);

(37)

TextView tv9 = (TextView) view.findViewById(R.id.txts2); tv9.setTypeface(myTypeface);

TextView tv10 = (TextView) view.findViewById(R.id.txts3); tv10.setTypeface(myTypeface);

TextView tv11 = (TextView) view.findViewById(R.id.txts4); tv11.setTypeface(myTypeface);

TextView tv12 = (TextView) view.findViewById(R.id.txts5); tv12.setTypeface(myTypeface);

return view; }

}

Activity_home.xml

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout

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:id="@+id/activity_home"

android:layout_width="match_parent" android:layout_height="match_parent" android:background="#e20514"

tools:context="com.example.root.bloodjobs.Home">

<FrameLayout

android:layout_width="match_parent" android:layout_height="200dp"

android:elevation="4dp"

(38)

android:layout_alignParentStart="true">

<ImageView

android:layout_marginTop="40dp" android:layout_width="match_parent" android:layout_height="150dp"

app:srcCompat="@drawable/newsplashi" android:id="@+id/imageView" />

</FrameLayout>

<TableRow

android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center">

<ImageButton

android:layout_width="110dp" android:onClick="menu"

android:layout_height="110dp"

android:background="@drawable/btn_menu" android:layout_gravity="center"

android:id="@+id/imageView4" />

<ImageButton

android:onClick="relwan" android:layout_width="110dp" android:layout_height="110dp"

android:background="@drawable/btn_click" android:layout_gravity="center"

android:layout_marginLeft="70dp" android:id="@+id/imageView5" /> </TableRow>

<FrameLayout

(39)

android:layout_weight="1">

<FrameLayout

android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1">

<ImageView

android:layout_width="match_parent" android:layout_marginTop="500dp" android:layout_marginRight="170dp" android:layout_height="match_parent" app:srcCompat="@drawable/newbg1" android:layout_marginLeft="5dp" android:id="@+id/imageView6" /> </FrameLayout>

</FrameLayout> </RelativeLayout>

Home.java

package com.example.root.bloodjobs;

import android.content.Intent; import android.os.Bundle; import android.os.Handler;

import android.support.v7.app.AppCompatActivity; import android.view.View;

import android.widget.Toast;

public class Home extends AppCompatActivity {

@Override

(40)

setContentView(R.layout.activity_home); }

boolean doubleBackToExitPressedOnce = false; @Override

public void onBackPressed() {

Toast.makeText(getApplicationContext(), "Ketuk dua kali untuk keluar", Toast.LENGTH_SHORT).show();

if (doubleBackToExitPressedOnce) { moveTaskToBack(true);

}

this.doubleBackToExitPressedOnce = true; new Handler().postDelayed(new Runnable() { @Override

public void run() {

doubleBackToExitPressedOnce = false; }

}, 2000); }

public void menu (View view){

Intent intent = new Intent(Home.this,Donor.class); startActivity(intent);

}

public void relwan (View view){

Intent intent = new Intent(Home.this,Tap.class); startActivity(intent);

}

}

Home_relawan.xml

(41)

xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"

android:id="@+id/activity_home_relawan" android:layout_width="match_parent" android:layout_height="match_parent"

tools:context="com.example.root.bloodjobs.HomeRelawan">

<FrameLayout

android:layout_width="match_parent" android:layout_height="120dp"

android:background="#e20514"

android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:id="@+id/frameLayout">

<ImageView

android:layout_width="match_parent" android:layout_height="100dp"

android:gravity="center" android:onClick="back"

android:layout_marginTop="10dp" android:src="@drawable/btn_judul"/>

</FrameLayout>

<FrameLayout

android:layout_width="match_parent" android:layout_height="70dp"

android:background="#e20514" android:layout_weight="1"

android:layout_alignParentBottom="true" android:layout_alignParentStart="true" android:id="@+id/frameLayout3">

<ImageView

android:layout_width="170dp"

(42)

android:layout_gravity="left" android:src="@drawable/newbg1"/>

<ImageView

android:layout_width="150dp"

android:layout_height="match_parent" android:layout_marginLeft="290dp" android:src="@drawable/pm"

android:layout_gravity="right"/> </FrameLayout>

<FrameLayout

android:layout_width="wrap_content" android:layout_height="500dp"

android:layout_weight="1"

android:layout_alignParentTop="true" android:layout_centerHorizontal="true">

<ImageView

android:layout_width="match_parent" android:layout_height="130dp"

android:src="@drawable/btn_kontak" android:layout_marginTop="200dp" android:onClick="relawan"

android:layout_marginLeft="175dp" android:id="@+id/imageView5" />

<ImageView

android:layout_width="match_parent" android:layout_height="130dp"

android:gravity="center"

android:src="@drawable/btn_propil" android:onClick="profil"

(43)

<ImageView

android:layout_width="130dp" android:onClick="jadirelawan" android:layout_height="130dp" android:layout_marginTop="150dp" android:layout_gravity="center" android:src="@drawable/ckrelawann"/> </FrameLayout>

</RelativeLayout>

HomeRelawan.java

package com.example.root.bloodjobs;

import android.content.Intent; import android.os.Bundle;

import android.support.v7.app.AppCompatActivity; import android.view.View;

public class HomeRelawan extends AppCompatActivity {

@Override

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setContentView(R.layout.activity_home_relawan); }

public void profil (View view){

Intent intent = new Intent(HomeRelawan.this,profil.class); startActivity(intent);

}

(44)

Intent(HomeRelawan.this,kontak_relawan.class); startActivity(intent);

}

public void back (View view){

Intent intent = new Intent(HomeRelawan.this,Home.class); startActivity(intent);

}

public void jadirelawan (View view){

Intent intent = new Intent(HomeRelawan.this,Daftar.class); startActivity(intent);

}

}

Activity_kamus.xml

<?xml version="1.0" encoding="utf-8"?> <LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"

android:id="@+id/activity_kamus" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"

android:background="#e20514"

tools:context="com.example.root.bloodjobs.kamus">

<ImageView

android:layout_marginTop="20dp" android:layout_width="match_parent" android:layout_height="100dp"

android:src="@drawable/newsplashi" android:id="@+id/imageView" />

(45)
(46)

android:layout_marginRight="10dp" android:background="@drawable/gogle" android:id="@+id/button" />

</LinearLayout>

Kamus.java

package com.example.root.bloodjobs;

import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View;

import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView;

import java.util.ArrayList; import java.util.HashMap;

public class kamus extends ListActivity {

ArrayList<HashMap<String, Object>> searchResults;

ArrayList<HashMap<String, Object>> originalValues;

LayoutInflater inflater;

@Override

(47)

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_kamus); final EditText kotakpencari=(EditText) findViewById(R.id.kotakpencari);

ListView playersListView=(ListView) findViewById(android.R.id.list);

//mengambil LayoutInflater untuk inflating thcustomView //disini akan menggunakan custom adapter

inflater=(LayoutInflater)

getSystemService(Context.LAYOUT_INFLATER_SERVICE);

//disini data aray akan di deklarasikan //dan akan disimpan ke dalam Arraylist

//tipe data string untuk textview integer untuk gambar icon String namakamus[]={"Plasma","Sel Darah

Merah","Darah","Hemoglobin","Sel Darah Putih","Rhesus" ,"Transfusi Darah","Golongan Darah"};

String penjelasan[]={"","","","","","","",""};

originalValues=new ArrayList<HashMap<String,Object>>();

//hasmap akan menyimpan data sementara dalam listview HashMap<String , Object> temp;

//jumlah baris dalam ListView int noOfPlayers=namakamus.length;

//pengulangan dalam Arraylist for(int i=0;i<noOfPlayers;i++) {

temp=new HashMap<String, Object>();

(48)

//menambah kan baris ke dalam ArrayList originalValues.add(temp);

}

//searchResults sama dengan OriginalValues searchResults=new

ArrayList<HashMap<String,Object>>(originalValues);

//membuat adapter

//first param-the context

//second param-the id of the layout file //you will be using to fill a row

//third param-the set of values that //will populate the ListView

final CustomAdapter adapter=new CustomAdapter(this,

R.layout.daftar_kamus,searchResults);

//menset adapter di dalam listview playersListView.setAdapter(adapter);

kotakpencari.addTextChangedListener(new TextWatcher() {

public void onTextChanged(CharSequence s, int start, int before, int count) {

//mengambil text di dalam EditText String

searchString=kotakpencari.getText().toString(); int textLength=searchString.length(); searchResults.clear();

for(int i=0;i<originalValues.size();i++) {

String

playerName=originalValues.get(i).get("namakamus").toString(); if(textLength<=playerName.length()){

if(searchString.equalsIgnoreCase(playerName.substring(0,textLength

)))

(49)

}}

adapter.notifyDataSetChanged(); }

public void beforeTextChanged(CharSequence s, int start, int count,

int after) {}

public void afterTextChanged(Editable s) {} });

}

//mendefinisikan custom adapter

private class CustomAdapter extends ArrayAdapter<HashMap<String, Object>>

{

public CustomAdapter(Context context, int textViewResourceId, ArrayList<HashMap<String, Object>> Strings) {

super(context, textViewResourceId, Strings); }

//class untuk menyimpan baris konten (cacheview) di listview private class ViewHolder

{

TextView namakamus,penjelasan,tdk; }

ViewHolder viewHolder;

@Override

public View getView(int position, View convertView, ViewGroup parent) {

(50)

{

convertView=inflater.inflate(R.layout.daftar_kamus, null);

viewHolder=new ViewHolder();

//isi konten (cache the views) viewHolder.namakamus=(TextView) convertView.findViewById(R.id.namakamus);

viewHolder.penjelasan=(TextView) convertView.findViewById(R.id.penjelasan);

//menghubungkan cached views ke dalam convertview convertView.setTag(viewHolder);

} else viewHolder=(ViewHolder) convertView.getTag();

//menset data untuk ditampilkan

viewHolder.namakamus.setText(searchResults.get(position).get("nama kamus").toString());

viewHolder.penjelasan.setText(searchResults.get(position).get("pen jelasan").toString());

//mengembalikan view untuk ditampilkan

return convertView;

} }

protected void onListItemClick(ListView l, View v, int position, long id) {

// TODO Auto-generated method stub

super.onListItemClick(l, v, position, id);//menggunakan method onliistitemclick dan mencarinya

String str =

(51)
(52)

Intent intent = new Intent(kamus.this,kdonor.class); startActivity(intent);

}

}

catch(Exception e){ e.printStackTrace(); }

}

public void google(View view){

Intent intent = new Intent(kamus.this,google.class); startActivity(intent);

} }

Kontak.java

package com.example.root.bloodjobs;

import android.content.Intent; import android.graphics.Typeface; import android.net.Uri;

import android.os.Bundle;

import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View;

import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView;

/**

(53)

public class kontak extends Fragment {

ImageView markaspmi, pmisu, pmiaceh, pmiriau, pmisumbar;

public kontak() {

// Required empty public constructor }

@Override

public View onCreateView(LayoutInflater inflater, ViewGroup container,

Bundle savedInstanceState) {

View view = inflater.inflate(R.layout.fragment_kontak, container, false);

Typeface myTypeface =

Typeface.createFromAsset(getActivity().getAssets(), "Alegreya.ttf");

Typeface myTypeface1 =

Typeface.createFromAsset(getActivity().getAssets(), "Alegreya-Bold.ttf");

TextView tv1 = (TextView) view.findViewById(R.id.pmi1); tv1.setTypeface(myTypeface1);

TextView tv2 = (TextView) view.findViewById(R.id.pmi2); tv2.setTypeface(myTypeface1);

TextView tv3 = (TextView) view.findViewById(R.id.pmi3); tv3.setTypeface(myTypeface1);

(54)

TextView tv5 = (TextView) view.findViewById(R.id.pmi5); tv5.setTypeface(myTypeface1);

TextView tv6 = (TextView) view.findViewById(R.id.alamat1); tv6.setTypeface(myTypeface);

TextView tv7 = (TextView) view.findViewById(R.id.alamat2); tv7.setTypeface(myTypeface);

TextView tv8 = (TextView) view.findViewById(R.id.alamat3); tv8.setTypeface(myTypeface);

TextView tv9 = (TextView) view.findViewById(R.id.alamat4); tv9.setTypeface(myTypeface);

TextView tv10 = (TextView) view.findViewById(R.id.alamat5); tv10.setTypeface(myTypeface);

TextView tv11 = (TextView) view.findViewById(R.id.no1); tv11.setTypeface(myTypeface);

TextView tv12 = (TextView) view.findViewById(R.id.no2); tv12.setTypeface(myTypeface);

TextView tv13 = (TextView) view.findViewById(R.id.no3); tv13.setTypeface(myTypeface);

TextView tv14 = (TextView) view.findViewById(R.id.no4); tv14.setTypeface(myTypeface);

TextView tv15 = (TextView) view.findViewById(R.id.no5); tv15.setTypeface(myTypeface);

(55)

tv16.setTypeface(myTypeface);

pmisu = (ImageView) view.findViewById(R.id.pmisu); pmiaceh = (ImageView) view.findViewById(R.id.pmiaceh); pmiriau = (ImageView) view.findViewById(R.id.pmiriau); markaspmi = (ImageView) view.findViewById(R.id.markaspmi); pmisumbar = (ImageView) view.findViewById(R.id.pmisumbar);

pmisu.setOnClickListener(new View.OnClickListener(){ @Override

public void onClick (View view){

Intent su = new Intent(Intent.ACTION_CALL); su.setData(Uri.parse("tel:0614531314")); startActivity(su);

} });

markaspmi.setOnClickListener(new View.OnClickListener(){ @Override

public void onClick (View view){

Intent markas = new Intent(Intent.ACTION_CALL); markas.setData(Uri.parse("tel:0217992325")); startActivity(markas);

} });

pmiaceh.setOnClickListener(new View.OnClickListener(){ @Override

public void onClick (View view){

Intent aceh = new Intent(Intent.ACTION_CALL); aceh.setData(Uri.parse("tel:06517551001")); startActivity(aceh);

} });

(56)

public void onClick (View view){

Intent riau = new Intent(Intent.ACTION_CALL); riau.setData(Uri.parse("tel:076144989")); startActivity(riau);

} });

pmisumbar.setOnClickListener(new View.OnClickListener(){ @Override

public void onClick (View view){

Intent sumbar = new Intent(Intent.ACTION_CALL); sumbar.setData(Uri.parse("tel:0751811538")); startActivity(sumbar);

} });

return view; }

}

Activity_profil.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:id="@+id/activity_profil" android:layout_width="match_parent" android:layout_height="match_parent"

tools:context="com.example.root.bloodjobs.profil">

<LinearLayout

android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"

(57)

<FrameLayout

android:layout_width="match_parent" android:layout_height="120dp"

android:background="#e20514"

android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:id="@+id/frameLayout">

<ImageView

android:layout_width="match_parent" android:layout_height="100dp"

android:gravity="center" android:onClick="back"

android:layout_marginTop="10dp" android:src="@drawable/btn_judul"/> </FrameLayout>

<FrameLayout

android:layout_width="match_parent" android:layout_height="match_parent">

</FrameLayout>

</LinearLayout>

<FrameLayout

android:layout_width="match_parent" android:layout_height="70dp"

android:background="#e20716" android:layout_weight="1"

android:layout_alignParentBottom="true" android:layout_alignParentStart="true" android:id="@+id/frameLayout2">

<ImageView

android:layout_width="170dp"

(58)

android:layout_gravity="left" android:src="@drawable/newbg1"/>

<ImageView

android:layout_width="150dp"

android:layout_height="match_parent" android:layout_marginLeft="290dp" android:src="@drawable/pm"

android:layout_gravity="right"/> </FrameLayout>

<WebView

android:layout_width="match_parent" android:layout_height="300dp"

android:id="@+id/website"

android:layout_above="@+id/frameLayout2" android:layout_below="@+id/linearLayout" /> </RelativeLayout>

Profil.java

package com.example.root.bloodjobs;

import android.content.Intent; import android.os.Bundle; import android.os.Handler;

import android.support.v7.app.AppCompatActivity; import android.view.View;

import android.webkit.WebSettings; import android.webkit.WebView;

import android.webkit.WebViewClient; import android.widget.Toast;

public class profil extends AppCompatActivity {

WebView website;

(59)

@Override

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setContentView(R.layout.activity_profil);

website = (WebView) findViewById(R.id.website); website.getSettings().setJavaScriptEnabled(true); website.setFocusable(true);

website.setFocusableInTouchMode(true);

website.getSettings().setRenderPriority(WebSettings.RenderPriority

.HIGH);

website.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); website.getSettings().setDomStorageEnabled(true);

website.getSettings().setDatabaseEnabled(true); website.getSettings().setAppCacheEnabled(true); website.getSettings().setJavaScriptEnabled(true); website.loadUrl(url);

website.goBack();

website.setWebViewClient(new WebViewClient() {

public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {

website.loadUrl(url); }

}); }

boolean doubleBackToExitPressedOnce = false; @Override

public void onBackPressed() {

Toast.makeText(getApplicationContext(), "Ketuk dua kali untuk kembali", Toast.LENGTH_SHORT).show();

if (doubleBackToExitPressedOnce) { finish();

(60)

this.doubleBackToExitPressedOnce = true; new Handler().postDelayed(new Runnable() { @Override

public void run() {

doubleBackToExitPressedOnce = false; }

}, 2000); }

public void back (View view){

Intent intent = new Intent(profil.this,HomeRelawan.class); startActivity(intent);

}

}

Activity_splash_screen.xml

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout

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:id="@+id/activity_splash_screen"

android:layout_width="match_parent" android:layout_height="match_parent" android:background="#b40203"

tools:context="com.example.root.bloodjobs.SplashScreen">

<FrameLayout

android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="visible"

android:elevation="4dp"

(61)

android:layout_alignParentStart="true">

<ImageView

android:onClick="klik"

android:layout_width="match_parent" android:layout_height="250dp"

android:layout_marginBottom="30dp" android:src="@drawable/newsplash02" android:layout_marginLeft="10dp" android:elevation="4dp"

android:layout_gravity="center" android:id="@+id/imageView2" /> </FrameLayout>

</RelativeLayout>

Splashscreen.java

package com.example.root.bloodjobs;

import android.content.Intent; import android.os.Handler;

import android.support.v7.app.AppCompatActivity; import android.os.Bundle;

import android.view.View; import android.view.Window;

public class SplashScreen extends AppCompatActivity {

public static int waktu=5000; @Override

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_splash_screen);

Referensi

Dokumen terkait

Apabila kita melihat suatu gambar tampak atas dari suatu rencana atap, maka panjang jurai luar ataupun dalam belum merupakan suatu garis atau panjang yang sebenarnya disini

Aspal di area parkir yang rusak, hal ini sudah masuk dalam program investasi Divisi Teknik pelabuhan tahun 2016, bukan lagi pengaspalan akan tetapi dengan

development management service training, Hygienic fish handling training and campaigns, Demonstrations and campaigns on Ahotor stoves in order to promote the new modern fish

Penerapan Program Tax Amnesty pada Kantor Pelayanan Pajak Pratama Medan Timur”.. Tujuan dan Manfaat Praktik Kerja Lapangan Mandiri (PKLM)

Storyline dimulai dengan menjelaskan apa itu Museum Samudra Raksa agar audience dapat menangkap dan memahami informasi awal tentang apa yang akan ditampilkan dalam

This study aims to analyze developing promotion strategy attractions Telaga Paca, and to know the factors that support or hinder the promotion strategy will be undertaken by

Planing merupakan proses pemikiran dan penentuan secara jelas dari segala sesuatu yang akan di jalankan Dalam rangka mencapai tujuan organisasi.. Planing meliputi