-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add check-in restrictions in settings #1034
Conversation
Codecov Report
@@ Coverage Diff @@
## development #1034 +/- ##
=================================================
- Coverage 27.25% 26.72% -0.53%
Complexity 735 735
=================================================
Files 198 202 +4
Lines 7588 7738 +150
Branches 310 314 +4
=================================================
Hits 2068 2068
- Misses 5434 5584 +150
Partials 86 86
Continue to review full report at Codecov.
|
38f1c96
to
bdcf66a
Compare
@@ -51,6 +67,16 @@ public void onCreatePreferencesFix(@Nullable Bundle bundle, String rootKey) { | |||
.commit(); | |||
return true; | |||
}); | |||
|
|||
|
|||
findPreference("check_in_restrictions").setOnPreferenceClickListener(preference -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using string literals
|
||
import java.util.List; | ||
|
||
public class CheckInRestrAdapter extends RecyclerView.Adapter<CheckInRestrAdapter.TicketViewHolder> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use complete name
notifyDataSetChanged(); | ||
} | ||
|
||
class TicketViewHolder extends RecyclerView.ViewHolder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make a separate class, follow principle of separation of concerns.
} | ||
|
||
public void updateTicket(Ticket ticket) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary line break
} | ||
|
||
public void loadTickets() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary line break
} | ||
|
||
public void updateAllTickets(boolean toRestrict) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
@@ -27,4 +28,8 @@ | |||
@DELETE("tickets/{id}") | |||
Completable deleteTicket(@Path("id") long id); | |||
|
|||
@PATCH("tickets/{ticket_id}") | |||
Observable<Ticket> updateTicket(@Path("ticket_id") long id, @Body Ticket ticket); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra line break
@@ -9,4 +9,8 @@ | |||
android:key="payment_preferences" | |||
android:title="@string/payment_preference"/> | |||
|
|||
<Preference | |||
android:key="check_in_restrictions" | |||
android:title="Check In Restrictions"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use string resources
@MishuVS Why is there option for restricting ticket types which we arn't supporting? Please describe the significance for all the types used. |
|
FragmentTransaction transaction = getFragmentManager().beginTransaction(); | ||
transaction | ||
.replace(R.id.fragment_container, ScanSettings.newInstance()) | ||
.addToBackStack(null) | ||
.commit(); | ||
return true; | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra line
|
||
<View | ||
android:background="@color/grey_400" | ||
android:layout_height="1dp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use dimens resource
android:title="@string/payment_preference"/> | ||
|
||
<Preference | ||
android:key="@string/check_in_restrictions_key" | ||
android:title="Check In Restrictions"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String resource
|
||
|
||
findPreference(getString(R.string.check_in_restrictions_key)).setOnPreferenceClickListener(preference -> { | ||
FragmentTransaction transaction = getFragmentManager().beginTransaction(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Transaction should not be needed.
@@ -43,14 +59,24 @@ public void onCreatePreferencesFix(@Nullable Bundle bundle, String rootKey) { | |||
return true; | |||
}); | |||
|
|||
findPreference("scan_settings").setOnPreferenceClickListener(preference -> { | |||
findPreference(getString(R.string.scan_settings_key)).setOnPreferenceClickListener(preference -> { | |||
FragmentTransaction transaction = getFragmentManager().beginTransaction(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
|
||
context = getContext(); | ||
if (getArguments() != null) | ||
eventId = getArguments().getLong(MainActivity.EVENT_KEY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use brackets
super.onCreate(savedInstanceState); | ||
|
||
if (getArguments() != null) | ||
eventId = getArguments().getLong(MainActivity.EVENT_KEY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use brackets
private void checkRestrictAll() { | ||
boolean restrictAll = true; | ||
|
||
for (Ticket ticket : ticketSettingsViewModel.getTickets().getValue()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can throw NPE ?
} | ||
|
||
public void loadTickets() { | ||
compositeDisposable.add(ticketRepository.getTickets(eventId, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass eventId as argument, will be required for testing.
android:layout_width="0dp" | ||
android:layout_weight="1" | ||
android:layout_height="wrap_content" | ||
android:text='@string/restrict_all'/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to default text color and size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no default style defined right now. Styles should be uniformly handled in other issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I didn't mean that you define some style. I meant that keep the text color as black and the text size similar to what we keep throughout the app. As per the gif, this screen is looking different with text size small and color grey.
@Masquerade0097 @iamareebjamal Please review |
b5f4959
to
a530953
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please resolve the style issue other than that LGTM
@iamareebjamal Please review |
Fixes #973
Changes: Adds check-in restrictions preferences for each ticket in Settings
GIF: