Commit d47ef1bd authored by Amin's avatar Amin

add filter function

parent bea10f55
......@@ -12,6 +12,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.Qms">
<activity
android:name=".FilterIssueList"
android:exported="false" />
<activity
android:name=".WithdrawIssueSummary"
android:exported="false" />
<activity
......
package com.example.qms;
import android.app.DatePickerDialog;
import android.os.Bundle;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
public class FilterIssueList extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_filter_issue_list);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
LinearLayout dateSelectorTo = findViewById(R.id.date_selector_to);
TextView tvDateTo = findViewById(R.id.tv_date_to);
LinearLayout dateSelectorFrom = findViewById(R.id.date_selector_from);
TextView tvDateFrom = findViewById(R.id.tv_date_from);
ImageButton backButon = findViewById(R.id.back_button);
backButon.setOnClickListener(v -> {
onBackPressed();
});
dateSelectorTo.setOnClickListener(v -> {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePicker = new DatePickerDialog(
this,
(view, year1, month1, dayOfMonth) -> {
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy", Locale.getDefault());
Calendar selectedDate = Calendar.getInstance();
selectedDate.set(year1, month1, dayOfMonth);
tvDateTo.setText(sdf.format(selectedDate.getTime()));
},
year, month, day
);
datePicker.show();
});
dateSelectorFrom.setOnClickListener(v -> {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePicker = new DatePickerDialog(
this,
(view, year1, month1, dayOfMonth) -> {
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy", Locale.getDefault());
Calendar selectedDate = Calendar.getInstance();
selectedDate.set(year1, month1, dayOfMonth);
tvDateFrom.setText(sdf.format(selectedDate.getTime()));
},
year, month, day
);
datePicker.show();
});
}
}
\ No newline at end of file
......@@ -12,7 +12,7 @@ import androidx.core.view.WindowInsetsCompat;
public class Issues extends AppCompatActivity {
private ImageButton withdrawIssueIcon, back_button;
private ImageButton withdrawIssueIcon, back_button, filter_issue;
......@@ -29,12 +29,19 @@ public class Issues extends AppCompatActivity {
withdrawIssueIcon = findViewById(R.id.withdraw_issue_icon);
back_button = findViewById(R.id.backButton);
filter_issue = findViewById(R.id.filterIssue);
withdrawIssueIcon.setOnClickListener(v -> {
Intent intent = new Intent(Issues.this, WithdrawIssue.class);
startActivity(intent);
});
filter_issue.setOnClickListener(v -> {
Intent intent = new Intent(Issues.this, FilterIssueList.class);
startActivity(intent);
});
back_button.setOnClickListener(v -> {
onBackPressed();
});
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF" />
<stroke android:width="1dp" android:color="@color/sync_button" />
<corners android:radius="30dp" />
</shape>
This diff is collapsed.
......@@ -122,6 +122,7 @@
android:textStyle="bold" />
<ImageButton
android:id="@+id/filterIssue"
android:layout_width="27dp"
android:layout_height="27dp"
android:background="@color/white"
......
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