Remove unneeded dependency.
Cette révision appartient à :
Parent
a81f6c3ac4
révision
5a83976fa5
3 fichiers modifiés avec 64 ajouts et 25 suppressions
|
@ -123,7 +123,6 @@ dependencies {
|
|||
compile 'com.github.bumptech.glide:glide:3.6.1'
|
||||
compile 'com.jakewharton:butterknife:7.0.1'
|
||||
compile 'com.jakewharton.timber:timber:4.1.0'
|
||||
compile 'uk.co.ribot:easyadapter:1.5.0@aar'
|
||||
compile 'ch.acra:acra:4.8.1'
|
||||
compile "frankiesardo:icepick:$ICEPICK_VERSION"
|
||||
provided "frankiesardo:icepick-processor:$ICEPICK_VERSION"
|
||||
|
|
|
@ -11,7 +11,6 @@ import android.view.View;
|
|||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
|
@ -25,11 +24,6 @@ import eu.kanade.tachiyomi.data.database.models.MangaSync;
|
|||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.subjects.PublishSubject;
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
import uk.co.ribot.easyadapter.ItemViewHolder;
|
||||
import uk.co.ribot.easyadapter.PositionInfo;
|
||||
import uk.co.ribot.easyadapter.annotations.LayoutId;
|
||||
import uk.co.ribot.easyadapter.annotations.ViewId;
|
||||
|
||||
public class MyAnimeListDialogFragment extends DialogFragment {
|
||||
|
||||
|
@ -37,7 +31,7 @@ public class MyAnimeListDialogFragment extends DialogFragment {
|
|||
@Bind(R.id.myanimelist_search_results) ListView searchResults;
|
||||
@Bind(R.id.progress) ProgressBar progressBar;
|
||||
|
||||
private EasyAdapter<MangaSync> adapter;
|
||||
private MyAnimeListSearchAdapter adapter;
|
||||
private MangaSync selectedItem;
|
||||
|
||||
private Subscription searchSubscription;
|
||||
|
@ -59,7 +53,7 @@ public class MyAnimeListDialogFragment extends DialogFragment {
|
|||
ButterKnife.bind(this, dialog.getView());
|
||||
|
||||
// Create adapter
|
||||
adapter = new EasyAdapter<>(getActivity(), ResultViewHolder.class);
|
||||
adapter = new MyAnimeListSearchAdapter(getActivity());
|
||||
searchResults.setAdapter(adapter);
|
||||
|
||||
// Set listeners
|
||||
|
@ -125,7 +119,7 @@ public class MyAnimeListDialogFragment extends DialogFragment {
|
|||
public void onSearchResultsError() {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
searchResults.setVisibility(View.VISIBLE);
|
||||
adapter.getItems().clear();
|
||||
adapter.clear();
|
||||
}
|
||||
|
||||
public MyAnimeListFragment getMALFragment() {
|
||||
|
@ -136,21 +130,6 @@ public class MyAnimeListDialogFragment extends DialogFragment {
|
|||
return getMALFragment().getPresenter();
|
||||
}
|
||||
|
||||
@LayoutId(R.layout.dialog_myanimelist_search_item)
|
||||
public static class ResultViewHolder extends ItemViewHolder<MangaSync> {
|
||||
|
||||
@ViewId(R.id.myanimelist_result_title) TextView title;
|
||||
|
||||
public ResultViewHolder(View view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetValues(MangaSync chapter, PositionInfo positionInfo) {
|
||||
title.setText(chapter.title);
|
||||
}
|
||||
}
|
||||
|
||||
private static class SimpleTextChangeListener implements TextWatcher {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package eu.kanade.tachiyomi.ui.manga.myanimelist;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.Bind;
|
||||
import butterknife.ButterKnife;
|
||||
import eu.kanade.tachiyomi.R;
|
||||
import eu.kanade.tachiyomi.data.database.models.MangaSync;
|
||||
|
||||
public class MyAnimeListSearchAdapter extends ArrayAdapter<MangaSync> {
|
||||
|
||||
public MyAnimeListSearchAdapter(Context context) {
|
||||
super(context, R.layout.dialog_myanimelist_search_item, new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View view, ViewGroup parent) {
|
||||
// Get the data item for this position
|
||||
MangaSync sync = getItem(position);
|
||||
// Check if an existing view is being reused, otherwise inflate the view
|
||||
SearchViewHolder holder; // view lookup cache stored in tag
|
||||
if (view == null) {
|
||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
view = inflater.inflate(R.layout.dialog_myanimelist_search_item, parent, false);
|
||||
holder = new SearchViewHolder(view);
|
||||
view.setTag(holder);
|
||||
} else {
|
||||
holder = (SearchViewHolder) view.getTag();
|
||||
}
|
||||
holder.onSetValues(sync);
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setItems(List<MangaSync> syncs) {
|
||||
setNotifyOnChange(false);
|
||||
clear();
|
||||
addAll(syncs);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public static class SearchViewHolder {
|
||||
|
||||
@Bind(R.id.myanimelist_result_title) TextView title;
|
||||
|
||||
public SearchViewHolder(View view) {
|
||||
ButterKnife.bind(this, view);
|
||||
}
|
||||
|
||||
public void onSetValues(MangaSync sync) {
|
||||
title.setText(sync.title);
|
||||
}
|
||||
}
|
||||
}
|
Référencer dans un nouveau ticket