Search in sources :

Example 1 with DataFolderAdapter

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

the class ChooseDataFolderDialog method showDialog.

public static void showDialog(final Context context, Consumer<String> handlerFunc) {
    View content = View.inflate(context, R.layout.choose_data_folder_dialog, null);
    AlertDialog dialog = new AlertDialog.Builder(context).setView(content).setTitle(R.string.choose_data_directory).setMessage(R.string.choose_data_directory_message).setNegativeButton(R.string.cancel_label, null).create();
    ((RecyclerView) content.findViewById(R.id.recyclerView)).setLayoutManager(new LinearLayoutManager(context));
    DataFolderAdapter adapter = new DataFolderAdapter(context, path -> {
        dialog.dismiss();
        handlerFunc.accept(path);
    });
    ((RecyclerView) content.findViewById(R.id.recyclerView)).setAdapter(adapter);
    if (adapter.getItemCount() > 0) {
        dialog.show();
    } else {
        new AlertDialog.Builder(context).setTitle(R.string.error_label).setMessage(R.string.external_storage_error_msg).setPositiveButton(android.R.string.ok, null).show();
    }
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) DataFolderAdapter(de.danoeh.antennapod.adapter.DataFolderAdapter)

Aggregations

View (android.view.View)1 AlertDialog (androidx.appcompat.app.AlertDialog)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 DataFolderAdapter (de.danoeh.antennapod.adapter.DataFolderAdapter)1