Created
March 4, 2017 11:57
-
-
Save alfianyusufabdullah/4ee82fa1796ee34d832ed4fafe838a41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout 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="masxdeveloper.counter.MainActivity" | |
android:orientation="vertical"> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="horizontal" | |
android:layout_marginTop="20dp"> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
android:orientation="vertical"> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="Kasir 1" | |
android:textSize="17sp" | |
android:textStyle="bold" | |
android:gravity="center" | |
android:padding="10dp"/> | |
<Button | |
android:id="@+id/btn_kasir1" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="Kasir 1"/> | |
</LinearLayout> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
android:orientation="vertical"> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="Kasir 2" | |
android:textSize="17sp" | |
android:textStyle="bold" | |
android:gravity="center" | |
android:padding="10dp"/> | |
<Button | |
android:id="@+id/btn_kasir2" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="Kasir 2" /> | |
</LinearLayout> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
android:orientation="vertical"> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="Kasir 3" | |
android:textSize="17sp" | |
android:textStyle="bold" | |
android:gravity="center" | |
android:padding="10dp"/> | |
<Button | |
android:id="@+id/btn_kasir3" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="Kasir 3"/> | |
</LinearLayout> | |
</LinearLayout> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="20dp" | |
android:text="Nomor Antrian Ke" | |
android:textSize="17sp" | |
android:gravity="center"/> | |
<TextView | |
android:id="@+id/nomor_antrian_kasir" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="20dp" | |
android:text="0" | |
android:textSize="50sp" | |
android:gravity="center"/> | |
<TextView | |
android:id="@+id/nomor_antrian_dipanggil" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:gravity="center" | |
android:text="Nomor Antrian Anda Dipanngil\nSilahkan Ke Kasir 2" | |
android:textColor="@color/colorAccent" | |
android:visibility="gone"/> | |
<Button | |
android:id="@+id/btn_nomor_antrian" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="ambil no. antrian" | |
android:layout_marginTop="20dp"/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="20dp" | |
android:text="Nomor Antrian" | |
android:textSize="17sp" | |
android:gravity="center"/> | |
<TextView | |
android:id="@+id/nomor_antrian_user" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="20dp" | |
android:text="0" | |
android:textSize="50sp" | |
android:gravity="center"/> | |
</LinearLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package masxdeveloper.counter; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.TextView; | |
public class MainActivity extends AppCompatActivity implements View.OnClickListener { | |
Button btn_nomor_antrian; | |
Button Kasir1; | |
Button Kasir2; | |
Button Kasir3; | |
TextView nomor_antarian_user; | |
TextView nomor_antarian_kasir; | |
TextView nomor_antarian_dipanggil; | |
int NOMOR_ANTRIAN = 0; | |
int NOMOR_ANTRIAN_KASIR = 0; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
nomor_antarian_user = (TextView) findViewById(R.id.nomor_antrian_user); | |
nomor_antarian_kasir = (TextView) findViewById(R.id.nomor_antrian_kasir); | |
nomor_antarian_dipanggil = (TextView) findViewById(R.id.nomor_antrian_dipanggil); | |
btn_nomor_antrian = (Button) findViewById(R.id.btn_nomor_antrian); | |
btn_nomor_antrian.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
NOMOR_ANTRIAN++; | |
nomor_antarian_user.setText(String.valueOf(NOMOR_ANTRIAN)); | |
} | |
}); | |
Kasir1 = (Button) findViewById(R.id.btn_kasir1); | |
Kasir2 = (Button) findViewById(R.id.btn_kasir2); | |
Kasir3 = (Button) findViewById(R.id.btn_kasir3); | |
Kasir1.setOnClickListener(this); | |
Kasir2.setOnClickListener(this); | |
Kasir3.setOnClickListener(this); | |
} | |
@Override | |
public void onClick(View view) { | |
NOMOR_ANTRIAN_KASIR++; | |
if (NOMOR_ANTRIAN == NOMOR_ANTRIAN_KASIR) { | |
String Text = "Nomor Antrian Anda Dipanggil\n"; | |
switch (view.getId()) { | |
case R.id.btn_kasir1: | |
Text = Text + "Silahkan Ke Kasir 1"; | |
break; | |
case R.id.btn_kasir2: | |
Text = Text + "Silahkan Ke Kasir 2"; | |
break; | |
case R.id.btn_kasir3: | |
Text = Text + "Silahkan Ke Kasir 3"; | |
break; | |
} | |
nomor_antarian_dipanggil.setVisibility(View.VISIBLE); | |
nomor_antarian_dipanggil.setText(Text); | |
} else { | |
nomor_antarian_dipanggil.setVisibility(View.GONE); | |
} | |
nomor_antarian_kasir.setText(String.valueOf(NOMOR_ANTRIAN_KASIR)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment