|
|
@ -24,6 +24,7 @@ import android.content.Context;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
@ -43,6 +44,7 @@ public class FragmentDialogFolder extends DialogFragmentEx {
|
|
|
|
String title = getArguments().getString("title");
|
|
|
|
String title = getArguments().getString("title");
|
|
|
|
|
|
|
|
|
|
|
|
final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_folder_select, null);
|
|
|
|
final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_folder_select, null);
|
|
|
|
|
|
|
|
final TextView tvNoFolder = dview.findViewById(R.id.tvNoFolder);
|
|
|
|
final RecyclerView rvFolder = dview.findViewById(R.id.rvFolder);
|
|
|
|
final RecyclerView rvFolder = dview.findViewById(R.id.rvFolder);
|
|
|
|
final ContentLoadingProgressBar pbWait = dview.findViewById(R.id.pbWait);
|
|
|
|
final ContentLoadingProgressBar pbWait = dview.findViewById(R.id.pbWait);
|
|
|
|
|
|
|
|
|
|
|
@ -50,15 +52,24 @@ public class FragmentDialogFolder extends DialogFragmentEx {
|
|
|
|
LinearLayoutManager llm = new LinearLayoutManager(getContext());
|
|
|
|
LinearLayoutManager llm = new LinearLayoutManager(getContext());
|
|
|
|
rvFolder.setLayoutManager(llm);
|
|
|
|
rvFolder.setLayoutManager(llm);
|
|
|
|
|
|
|
|
|
|
|
|
rvFolder.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
pbWait.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putLong("account", getArguments().getLong("account"));
|
|
|
|
args.putLong("account", getArguments().getLong("account"));
|
|
|
|
|
|
|
|
|
|
|
|
new SimpleTask<List<TupleFolderEx>>() {
|
|
|
|
new SimpleTask<List<TupleFolderEx>>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected List<TupleFolderEx> onExecute(Context context, Bundle args) {
|
|
|
|
protected void onPreExecute(Bundle args) {
|
|
|
|
|
|
|
|
tvNoFolder.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
rvFolder.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
pbWait.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onPostExecute(Bundle args) {
|
|
|
|
|
|
|
|
pbWait.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected List<TupleFolderEx> onExecute(Context context, Bundle args) throws Throwable {
|
|
|
|
long account = args.getLong("account");
|
|
|
|
long account = args.getLong("account");
|
|
|
|
|
|
|
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
@ -70,26 +81,29 @@ public class FragmentDialogFolder extends DialogFragmentEx {
|
|
|
|
if (folders == null)
|
|
|
|
if (folders == null)
|
|
|
|
folders = new ArrayList<>();
|
|
|
|
folders = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
long account = args.getLong("account");
|
|
|
|
if (folders.size() == 0)
|
|
|
|
AdapterFolder adapter = new AdapterFolder(getContext(), getActivity(),
|
|
|
|
tvNoFolder.setVisibility(View.VISIBLE);
|
|
|
|
account, false, new AdapterFolder.IFolderSelectedListener() {
|
|
|
|
else {
|
|
|
|
@Override
|
|
|
|
long account = args.getLong("account");
|
|
|
|
public void onFolderSelected(TupleFolderEx folder) {
|
|
|
|
AdapterFolder adapter = new AdapterFolder(getContext(), getActivity(),
|
|
|
|
Bundle args = getArguments();
|
|
|
|
account, false, new AdapterFolder.IFolderSelectedListener() {
|
|
|
|
args.putLong("folder", folder.id);
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onFolderSelected(TupleFolderEx folder) {
|
|
|
|
sendResult(RESULT_OK);
|
|
|
|
Bundle args = getArguments();
|
|
|
|
dismiss();
|
|
|
|
args.putLong("folder", folder.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
sendResult(RESULT_OK);
|
|
|
|
|
|
|
|
dismiss();
|
|
|
|
rvFolder.setAdapter(adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
adapter.setDisabled(Helper.fromLongArray(getArguments().getLongArray("disabled")));
|
|
|
|
|
|
|
|
adapter.set(folders);
|
|
|
|
rvFolder.setAdapter(adapter);
|
|
|
|
|
|
|
|
|
|
|
|
pbWait.setVisibility(View.GONE);
|
|
|
|
adapter.setDisabled(Helper.fromLongArray(getArguments().getLongArray("disabled")));
|
|
|
|
rvFolder.setVisibility(View.VISIBLE);
|
|
|
|
adapter.set(folders);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rvFolder.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|