Merge branch 'main' into 7-assign-team-to-repo

This commit is contained in:
M M Arif 2021-05-01 19:45:45 +02:00
commit 36808b1dbb
21 changed files with 64 additions and 53 deletions

View File

@ -231,7 +231,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
drawer.addDrawerListener(toggle);
drawer.addDrawerListener(new DrawerLayout.DrawerListener() {
@Override
public void onDrawerOpened(@NonNull View drawerView) {

View File

@ -71,9 +71,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
private FragmentRefreshListenerMilestone fragmentRefreshListenerMilestone;
private FragmentRefreshListenerFiles fragmentRefreshListenerFiles;
private String loginUid;
private String instanceToken;
private String repositoryOwner;
private String repositoryName;
@ -108,9 +105,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
Objects.requireNonNull(getSupportActionBar()).setTitle(repositoryName);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
loginUid = tinyDB.getString("loginUid");
instanceToken = "token " + tinyDB.getString(loginUid + "-token");
tinyDB.putString("repoIssuesState", "open");
tinyDB.putString("repoPrState", "open");
tinyDB.putString("milestoneState", "open");
@ -433,7 +427,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
Call<List<Branches>> call = RetrofitClient
.getApiInterface(ctx)
.getBranches(instanceToken, repositoryOwner, repositoryName);
.getBranches(Authorization.get(ctx), repositoryOwner, repositoryName);
call.enqueue(new Callback<List<Branches>>() {

View File

@ -45,7 +45,7 @@ public class RepoForksActivity extends BaseActivity {
private View.OnClickListener onClickListener;
private TextView noData;
private ProgressBar progressBar;
private String TAG = "RepositoryForks";
private final String TAG = "RepositoryForks";
private int resultLimit = Constants.resultLimitOldGiteaInstances;
private int pageSize = 1;

View File

@ -37,7 +37,6 @@ public class CommitsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
this.context = ctx;
this.commitsList = commitsListMain;
}
@NonNull
@ -67,7 +66,6 @@ public class CommitsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
((CommitsHolder) holder).bindData(commitsList.get(position));
}
}
@Override

View File

@ -59,6 +59,7 @@ public class DraftsAdapter extends RecyclerView.Adapter<DraftsAdapter.DraftsView
deleteDraft(getAdapterPosition());
DraftsApi draftsApi = BaseApi.getInstance(context, DraftsApi.class);
assert draftsApi != null;
draftsApi.deleteSingleDraft(getDraftId);
});

View File

@ -102,6 +102,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
//RepositoriesRepository.deleteRepositoriesByAccount(currentActiveAccountId);
assert repositoryData != null;
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
if(count == 0) {
@ -191,7 +192,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
ColorGenerator generator = ColorGenerator.MATERIAL;
int color = generator.getColor(currentItem.getName());
String firstCharacter = String.valueOf(currentItem.getName().charAt(0));
String firstCharacter = String.valueOf(currentItem.getFullName().charAt(0));
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).fontSize(18).toUpperCase().width(28).height(28).endConfig().buildRoundRect(firstCharacter, color, 3);
@ -238,6 +239,9 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
if(!currentItem.getDescription().equals("")) {
holder.repoDescription.setText(currentItem.getDescription());
}
else {
holder.repoDescription.setText(context.getString(R.string.noDataDescription));
}
if(holder.isRepoAdmin == null) {
holder.isRepoAdmin = new CheckBox(context);

View File

@ -310,7 +310,6 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_issue_comments, parent, false);
return new IssueCommentsAdapter.IssueCommentViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull IssueCommentsAdapter.IssueCommentViewHolder holder, int position) {

View File

@ -100,6 +100,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
//RepositoriesRepository.deleteRepositoriesByAccount(currentActiveAccountId);
assert repositoryData != null;
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
if(count == 0) {
@ -198,7 +199,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
ColorGenerator generator = ColorGenerator.MATERIAL;
int color = generator.getColor(currentItem.getName());
String firstCharacter = String.valueOf(currentItem.getName().charAt(0));
String firstCharacter = String.valueOf(currentItem.getFullName().charAt(0));
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).fontSize(18).toUpperCase().width(28).height(28).endConfig().buildRoundRect(firstCharacter, color, 3);
@ -245,6 +246,9 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
if(!currentItem.getDescription().equals("")) {
holder.repoDescription.setText(currentItem.getDescription());
}
else {
holder.repoDescription.setText(context.getString(R.string.noDataDescription));
}
if(holder.isRepoAdmin == null) {
holder.isRepoAdmin = new CheckBox(context);

View File

@ -142,7 +142,7 @@ public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
ColorGenerator generator = ColorGenerator.MATERIAL;
int color = generator.getColor(forksModel.getName());
String firstCharacter = String.valueOf(forksModel.getName().charAt(0));
String firstCharacter = String.valueOf(forksModel.getFullName().charAt(0));
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).fontSize(18).toUpperCase().width(28).height(28)
.endConfig().buildRoundRect(firstCharacter, color, 3);
@ -191,6 +191,9 @@ public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
if(!forksModel.getDescription().equals("")) {
repoDescription.setText(forksModel.getDescription());
}
else {
repoDescription.setText(context.getString(R.string.noDataDescription));
}
if(isRepoAdmin == null) {
isRepoAdmin = new CheckBox(context);
@ -224,6 +227,7 @@ public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
//RepositoriesRepository.deleteRepositoriesByAccount(currentActiveAccountId);
assert repositoryData != null;
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
if(count == 0) {

View File

@ -100,6 +100,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
//RepositoriesRepository.deleteRepositoriesByAccount(currentActiveAccountId);
assert repositoryData != null;
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
if(count == 0) {
@ -197,7 +198,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
ColorGenerator generator = ColorGenerator.MATERIAL;
int color = generator.getColor(currentItem.getName());
String firstCharacter = String.valueOf(currentItem.getFullName().split("/")[0].charAt(0));
String firstCharacter = String.valueOf(currentItem.getFullName().charAt(0));
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).fontSize(18).toUpperCase().width(28).height(28).endConfig().buildRoundRect(firstCharacter, color, 3);
@ -244,6 +245,9 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
if(!currentItem.getDescription().equals("")) {
holder.repoDescription.setText(currentItem.getDescription());
}
else {
holder.repoDescription.setText(context.getString(R.string.noDataDescription));
}
if(holder.isRepoAdmin == null) {
holder.isRepoAdmin = new CheckBox(context);

View File

@ -100,7 +100,8 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
//RepositoriesRepository.deleteRepositoriesByAccount(currentActiveAccountId);
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
assert repositoryData != null;
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
if(count == 0) {
@ -194,7 +195,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
ColorGenerator generator = ColorGenerator.MATERIAL;
int color = generator.getColor(currentItem.getName());
String firstCharacter = String.valueOf(currentItem.getName().charAt(0));
String firstCharacter = String.valueOf(currentItem.getFullName().charAt(0));
TextDrawable drawable = TextDrawable.builder()
.beginConfig()
@ -248,6 +249,9 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
if(!currentItem.getDescription().equals("")) {
holder.repoDescription.setText(currentItem.getDescription());
}
else {
holder.repoDescription.setText(context.getString(R.string.noDataDescription));
}
if(holder.isRepoAdmin == null) {
holder.isRepoAdmin = new CheckBox(context);

View File

@ -83,6 +83,7 @@ public class SearchIssuesAdapter extends RecyclerView.Adapter<SearchIssuesAdapte
int currentActiveAccountId = tinyDb.getInt("currentActiveAccountId");
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
assert repositoryData != null;
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
if(count == 0) {

View File

@ -100,7 +100,8 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
//RepositoriesRepository.deleteRepositoriesByAccount(currentActiveAccountId);
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
assert repositoryData != null;
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
if(count == 0) {
@ -195,7 +196,7 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
ColorGenerator generator = ColorGenerator.MATERIAL;
int color = generator.getColor(currentItem.getName());
String firstCharacter = String.valueOf(currentItem.getName().charAt(0));
String firstCharacter = String.valueOf(currentItem.getFullName().charAt(0));
TextDrawable drawable = TextDrawable.builder()
.beginConfig()
@ -249,6 +250,9 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
if(!currentItem.getDescription().equals("")) {
holder.repoDescription.setText(currentItem.getDescription());
}
else {
holder.repoDescription.setText(context.getString(R.string.noDataDescription));
}
if(holder.isRepoAdmin == null) {
holder.isRepoAdmin = new CheckBox(context);

View File

@ -65,6 +65,7 @@ public class UserAccountsAdapter extends RecyclerView.Adapter<UserAccountsAdapte
updateLayoutByPosition(getAdapterPosition());
UserAccountsApi userAccountsApi = BaseApi.getInstance(context, UserAccountsApi.class);
assert userAccountsApi != null;
userAccountsApi.deleteAccount(Integer.parseInt(String.valueOf(accountId)));
}).setNeutralButton(context.getResources().getString(R.string.cancelButton), null)
.show();
@ -73,6 +74,7 @@ public class UserAccountsAdapter extends RecyclerView.Adapter<UserAccountsAdapte
itemView.setOnClickListener(switchAccount -> {
UserAccountsApi userAccountsApi = BaseApi.getInstance(context, UserAccountsApi.class);
assert userAccountsApi != null;
UserAccount userAccount = userAccountsApi.getAccountByName(accountName);
if(AppUtil.switchToAccount(context, userAccount)) {

View File

@ -24,6 +24,7 @@
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
android:padding="16dp"
android:background="?android:attr/selectableItemBackground"
app:drawableStartCompat="@drawable/ic_people" />
<View
@ -43,6 +44,7 @@
android:textSize="16sp"
android:padding="16dp"
android:visibility="gone"
android:background="?android:attr/selectableItemBackground"
app:drawableStartCompat="@drawable/ic_tasks" />
</LinearLayout>

View File

@ -18,6 +18,18 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/repoIsArchived"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_gravity="center"
android:text="@string/archivedRepositoryMessage"
android:background="@drawable/shape_archived"
android:padding="6dp"
android:layout_marginBottom="8dp"
android:textColor="@color/colorWhite" />
<LinearLayout
android:id="@+id/repoMetaFrameHeader"
android:layout_width="match_parent"
@ -46,6 +58,7 @@
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:layout_gravity="center_vertical|end"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/issueDescriptionEmpty"
app:srcCompat="@drawable/ic_chevron_down"/>
@ -57,18 +70,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/repoIsArchived"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_gravity="center"
android:text="@string/archivedRepositoryMessage"
android:background="@drawable/shape_archived"
android:padding="5dp"
android:layout_marginBottom="8dp"
android:textColor="@color/colorWhite" />
<TextView
android:id="@+id/repoMetaName"
android:layout_width="match_parent"
@ -369,6 +370,7 @@
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:layout_gravity="center_vertical|end"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/issueDescriptionEmpty"
app:srcCompat="@drawable/ic_chevron_up"/>

View File

@ -57,7 +57,8 @@
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_weight="0"
android:contentDescription="@string/generalImgContentText"
android:contentDescription="@string/menuContentDesc"
android:background="?android:attr/selectableItemBackgroundBorderless"
app:srcCompat="@drawable/ic_dotted_menu_horizontal" />
</LinearLayout>

View File

@ -58,8 +58,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:contentDescription="@string/labelMenuContentDesc"
android:paddingStart="10dp"
android:paddingEnd="0dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_dotted_menu_horizontal" />
</LinearLayout>

View File

@ -156,11 +156,11 @@
<ImageView
android:id="@+id/milestonesMenu"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_weight=".10"
android:contentDescription="@string/menuContentDesc"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:scaleType="fitEnd"
android:src="@drawable/ic_dotted_menu_horizontal" />

View File

@ -49,8 +49,8 @@
app:cardBackgroundColor="?attr/primaryBackgroundColor"
app:cardCornerRadius="20dp"
app:cardElevation="0dp"
app:contentPaddingLeft="5dp"
app:contentPaddingRight="5dp"
app:contentPaddingLeft="8dp"
app:contentPaddingRight="8dp"
tools:visibility="visible">
<androidx.recyclerview.widget.RecyclerView

View File

@ -101,7 +101,6 @@
<string name="protocolEmptyError">Protocol is required</string>
<string name="checkNetConnection">Cannot access network, please check your Internet connection</string>
<string name="netConnectionIsBack">Yay, We have Internet connection!</string>
<string name="repoNameErrorEmpty">Repository name is empty</string>
<string name="repoNameErrorInvalid">Repository name is not valid. [a&#8211;z A&#8211;Z 0&#8211;9 &#8211; _]</string>
@ -177,7 +176,7 @@
<string name="featureDeprecated">This function will be removed in the future</string>
<string name="screamingInFearEmoticon" translatable="false">😱</string>
<string name="generalImgContentText">Avatar</string>
<string name="generalImgContentText">Image</string>
<string name="noDataMilestonesTab">No milestones found</string>
@ -236,7 +235,7 @@
<string name="settingsDateTimeHeaderDefault">Pretty</string>
<string name="settingsLanguageSelectorDialogTitle">Choose Language</string>
<string name="settingsTimeSelectorDialogTitle">Choose Time Format</string>
<string name="settingsHelpTranslateText">Help us translate GitNex to your language</string>
<string name="settingsHelpTranslateText">Translate GitNex via Crodwin</string>
<string name="codeBlockSelectedText" translatable="false">Green - Black</string>
<string name="codeBlockHeaderText">Code Block Color</string>
<string name="settingsCodeBlockSelectorDialogTitle">Code Block Color Selector</string>
@ -249,12 +248,9 @@
<string name="themeSelectorDialogTitle">Select App Theme</string>
<string name="themeSelectionHeaderText">Theme</string>
<string name="themeSelectionSelectedText" translatable="false">Dark</string>
<string name="settingsPdfModeHeaderText">PDF Night Mode</string>
<string name="fileViewerHeader">File Viewer</string>
<string name="settingsCounterBadges">Counter Badges</string>
<string name="settingsFileViewerSourceCodeHeaderText">Source Code Theme</string>
<string name="settingsFileViewerSourceCodeSelectedText" translatable="false">Sublime</string>
<string name="fileViewerSourceCodeThemeSelectorDialogTitle">Select Source Code Theme</string>
<string name="cacheSizeDataDialogHeader">Data Cache Size</string>
<string name="cacheSizeDataSelectionHeaderText">Data Cache Size</string>
<string name="cacheSizeDataSelectionSelectedText" translatable="false">50 MB</string>
@ -480,7 +476,7 @@
<string name="copyIssueUrl">Copy Issue URL</string>
<string name="copyIssueUrlToastMsg">URL copied to clipboard</string>
<string name="copyIssueCommentToastMsg">Copied comment to clipboard</string>
<string name="copyIssueCommentToastMsg">Comment copied to clipboard</string>
<string name="milestoneCompletion">%1$d\uFF05 completed</string>
@ -638,7 +634,6 @@
<string name="draftSaved">Draft was saved automatically.</string>
<string name="appearanceHintText">Themes, fonts, badges</string>
<string name="fileViewerHintText">PDF mode, source code theme</string>
<string name="securityHintText">Biometric authentication, SSL certificates, cache</string>
<string name="languagesHintText">Languages</string>
<string name="reportsHintText">Crash reports</string>
@ -732,12 +727,6 @@
<string name="launchApp">Go to App</string>
<string name="noActionText">GitNex cannot handle the requested resource, you can open an issue at the project repository as an improvement with providing details of the work. Just launch a default screen for now from the buttons below, it can be changed from settings.</string>
<string name="codeBlockGreenOnBlack">Green on Black</string>
<string name="codeBlockWhiteOnBlack">White on Black</string>
<string name="codeBlockGreyOnBlack">Grey on Black</string>
<string name="codeBlockWhiteOnGrey">White on Grey</string>
<string name="codeBlockDarkOnWhite">Dark on White</string>
<string name="biometricAuthTitle">Biometric Authentication</string>
<string name="biometricAuthSubTitle">Unlock using your biometric credentials</string>
<string name="biometricNotSupported">No biometric features available on this device</string>