Minor changes

This commit is contained in:
inorichi 2016-01-30 00:41:39 +01:00
parent 38bb0b61d4
commit 78a2eae719
2 changed files with 21 additions and 22 deletions

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.io;
package eu.kanade.tachiyomi.data.io;
import android.content.ContentResolver;
import android.content.Context;

View File

@ -27,7 +27,7 @@ import eu.kanade.tachiyomi.R;
import eu.kanade.tachiyomi.data.cache.CoverCache;
import eu.kanade.tachiyomi.data.database.models.Manga;
import eu.kanade.tachiyomi.data.source.base.Source;
import eu.kanade.tachiyomi.io.IOHandler;
import eu.kanade.tachiyomi.data.io.IOHandler;
import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment;
import eu.kanade.tachiyomi.util.ToastUtil;
import nucleus.factory.RequiresPresenter;
@ -35,7 +35,6 @@ import nucleus.factory.RequiresPresenter;
@RequiresPresenter(MangaInfoPresenter.class)
public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> {
private static final int REQUEST_IMAGE_OPEN = 101;
@Bind(R.id.swipe_refresh) SwipeRefreshLayout swipeRefresh;
@Bind(R.id.manga_artist) TextView artist;
@Bind(R.id.manga_author) TextView author;
@ -48,6 +47,8 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> {
@Bind(R.id.action_favorite) Button favoriteBtn;
@Bind(R.id.fab_edit) FloatingActionButton fabEdit;
private static final int REQUEST_IMAGE_OPEN = 101;
public static MangaInfoFragment newInstance() {
return new MangaInfoFragment();
}
@ -71,11 +72,11 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> {
.color(ContextCompat.getColor(this.getContext(), R.color.white))
.sizeDp(24);
// Update image of fab buttons
// Update image of fab button
fabEdit.setImageDrawable(edit);
// Set listener.
fabEdit.setOnClickListener(v -> MangaInfoFragment.this.selectImage());
fabEdit.setOnClickListener(v -> selectImage());
favoriteBtn.setOnClickListener(v -> getPresenter().toggleFavorite());
@ -150,20 +151,19 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> {
}
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
if (requestCode == REQUEST_IMAGE_OPEN) {
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_IMAGE_OPEN) {
// Get the file's content URI from the incoming Intent
Uri selectedImageUri = data.getData();
// Convert to absolute path to prevent FileNotFoundException
String result = IOHandler.getFilePath(selectedImageUri, this.getContext().getContentResolver(), this.getContext());
String result = IOHandler.getFilePath(selectedImageUri,
getContext().getContentResolver(), getContext());
// Get file from filepath
File picture = new File(result != null ? result : "");
try {
// Update cover to selected file
getPresenter().editCoverWithLocalFile(picture, cover);
@ -173,7 +173,6 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> {
}
}
}
}
public void onFetchMangaDone() {
setRefreshing(false);