1
0
mirror of https://codeberg.org/gitnex/GitNex synced 2024-12-23 17:15:49 +01:00

Merge branch 'master' of gitea.com:mmarif/GitNex

This commit is contained in:
M M Arif 2019-10-01 15:06:46 +05:00
commit e2fa79b2a9
12 changed files with 158 additions and 122 deletions

View File

@ -323,10 +323,11 @@ public class CreateIssueActivity extends AppCompatActivity implements View.OnCli
private void getMilestones(String instanceUrl, String instanceToken, String repoOwner, String repoName, String loginUid) {
String msState = "open";
Call<List<Milestones>> call = RetrofitClient
.getInstance(instanceUrl)
.getApiInterface()
.getMilestones(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
.getMilestones(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, msState);
call.enqueue(new Callback<List<Milestones>>() {

View File

@ -56,6 +56,8 @@ public class EditIssueActivity extends AppCompatActivity implements View.OnClick
private Button editIssueButton;
private Spinner editIssueMilestoneSpinner;
private String msState = "open";
List<Milestones> milestonesList = new ArrayList<>();
private ArrayAdapter<Mention> defaultMentionAdapter;
@ -331,7 +333,7 @@ public class EditIssueActivity extends AppCompatActivity implements View.OnClick
Call<List<Milestones>> call_ = RetrofitClient
.getInstance(instanceUrl)
.getApiInterface()
.getMilestones(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
.getMilestones(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, msState);
final int finalMsId = msId;

View File

@ -82,7 +82,7 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
msDueDate = itemView.findViewById(R.id.milestoneDueDate);
msProgress = itemView.findViewById(R.id.milestoneProgress);
/*issueTitle.setOnClickListener(new View.OnClickListener() {
/*msTitle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -234,13 +234,20 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
holder.msClosedIssues.setOnClickListener(new ClickListener(mCtx.getResources().getString(R.string.milestoneClosedIssues, currentItem.getClosed_issues()), mCtx));
if ((currentItem.getOpen_issues() + currentItem.getClosed_issues()) > 0) {
if (currentItem.getOpen_issues() == 0) {
holder.msProgress.setProgress(100);
} else {
holder.msProgress.setProgress(100*currentItem.getClosed_issues()/(currentItem.getOpen_issues() + currentItem.getClosed_issues()));
}
} else {
else {
int msCompletion = 100 * currentItem.getClosed_issues() / (currentItem.getOpen_issues() + currentItem.getClosed_issues());
holder.msProgress.setOnClickListener(new ClickListener(mCtx.getResources().getString(R.string.milestoneCompletion, msCompletion), mCtx));
holder.msProgress.setProgress(msCompletion);
}
}
else {
holder.msProgress.setProgress(0);
holder.msProgress.setOnClickListener(new ClickListener(mCtx.getResources().getString(R.string.milestoneCompletion, 0), mCtx));
}
if(currentItem.getDue_on() != null) {
@ -276,7 +283,7 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
}
else {
holder.msDueDate.setVisibility(View.INVISIBLE);
holder.msDueDate.setVisibility(View.GONE);
}
}

View File

@ -46,6 +46,7 @@ public class MilestonesFragment extends Fragment {
private String repoName;
private String repoOwner;
private String msState = "all";
private OnFragmentInteractionListener mListener;
@ -103,7 +104,7 @@ public class MilestonesFragment extends Fragment {
@Override
public void run() {
swipeRefresh.setRefreshing(false);
MilestonesViewModel.loadMilestonesList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName);
MilestonesViewModel.loadMilestonesList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, msState);
}
}, 50);
}
@ -127,7 +128,7 @@ public class MilestonesFragment extends Fragment {
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
if(tinyDb.getBoolean("milestoneCreated")) {
MilestonesViewModel.loadMilestonesList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName);
MilestonesViewModel.loadMilestonesList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, msState);
tinyDb.putBoolean("milestoneCreated", false);
}
}
@ -152,7 +153,7 @@ public class MilestonesFragment extends Fragment {
MilestonesViewModel msModel = new ViewModelProvider(this).get(MilestonesViewModel.class);
msModel.getMilestonesList(instanceUrl, instanceToken, owner, repo).observe(this, new Observer<List<Milestones>>() {
msModel.getMilestonesList(instanceUrl, instanceToken, owner, repo, msState).observe(this, new Observer<List<Milestones>>() {
@Override
public void onChanged(@Nullable List<Milestones> msListMain) {
adapter = new MilestonesAdapter(getContext(), msListMain);

View File

@ -99,7 +99,7 @@ public interface ApiInterface {
Call<Issues> replyCommentToIssue(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("index") int issueIndex, @Body Issues jsonStr);
@GET("repos/{owner}/{repo}/milestones") // get milestones by repo
Call<List<Milestones>> getMilestones(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
Call<List<Milestones>> getMilestones(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Query("state") String state);
@GET("repos/{owner}/{repo}/branches") // get branches
Call<List<Branches>> getBranches(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);

View File

@ -20,20 +20,20 @@ public class MilestonesViewModel extends ViewModel {
private static MutableLiveData<List<Milestones>> milestonesList;
public LiveData<List<Milestones>> getMilestonesList(String instanceUrl, String token, String owner, String repo) {
public LiveData<List<Milestones>> getMilestonesList(String instanceUrl, String token, String owner, String repo, String msState) {
milestonesList = new MutableLiveData<>();
loadMilestonesList(instanceUrl, token, owner, repo);
loadMilestonesList(instanceUrl, token, owner, repo, msState);
return milestonesList;
}
public static void loadMilestonesList(String instanceUrl, String token, String owner, String repo) {
public static void loadMilestonesList(String instanceUrl, String token, String owner, String repo, String msState) {
Call<List<Milestones>> call = RetrofitClient
.getInstance(instanceUrl)
.getApiInterface()
.getMilestones(token, owner, repo);
.getMilestones(token, owner, repo, msState);
call.enqueue(new Callback<List<Milestones>>() {

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:top="4dp"
android:bottom="4dp"
android:right="1dp"
android:left="1dp">
<shape>
<size android:height="1dp"/>
<corners android:radius="15dp"/>
<solid android:color="@color/divider"/>
</shape>
</item>
<item
android:top="1dp"
android:bottom="1dp"
android:left="1dp"
android:right="1dp">
<scale android:scaleWidth="100%" android:scaleHeight="80%">
<shape>
<corners android:radius="15dp" />
</shape>
</scale>
</item>
</layer-list>

View File

@ -1,118 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/relativeLayoutMainFrame"
android:background="@color/backgroundColor">
android:layout_margin="15dp"
android:id="@+id/milestoneFrame"
android:background="@color/backgroundColor"
android:orientation="vertical">
<LinearLayout
android:id="@+id/frameTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/milestoneTitle"
android:layout_width="0dp"
android:textIsSelectable="true"
android:layout_height="wrap_content"
android:layout_weight=".80"
android:layout_marginBottom="5dp"
android:textColor="@color/white"
android:textSize="18sp" />
<ImageView
android:id="@+id/milestoneState"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".15"
android:layout_gravity="end"
android:gravity="end"
android:contentDescription="@string/pageTitleCreateMilestone"
android:layout_marginBottom="5dp" />
</LinearLayout>
<TextView
android:id="@+id/milestoneDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/repoDescription"
android:textIsSelectable="true"
android:textColor="@color/colorWhite"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/milestoneIssuesClosed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:text="@string/repoWatchers"
android:gravity="start"
android:textColor="@color/colorWhite"
android:textSize="14sp" />
<ProgressBar
android:id="@+id/milestoneProgress"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="82"
android:progress="50"
android:layout_marginTop="2dp"
android:progressDrawable="@drawable/progress_bar"
android:progressTint="@color/colorLightGreen" />
<TextView
android:id="@+id/milestoneIssuesOpen"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:text="@string/repoStars"
android:gravity="end"
android:textColor="@color/colorWhite"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="15dp"
android:id="@+id/milestoneFrame"
android:orientation="vertical">
<LinearLayout
android:id="@+id/frameTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/milestoneTitle"
android:layout_width="0dp"
android:textIsSelectable="true"
android:layout_height="wrap_content"
android:layout_weight=".80"
android:layout_marginBottom="5dp"
android:textColor="@color/white"
android:textSize="18sp" />
<ImageView
android:id="@+id/milestoneState"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".15"
android:layout_gravity="end"
android:gravity="end"
android:contentDescription="@string/pageTitleCreateMilestone"
android:layout_marginBottom="5dp" />
</LinearLayout>
android:orientation="horizontal">
<TextView
android:id="@+id/milestoneDescription"
android:layout_width="match_parent"
android:id="@+id/milestoneDueDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/repoDescription"
android:textIsSelectable="true"
android:text="@string/repoWatchers"
android:gravity="start"
android:layout_marginTop="5dp"
android:textColor="@color/colorWhite"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="0dp"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/milestoneProgress"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="100"
android:progress="50"
android:progressTint="#00FF25" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/milestoneIssuesOpen"
android:layout_width="0dp"
android:layout_height="24dp"
android:layout_weight=".25"
android:drawableStart="@drawable/ic_issues"
android:drawablePadding="6dp"
android:text="@string/repoStars"
android:gravity="start"
android:textColor="@color/colorWhite"
android:textSize="16sp" />
<TextView
android:id="@+id/milestoneIssuesClosed"
android:layout_width="0dp"
android:layout_height="24dp"
android:layout_weight=".25"
android:drawableStart="@drawable/ic_issue_closed"
android:drawablePadding="6dp"
android:text="@string/repoWatchers"
android:gravity="start"
android:textColor="@color/colorWhite"
android:textSize="16sp" />
<TextView
android:id="@+id/milestoneDueDate"
android:layout_width="0dp"
android:layout_height="24dp"
android:layout_weight=".50"
android:drawableStart="@drawable/ic_calendar"
android:drawablePadding="06dp"
android:text="@string/repoWatchers"
android:gravity="start"
android:textColor="@color/colorWhite"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>

View File

@ -109,7 +109,7 @@
<string name="genericApiStatusError">Die Gitea Instanz hat einen Fehler zurückgegeben. Code\u0020</string>
<string name="title_activity_repo_detail">Repo-Details Aktivität</string>
<string name="tab_text_info">Information</string>
<string name="tab_text_info">Details</string>
<string name="tab_text_issues">Offene Issues</string>
<string name="tabItemCloseIssues">Geschlossene Issues</string>
<string name="tab_text_ml">Meilensteine</string>
@ -430,6 +430,8 @@
<string name="copyIssueUrl">Issue URL kopieren</string>
<string name="copyIssueUrlToastMsg">Issue URL copied to clipboard</string>
<string name="milestoneCompletion">%1$d\uFF05 abgeschlossen</string>
<!-- generic copy -->
<string name="okButton">OK</string>
<string name="doneButton">Fertig</string>

View File

@ -110,7 +110,7 @@
<string name="genericApiStatusError">L\'instance a renvoyé une erreur. Code\u0020</string>
<string name="title_activity_repo_detail">RepoDetailActivity</string>
<string name="tab_text_info">Info</string>
<string name="tab_text_info">Détails</string>
<string name="tab_text_issues">Open Issues</string>
<string name="tabItemCloseIssues">Closed Issues</string>
<string name="tab_text_ml">Milestones</string>
@ -430,6 +430,8 @@
<string name="copyIssueUrl">Copier l Issue URL</string>
<string name="copyIssueUrlToastMsg">Issue URL copied to clipboard</string>
<string name="milestoneCompletion">%1$d\uFF05 terminé</string>
<!-- generic copy -->
<string name="okButton">OK</string>
<string name="doneButton">Done</string>

View File

@ -110,7 +110,7 @@
<string name="genericApiStatusError">Инстанция вернула ошибку. Код\u0020</string>
<string name="title_activity_repo_detail">Активность</string>
<string name="tab_text_info">Информация</string>
<string name="tab_text_info">Детали</string>
<string name="tab_text_issues">Открытые задачи</string>
<string name="tabItemCloseIssues">Закрытые задачи</string>
<string name="tab_text_ml">Вехи</string>
@ -430,6 +430,8 @@
<string name="copyIssueUrl">Copy Issue URL</string>
<string name="copyIssueUrlToastMsg">Issue URL copied to clipboard</string>
<string name="milestoneCompletion">%1$d\uFF05 выполненный</string>
<!-- generic copy -->
<string name="okButton">OK</string>
<string name="doneButton">Готово</string>

View File

@ -130,7 +130,7 @@
<string name="genericApiStatusError">Instance has returned an error. Code\u0020</string>
<string name="title_activity_repo_detail">RepoDetailActivity</string>
<string name="tab_text_info">Information</string>
<string name="tab_text_info">Details</string>
<string name="tab_text_issues">Open Issues</string>
<string name="tabItemCloseIssues">Closed Issues</string>
<string name="tab_text_ml">Milestones</string>
@ -467,6 +467,8 @@
<string name="copyIssueUrl">Copy Issue URL</string>
<string name="copyIssueUrlToastMsg">Issue URL copied to clipboard</string>
<string name="milestoneCompletion">%1$d\uFF05 completed</string>
<!-- generic copy -->
<string name="okButton">OK</string>
<string name="doneButton">Done</string>