fix toolbar title, add ms list to edit issue. #2
This commit is contained in:
parent
f4ee0bbfbf
commit
e5ddb83fbb
@ -8,6 +8,7 @@ import retrofit2.Response;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.DatePickerDialog;
|
import android.app.DatePickerDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -31,10 +32,12 @@ import org.mian.gitnex.helpers.Toasty;
|
|||||||
import org.mian.gitnex.models.Collaborators;
|
import org.mian.gitnex.models.Collaborators;
|
||||||
import org.mian.gitnex.models.CreateIssue;
|
import org.mian.gitnex.models.CreateIssue;
|
||||||
import org.mian.gitnex.models.Issues;
|
import org.mian.gitnex.models.Issues;
|
||||||
|
import org.mian.gitnex.models.Milestones;
|
||||||
import org.mian.gitnex.util.AppUtil;
|
import org.mian.gitnex.util.AppUtil;
|
||||||
import org.mian.gitnex.util.TinyDB;
|
import org.mian.gitnex.util.TinyDB;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -53,6 +56,7 @@ public class EditIssueActivity extends AppCompatActivity implements View.OnClick
|
|||||||
private Button editIssueButton;
|
private Button editIssueButton;
|
||||||
private Spinner editIssueMilestoneSpinner;
|
private Spinner editIssueMilestoneSpinner;
|
||||||
|
|
||||||
|
List<Milestones> milestonesList = new ArrayList<>();
|
||||||
private ArrayAdapter<Mention> defaultMentionAdapter;
|
private ArrayAdapter<Mention> defaultMentionAdapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -82,6 +86,9 @@ public class EditIssueActivity extends AppCompatActivity implements View.OnClick
|
|||||||
defaultMentionAdapter = new MentionArrayAdapter<>(this);
|
defaultMentionAdapter = new MentionArrayAdapter<>(this);
|
||||||
loadCollaboratorsList();
|
loadCollaboratorsList();
|
||||||
|
|
||||||
|
editIssueMilestoneSpinner = findViewById(R.id.editIssueMilestoneSpinner);
|
||||||
|
editIssueMilestoneSpinner.getBackground().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
|
||||||
|
|
||||||
editIssueDescription.setMentionAdapter(defaultMentionAdapter);
|
editIssueDescription.setMentionAdapter(defaultMentionAdapter);
|
||||||
|
|
||||||
initCloseListener();
|
initCloseListener();
|
||||||
@ -292,7 +299,7 @@ public class EditIssueActivity extends AppCompatActivity implements View.OnClick
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getIssue(String instanceUrl, String instanceToken, String loginUid, String repoOwner, String repoName, int issueIndex) {
|
private void getIssue(final String instanceUrl, final String instanceToken, final String loginUid, final String repoOwner, final String repoName, int issueIndex) {
|
||||||
|
|
||||||
Call<Issues> call = RetrofitClient
|
Call<Issues> call = RetrofitClient
|
||||||
.getInstance(instanceUrl)
|
.getInstance(instanceUrl)
|
||||||
@ -310,6 +317,74 @@ public class EditIssueActivity extends AppCompatActivity implements View.OnClick
|
|||||||
editIssueTitle.setText(response.body().getTitle());
|
editIssueTitle.setText(response.body().getTitle());
|
||||||
editIssueDescription.setText(response.body().getBody());
|
editIssueDescription.setText(response.body().getBody());
|
||||||
|
|
||||||
|
int msId = 0;
|
||||||
|
if(response.body().getMilestone() != null) {
|
||||||
|
msId = response.body().getMilestone().getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
// get milestones list
|
||||||
|
if(response.body().getId() > 0) {
|
||||||
|
|
||||||
|
Call<List<Milestones>> call_ = RetrofitClient
|
||||||
|
.getInstance(instanceUrl)
|
||||||
|
.getApiInterface()
|
||||||
|
.getMilestones(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||||
|
|
||||||
|
final int finalMsId = msId;
|
||||||
|
|
||||||
|
call_.enqueue(new Callback<List<Milestones>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<List<Milestones>> call, @NonNull retrofit2.Response<List<Milestones>> response_) {
|
||||||
|
|
||||||
|
int finalMsId1 = 0;
|
||||||
|
|
||||||
|
if (response_.code() == 200) {
|
||||||
|
|
||||||
|
List<Milestones> milestonesList_ = response_.body();
|
||||||
|
|
||||||
|
milestonesList.add(new Milestones(0, "No milestone"));
|
||||||
|
assert milestonesList_ != null;
|
||||||
|
if (milestonesList_.size() > 0) {
|
||||||
|
for (int i = 0; i < milestonesList_.size(); i++) {
|
||||||
|
|
||||||
|
Milestones data = new Milestones(
|
||||||
|
milestonesList_.get(i).getId(),
|
||||||
|
milestonesList_.get(i).getTitle()
|
||||||
|
);
|
||||||
|
milestonesList.add(data);
|
||||||
|
|
||||||
|
if(finalMsId == milestonesList_.get(i).getId()) {
|
||||||
|
finalMsId1 = i + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayAdapter<Milestones> adapter_ = new ArrayAdapter<>(getApplicationContext(),
|
||||||
|
R.layout.spinner_item, milestonesList);
|
||||||
|
|
||||||
|
adapter_.setDropDownViewResource(R.layout.spinner_dropdown_item);
|
||||||
|
editIssueMilestoneSpinner.setAdapter(adapter_);
|
||||||
|
|
||||||
|
if(milestonesList_.size() > 0) {
|
||||||
|
editIssueMilestoneSpinner.setSelection(finalMsId1);
|
||||||
|
}
|
||||||
|
enableProcessButton();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<List<Milestones>> call, @NonNull Throwable t) {
|
||||||
|
Log.e("onFailure", t.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
// get milestones list
|
||||||
|
|
||||||
if(response.body().getDue_date() != null) {
|
if(response.body().getDue_date() != null) {
|
||||||
|
|
||||||
@SuppressLint("SimpleDateFormat") DateFormat formatter = new SimpleDateFormat("yyyy-M-dd");
|
@SuppressLint("SimpleDateFormat") DateFormat formatter = new SimpleDateFormat("yyyy-M-dd");
|
||||||
@ -317,7 +392,7 @@ public class EditIssueActivity extends AppCompatActivity implements View.OnClick
|
|||||||
editIssueDueDate.setText(dueDate);
|
editIssueDueDate.setText(dueDate);
|
||||||
|
|
||||||
}
|
}
|
||||||
enableProcessButton();
|
//enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
@ -74,7 +74,6 @@ import java.util.Objects;
|
|||||||
public class IssueDetailActivity extends AppCompatActivity {
|
public class IssueDetailActivity extends AppCompatActivity {
|
||||||
|
|
||||||
public ImageView closeActivity;
|
public ImageView closeActivity;
|
||||||
private View.OnClickListener onClickListener;
|
|
||||||
private IssueCommentsAdapter adapter;
|
private IssueCommentsAdapter adapter;
|
||||||
private RecyclerView mRecyclerView;
|
private RecyclerView mRecyclerView;
|
||||||
private ImageView assigneeAvatar;
|
private ImageView assigneeAvatar;
|
||||||
@ -110,7 +109,6 @@ public class IssueDetailActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
final SwipeRefreshLayout swipeRefresh = findViewById(R.id.pullToRefresh);
|
final SwipeRefreshLayout swipeRefresh = findViewById(R.id.pullToRefresh);
|
||||||
|
|
||||||
closeActivity = findViewById(R.id.close);
|
|
||||||
assigneeAvatar = findViewById(R.id.assigneeAvatar);
|
assigneeAvatar = findViewById(R.id.assigneeAvatar);
|
||||||
issueTitle = findViewById(R.id.issueTitle);
|
issueTitle = findViewById(R.id.issueTitle);
|
||||||
issueDescription = findViewById(R.id.issueDescription);
|
issueDescription = findViewById(R.id.issueDescription);
|
||||||
@ -127,10 +125,7 @@ public class IssueDetailActivity extends AppCompatActivity {
|
|||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
Objects.requireNonNull(getSupportActionBar()).setTitle(repoName);
|
Objects.requireNonNull(getSupportActionBar()).setTitle(repoName);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
initCloseListener();
|
|
||||||
closeActivity.setOnClickListener(onClickListener);
|
|
||||||
|
|
||||||
mRecyclerView = findViewById(R.id.recyclerView);
|
mRecyclerView = findViewById(R.id.recyclerView);
|
||||||
mRecyclerView.setHasFixedSize(true);
|
mRecyclerView.setHasFixedSize(true);
|
||||||
@ -437,6 +432,7 @@ public class IssueDetailActivity extends AppCompatActivity {
|
|||||||
PrettyTime prettyTime = new PrettyTime(new Locale(locale));
|
PrettyTime prettyTime = new PrettyTime(new Locale(locale));
|
||||||
String createdTime = prettyTime.format(singleIssue.getCreated_at());
|
String createdTime = prettyTime.format(singleIssue.getCreated_at());
|
||||||
issueCreatedTime.setText(getString(R.string.createdTime, createdTime));
|
issueCreatedTime.setText(getString(R.string.createdTime, createdTime));
|
||||||
|
issueCreatedTime.setVisibility(View.VISIBLE);
|
||||||
issueCreatedTime.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(singleIssue.getCreated_at()), getApplicationContext()));
|
issueCreatedTime.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(singleIssue.getCreated_at()), getApplicationContext()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -444,12 +440,14 @@ public class IssueDetailActivity extends AppCompatActivity {
|
|||||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd '" + getResources().getString(R.string.timeAtText) + "' HH:mm", new Locale(locale));
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd '" + getResources().getString(R.string.timeAtText) + "' HH:mm", new Locale(locale));
|
||||||
String createdTime = formatter.format(singleIssue.getCreated_at());
|
String createdTime = formatter.format(singleIssue.getCreated_at());
|
||||||
issueCreatedTime.setText(getString(R.string.createdTime, createdTime));
|
issueCreatedTime.setText(getString(R.string.createdTime, createdTime));
|
||||||
|
issueCreatedTime.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "normal1": {
|
case "normal1": {
|
||||||
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy '" + getResources().getString(R.string.timeAtText) + "' HH:mm", new Locale(locale));
|
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy '" + getResources().getString(R.string.timeAtText) + "' HH:mm", new Locale(locale));
|
||||||
String createdTime = formatter.format(singleIssue.getCreated_at());
|
String createdTime = formatter.format(singleIssue.getCreated_at());
|
||||||
issueCreatedTime.setText(getString(R.string.createdTime, createdTime));
|
issueCreatedTime.setText(getString(R.string.createdTime, createdTime));
|
||||||
|
issueCreatedTime.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -490,7 +488,7 @@ public class IssueDetailActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
View.OnClickListener onClickListener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
finish();
|
finish();
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout android:layout_width="match_parent"
|
<LinearLayout android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
@ -8,54 +9,21 @@
|
|||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/AppTheme.AppBarOverlay" >
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:layout_weight="1"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
tools:ignore="UnusedAttribute">
|
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||||
|
app:title="@string/app_name" />
|
||||||
<ImageView
|
|
||||||
android:id="@+id/close"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_marginRight="15dp"
|
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:contentDescription="@string/close"
|
|
||||||
android:src="@drawable/ic_close" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/toolbar_title"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:text="@string/generalPageTitle"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/editIssue1"
|
|
||||||
android:layout_width="28dp"
|
|
||||||
android:layout_height="28dp"
|
|
||||||
android:layout_marginRight="15dp"
|
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:gravity="end"
|
|
||||||
android:layout_gravity="end"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:contentDescription="@string/editText"
|
|
||||||
android:src="@drawable/ic_edit" />
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.Toolbar>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/relativeMainLayoutFrame"
|
android:id="@+id/relativeMainLayoutFrame"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@ -73,7 +41,6 @@
|
|||||||
android:fillViewport="true">
|
android:fillViewport="true">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/relativeLayoutFrame"
|
android:id="@+id/relativeLayoutFrame"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -194,6 +161,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:text="@string/createdText"
|
android:text="@string/createdText"
|
||||||
|
android:visibility="gone"
|
||||||
android:textColor="@color/colorWhite"
|
android:textColor="@color/colorWhite"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
@ -204,6 +172,7 @@
|
|||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:layout_toEndOf="@+id/issueCreatedTime"
|
android:layout_toEndOf="@+id/issueCreatedTime"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
|
android:visibility="gone"
|
||||||
android:text="@string/modifiedText" />
|
android:text="@string/modifiedText" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user