Skip to content

Commit

Permalink
Merge pull request #47 from ObjectiveTruth/bug_fixes
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
ObjectiveTruth authored Nov 28, 2016
2 parents 3d8235c + 4756395 commit aa0538a
Show file tree
Hide file tree
Showing 24 changed files with 41 additions and 21 deletions.
4 changes: 4 additions & 0 deletions app/src/main/assets/whatsnew_minor.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
November 27, 2016
===
‣ Fixed issue with MyAccount no loading records properly

October 22, 2016
===
‣ Fixed issue with date not being available which crashed the app
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/assets/whatsnew_thisversion.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
November 27, 2016
November 28, 2016
===
‣ Fixed issue with MyAccount no loading records properly
‣ More bug fixes
‣ Room picture now show correctly
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public BookingInteractionModel(UOITLibraryBookingApp mApplication,
this.bookingInteractionWebService = bookingInteractionWebService;
this.calendarWebService = calendarWebService;
this.userModel = userModel;
_initialize();
}

/**
* Initializes observables so they're ready when they are requested
*/
private void _initialize() {
getBookingInteractionEventUserRequestSubject();
}

/**
Expand Down Expand Up @@ -79,7 +87,6 @@ public PublishSubject<BookingInteractionEventUserRequest> getBookingInteractionE
}else {
return bookingInteractionEventUserRequestPublishSubject;
}

}

private void _bindUserRequestEventToWebCalls(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public static Observable<LeftOrRight<String, String>> parseWebpageForMessageLabe
if(rawWebPage.contains(ERROR_LABEL_ID)) {
String search = ParseUtilities.findStringFromStringBetweenSearchTerms(rawWebPage,
ERROR_LABEL_ID, "</span>");
left = search.split(">")[1];
String[] searchSplit = search.split(">");
left = searchSplit[searchSplit.length - 1]; // Take the last part For example "<b>ERROR</b>real message"
}else if(rawWebPage.contains(SUCCESS_LABEL_ID)){
String search = ParseUtilities.findStringFromStringBetweenSearchTerms(rawWebPage,
SUCCESS_LABEL_ID, "</span>");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.objectivetruth.uoitlibrarybooking.userinterface.BookingInteraction.common;

import android.support.v4.app.Fragment;
import com.objectivetruth.uoitlibrarybooking.R;
import com.objectivetruth.uoitlibrarybooking.data.models.calendarmodel.TimeCell;
import timber.log.Timber;

public abstract class InteractionFragment extends Fragment {
Expand All @@ -25,4 +27,18 @@ protected void popFragmentBackstack() {
Timber.d("Popping backstack");
getActivity().getSupportFragmentManager().popBackStack();
}

/**
* Takes the timeCell given and searches for he image in the resources directory for it. If its not found it will
* return the unknown room picture resource ID
* @param timeCell
* @return int resourceID
*/
protected int getResourceIDForRoomOrDefault(TimeCell timeCell) {
final String DRAWABLE_RESOURCE_TYPE = "drawable";
int libraryRoomResourceID = getResources().getIdentifier(timeCell.param_room.toLowerCase(),
DRAWABLE_RESOURCE_TYPE, getActivity().getPackageName());
libraryRoomResourceID = libraryRoomResourceID <= 0 ? R.drawable.unknown_room : libraryRoomResourceID;
return libraryRoomResourceID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public View onCreateView(LayoutInflater inflater,

TextView roomNumberTextView = (TextView) view.findViewById(R.id.bookingInteraction_book_roomnumber);
if(roomNumberTextView != null) {roomNumberTextView.setText(timeCell.param_room.toUpperCase());}
if(pictureOfRoom != null) {pictureOfRoom.setImageResource(getResourceIDForRoomOrDefault(timeCell));}

ImageButton commentButton = (ImageButton) view.findViewById(R.id.bookingInteraction_book_comment_button);
_setupCommentButton(commentButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public View onCreateView(LayoutInflater inflater,

pictureOfRoom = (ImageView) view.findViewById(R.id.room_landing_room_picture);

roomNumberTextView.setText(timeCell.param_room);
if(roomNumberTextView != null) {roomNumberTextView.setText(timeCell.param_room);}
if(pictureOfRoom != null) {pictureOfRoom.setImageResource(getResourceIDForRoomOrDefault(timeCell));}

createButton.setOnClickListener(new View.OnClickListener(){
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public View onCreateView(LayoutInflater inflater,

pictureOfRoom = (ImageView) view.findViewById(R.id.room_landing_room_picture);

roomNumberTextView.setText(timeCell.param_room);
if(roomNumberTextView != null) {roomNumberTextView.setText(timeCell.param_room);}
if(pictureOfRoom != null) {pictureOfRoom.setImageResource(getResourceIDForRoomOrDefault(timeCell));}

joinButton.setOnClickListener(new View.OnClickListener(){
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public int getColumnCount() {
}

@Override
public View getView(int row, int column, View recycleView, ViewGroup parent) {
public View getView(final int row, final int column, View recycleView, ViewGroup parent) {
// ViewHolder Pattern. Recommended to make listviews that use the recycler faster
View convertView = recycleView;
ViewHolder holder;
Expand Down Expand Up @@ -188,7 +188,7 @@ private int _convertRowAndColumnToTimeCellIndex(int row, int column) {
*/
@Nullable
private TimeCell _getTimeCellWithGroupNameAboveThisOne(int row, int column) {
for(int irow = row; irow > 0; irow--) {
for(int irow = row; irow >= 0; irow--) {
TimeCell suspect = calendarDay.timeCells.get(_convertRowAndColumnToTimeCellIndex(irow, column));
if(suspect.timeCellType == BOOKING_CONFIRMED) {
// Quit early once we find the first BookingConfirmed TimeCell above this one
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-hdpi/ic_logout.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-hdpi/ic_logout_pressed.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-mdpi/ic_logout.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-mdpi/ic_logout_pressed.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-xhdpi/ic_logout.png
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-xxhdpi/ic_logout.png
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 0 additions & 12 deletions app/src/main/res/drawable/logout_selector.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:id="@+id/my_account_menu_item_logout"
android:orderInCategory="50"
android:title="logout"
android:icon="@drawable/ic_logout"
android:icon="@drawable/ic_action_action_exit_to_app"
app:showAsAction="always"
/>
</menu>

0 comments on commit aa0538a

Please sign in to comment.