mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2024-12-16 15:48:13 +08:00
Close/reopen milestone
This commit is contained in:
parent
79944241fe
commit
0caaa63b06
143
app/src/main/java/org/mian/gitnex/actions/MilestoneActions.java
Normal file
143
app/src/main/java/org/mian/gitnex/actions/MilestoneActions.java
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
package org.mian.gitnex.actions;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import org.mian.gitnex.R;
|
||||||
|
import org.mian.gitnex.clients.RetrofitClient;
|
||||||
|
import org.mian.gitnex.helpers.AlertDialogs;
|
||||||
|
import org.mian.gitnex.helpers.Authorization;
|
||||||
|
import org.mian.gitnex.helpers.Toasty;
|
||||||
|
import org.mian.gitnex.models.Milestones;
|
||||||
|
import org.mian.gitnex.util.TinyDB;
|
||||||
|
import org.mian.gitnex.viewmodels.MilestonesViewModel;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author M M Arif
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class MilestoneActions {
|
||||||
|
|
||||||
|
static final private String TAG = "MilestoneActions : ";
|
||||||
|
|
||||||
|
public static void closeMilestone(final Context ctx, int milestoneId_) {
|
||||||
|
|
||||||
|
final TinyDB tinyDB = new TinyDB(ctx);
|
||||||
|
|
||||||
|
final String instanceUrl = tinyDB.getString("instanceUrl");
|
||||||
|
String repoFullName = tinyDB.getString("repoFullName");
|
||||||
|
String[] parts = repoFullName.split("/");
|
||||||
|
final String repoOwner = parts[0];
|
||||||
|
final String repoName = parts[1];
|
||||||
|
final String loginUid = tinyDB.getString("loginUid");
|
||||||
|
final String token = "token " + tinyDB.getString(loginUid + "-token");
|
||||||
|
|
||||||
|
Milestones milestoneStateJson = new Milestones("closed");
|
||||||
|
Call<JsonElement> call;
|
||||||
|
|
||||||
|
call = RetrofitClient
|
||||||
|
.getInstance(instanceUrl, ctx)
|
||||||
|
.getApiInterface()
|
||||||
|
.closeReopenMilestone(token, repoOwner, repoName, milestoneId_, milestoneStateJson);
|
||||||
|
|
||||||
|
call.enqueue(new Callback<JsonElement>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||||
|
|
||||||
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
|
Toasty.info(ctx, ctx.getString(R.string.milestoneStatusUpdate));
|
||||||
|
MilestonesViewModel.loadMilestonesList(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, token), repoOwner, repoName, "all", ctx);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
|
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||||
|
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
|
ctx.getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
|
ctx.getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
Toasty.info(ctx, ctx.getString(R.string.genericError));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
Log.e(TAG, t.toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void openMilestone(final Context ctx, int milestoneId_) {
|
||||||
|
|
||||||
|
final TinyDB tinyDB = new TinyDB(ctx);
|
||||||
|
|
||||||
|
final String instanceUrl = tinyDB.getString("instanceUrl");
|
||||||
|
String repoFullName = tinyDB.getString("repoFullName");
|
||||||
|
String[] parts = repoFullName.split("/");
|
||||||
|
final String repoOwner = parts[0];
|
||||||
|
final String repoName = parts[1];
|
||||||
|
final String loginUid = tinyDB.getString("loginUid");
|
||||||
|
final String token = "token " + tinyDB.getString(loginUid + "-token");
|
||||||
|
|
||||||
|
Milestones milestoneStateJson = new Milestones("open");
|
||||||
|
Call<JsonElement> call;
|
||||||
|
|
||||||
|
call = RetrofitClient
|
||||||
|
.getInstance(instanceUrl, ctx)
|
||||||
|
.getApiInterface()
|
||||||
|
.closeReopenMilestone(token, repoOwner, repoName, milestoneId_, milestoneStateJson);
|
||||||
|
|
||||||
|
call.enqueue(new Callback<JsonElement>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||||
|
|
||||||
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
|
Toasty.info(ctx, ctx.getString(R.string.milestoneStatusUpdate));
|
||||||
|
MilestonesViewModel.loadMilestonesList(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, token), repoOwner, repoName, "all", ctx);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
|
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||||
|
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
|
ctx.getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
|
ctx.getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
Toasty.info(ctx, ctx.getString(R.string.genericError));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
Log.e(TAG, t.toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -68,7 +68,6 @@ import org.mian.gitnex.helpers.RoundedTransformation;
|
|||||||
import org.mian.gitnex.util.TinyDB;
|
import org.mian.gitnex.util.TinyDB;
|
||||||
import org.mian.gitnex.helpers.ClickListener;
|
import org.mian.gitnex.helpers.ClickListener;
|
||||||
import org.mian.gitnex.viewmodels.IssueCommentsViewModel;
|
import org.mian.gitnex.viewmodels.IssueCommentsViewModel;
|
||||||
import org.ocpsoft.prettytime.PrettyTime;
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -199,10 +198,6 @@ public class IssueDetailActivity extends BaseActivity {
|
|||||||
|
|
||||||
switch(tinyDb.getInt("customFontId")) {
|
switch(tinyDb.getInt("customFontId")) {
|
||||||
|
|
||||||
case 0:
|
|
||||||
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/roboto.ttf");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/manroperegular.ttf");
|
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/manroperegular.ttf");
|
||||||
break;
|
break;
|
||||||
|
@ -15,8 +15,10 @@ import android.widget.ImageView;
|
|||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import com.amulyakhare.textdrawable.TextDrawable;
|
import com.amulyakhare.textdrawable.TextDrawable;
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||||
import com.vdurmont.emoji.EmojiParser;
|
import com.vdurmont.emoji.EmojiParser;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
|
import org.mian.gitnex.actions.MilestoneActions;
|
||||||
import org.mian.gitnex.helpers.ClickListener;
|
import org.mian.gitnex.helpers.ClickListener;
|
||||||
import org.mian.gitnex.helpers.TimeHelper;
|
import org.mian.gitnex.helpers.TimeHelper;
|
||||||
import org.mian.gitnex.models.Milestones;
|
import org.mian.gitnex.models.Milestones;
|
||||||
@ -32,7 +34,6 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||||
import io.noties.markwon.Markwon;
|
import io.noties.markwon.Markwon;
|
||||||
@ -42,7 +43,6 @@ import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
|||||||
import io.noties.markwon.ext.tables.TablePlugin;
|
import io.noties.markwon.ext.tables.TablePlugin;
|
||||||
import io.noties.markwon.ext.tasklist.TaskListPlugin;
|
import io.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||||
import io.noties.markwon.html.HtmlPlugin;
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
import io.noties.markwon.image.AsyncDrawable;
|
|
||||||
import io.noties.markwon.image.DefaultMediaDecoder;
|
import io.noties.markwon.image.DefaultMediaDecoder;
|
||||||
import io.noties.markwon.image.ImageItem;
|
import io.noties.markwon.image.ImageItem;
|
||||||
import io.noties.markwon.image.ImagesPlugin;
|
import io.noties.markwon.image.ImagesPlugin;
|
||||||
@ -63,6 +63,7 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
|||||||
|
|
||||||
static class MilestonesViewHolder extends RecyclerView.ViewHolder {
|
static class MilestonesViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
private TextView milestoneId;
|
||||||
private TextView msTitle;
|
private TextView msTitle;
|
||||||
private TextView msDescription;
|
private TextView msDescription;
|
||||||
private TextView msOpenIssues;
|
private TextView msOpenIssues;
|
||||||
@ -70,10 +71,12 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
|||||||
private TextView msDueDate;
|
private TextView msDueDate;
|
||||||
private ImageView msStatus;
|
private ImageView msStatus;
|
||||||
private ProgressBar msProgress;
|
private ProgressBar msProgress;
|
||||||
|
private TextView milestoneStatus;
|
||||||
|
|
||||||
private MilestonesViewHolder(View itemView) {
|
private MilestonesViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
|
||||||
|
milestoneId = itemView.findViewById(R.id.milestoneId);
|
||||||
msTitle = itemView.findViewById(R.id.milestoneTitle);
|
msTitle = itemView.findViewById(R.id.milestoneTitle);
|
||||||
msStatus = itemView.findViewById(R.id.milestoneState);
|
msStatus = itemView.findViewById(R.id.milestoneState);
|
||||||
msDescription = itemView.findViewById(R.id.milestoneDescription);
|
msDescription = itemView.findViewById(R.id.milestoneDescription);
|
||||||
@ -81,23 +84,52 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
|||||||
msClosedIssues = itemView.findViewById(R.id.milestoneIssuesClosed);
|
msClosedIssues = itemView.findViewById(R.id.milestoneIssuesClosed);
|
||||||
msDueDate = itemView.findViewById(R.id.milestoneDueDate);
|
msDueDate = itemView.findViewById(R.id.milestoneDueDate);
|
||||||
msProgress = itemView.findViewById(R.id.milestoneProgress);
|
msProgress = itemView.findViewById(R.id.milestoneProgress);
|
||||||
|
ImageView milestonesMenu = itemView.findViewById(R.id.milestonesMenu);
|
||||||
|
milestoneStatus = itemView.findViewById(R.id.milestoneStatus);
|
||||||
|
|
||||||
/*msTitle.setOnClickListener(new View.OnClickListener() {
|
milestonesMenu.setOnClickListener(v -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
|
|
||||||
Context context = v.getContext();
|
Context ctx = v.getContext();
|
||||||
Log.i("issueNumber", issueNumber.getText().toString());
|
int milestoneId_ = Integer.parseInt(milestoneId.getText().toString());
|
||||||
|
|
||||||
Intent intent = new Intent(context, IssueDetailActivity.class);
|
@SuppressLint("InflateParams") View view = LayoutInflater.from(ctx).inflate(R.layout.bottom_sheet_milestones_in_list, null);
|
||||||
intent.putExtra("issueNumber", issueNumber.getText());
|
|
||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(context);
|
TextView closeMilestone = view.findViewById(R.id.closeMilestone);
|
||||||
tinyDb.putString("issueNumber", issueNumber.getText().toString());
|
TextView openMilestone = view.findViewById(R.id.openMilestone);
|
||||||
context.startActivity(intent);
|
|
||||||
|
BottomSheetDialog dialog = new BottomSheetDialog(ctx);
|
||||||
|
dialog.setContentView(view);
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
|
if(milestoneStatus.getText().toString().equals("open")) {
|
||||||
|
|
||||||
|
closeMilestone.setVisibility(View.VISIBLE);
|
||||||
|
openMilestone.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
closeMilestone.setVisibility(View.GONE);
|
||||||
|
openMilestone.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
closeMilestone.setOnClickListener(v12 -> {
|
||||||
|
|
||||||
|
MilestoneActions.closeMilestone(ctx, milestoneId_);
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
openMilestone.setOnClickListener(v12 -> {
|
||||||
|
|
||||||
|
MilestoneActions.openMilestone(ctx, milestoneId_);
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,46 +155,40 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
|||||||
|
|
||||||
Milestones currentItem = milestonesList.get(position);
|
Milestones currentItem = milestonesList.get(position);
|
||||||
|
|
||||||
|
holder.milestoneId.setText(String.valueOf(currentItem.getId()));
|
||||||
|
holder.milestoneStatus.setText(currentItem.getState());
|
||||||
|
|
||||||
final Markwon markwon = Markwon.builder(Objects.requireNonNull(mCtx))
|
final Markwon markwon = Markwon.builder(Objects.requireNonNull(mCtx))
|
||||||
.usePlugin(CorePlugin.create())
|
.usePlugin(CorePlugin.create())
|
||||||
.usePlugin(ImagesPlugin.create(new ImagesPlugin.ImagesConfigure() {
|
.usePlugin(ImagesPlugin.create(plugin -> {
|
||||||
@Override
|
plugin.addSchemeHandler(new SchemeHandler() {
|
||||||
public void configureImages(@NonNull ImagesPlugin plugin) {
|
@NonNull
|
||||||
plugin.addSchemeHandler(new SchemeHandler() {
|
@Override
|
||||||
@NonNull
|
public ImageItem handle(@NonNull String raw, @NonNull Uri uri) {
|
||||||
@Override
|
|
||||||
public ImageItem handle(@NonNull String raw, @NonNull Uri uri) {
|
|
||||||
|
|
||||||
final int resourceId = mCtx.getResources().getIdentifier(
|
final int resourceId = mCtx.getResources().getIdentifier(
|
||||||
raw.substring("drawable://".length()),
|
raw.substring("drawable://".length()),
|
||||||
"drawable",
|
"drawable",
|
||||||
mCtx.getPackageName());
|
mCtx.getPackageName());
|
||||||
|
|
||||||
final Drawable drawable = mCtx.getDrawable(resourceId);
|
final Drawable drawable = mCtx.getDrawable(resourceId);
|
||||||
|
|
||||||
assert drawable != null;
|
assert drawable != null;
|
||||||
return ImageItem.withResult(drawable);
|
return ImageItem.withResult(drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> supportedSchemes() {
|
public Collection<String> supportedSchemes() {
|
||||||
return Collections.singleton("drawable");
|
return Collections.singleton("drawable");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
plugin.placeholderProvider(new ImagesPlugin.PlaceholderProvider() {
|
plugin.placeholderProvider(drawable -> null);
|
||||||
@Nullable
|
plugin.addMediaDecoder(GifMediaDecoder.create(false));
|
||||||
@Override
|
plugin.addMediaDecoder(SvgMediaDecoder.create(mCtx.getResources()));
|
||||||
public Drawable providePlaceholder(@NonNull AsyncDrawable drawable) {
|
plugin.addMediaDecoder(SvgMediaDecoder.create());
|
||||||
return null;
|
plugin.defaultMediaDecoder(DefaultMediaDecoder.create(mCtx.getResources()));
|
||||||
}
|
plugin.defaultMediaDecoder(DefaultMediaDecoder.create());
|
||||||
});
|
|
||||||
plugin.addMediaDecoder(GifMediaDecoder.create(false));
|
|
||||||
plugin.addMediaDecoder(SvgMediaDecoder.create(mCtx.getResources()));
|
|
||||||
plugin.addMediaDecoder(SvgMediaDecoder.create());
|
|
||||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create(mCtx.getResources()));
|
|
||||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create());
|
|
||||||
}
|
|
||||||
}))
|
}))
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
@Override
|
@Override
|
||||||
@ -182,7 +208,6 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
|||||||
|
|
||||||
Spanned msTitle = markwon.toMarkdown(currentItem.getTitle());
|
Spanned msTitle = markwon.toMarkdown(currentItem.getTitle());
|
||||||
markwon.setParsedMarkdown(holder.msTitle, msTitle);
|
markwon.setParsedMarkdown(holder.msTitle, msTitle);
|
||||||
//holder.msStatus.setText(currentItem.getState());
|
|
||||||
|
|
||||||
if(currentItem.getState().equals("open")) {
|
if(currentItem.getState().equals("open")) {
|
||||||
|
|
||||||
@ -261,13 +286,14 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
|||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
String dueDate = formatter.format(date);
|
|
||||||
assert date != null;
|
assert date != null;
|
||||||
|
String dueDate = formatter.format(date);
|
||||||
|
|
||||||
if(date.before(new Date())) {
|
if(date.before(new Date())) {
|
||||||
holder.msDueDate.setTextColor(mCtx.getResources().getColor(R.color.darkRed));
|
holder.msDueDate.setTextColor(mCtx.getResources().getColor(R.color.darkRed));
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.msDueDate.setText(dueDate);
|
holder.msDueDate.setText(mCtx.getResources().getString(R.string.dueDate, dueDate));
|
||||||
holder.msDueDate.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToast(currentItem.getDue_on()), mCtx));
|
holder.msDueDate.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToast(currentItem.getDue_on()), mCtx));
|
||||||
|
|
||||||
} else if (timeFormat.equals("normal1")) {
|
} else if (timeFormat.equals("normal1")) {
|
||||||
@ -279,7 +305,7 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
String dueDate = formatter.format(date1);
|
String dueDate = formatter.format(date1);
|
||||||
holder.msDueDate.setText(dueDate);
|
holder.msDueDate.setText(mCtx.getResources().getString(R.string.dueDate, dueDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -300,6 +326,7 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Filter milestoneFilter = new Filter() {
|
private Filter milestoneFilter = new Filter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FilterResults performFiltering(CharSequence constraint) {
|
protected FilterResults performFiltering(CharSequence constraint) {
|
||||||
List<Milestones> filteredList = new ArrayList<>();
|
List<Milestones> filteredList = new ArrayList<>();
|
||||||
@ -328,6 +355,7 @@ public class MilestonesAdapter extends RecyclerView.Adapter<MilestonesAdapter.Mi
|
|||||||
milestonesList.addAll((List) results.values);
|
milestonesList.addAll((List) results.values);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -266,4 +266,7 @@ public interface ApiInterface {
|
|||||||
|
|
||||||
@GET("repos/{owner}/{repo}/commits") // get all commits
|
@GET("repos/{owner}/{repo}/commits") // get all commits
|
||||||
Call<List<Commits>> getRepositoryCommits(@Header("Authorization") String token, @Path("owner") String owner, @Path("repo") String repo, @Query("page") int page, @Query("sha") String branchName);
|
Call<List<Commits>> getRepositoryCommits(@Header("Authorization") String token, @Path("owner") String owner, @Path("repo") String repo, @Query("page") int page, @Query("sha") String branchName);
|
||||||
|
|
||||||
|
@PATCH("repos/{owner}/{repo}/milestones/{index}") // close / reopen milestone
|
||||||
|
Call<JsonElement> closeReopenMilestone(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("index") int index, @Body Milestones jsonStr);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,10 @@ public class Milestones {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Milestones(String state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
48
app/src/main/res/layout/bottom_sheet_milestones_in_list.xml
Normal file
48
app/src/main/res/layout/bottom_sheet_milestones_in_list.xml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:background="?attr/primaryBackgroundColor"
|
||||||
|
android:paddingTop="8dp">
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/closeMilestone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="@string/closeMilestone"
|
||||||
|
android:drawableStart="@drawable/ic_close"
|
||||||
|
android:drawablePadding="24dp"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:padding="16dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/openMilestone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="@string/openMilestone"
|
||||||
|
android:drawableStart="@drawable/ic_check"
|
||||||
|
android:drawablePadding="24dp"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:padding="16dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -8,6 +8,18 @@
|
|||||||
android:background="?attr/primaryBackgroundColor"
|
android:background="?attr/primaryBackgroundColor"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/milestoneId" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/milestoneStatus" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/frameTitle"
|
android:id="@+id/frameTitle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -31,6 +43,7 @@
|
|||||||
android:layout_weight=".15"
|
android:layout_weight=".15"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
|
android:scaleType="fitEnd"
|
||||||
android:contentDescription="@string/pageTitleCreateMilestone"
|
android:contentDescription="@string/pageTitleCreateMilestone"
|
||||||
android:layout_marginBottom="5dp" />
|
android:layout_marginBottom="5dp" />
|
||||||
|
|
||||||
@ -87,18 +100,39 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/milestoneDateMenuFrame"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:id="@+id/milestoneDueDate"
|
android:layout_width="0dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_weight=".90"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/repoWatchers"
|
android:id="@+id/dueDateFrame"
|
||||||
android:gravity="start"
|
android:orientation="horizontal"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="3dp">
|
||||||
android:textColor="?attr/primaryTextColor"
|
|
||||||
android:textSize="16sp" />
|
<TextView
|
||||||
|
android:id="@+id/milestoneDueDate"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/dueDate"
|
||||||
|
android:gravity="start"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/milestonesMenu"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight=".10"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:scaleType="fitEnd"
|
||||||
|
android:src="@drawable/ic_dotted_menu_horizontal"
|
||||||
|
android:contentDescription="@string/menuContentDesc" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@
|
|||||||
<string name="issueCommenter">Commenter:\u0020</string>
|
<string name="issueCommenter">Commenter:\u0020</string>
|
||||||
<string name="issueTitleWithId" translatable="false">#%1$d %2$s</string>
|
<string name="issueTitleWithId" translatable="false">#%1$d %2$s</string>
|
||||||
<string name="issueMilestone">Milestone %1$s</string>
|
<string name="issueMilestone">Milestone %1$s</string>
|
||||||
<string name="dueDate">Due %1$s</string>
|
<string name="dueDate">Due on %1$s</string>
|
||||||
<string name="createdTime">Opened %1$s</string>
|
<string name="createdTime">Opened %1$s</string>
|
||||||
<string name="assignedTo">Assigned to: %1$s</string>
|
<string name="assignedTo">Assigned to: %1$s</string>
|
||||||
<string name="commentButtonText">Comment</string>
|
<string name="commentButtonText">Comment</string>
|
||||||
@ -602,4 +602,8 @@
|
|||||||
<string name="issueSubscribtionError">Issue Subscription failed</string>
|
<string name="issueSubscribtionError">Issue Subscription failed</string>
|
||||||
<string name="issueUnsubscribtion">Issue Unsubscribed</string>
|
<string name="issueUnsubscribtion">Issue Unsubscribed</string>
|
||||||
<string name="issueUnsubscribtionError">Issue Un-Subscription failed</string>
|
<string name="issueUnsubscribtionError">Issue Un-Subscription failed</string>
|
||||||
|
|
||||||
|
<string name="closeMilestone">Close Milestone</string>
|
||||||
|
<string name="openMilestone">Open Milestone</string>
|
||||||
|
<string name="milestoneStatusUpdate">Milestone status updated successfully</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user