Show archived repo message (#530)

Implement archived repo in all adapters

Merge branch 'archive-repo2' into archive-repo

Fix typos

Fixing gravity.

Restoring old names.

Design changes.

Adjusting sizing.

Improving design of archived message.

Show archived repo message and other fixes

Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: opyale <opyale@noreply.gitea.io>
Reviewed-by: opyale <opyale@noreply.codeberg.org>
This commit is contained in:
M M Arif 2020-06-06 21:41:19 +02:00
parent 5e41469452
commit e267aa5100
16 changed files with 137 additions and 23 deletions

View File

@ -203,7 +203,7 @@ public class IssueActions {
}
else {
Toasty.info(ctx, ctx.getString(R.string.subscribtionError));
Toasty.info(ctx, ctx.getString(R.string.subscriptionError));
}
@ -263,7 +263,7 @@ public class IssueActions {
}
else {
Toasty.info(ctx, ctx.getString(R.string.unsubscribtionError));
Toasty.info(ctx, ctx.getString(R.string.unsubscriptionError));
}
@ -272,7 +272,7 @@ public class IssueActions {
@Override
public void onFailure(@NonNull Call<Void> call, @NonNull Throwable t) {
Toasty.info(ctx, ctx.getString(R.string.unsubscribtionError));
Toasty.info(ctx, ctx.getString(R.string.unsubscriptionError));
}
});
}

View File

@ -439,7 +439,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
gitea_version = new Version(version.getVersion());
}
catch(Error e) {
SnackBar.error(ctx, layoutView, getResources().getString(R.string.versionUnknow));
SnackBar.error(ctx, layoutView, getResources().getString(R.string.versionUnknown));
enableProcessButton();
}
//(getString(R.string.versionLow), getString(), version.getVersion());

View File

@ -201,7 +201,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
AlertDialog.Builder hsBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
hsBuilder.setTitle(R.string.settingshomeScreenSelectorDialogTitle);
hsBuilder.setTitle(R.string.settingsHomeScreenSelectorDialogTitle);
if(homeScreenSelectedChoice != -1) {
hsBuilder.setCancelable(true);
}

View File

@ -9,6 +9,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
@ -58,6 +59,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
private TextView repoStars;
private TextView repoForks;
private TextView repoOpenIssuesCount;
private LinearLayout archiveRepo;
private ReposSearchViewHolder(View itemView) {
@ -73,6 +75,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
repoForks = itemView.findViewById(R.id.repoForks);
repoOpenIssuesCount = itemView.findViewById(R.id.repoOpenIssuesCount);
ImageView reposDropdownMenu = itemView.findViewById(R.id.reposDropdownMenu);
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
itemView.setOnClickListener(v -> {
@ -242,6 +245,13 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
}
holder.isRepoAdmin.setChecked(currentItem.getPermissions().isAdmin());
if(currentItem.isArchived()) {
holder.archiveRepo.setVisibility(View.VISIBLE);
}
else {
holder.archiveRepo.setVisibility(View.GONE);
}
}
@Override

View File

@ -11,6 +11,7 @@ import android.widget.CheckBox;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.amulyakhare.textdrawable.TextDrawable;
import com.amulyakhare.textdrawable.util.ColorGenerator;
@ -56,6 +57,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
private TextView repoOpenIssuesCount;
private TextView repoType;
private CheckBox isRepoAdmin;
private LinearLayout archiveRepo;
private MyReposViewHolder(View itemView) {
super(itemView);
@ -70,6 +72,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
ImageView reposDropdownMenu = itemView.findViewById(R.id.reposDropdownMenu);
repoType = itemView.findViewById(R.id.repoType);
isRepoAdmin = itemView.findViewById(R.id.repoIsAdmin);
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
itemView.setOnClickListener(v -> {
@ -252,6 +255,13 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
}
holder.isRepoAdmin.setChecked(currentItem.getPermissions().isAdmin());
if(currentItem.isArchived()) {
holder.archiveRepo.setVisibility(View.VISIBLE);
}
else {
holder.archiveRepo.setVisibility(View.GONE);
}
}
@Override

View File

@ -11,6 +11,7 @@ import android.widget.CheckBox;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
@ -56,6 +57,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
private TextView repoForks;
private TextView repoOpenIssuesCount;
private TextView repoType;
private LinearLayout archiveRepo;
private ReposViewHolder(View itemView) {
@ -71,6 +73,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
repoOpenIssuesCount = itemView.findViewById(R.id.repoOpenIssuesCount);
ImageView reposDropdownMenu = itemView.findViewById(R.id.reposDropdownMenu);
repoType = itemView.findViewById(R.id.repoType);
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
itemView.setOnClickListener(v -> {
@ -249,6 +252,13 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
}
holder.isRepoAdmin.setChecked(currentItem.getPermissions().isAdmin());
if(currentItem.isArchived()) {
holder.archiveRepo.setVisibility(View.VISIBLE);
}
else {
holder.archiveRepo.setVisibility(View.GONE);
}
}
@Override

View File

@ -11,6 +11,7 @@ import android.widget.CheckBox;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.amulyakhare.textdrawable.TextDrawable;
import com.amulyakhare.textdrawable.util.ColorGenerator;
@ -56,6 +57,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
private TextView repoForks;
private TextView repoOpenIssuesCount;
private TextView repoType;
private LinearLayout archiveRepo;
private OrgReposViewHolder(View itemView) {
super(itemView);
@ -70,6 +72,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
repoOpenIssuesCount = itemView.findViewById(R.id.repoOpenIssuesCount);
ImageView reposDropdownMenu = itemView.findViewById(R.id.reposDropdownMenu);
repoType = itemView.findViewById(R.id.repoType);
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
itemView.setOnClickListener(v -> {
@ -252,6 +255,13 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
}
holder.isRepoAdmin.setChecked(currentItem.getPermissions().isAdmin());
if(currentItem.isArchived()) {
holder.archiveRepo.setVisibility(View.VISIBLE);
}
else {
holder.archiveRepo.setVisibility(View.GONE);
}
}
@Override

View File

@ -11,6 +11,7 @@ import android.widget.CheckBox;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.amulyakhare.textdrawable.TextDrawable;
import com.amulyakhare.textdrawable.util.ColorGenerator;
@ -56,6 +57,7 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
private TextView repoForks;
private TextView repoOpenIssuesCount;
private TextView repoType;
private LinearLayout archiveRepo;
private StarredReposViewHolder(View itemView) {
super(itemView);
@ -70,6 +72,7 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
repoOpenIssuesCount = itemView.findViewById(R.id.repoOpenIssuesCount);
ImageView reposDropdownMenu = itemView.findViewById(R.id.reposDropdownMenu);
repoType = itemView.findViewById(R.id.repoType);
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
itemView.setOnClickListener(v -> {
@ -252,6 +255,13 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
}
holder.isRepoAdmin.setChecked(currentItem.getPermissions().isAdmin());
if(currentItem.isArchived()) {
holder.archiveRepo.setVisibility(View.VISIBLE);
}
else {
holder.archiveRepo.setVisibility(View.GONE);
}
}
@Override

View File

@ -605,7 +605,7 @@ public class MemorizingTrustManager implements X509TrustManager {
private boolean interactHostname(X509Certificate cert, String hostname) {
if(interact(hostNameMessage(cert, hostname), R.string.mtm_accept_servername) == MTMDecision.DECISION_ALWAYS) {
if(interact(hostNameMessage(cert, hostname), R.string.mtm_accept_server_name) == MTMDecision.DECISION_ALWAYS) {
storeCert(hostname, cert);
return true;
}

View File

@ -31,6 +31,7 @@ public class UserRepositories {
private String forks_count;
private Boolean has_issues;
private String avatar_url;
private boolean archived;
private permissionsObject permissions;
@ -167,4 +168,24 @@ public class UserRepositories {
return avatar_url;
}
public boolean isPrivateFlag() {
return privateFlag;
}
public String getOpen_pr_counter() {
return open_pr_counter;
}
public String getRelease_counter() {
return release_counter;
}
public boolean isArchived() {
return archived;
}
}

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#368F73"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M20.54,5.23l-1.39,-1.68C18.88,3.21 18.47,3 18,3H6c-0.47,0 -0.88,0.21 -1.16,0.55L3.46,5.23C3.17,5.57 3,6.02 3,6.5V19c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V6.5c0,-0.48 -0.17,-0.93 -0.46,-1.27zM12,17.5L6.5,12H10v-2h4v2h3.5L12,17.5zM5.12,5l0.81,-1h12l0.94,1H5.12z"/>
</vector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="3dp"/>
<solid android:color="@color/releasePre" />
</shape>

View File

@ -49,10 +49,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="0dp"
android:scrollbars="vertical" />
</LinearLayout>
</LinearLayout>

View File

@ -42,7 +42,7 @@
android:layout_gravity="center_vertical"
android:paddingStart="60dp"
android:paddingEnd="12dp"
android:text="@string/appreanceHintText"
android:text="@string/appearanceHintText"
android:textColor="?attr/primaryTextColor"
android:textSize="12sp" />
@ -180,4 +180,4 @@
</ScrollView>
</RelativeLayout>
</RelativeLayout>

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/primaryBackgroundColor" >
android:background="?attr/primaryBackgroundColor">
<TextView
android:id="@+id/repoType"
@ -14,7 +16,6 @@
android:id="@+id/linearLayoutFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_margin="15dp"
android:orientation="vertical">
@ -37,23 +38,54 @@
android:id="@+id/frameRepoName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/repoName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_weight=".95"
android:text="@string/repoName"
android:textColor="?attr/primaryTextColor"
android:textSize="18sp" />
<LinearLayout
android:id="@+id/archiveRepoFrame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="6dp"
android:background="@drawable/shape_archived"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="center_vertical"
android:text="@string/archivedRepository"
android:textColor="@color/colorWhite" />
<ImageView
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginStart="3dp"
android:layout_weight="0"
android:contentDescription="@string/generalImgContentText"
app:srcCompat="@drawable/ic_archive"
app:tint="@color/colorWhite" />
</LinearLayout>
<ImageView
android:id="@+id/imageRepoType"
android:layout_width="10dp"
android:layout_height="20dp"
android:layout_gravity="end"
android:layout_weight=".05"
android:contentDescription="@string/privateAvatar"
android:src="@drawable/ic_lock_24dp" />

View File

@ -278,7 +278,7 @@
<string name="settingsCodeBlockSelectorDialogTitle">Code Block Color Selector</string>
<string name="settingsHomeScreenHeaderText">Home Screen</string>
<string name="settingsHomeScreenSelectedText">My Repositories</string>
<string name="settingshomeScreenSelectorDialogTitle">Select Home Screen</string>
<string name="settingsHomeScreenSelectorDialogTitle">Select Home Screen</string>
<string name="settingsCustomFontHeaderText">Font</string>
<string name="settingsCustomFontSelectorDialogTitle">Choose Font</string>
<string name="settingsCustomFontDefault" translatable="false">Manrope</string>
@ -575,7 +575,7 @@
<string name="versionUnsupportedNew">New Gitea version detected! Please UPDATE GitNex!</string>
<string name="versionSupportedLatest">Gitea version is up to date</string>
<string name="versionDevelopment">Gitea development version</string>
<string name="versionUnknow">No Gitea detected!</string>
<string name="versionUnknown">No Gitea detected!</string>
<string name="versionAlertTitle">Version Alert</string>
<string name="versionAlertDialogHeader">Unsupported Version of Gitea</string>
@ -629,7 +629,7 @@
<string name="mtm_accept_cert">Accept Unknown Certificate?</string>
<string name="mtm_trust_anchor">The server certificate is not signed by a known Certificate Authority.</string>
<string name="mtm_cert_expired">The server certificate is expired.</string>
<string name="mtm_accept_servername">Accept Mismatching Server Name?</string>
<string name="mtm_accept_server_name">Accept Mismatching Server Name?</string>
<string name="mtm_hostname_mismatch">Server could not authenticate as \&quot;%s\&quot;. The certificate is only valid for:</string>
<string name="mtm_connect_anyway">Do you want to connect anyway?</string>
<string name="mtm_cert_details">Certificate details:</string>
@ -639,10 +639,10 @@
<string name="subscribedSuccessfully">Subscribed successfully</string>
<string name="alreadySubscribed">You have already subscribed</string>
<string name="subscribtionError">Subscription failed</string>
<string name="subscriptionError">Subscription failed</string>
<string name="unsubscribedSuccessfully">Unsubscribed successfully</string>
<string name="alreadyUnsubscribed">You have already Unsubscribed</string>
<string name="unsubscribtionError">Un-Subscription failed</string>
<string name="unsubscriptionError">Un-Subscription failed</string>
<string name="closeMilestone">Close Milestone</string>
<string name="openMilestone">Open Milestone</string>
@ -656,9 +656,11 @@
<string name="setCrashReports">Crash reports</string>
<string name="crashMessage">You can tap the OK button to send the crash report by email. It will help to fix it :)\n\nYou can also add additional content in the email. Thank you!</string>
<string name="appreanceHintText">Themes, fonts, badges, code block theme</string>
<string name="appearanceHintText">Themes, fonts, badges, code block theme</string>
<string name="fileViewerHintText">PDF mode, source code theme</string>
<string name="securityHintText">SSL certificates, cache</string>
<string name="languagesHintText">Languages</string>
<string name="reportsHintText">Crash reports</string>
<string name="archivedRepository">Archived</string>
</resources>