Commit 943b715b authored by Amin's avatar Amin

create alert ui

parent 67fb3eaf
package com.example.qms;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
......@@ -10,6 +15,8 @@ import androidx.core.view.WindowInsetsCompat;
public class SyncActivity extends AppCompatActivity {
private Button syncButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -20,5 +27,44 @@ public class SyncActivity extends AppCompatActivity {
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
syncButton = findViewById(R.id.sync_button);
syncButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showAlertDialog();
}
});
}
private void showAlertDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Alert Title");
builder.setMessage("This is a simple alert message.");
builder.setCancelable(false); // User must click a button to dismiss
// Add a positive button
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(SyncActivity.this, "OK clicked!", Toast.LENGTH_SHORT).show();
dialog.dismiss(); // Dismiss the dialog
}
});
// Add a negative button (optional)
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(SyncActivity.this, "Cancel clicked!", Toast.LENGTH_SHORT).show();
dialog.dismiss(); // Dismiss the dialog
}
});
// Create and show the AlertDialog
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
}
\ No newline at end of file
}
......@@ -264,6 +264,7 @@
</ScrollView>
<Button
android:id="@+id/sync_button"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginBottom="15dp"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/syncAlert"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintHeight="wrap_content"
app:layout_constraintWidth="300dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingHorizontal="30dp"
android:paddingVertical="30dp">
<ImageView
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginBottom="25dp"
android:src="@drawable/alert_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="Alert"
android:textSize="23sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="Please comfirm items to sync"
android:textSize="19sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Submit All Offline Pending Items"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginEnd="60dp"/>
<com.google.android.material.checkbox.MaterialCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:buttonTint="@color/primary"
app:useMaterialThemeColors="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Download Details of Selected Unit"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginEnd="60dp"/>
<com.google.android.material.checkbox.MaterialCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:buttonTint="@color/primary"
app:useMaterialThemeColors="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Active Issues Only"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginEnd="60dp"/>
<com.google.android.material.checkbox.MaterialCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:buttonTint="@color/primary"
app:useMaterialThemeColors="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Active Issues Only (Without Images)"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginEnd="60dp"/>
<com.google.android.material.checkbox.MaterialCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:buttonTint="@color/primary"
app:useMaterialThemeColors="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="All Issues Only (Without Images)"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginEnd="60dp"/>
<com.google.android.material.checkbox.MaterialCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:buttonTint="@color/primary"
app:useMaterialThemeColors="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Definition for:"
android:textSize="19sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="30dp"
android:text="“Active” - Lodge, PA, WIP Complete. “All” - Active, POA Closed."
android:textSize="19sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Download Selected Digital Form"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginEnd="60dp"/>
<com.google.android.material.checkbox.MaterialCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:buttonTint="@color/primary"
app:useMaterialThemeColors="true" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="20dp">
<Button
android:layout_width="165dp"
android:layout_height="64dp"
android:layout_marginEnd="10dp"
android:backgroundTint="@color/white"
android:clickable="true"
android:focusable="true"
android:text="No"
android:textColor="@color/primary"
android:textSize="19sp"
app:cornerRadius="27dp"
app:strokeColor="@color/primary"
app:strokeWidth="1dp"/>
<Button
android:layout_width="165dp"
android:layout_height="64dp"
android:backgroundTint="@color/primary"
android:clickable="true"
android:focusable="true"
android:text="Yes"
android:textColor="@color/white"
android:textSize="19sp"
app:cornerRadius="27dp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment