Merge branch '37-fix-crash-within-tabs' of mmarif/GitNex into master

This commit is contained in:
M M Arif 2019-09-14 09:43:54 +00:00 committed by Gitea
commit e8e0cf904b
9 changed files with 100 additions and 99 deletions

View File

@ -172,7 +172,7 @@ public class RepoDetailActivity extends AppCompatActivity implements RepoBottomS
public class SectionsPagerAdapter extends FragmentStatePagerAdapter {
SectionsPagerAdapter(FragmentManager fm) {
super(fm);
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
}
@NonNull

View File

@ -66,7 +66,7 @@ public class BranchesAdapter extends RecyclerView.Adapter<BranchesAdapter.Branch
holder.branchCommitAuthor.setText(mCtx.getResources().getString(R.string.commitAuthor, currentItem.getCommit().getAuthor().getUsername()));
}
holder.branchCommitHash.setText(mCtx.getResources().getString(R.string.commitHash, UrlHelper.cleanUrl(instanceUrl), currentItem.getCommit().getUrl()));
holder.branchCommitHash.setText(mCtx.getResources().getString(R.string.commitHash, "", currentItem.getCommit().getUrl()));
}

View File

@ -1,7 +1,6 @@
package org.mian.gitnex.fragments;
import android.content.Context;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
@ -15,7 +14,6 @@ import ru.noties.markwon.core.CorePlugin;
import ru.noties.markwon.core.MarkwonTheme;
import ru.noties.markwon.ext.strikethrough.StrikethroughPlugin;
import ru.noties.markwon.ext.tables.TablePlugin;
import ru.noties.markwon.ext.tables.TableTheme;
import ru.noties.markwon.ext.tasklist.TaskListPlugin;
import ru.noties.markwon.html.HtmlPlugin;
import ru.noties.markwon.image.ImagesPlugin;
@ -220,6 +218,8 @@ public class RepoInfoFragment extends Fragment {
UserRepositories repoInfo = response.body();
if (isAdded()) {
if (response.isSuccessful()) {
if (response.code() == 200) {
@ -270,6 +270,8 @@ public class RepoInfoFragment extends Fragment {
}
}
@Override
public void onFailure(@NonNull Call<UserRepositories> call, @NonNull Throwable t) {
Log.e("onFailure", t.toString());
@ -292,6 +294,8 @@ public class RepoInfoFragment extends Fragment {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) {
if (isAdded()) {
if (response.code() == 200) {
final Markwon markwon = Markwon.builder(Objects.requireNonNull(getContext()))
@ -320,31 +324,29 @@ public class RepoInfoFragment extends Fragment {
}
repoFileContents.setText(bodyWithMD);
}
else if(response.code() == 401) {
} else if (response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
}
else if(response.code() == 403) {
} else if (response.code() == 403) {
Toasty.info(ctx, ctx.getString(R.string.authorizeError));
}
else if(response.code() == 404) {
} else if (response.code() == 404) {
fileContentsFrameHeader.setVisibility(View.GONE);
fileContentsFrame.setVisibility(View.GONE);
}
else {
} else {
Toasty.info(getContext(), getString(R.string.genericError));
}
}
}

View File

@ -9,11 +9,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:paddingTop="10dp"
android:paddingBottom="15dp"
android:paddingBottom="5dp"
android:id="@+id/branchesFrame"
android:layout_margin="15dp"
android:orientation="vertical">
<TextView

View File

@ -107,6 +107,7 @@
android:textIsSelectable="true"
android:textSize="16sp"
android:paddingTop="5dp"
android:autoLink="web"
android:textColor="@color/colorWhite"/>
<TextView

View File

@ -9,7 +9,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="15dp"
android:layout_margin="15dp"
android:id="@+id/labelsFrame"
android:orientation="horizontal">

View File

@ -9,7 +9,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="15dp"
android:layout_margin="15dp"
android:id="@+id/milestoneFrame"
android:orientation="vertical">

View File

@ -11,7 +11,7 @@
android:layout_alignParentTop="true"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:padding="15dp"
android:layout_margin="15dp"
android:theme="@style/AppTheme">
<LinearLayout

View File

@ -11,7 +11,7 @@
android:id="@+id/relativeLayoutFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="15dp"
android:layout_margin="15dp"
android:theme="@style/AppTheme"
tools:context=".activities.RepoDetailActivity">