Skip to content

Commit

Permalink
userStat
Browse files Browse the repository at this point in the history
UserStatisticsFragment is now updated on every click on menu
  • Loading branch information
bill-chamal committed May 30, 2024
1 parent bc524fd commit ebe1838
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ public void onComplete(@NonNull Task<QuerySnapshot> task) {
entries.add(new BarEntry(1, total_paper));
entries.add(new BarEntry(2, total_glass));
entries.add(new BarEntry(3, total_metal));

// Set Values bar
ArrayList<BarEntry> valueEntries = new ArrayList<>();
valueEntries.add(new BarEntry(0, totalValue_plastic));
valueEntries.add(new BarEntry(1, totalValue_paper));
valueEntries.add(new BarEntry(2, totalValue_glass));
valueEntries.add(new BarEntry(3, totalValue_metal));

// Set axis
YAxis yAxis = barChart.getAxisLeft();
yAxis.setAxisMinimum(0f);
yAxis.setAxisLineWidth(2f);
Expand Down Expand Up @@ -214,13 +214,11 @@ private void generativeModelGemini(TextView geminiView, TextView citeGemini, Bit
! READ IMPORTANT NOTICE !
This is the AI Model from Google AI called Gemini.
Gemini requires API Level 21 and higher.
The usage of Gemini does not violate any Google’s Policy listed here https://policies.google.com/terms/generative-ai/use-policy https://ai.google.dev/gemini-api/terms#use-restrictions
Gemini is not free in EU. Requires a linked billing account. Provides 300$ free for new accounts, for a specific period of time. https://ai.google.dev/gemini-api/docs/available-regions#unpaid-tier-unavailable
Gemini is not free in EU. Requires a linked billing account. Provides 300$ of free to charge use for new accounts, for a specific period of time.
The linked billing account will be removed in order to avoid any unwilling charges.
*/
// The Gemini 1.5 models are versatile and work with both text-only and multimodal prompts
GenerativeModel gm = new GenerativeModel(/* modelName */ "gemini-pro-vision",
// Access your API key as a Build Configuration variable (see "Set up your API key" above)
/* apiKey */ "AIzaSyDGq-JkuIHRm8DzpF0LTRkLSzf3Cf_2lQU");
GenerativeModelFutures model = GenerativeModelFutures.from(gm);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ private void generativeModelGemini(TextView geminiView) {
! READ IMPORTANT NOTICE !
This is the AI Model from Google AI called Gemini.
Gemini requires API Level 21 and higher.
The usage of Gemini does not violate any Google’s Policy listed here https://policies.google.com/terms/generative-ai/use-policy https://ai.google.dev/gemini-api/terms#use-restrictions
Gemini is not free in EU. Requires a linked billing account. Provides 300$ free for new accounts, for a specific period of time. https://ai.google.dev/gemini-api/docs/available-regions#unpaid-tier-unavailable
Gemini is not free in EU. Requires a linked billing account. Provides 300$ free for new accounts, for a specific period of time.
The linked billing account will be removed in order to avoid any unwilling charges.
*/
// The Gemini 1.5 models are versatile and work with both text-only and multimodal prompts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
public boolean onNavigationItemSelected(@NonNull MenuItem item) {

if (item.getItemId() == R.id.nav_about) {
// Show About dialog
Dialog aboutDialog = new Dialog(getContext());
aboutDialog.setContentView(R.layout.fragment_about_popup);
aboutDialog.show();
}
if (item.getItemId() == R.id.nav_logout) {
// Sign out and go to the Enter Screen
mAuth.signOut();
Intent gotoMainActivity = new Intent(getContext(), MainActivity.class);
gotoMainActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
Expand Down Expand Up @@ -221,7 +223,8 @@ public void replaceStatFragmentAndNotify() {
// In case of any changes, notify the adapter
if (userRegisterFragment.getContext() != null)
userRegisterFragment.notifyAdapter();
replaceFragment(userStatisticsFragment);
// Refresh UI on click
replaceFragment(new UserStatisticsFragment(user));
}

private void replaceFragment(Fragment fragment) {
Expand Down

0 comments on commit ebe1838

Please sign in to comment.