-
Notifications
You must be signed in to change notification settings - Fork 2
References
lndslpn edited this page Mar 31, 2025
·
18 revisions
Navigation Bar Reference
- Link: https://www.youtube.com/watch?v=jOFLmKMOcK0
- Date: 27/02/2025
- Files used: activity_home_page.xml, HomePage.java
- Code block: majority of activity_home_page, replaceFragment method in HomePage
Finding Current User
- Link: https://firebase.google.com/docs/auth/android/manage-users
- Date: 28/02/2025
- Used in HistoryFragment.java and MoodEventArrayAdapter.java files
- Code used: FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser();
Turning Date Object Into String
- Link: https://stackoverflow.com/questions/5683728/convert-java-util-date-to-string
- Date: 01/03/2025
- Files used: HistoryMoodEventArrayAdapter
- Code: Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String s = formatter.format(eventDate);holder.date.setText(s);
Foundation for Function That Actively Listens for Mood Events
- Link: https://firebase.google.com/docs/firestore/query-data/listen
- Date: 28/02/2025
- Files: MoodEventRepository.java
- Code: Integrated pieces of code from the link into listenForEventsWithParticipantRef() method
Updating User Values in SettingsFragment
- Link: https://firebase.google.com/docs/firestore/manage-data/add-data#update-data
- Date: 08/03/2025
- Files: SettingsFragment.java
- Code: Used similar implementation in link to implement updating values in editName() method
Image Upload
- Link: https://www.youtube.com/watch?v=nOtlFl1aUCw
- Date: 15/03/2025
- Files: AddMoodEventFragment.java
- Code: registerResult() method and pickImage() method
Underlining Text
- Link: https://stackoverflow.com/questions/10019001/how-do-you-underline-a-text-in-android-xml
- Date: 24/03/2025
- Files: LoginPage.java
- Code: TextView txt = (TextView) findViewById(R.id.Textview1); txt.setPaintFlags(txt.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
Adding Mood Event Icons to Map
- Link: https://www.youtube.com/watch?v=4fExmOFKgQY
- Date: 24/03/2025
- Files: MapFragment.java
- Code: MarkerOptions testMark = new MarkerOptions().position(eventPos).title(finalString).icon(BitmapDescriptorFactory .fromBitmap(textAsBitmap(emoji))); mMap.addMarker(testMark);
Adding Map UI Controls
- Link: https://www.youtube.com/watch?v=y84o2kyi_eo
- Date: 24/03/2025
- Files: MapFragment.java
- Code: UiSettings uiSettings = googleMap.getUiSettings(); // Enable map gestures and controls uiSettings.setZoomControlsEnabled(true); uiSettings.setZoomGesturesEnabled(true); uiSettings.setCompassEnabled(true); uiSettings.setRotateGesturesEnabled(true); uiSettings.setTiltGesturesEnabled(true); uiSettings.setScrollGesturesEnabled(true); uiSettings.setScrollGesturesEnabledDuringRotateOrZoom(false); uiSettings.setIndoorLevelPickerEnabled(true);
Converting String Text to Bitmap
- Link: https://stackoverflow.com/questions/8799290/convert-string-text-to-bitmap
- Date: 24/03/2025
- Files: MapFragment.java
- Code: used in textAsBitmap() in code public Bitmap textAsBitmap(String text, float textSize, int textColor) { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setTextSize(textSize); paint.setColor(textColor); paint.setTextAlign(Paint.Align.LEFT); float baseline = -paint.ascent(); // ascent() is negative int width = (int) (paint.measureText(text) + 0.5f); // round int height = (int) (baseline + paint.descent() + 0.5f); Bitmap image = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(image); canvas.drawText(text, 0, baseline, paint); return image; }
UI Automator to Test Map
- Link: https://developer.android.com/training/testing/other-components/ui-automator
- Date: 27/03/2025
- Files: MapFragmentTest.java
- Code: Context context = ApplicationProvider.getApplicationContext(); FusedLocationProviderClient fusedClient = LocationServices.getFusedLocationProviderClient(context); Tasks.await(fusedClient.setMockMode(true)); UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); (integrated in with the test and some pieces changed based on context)