Skip to content
Snippets Groups Projects
Commit fc3fcbba authored by Jawnnypoo's avatar Jawnnypoo
Browse files

Allow user to delete issue

parent f4af2b8a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -16,12 +16,12 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
 
import com.commit451.easycallback.EasyCallback;
import com.commit451.gitlab.App;
import com.commit451.gitlab.R;
import com.commit451.gitlab.adapter.IssueDetailsAdapter;
import com.commit451.easycallback.EasyCallback;
import com.commit451.gitlab.api.GitLabFactory;
import com.commit451.gitlab.event.IssueChangedEvent;
import com.commit451.gitlab.event.IssueReloadEvent;
import com.commit451.gitlab.model.api.FileUploadResponse;
Loading
Loading
@@ -46,7 +46,9 @@ import butterknife.ButterKnife;
import butterknife.OnClick;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import timber.log.Timber;
 
/**
Loading
Loading
@@ -92,23 +94,18 @@ public class IssueActivity extends BaseActivity {
@BindView(R.id.progress)
View mProgress;
 
@OnClick(R.id.fab_edit_issue)
public void onEditIssueClick(View fab) {
Navigator.navigateToEditIssue(IssueActivity.this, fab, mProject, mIssue);
}
private MenuItem mOpenCloseMenuItem;
private IssueDetailsAdapter mIssueDetailsAdapter;
private LinearLayoutManager mNotesLayoutManager;
MenuItem mOpenCloseMenuItem;
IssueDetailsAdapter mIssueDetailsAdapter;
LinearLayoutManager mNotesLayoutManager;
 
private Project mProject;
private Issue mIssue;
private String mIssueIid;
private boolean mLoading;
private Uri mNextPageUrl;
private Teleprinter mTeleprinter;
Project mProject;
Issue mIssue;
String mIssueIid;
boolean mLoading;
Uri mNextPageUrl;
Teleprinter mTeleprinter;
 
private EventReceiver mEventReceiver;
EventReceiver mEventReceiver;
 
private final RecyclerView.OnScrollListener mOnScrollListener = new RecyclerView.OnScrollListener() {
@Override
Loading
Loading
@@ -133,6 +130,9 @@ public class IssueActivity extends BaseActivity {
case R.id.action_close:
closeOrOpenIssue();
return true;
case R.id.action_delete:
App.instance().getGitLab().deleteIssue(mProject.getId(), mIssue.getId()).enqueue(mDeleteIssueCallback);
return true;
}
return false;
}
Loading
Loading
@@ -273,6 +273,28 @@ public class IssueActivity extends BaseActivity {
}
};
 
private final Callback<Void> mDeleteIssueCallback = new Callback<Void>() {
@Override
public void onResponse(Call<Void> call, Response<Void> response) {
App.bus().post(new IssueReloadEvent());
Toast.makeText(IssueActivity.this, R.string.issue_deleted, Toast.LENGTH_SHORT)
.show();
finish();
}
@Override
public void onFailure(Call<Void> call, Throwable t) {
Timber.e(t, null);
Snackbar.make(mRoot, getString(R.string.failed_to_delete_issue), Snackbar.LENGTH_SHORT)
.show();
}
};
@OnClick(R.id.fab_edit_issue)
public void onEditIssueClick(View fab) {
Navigator.navigateToEditIssue(IssueActivity.this, fab, mProject, mIssue);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Loading
Loading
Loading
Loading
@@ -314,6 +314,10 @@ public interface GitLab {
@Path("issue_id") long issueId,
@Field("body") String body);
 
@DELETE(API_VERSION + "/projects/{id}/issues/{issue_id}")
Call<Void> deleteIssue(@Path("id") long projectId,
@Path("issue_id") long issueId);
/* --- REPOSITORY --- */
 
@GET(API_VERSION + "/projects/{id}/repository/branches?order_by=last_activity_at")
Loading
Loading
Loading
Loading
@@ -13,4 +13,9 @@
android:title="@string/action_share"
android:icon="@drawable/ic_share_24dp"/>
 
<item
android:id="@+id/action_delete"
app:showAsAction="never"
android:title="@string/action_delete"/>
</menu>
\ No newline at end of file
Loading
Loading
@@ -27,20 +27,4 @@
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
<!-- Light theme -->
<style name="ActivityLight.Projects">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
<style name="ActivityLight.Groups">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
<style name="ActivityLight.Activity">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</resources>
\ No newline at end of file
Loading
Loading
@@ -26,6 +26,7 @@
<string name="action_erase">Erase</string>
<string name="action_retry">Retry</string>
<string name="action_cancel">Cancel</string>
<string name="action_delete">Delete</string>
<string name="action_copy_git_https">Copy git https link</string>
<string name="action_copy_git_ssh">Copy git ssh link</string>
 
Loading
Loading
@@ -206,6 +207,8 @@
<string name="no_milestone">No Milestone</string>
<string name="add_labels">+ Add Labels</string>
<string name="label_already_added">Label already added</string>
<string name="failed_to_delete_issue">Failed to delete issue</string>
<string name="issue_deleted">Issue deleted</string>
 
<!-- Labels -->
<string name="labels">Labels</string>
Loading
Loading
Loading
Loading
@@ -49,47 +49,6 @@
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
 
<!-- Light theme -->
<style name="AppThemeLight" parent="Theme.AppCompat.Light.NoActionBar">
<item name="cardBackgroundColor">#FFFFFF</item>
<item name="android:windowContentTransitions" tools:ignore="NewApi">true</item>
<item name="dialogTheme">@style/AppDialogTheme</item>
<item name="ate_key">light_theme</item>
</style>
<style name="ActivityLight" parent="AppThemeLight"/>
<style name="ActivityLight.Projects">
<!--Check v21 for the good bits-->
</style>
<style name="ActivityLight.Groups">
<!--Check v21 for the good bits-->
</style>
<style name="ActivityLight.Activity">
<!--Check v21 for the good bits-->
</style>
<style name="ActivityLight.User">
<item name="colorPrimaryDark">@android:color/transparent</item>
<item name="android:statusBarColor" tools:ignore="NewApi">@android:color/transparent</item>
<item name="android:windowTranslucentStatus" tools:ignore="NewApi">true</item>
</style>
<style name="ActivityLight.Group">
<item name="colorPrimaryDark">@android:color/transparent</item>
<item name="android:statusBarColor" tools:ignore="NewApi">@android:color/transparent</item>
<item name="android:windowTranslucentStatus" tools:ignore="NewApi">true</item>
</style>
<style name="ActivityLight.Translucent">
<item name="android:windowBackground">@color/scrim</item>
<item name="windowBackground">@color/scrim</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@null</item>
</style>
<!-- Widget styles -->
<style name="AppDialogTheme" parent="Theme.AppCompat.Dialog">
<item name="colorAccent">@color/yellow</item>
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment