use of com.orgzly.android.Shelf in project orgzly-android by orgzly.
the class NoteFragment method onAttach.
@Override
public void onAttach(Context context) {
if (BuildConfig.LOG_DEBUG)
LogUtils.d(TAG, getActivity());
super.onAttach(context);
/* This makes sure that the container activity has implemented
* the callback interface. If not, it throws an exception
*/
try {
mListener = (NoteFragmentListener) getActivity();
} catch (ClassCastException e) {
throw new ClassCastException(getActivity().toString() + " must implement " + NoteFragmentListener.class);
}
mShelf = new Shelf(getActivity().getApplicationContext());
parseArguments();
mUserTimeFormatter = new UserTimeFormatter(getActivity().getApplicationContext());
}
use of com.orgzly.android.Shelf in project orgzly-android by orgzly.
the class ListWidgetProvider method setNoteDone.
@SuppressLint("StaticFieldLeak")
private void setNoteDone(Context context, Intent intent) {
final Shelf shelf = new Shelf(context);
final long noteId = intent.getLongExtra(AppIntent.EXTRA_NOTE_ID, 0L);
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
shelf.setStateToFirstDone(noteId);
return null;
}
}.execute();
}
use of com.orgzly.android.Shelf in project orgzly-android by orgzly.
the class SyncService method onCreate.
@Override
public void onCreate() {
if (BuildConfig.LOG_DEBUG)
LogUtils.d(TAG);
shelf = new Shelf(this);
status.loadFromPreferences(this);
}
use of com.orgzly.android.Shelf in project orgzly-android by orgzly.
the class BookChooserActivity method onBookClicked.
@Override
public void onBookClicked(long bookId) {
if (action != null && action.equals(Intent.ACTION_CREATE_SHORTCUT)) {
// Get Book by its ID
Shelf shelf = new Shelf(this);
Book book = shelf.getBook(bookId);
if (book == null) {
Toast.makeText(this, R.string.book_does_not_exist_anymore, Toast.LENGTH_SHORT).show();
setResult(RESULT_CANCELED);
finish();
return;
}
String id = "notebook-" + bookId;
String name = book.getName();
String title = BookUtils.getFragmentTitleForBook(book);
Intent launchIntent = createLaunchIntent(book);
IconCompat icon = createIcon();
ShortcutInfoCompat shortcut = new ShortcutInfoCompat.Builder(this, id).setShortLabel(name).setLongLabel(title).setIcon(icon).setIntent(launchIntent).build();
setResult(RESULT_OK, ShortcutManagerCompat.createShortcutResultIntent(this, shortcut));
finish();
}
}
use of com.orgzly.android.Shelf in project orgzly-android by orgzly.
the class MainActivity method onNoteScrollToRequest.
@Override
public void onNoteScrollToRequest(long noteId) {
// TODO: Avoid using Shelf from activity directly
Shelf shelf = new Shelf(this);
Note note = shelf.getNote(noteId);
if (note != null) {
long bookId = note.getPosition().getBookId();
mSyncFragment.sparseTree(bookId, noteId);
DisplayManager.displayBook(getSupportFragmentManager(), bookId, noteId);
}
}
Aggregations