mirror of https://codeberg.org/gitnex/GitNex.git
revert back
This commit is contained in:
parent
56b8b486df
commit
5baacbd801
|
@ -10,7 +10,6 @@ import android.widget.Filterable;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.activities.FileViewActivity;
|
import org.mian.gitnex.activities.FileViewActivity;
|
||||||
|
@ -29,11 +28,6 @@ public class FilesAdapter extends RecyclerView.Adapter<FilesAdapter.FilesViewHol
|
||||||
private List<Files> filesList;
|
private List<Files> filesList;
|
||||||
private Context mCtx;
|
private Context mCtx;
|
||||||
private List<Files> filesListFull;
|
private List<Files> filesListFull;
|
||||||
public FilesDirsResponse filesDirResponse;
|
|
||||||
|
|
||||||
public interface FilesDirsResponse{
|
|
||||||
void onClickResponse(String str);
|
|
||||||
}
|
|
||||||
|
|
||||||
class FilesViewHolder extends RecyclerView.ViewHolder {
|
class FilesViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
@ -64,9 +58,7 @@ public class FilesAdapter extends RecyclerView.Adapter<FilesAdapter.FilesViewHol
|
||||||
}
|
}
|
||||||
else if(fileType.getText().toString().equals("dir")) {
|
else if(fileType.getText().toString().equals("dir")) {
|
||||||
//tinyDb.putString("filesDir", fileName.getText().toString());
|
//tinyDb.putString("filesDir", fileName.getText().toString());
|
||||||
if(filesDirResponse!=null)
|
Toasty.info(context, context.getString(R.string.filesDirNotSupportedYet));
|
||||||
filesDirResponse.onClickResponse(fileName.getText().toString());
|
|
||||||
//Toasty.info(context, context.getString(R.string.filesDirNotSupportedYet));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Toasty.info(context, context.getString(R.string.filesGenericError));
|
Toasty.info(context, context.getString(R.string.filesGenericError));
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.os.Bundle;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import androidx.lifecycle.Observer;
|
import androidx.lifecycle.Observer;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
|
@ -30,8 +29,6 @@ import org.mian.gitnex.models.Files;
|
||||||
import org.mian.gitnex.util.AppUtil;
|
import org.mian.gitnex.util.AppUtil;
|
||||||
import org.mian.gitnex.util.TinyDB;
|
import org.mian.gitnex.util.TinyDB;
|
||||||
import org.mian.gitnex.viewmodels.FilesViewModel;
|
import org.mian.gitnex.viewmodels.FilesViewModel;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -39,7 +36,7 @@ import java.util.Objects;
|
||||||
* Author M M Arif
|
* Author M M Arif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class FilesFragment extends Fragment implements FilesAdapter.FilesDirsResponse {
|
public class FilesFragment extends Fragment {
|
||||||
|
|
||||||
private ProgressBar mProgressBar;
|
private ProgressBar mProgressBar;
|
||||||
private FilesAdapter adapter;
|
private FilesAdapter adapter;
|
||||||
|
@ -52,7 +49,6 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesDirsRes
|
||||||
|
|
||||||
private String repoName;
|
private String repoName;
|
||||||
private String repoOwner;
|
private String repoOwner;
|
||||||
private List<Files> filesList;
|
|
||||||
|
|
||||||
private OnFragmentInteractionListener mListener;
|
private OnFragmentInteractionListener mListener;
|
||||||
|
|
||||||
|
@ -84,9 +80,6 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesDirsRes
|
||||||
View v = inflater.inflate(R.layout.fragment_files, container, false);
|
View v = inflater.inflate(R.layout.fragment_files, container, false);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
FilesAdapter myAdapter = new FilesAdapter(getActivity(), filesList);
|
|
||||||
myAdapter.filesDirResponse = this;
|
|
||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(getContext());
|
TinyDB tinyDb = new TinyDB(getContext());
|
||||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||||
final String loginUid = tinyDb.getString("loginUid");
|
final String loginUid = tinyDb.getString("loginUid");
|
||||||
|
@ -122,29 +115,12 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesDirsRes
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(filesDirDB.isEmpty()) {
|
|
||||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName);
|
|
||||||
tinyDb.putString("filesDir", "");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
tinyDb.putString("filesDir", "");
|
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||||
}
|
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClickResponse(String str) {
|
|
||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(getContext());
|
|
||||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
|
||||||
final String loginUid = tinyDb.getString("loginUid");
|
|
||||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
|
||||||
|
|
||||||
fetchDataAsyncSub(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) {
|
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) {
|
||||||
|
|
||||||
FilesViewModel filesModel = new ViewModelProvider(this).get(FilesViewModel.class);
|
FilesViewModel filesModel = new ViewModelProvider(this).get(FilesViewModel.class);
|
||||||
|
|
Loading…
Reference in New Issue