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

@ -50,14 +50,14 @@ dependencies {
androidTestImplementation "androidx.test:runner:1.2.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.2.0"
implementation "com.github.vihtarb:tooltip:0.2.0"
implementation 'com.squareup.okhttp3:okhttp:4.7.2'
implementation 'com.squareup.okhttp3:okhttp:4.8.0'
implementation "com.google.code.gson:gson:2.8.6"
implementation "com.squareup.picasso:picasso:2.71828"
implementation "com.amulyakhare:com.amulyakhare.textdrawable:1.0.1"
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.0'
implementation 'org.ocpsoft.prettytime:prettytime:4.0.5.Final'
implementation "com.vdurmont:emoji-java:5.1.1"
implementation "com.pes.materialcolorpicker:library:1.2.5"

View File

@ -3,6 +3,7 @@ package org.mian.gitnex.adapters;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -64,10 +65,10 @@ public class DraftsAdapter extends RecyclerView.Adapter<DraftsAdapter.DraftsView
itemView.setOnClickListener(itemEdit -> {
Intent intent = new Intent(mCtx, ReplyToIssueActivity.class);
intent.putExtra("commentBody", draftText.getText());
intent.putExtra("issueNumber", issueNumber.getText());
intent.putExtra("repositoryId", repoId.getText());
intent.putExtra("draftTitle", repoInfo.getText());
intent.putExtra("commentBody", draftText.getText().toString());
intent.putExtra("issueNumber", issueNumber.getText().toString());
intent.putExtra("repositoryId", repoId.getText().toString());
intent.putExtra("draftTitle", repoInfo.getText().toString());
TinyDB tinyDb = new TinyDB(mCtx);
tinyDb.putString("issueNumber", issueNumber.getText().toString());
@ -116,7 +117,9 @@ public class DraftsAdapter extends RecyclerView.Adapter<DraftsAdapter.DraftsView
holder.repoOwner.setText(currentItem.getRepositoryOwner());
holder.repoName.setText(currentItem.getRepositoryName());
holder.draftText.setText(currentItem.getDraftText());
holder.repoInfo.setText(String.format("%s%d %s / %s", mCtx.getResources().getString(R.string.hash), currentItem.getIssueId(), currentItem.getRepositoryOwner(), currentItem.getRepositoryName()));
String issueNumber = "<font color='" + mCtx.getResources().getColor(R.color.lightGray) + "'>" + mCtx.getResources().getString(R.string.hash) + currentItem.getIssueId() + "</font>";
holder.repoInfo.setText(Html.fromHtml(issueNumber + " " + currentItem.getRepositoryOwner() + " / " + currentItem.getRepositoryName()));
}

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) {

View File

@ -90,7 +90,7 @@
<com.hendraanggrian.appcompat.widget.SocialAutoCompleteTextView
android:id="@+id/newIssueDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="240dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:completionThreshold="1"

View File

@ -139,7 +139,7 @@
<EditText
android:id="@+id/releaseContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="240dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:maxLines="8"

View File

@ -89,7 +89,7 @@
<com.hendraanggrian.appcompat.widget.SocialAutoCompleteTextView
android:id="@+id/editIssueDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="240dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:completionThreshold="1"

View File

@ -100,7 +100,7 @@
<EditText
android:id="@+id/newFileContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="240dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:maxLines="16"

View File

@ -90,7 +90,7 @@
<EditText
android:id="@+id/milestoneDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="160dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:maxLines="8"

View File

@ -90,7 +90,7 @@
<EditText
android:id="@+id/newOrganizationDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="160dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:maxLines="8"

View File

@ -118,7 +118,7 @@
<EditText
android:id="@+id/newRepoDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="160dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:background="@drawable/shape_inputs"

View File

@ -71,7 +71,7 @@
<com.hendraanggrian.appcompat.widget.SocialAutoCompleteTextView
android:id="@+id/addComment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="240dp"
android:padding="10dp"
android:completionThreshold="1"
android:background="@drawable/shape_inputs"

View File

@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
}
}