Skip to content
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

[WIP] Add categories to favourites #510

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
*/
package de.geeksfactory.opacclient.objects;

import java.util.ArrayList;
import java.util.List;

/**
* Object representing a bookmarked item. Not part of the API you are interested
* in if you want to implement a library system.
Expand All @@ -32,6 +35,7 @@ public class Starred {
private String mnr;
private String title;
private SearchResult.MediaType mediaType;
private List<Tag> tags = new ArrayList<>();

@Override
public String toString() {
Expand Down Expand Up @@ -94,4 +98,28 @@ public SearchResult.MediaType getMediaType() {
public void setMediaType(SearchResult.MediaType mediaType) {
this.mediaType = mediaType;
}

/**
* Get this item's tag list
*/
public List<Tag> getTags() {
return tags;
}

/**
* Add a tag to this item's tag list
*/
public void addTag(Tag tag) {
this.tags.add(tag);
}

/**
* Remove a tag from this item's tag list
*/
public void removeTag(Tag tag) {
if (tags.contains(tag)) {
this.tags.remove(tag);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package de.geeksfactory.opacclient.objects;

/**
* Object representing a tag in a starred item.
*/

public class Tag {

private int id;
private String tagName;
private int starredItemRefId;

@Override
public String toString() {
return tagName;
}

/**
* Get this tag's ID
*/
public int getId() {
return id;
}

/**
* Set this tag's ID
*/
public void setId(int id) {
this.id = id;
}

/**
* Get this tag's name
*/
public String getTagName() {
return tagName;
}

/**
* Set this tag's name
*/
public void setTagName(String tagName) {
this.tagName = tagName;
}

/**
* Get this tag's reference ID to the starred item it is attached to
*/
public int getStarredItemRefId() {
return starredItemRefId;
}

/**
* Set this tag's reference ID to the starred item it is attached to
*/
public void setStarredItemRefId(int starredItemRefId) {
this.starredItemRefId = starredItemRefId;
}
}
1 change: 1 addition & 0 deletions opacclient/opacapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ dependencies {
testImplementation 'com.squareup.okhttp3:okhttp:3.10.0'
testImplementation 'com.squareup.retrofit2:retrofit-mock:2.3.0'
testImplementation 'commons-io:commons-io:2.5'
implementation "com.hootsuite.android:nachos:1.1.1"

// We don't want to rely on the CommonsWare Maven repo, so we include these libraries as JARs
implementation files('libs/adapter-1.0.1.jar')
Expand Down
Loading