Fix some bugs (#596)

remove redundant casting

Fix edittext layout when typing(reduce size), fix refresh drafts. Minor improvements

Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/596
Reviewed-by: 6543 <6543@noreply.codeberg.org>
This commit is contained in:
M M Arif
2020-07-19 15:44:08 +02:00
committed by 6543
parent e6109ef36d
commit b529f81115
12 changed files with 28 additions and 24 deletions

View File

@@ -40,6 +40,7 @@ public class DraftsFragment extends Fragment {
private TextView noData;
private List<DraftWithRepository> draftsList_;
private int currentActiveAccountId;
private SwipeRefreshLayout swipeRefresh;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -56,7 +57,7 @@ public class DraftsFragment extends Fragment {
noData = v.findViewById(R.id.noData);
mRecyclerView = v.findViewById(R.id.recyclerView);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
swipeRefresh = v.findViewById(R.id.pullToRefresh);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(ctx));
@@ -67,16 +68,15 @@ public class DraftsFragment extends Fragment {
adapter = new DraftsAdapter(getContext(), draftsList_);
currentActiveAccountId = tinyDb.getInt("currentActiveAccountId");
swipeRefresh.setOnRefreshListener(() -> new Handler().postDelayed(() -> {
draftsList_.clear();
swipeRefresh.setRefreshing(false);
fetchDataAsync(1);
fetchDataAsync(currentActiveAccountId);
}, 250));
currentActiveAccountId = tinyDb.getInt("currentActiveAccountId");
fetchDataAsync(currentActiveAccountId);
return v;
@@ -87,6 +87,7 @@ public class DraftsFragment extends Fragment {
draftsApi.getDrafts(accountId).observe(getViewLifecycleOwner(), drafts -> {
swipeRefresh.setRefreshing(false);
assert drafts != null;
if(drafts.size() > 0) {
@@ -141,7 +142,7 @@ public class DraftsFragment extends Fragment {
SearchView searchView = (SearchView) searchItem.getActionView();
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
((SearchView) searchView).setOnQueryTextListener(new SearchView.OnQueryTextListener() {
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {