|
|
bet | 2/4 | Sana | 24.06.2021 | Hajmi | 232,5 Kb. | | #100103 |
| Bog'liq Dasturlash uslublari va paradigmalar
for (int i = 1; i < SIZE * SIZE; i++) {
data.add(i + "");
}
}
private void loadDataToViews() {
generateData();
for (int i = 0; i < SIZE * SIZE - 1; i++) {
buttons[i / SIZE][i % SIZE].setText(data.get(i));
chronometer = findViewById(R.id.soat);
chronometer.start();
p=0;
}
buttons[emptyObject.getX(3)][emptyObject.getY(3)].setText("");
}
public void generateData() {
Collections.shuffle(data);
}
public void back(View view) {
Intent intent=new Intent(getApplicationContext(),Asosiy_oyna.class);
startActivityForResult(intent ,1);
mediaPlayer1= MediaPlayer.create(getApplicationContext(),R.raw.buttoneffectq);
mediaPlayer1.start();
}
public void onClick1(View view) {
emptyObject.setX(3);
emptyObject.setY(3);
chronometer.setBase(SystemClock.elapsedRealtime());
chronometer.start();
loadDataToViews();
steps.setText("0");
mediaPlayer1= MediaPlayer.create(getApplicationContext(),R.raw.buttoneffectq);
mediaPlayer1.start();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (requestCode==1){
finish();
}
super.onActivityResult(requestCode, resultCode, data);
}
/*public void check() {
buttons[3][3].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
for (int i = 0; i <15; i++) {
ana=Integer.parseInt(buttons[i / SIZE][i % SIZE].getText().toString());
if (ana==i+1) {
++r;
}
}
if (r==15) {
Intent intent = new Intent(getApplicationContext(), YouWin.class);
startActivity(intent);
}
}
});
}*/
}
FRONTEND
xml version="1.0" encoding="utf-8"?>
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=".Asosiy_oyna"
android:background="@drawable/noroot"
android:orientation="horizontal">
android:layout_marginBottom="50dp"
android:layout_width="match_parent"
android:gravity="center"
android:orientation="vertical"
android:layout_height="match_parent">
android:id="@+id/vol"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_gravity="end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_baseline_volume_up_24"
android:onClick="volue1"
android:tint="#fff"/>
android:id="@+id/vol2"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_gravity="end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_baseline_volume_off_24"
android:onClick="volue"
android:tint="#fff"/>-->
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:fontFamily="@font/son2"
android:text="Stone"
android:textColor="#E2F40000"
android:textSize="90sp"
android:textStyle="bold|italic" />
android:layout_marginLeft="50dp"
android:layout_marginBottom="10dp"
android:layout_width="wrap_content"
Do'stlaringiz bilan baham: |
|
|