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

Merkliste mit Verfügbarkeit in einer Zweigstelle #647

Open
wants to merge 1 commit 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
@@ -0,0 +1,97 @@
/**
* Copyright (C) 2013 by Raphael Michel under the MIT license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package de.geeksfactory.opacclient.objects;

/**
* Object representing a bookmarked item. Not part of the API you are interested
* in if you want to implement a library system.
*
* @author Raphael Michel
*/
public class Starred {
private int id;
private String mnr;
private String title;
private SearchResult.MediaType mediaType;

@Override
public String toString() {
return "Starred [id=" + id + ", mnr=" + mnr + ", title=" + title + ", mediaType=" +
mediaType.toString() + "]";
}

/**
* Get this item's ID in bookmark database
*/
public int getId() {
return id;
}

/**
* Set this item's ID in bookmark database
*/
public void setId(int id) {
this.id = id;
}

/**
* Get this item's unique identifier
*/
public String getMNr() {
return mnr;
}

/**
* Set this item's unique identifier
*/
public void setMNr(String mnr) {
this.mnr = mnr;
}

/**
* Get this item's title
*/
public String getTitle() {
return title;
}

/**
* Set this item's title
*/
public void setTitle(String title) {
this.title = title;
}

/**
* Get this item's media type
*/
public SearchResult.MediaType getMediaType() {
return mediaType;
}

/**
* Set this item's media type
*/
public void setMediaType(SearchResult.MediaType mediaType) {
this.mediaType = mediaType;
}
}
1 change: 1 addition & 0 deletions opacclient/opacapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ dependencies {
debugImplementation 'com.facebook.flipper:flipper:0.87.0'
debugImplementation 'com.facebook.soloader:soloader:0.10.1'
debugImplementation 'com.facebook.flipper:flipper-network-plugin:0.87.0'
debugImplementation 'org.slf4j:slf4j-android:1.7.26'
releaseImplementation 'com.facebook.flipper:flipper-noop:0.87.0'

// Testing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import de.geeksfactory.opacclient.frontend.MainActivity;
import de.geeksfactory.opacclient.frontend.MainPreferenceActivity;
import de.geeksfactory.opacclient.frontend.SearchResultListActivity;
import de.geeksfactory.opacclient.frontend.StarredFragment;
import de.geeksfactory.opacclient.i18n.AndroidStringProvider;
import de.geeksfactory.opacclient.networking.AndroidHttpClientFactory;
import de.geeksfactory.opacclient.objects.Account;
Expand Down Expand Up @@ -395,6 +396,12 @@ public void onCreate() {

sp = PreferenceManager.getDefaultSharedPreferences(this);

// Starred-Preferences: reset for keys which should not survive a restart
SharedPreferences.Editor editor = sp.edit();
editor.remove(StarredFragment.STATE_ACTIVATED_POSITION);
editor.remove(StarredFragment.STATE_FILTER_BRANCH);
editor.apply();

if (BuildConfig.SENTRY_DSN != null) {
SentryAndroid.init(this, options -> {
options.setDsn(BuildConfig.SENTRY_DSN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import de.geeksfactory.opacclient.barcode.BarcodeScanIntegrator;
import de.geeksfactory.opacclient.objects.Account;
import de.geeksfactory.opacclient.objects.LentItem;
import de.geeksfactory.opacclient.objects.SearchResult;
import de.geeksfactory.opacclient.reminder.Alarm;
import de.geeksfactory.opacclient.reminder.ReminderBroadcastReceiver;
import de.geeksfactory.opacclient.searchfields.SearchField;
Expand Down Expand Up @@ -506,12 +507,11 @@ public void onNewIntent(Intent intent) {
}

@Override
public void showDetail(String mNr) {
public void showDetail(String mNr, SearchResult.MediaType mediaType) {
if (isTablet()) {
rightFragment = new SearchResultDetailFragment();
Bundle args = new Bundle();
args.putString(SearchResultDetailFragment.ARG_ITEM_ID, mNr);
args.putString(SearchResultDetailFragment.ARG_ITEM_LIBRARY_IDENT, app.getLibrary().getIdent());
rightFragment.setArguments(args);

// Insert the fragment
Expand All @@ -521,7 +521,10 @@ public void showDetail(String mNr) {
} else {
Intent intent = new Intent(this, SearchResultDetailActivity.class);
intent.putExtra(SearchResultDetailFragment.ARG_ITEM_ID, mNr);
intent.putExtra(SearchResultDetailFragment.ARG_ITEM_LIBRARY_IDENT, app.getLibrary().getIdent());
if (mediaType!= null) {
intent.putExtra(SearchResultDetailFragment.ARG_ITEM_MEDIATYPE,
mediaType.toString());
}
startActivity(intent);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ public void onClick(DialogInterface dialog, int di) {
star.remove(star.getItemByTitle(bib, title));
item.setIcon(R.drawable.ic_star_0_white_24dp);
} else {
star.star(null, title, bib, getItem().getMediaType());
star.star(null, title, bib, getItem().getMediaType(), getItem().getCopies());
Toast toast = Toast.makeText(getActivity(),
getString(R.string.starred), Toast.LENGTH_SHORT);
toast.show();
Expand All @@ -863,7 +863,7 @@ public void onClick(DialogInterface dialog, int di) {
star.remove(star.getItem(bib, id));
item.setIcon(R.drawable.ic_star_0_white_24dp);
} else {
star.star(id, title, bib, getItem().getMediaType());
star.star(id, title, bib, getItem().getMediaType(), getItem().getCopies());
Toast toast = Toast.makeText(getActivity(),
getString(R.string.starred), Toast.LENGTH_SHORT);
toast.show();
Expand Down
Loading