Search in sources :

Example 1 with SimpleIconListAdapter

use of de.danoeh.antennapod.adapter.SimpleIconListAdapter in project AntennaPod by AntennaPod.

the class SpecialThanksFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    getListView().setDivider(null);
    getListView().setSelector(android.R.color.transparent);
    translatorsLoader = Single.create((SingleOnSubscribe<ArrayList<SimpleIconListAdapter.ListItem>>) emitter -> {
        ArrayList<SimpleIconListAdapter.ListItem> translators = new ArrayList<>();
        BufferedReader reader = new BufferedReader(new InputStreamReader(getContext().getAssets().open("special_thanks.csv"), "UTF-8"));
        String line;
        while ((line = reader.readLine()) != null) {
            String[] info = line.split(";");
            translators.add(new SimpleIconListAdapter.ListItem(info[0], info[1], info[2]));
        }
        emitter.onSuccess(translators);
    }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(translators -> setListAdapter(new SimpleIconListAdapter<>(getContext(), translators)), error -> Toast.makeText(getContext(), error.getMessage(), Toast.LENGTH_LONG).show());
}
Also used : Bundle(android.os.Bundle) NonNull(androidx.annotation.NonNull) Single(io.reactivex.Single) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) InputStreamReader(java.io.InputStreamReader) SimpleIconListAdapter(de.danoeh.antennapod.adapter.SimpleIconListAdapter) ArrayList(java.util.ArrayList) Disposable(io.reactivex.disposables.Disposable) Nullable(androidx.annotation.Nullable) Toast(android.widget.Toast) View(android.view.View) ListFragment(androidx.fragment.app.ListFragment) Schedulers(io.reactivex.schedulers.Schedulers) BufferedReader(java.io.BufferedReader) SingleOnSubscribe(io.reactivex.SingleOnSubscribe) InputStreamReader(java.io.InputStreamReader) ArrayList(java.util.ArrayList) BufferedReader(java.io.BufferedReader) SimpleIconListAdapter(de.danoeh.antennapod.adapter.SimpleIconListAdapter)

Example 2 with SimpleIconListAdapter

use of de.danoeh.antennapod.adapter.SimpleIconListAdapter in project AntennaPod by AntennaPod.

the class TranslatorsFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    getListView().setDivider(null);
    getListView().setSelector(android.R.color.transparent);
    translatorsLoader = Single.create((SingleOnSubscribe<ArrayList<SimpleIconListAdapter.ListItem>>) emitter -> {
        ArrayList<SimpleIconListAdapter.ListItem> translators = new ArrayList<>();
        BufferedReader reader = new BufferedReader(new InputStreamReader(getContext().getAssets().open("translators.csv"), "UTF-8"));
        String line;
        while ((line = reader.readLine()) != null) {
            String[] info = line.split(";");
            translators.add(new SimpleIconListAdapter.ListItem(info[0], info[1], null));
        }
        emitter.onSuccess(translators);
    }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(translators -> setListAdapter(new SimpleIconListAdapter<>(getContext(), translators)), error -> Toast.makeText(getContext(), error.getMessage(), Toast.LENGTH_LONG).show());
}
Also used : Bundle(android.os.Bundle) NonNull(androidx.annotation.NonNull) Single(io.reactivex.Single) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) InputStreamReader(java.io.InputStreamReader) SimpleIconListAdapter(de.danoeh.antennapod.adapter.SimpleIconListAdapter) ArrayList(java.util.ArrayList) Disposable(io.reactivex.disposables.Disposable) Nullable(androidx.annotation.Nullable) Toast(android.widget.Toast) View(android.view.View) ListFragment(androidx.fragment.app.ListFragment) Schedulers(io.reactivex.schedulers.Schedulers) BufferedReader(java.io.BufferedReader) SingleOnSubscribe(io.reactivex.SingleOnSubscribe) InputStreamReader(java.io.InputStreamReader) ArrayList(java.util.ArrayList) BufferedReader(java.io.BufferedReader) SimpleIconListAdapter(de.danoeh.antennapod.adapter.SimpleIconListAdapter)

Example 3 with SimpleIconListAdapter

use of de.danoeh.antennapod.adapter.SimpleIconListAdapter in project AntennaPod by AntennaPod.

the class DevelopersFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    getListView().setDivider(null);
    getListView().setSelector(android.R.color.transparent);
    developersLoader = Single.create((SingleOnSubscribe<ArrayList<SimpleIconListAdapter.ListItem>>) emitter -> {
        ArrayList<SimpleIconListAdapter.ListItem> developers = new ArrayList<>();
        BufferedReader reader = new BufferedReader(new InputStreamReader(getContext().getAssets().open("developers.csv"), "UTF-8"));
        String line;
        while ((line = reader.readLine()) != null) {
            String[] info = line.split(";");
            developers.add(new SimpleIconListAdapter.ListItem(info[0], info[2], "https://avatars2.githubusercontent.com/u/" + info[1] + "?s=60&v=4"));
        }
        emitter.onSuccess(developers);
    }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(developers -> setListAdapter(new SimpleIconListAdapter<>(getContext(), developers)), error -> Toast.makeText(getContext(), error.getMessage(), Toast.LENGTH_LONG).show());
}
Also used : Bundle(android.os.Bundle) NonNull(androidx.annotation.NonNull) Single(io.reactivex.Single) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) InputStreamReader(java.io.InputStreamReader) SimpleIconListAdapter(de.danoeh.antennapod.adapter.SimpleIconListAdapter) ArrayList(java.util.ArrayList) Disposable(io.reactivex.disposables.Disposable) Nullable(androidx.annotation.Nullable) Toast(android.widget.Toast) View(android.view.View) ListFragment(androidx.fragment.app.ListFragment) Schedulers(io.reactivex.schedulers.Schedulers) BufferedReader(java.io.BufferedReader) SingleOnSubscribe(io.reactivex.SingleOnSubscribe) InputStreamReader(java.io.InputStreamReader) ArrayList(java.util.ArrayList) BufferedReader(java.io.BufferedReader) SimpleIconListAdapter(de.danoeh.antennapod.adapter.SimpleIconListAdapter)

Aggregations

Bundle (android.os.Bundle)3 View (android.view.View)3 Toast (android.widget.Toast)3 NonNull (androidx.annotation.NonNull)3 Nullable (androidx.annotation.Nullable)3 ListFragment (androidx.fragment.app.ListFragment)3 SimpleIconListAdapter (de.danoeh.antennapod.adapter.SimpleIconListAdapter)3 Single (io.reactivex.Single)3 SingleOnSubscribe (io.reactivex.SingleOnSubscribe)3 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)3 Disposable (io.reactivex.disposables.Disposable)3 Schedulers (io.reactivex.schedulers.Schedulers)3 BufferedReader (java.io.BufferedReader)3 InputStreamReader (java.io.InputStreamReader)3 ArrayList (java.util.ArrayList)3