Redesign creating PR screen and other UI refinements

This commit is contained in:
M M Arif 2023-10-01 15:13:57 +05:00
parent 41e2e3c394
commit 1a1b3bbf13
8 changed files with 221 additions and 330 deletions

View File

@ -1,26 +1,26 @@
package org.mian.gitnex.activities; package org.mian.gitnex.activities;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.DatePickerDialog;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.android.material.datepicker.MaterialDatePicker;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.vdurmont.emoji.EmojiParser; import com.vdurmont.emoji.EmojiParser;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import java.util.TimeZone;
import org.gitnex.tea4j.v2.models.Branch; import org.gitnex.tea4j.v2.models.Branch;
import org.gitnex.tea4j.v2.models.CreatePullRequestOption; import org.gitnex.tea4j.v2.models.CreatePullRequestOption;
import org.gitnex.tea4j.v2.models.Label; import org.gitnex.tea4j.v2.models.Label;
@ -35,7 +35,7 @@ import org.mian.gitnex.databinding.CustomLabelsSelectionDialogBinding;
import org.mian.gitnex.fragments.PullRequestsFragment; import org.mian.gitnex.fragments.PullRequestsFragment;
import org.mian.gitnex.helpers.Constants; import org.mian.gitnex.helpers.Constants;
import org.mian.gitnex.helpers.Markdown; import org.mian.gitnex.helpers.Markdown;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.SnackBar;
import org.mian.gitnex.helpers.contexts.RepositoryContext; import org.mian.gitnex.helpers.contexts.RepositoryContext;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
@ -50,11 +50,9 @@ public class CreatePullRequestActivity extends BaseActivity
LinkedHashMap<String, Milestone> milestonesList = new LinkedHashMap<>(); LinkedHashMap<String, Milestone> milestonesList = new LinkedHashMap<>();
List<String> branchesList = new ArrayList<>(); List<String> branchesList = new ArrayList<>();
List<Label> labelsList = new ArrayList<>(); List<Label> labelsList = new ArrayList<>();
private View.OnClickListener onClickListener;
private ActivityCreatePrBinding viewBinding; private ActivityCreatePrBinding viewBinding;
private List<Integer> labelsIds = new ArrayList<>(); private List<Integer> labelsIds = new ArrayList<>();
private int milestoneId; private int milestoneId;
private Date currentDate = null;
private RepositoryContext repository; private RepositoryContext repository;
private LabelsListAdapter labelsAdapter; private LabelsListAdapter labelsAdapter;
private MaterialAlertDialogBuilder materialAlertDialogBuilder; private MaterialAlertDialogBuilder materialAlertDialogBuilder;
@ -69,7 +67,6 @@ public class CreatePullRequestActivity extends BaseActivity
viewBinding = ActivityCreatePrBinding.inflate(getLayoutInflater()); viewBinding = ActivityCreatePrBinding.inflate(getLayoutInflater());
setContentView(viewBinding.getRoot()); setContentView(viewBinding.getRoot());
setSupportActionBar(viewBinding.toolbar);
repositoryContext = RepositoryContext.fromIntent(getIntent()); repositoryContext = RepositoryContext.fromIntent(getIntent());
@ -95,22 +92,55 @@ public class CreatePullRequestActivity extends BaseActivity
labelsAdapter = labelsAdapter =
new LabelsListAdapter(labelsList, CreatePullRequestActivity.this, labelsIds); new LabelsListAdapter(labelsList, CreatePullRequestActivity.this, labelsIds);
ImageView closeActivity = findViewById(R.id.close); showDatePickerDialog();
initCloseListener(); viewBinding.topAppBar.setNavigationOnClickListener(
closeActivity.setOnClickListener(onClickListener); v -> {
finish();
// contentUri.clear();
});
viewBinding.prDueDate.setOnClickListener(dueDate -> setDueDate()); viewBinding.topAppBar.setOnMenuItemClickListener(
menuItem -> {
int id = menuItem.getItemId();
disableProcessButton(); if (id == R.id.markdown) {
if (!renderMd) {
Markdown.render(
ctx,
EmojiParser.parseToUnicode(
Objects.requireNonNull(viewBinding.prBody.getText())
.toString()),
viewBinding.markdownPreview,
repositoryContext);
viewBinding.markdownPreview.setVisibility(View.VISIBLE);
viewBinding.prBodyLayout.setVisibility(View.GONE);
renderMd = true;
} else {
viewBinding.markdownPreview.setVisibility(View.GONE);
viewBinding.prBodyLayout.setVisibility(View.VISIBLE);
renderMd = false;
}
return true;
} else if (id == R.id.create) {
processPullRequest();
return true;
/*} else if (id == R.id.attachment) {
checkForAttachments();
return true;*/
} else {
return super.onOptionsItemSelected(menuItem);
}
});
getMilestones(repository.getOwner(), repository.getName(), resultLimit); getMilestones(repository.getOwner(), repository.getName(), resultLimit);
getBranches(repository.getOwner(), repository.getName()); getBranches(repository.getOwner(), repository.getName());
viewBinding.prLabels.setOnClickListener(prLabels -> showLabels()); viewBinding.prLabels.setOnClickListener(prLabels -> showLabels());
viewBinding.createPr.setOnClickListener(createPr -> processPullRequest());
if (!repository.getPermissions().isPush()) { if (!repository.getPermissions().isPush()) {
viewBinding.prDueDateLayout.setVisibility(View.GONE); viewBinding.prDueDateLayout.setVisibility(View.GONE);
viewBinding.prLabelsLayout.setVisibility(View.GONE); viewBinding.prLabelsLayout.setVisibility(View.GONE);
@ -118,51 +148,13 @@ public class CreatePullRequestActivity extends BaseActivity
} }
} }
@Override
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.markdown_switcher, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.markdown) {
if (!renderMd) {
Markdown.render(
ctx,
EmojiParser.parseToUnicode(
Objects.requireNonNull(viewBinding.prBody.getText()).toString()),
viewBinding.markdownPreview,
repositoryContext);
viewBinding.markdownPreview.setVisibility(View.VISIBLE);
viewBinding.prBodyLayout.setVisibility(View.GONE);
renderMd = true;
} else {
viewBinding.markdownPreview.setVisibility(View.GONE);
viewBinding.prBodyLayout.setVisibility(View.VISIBLE);
renderMd = false;
}
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
private void processPullRequest() { private void processPullRequest() {
String prTitle = String.valueOf(viewBinding.prTitle.getText()); String prTitle = String.valueOf(viewBinding.prTitle.getText());
String prDescription = String.valueOf(viewBinding.prBody.getText()); String prDescription = String.valueOf(viewBinding.prBody.getText());
String mergeInto = viewBinding.mergeIntoBranchSpinner.getText().toString(); String mergeInto = viewBinding.mergeIntoBranchSpinner.getText().toString();
String pullFrom = viewBinding.pullFromBranchSpinner.getText().toString(); String pullFrom = viewBinding.pullFromBranchSpinner.getText().toString();
String prDueDate = Objects.requireNonNull(viewBinding.prDueDate.getText()).toString();
assignees.add(""); assignees.add("");
@ -173,19 +165,23 @@ public class CreatePullRequestActivity extends BaseActivity
if (prTitle.matches("")) { if (prTitle.matches("")) {
Toasty.error(ctx, getString(R.string.titleError)); SnackBar.error(ctx, findViewById(android.R.id.content), getString(R.string.titleError));
} else if (mergeInto.matches("")) { } else if (mergeInto.matches("")) {
Toasty.error(ctx, getString(R.string.mergeIntoError)); SnackBar.error(
ctx, findViewById(android.R.id.content), getString(R.string.mergeIntoError));
} else if (pullFrom.matches("")) { } else if (pullFrom.matches("")) {
Toasty.error(ctx, getString(R.string.pullFromError)); SnackBar.error(
ctx, findViewById(android.R.id.content), getString(R.string.pullFromError));
} else if (pullFrom.equals(mergeInto)) { } else if (pullFrom.equals(mergeInto)) {
Toasty.error(ctx, getString(R.string.sameBranchesError)); SnackBar.error(
ctx, findViewById(android.R.id.content), getString(R.string.sameBranchesError));
} else { } else {
createPullRequest(prTitle, prDescription, mergeInto, pullFrom, milestoneId, assignees); createPullRequest(
prTitle, prDescription, mergeInto, pullFrom, milestoneId, assignees, prDueDate);
} }
} }
@ -195,7 +191,8 @@ public class CreatePullRequestActivity extends BaseActivity
String mergeInto, String mergeInto,
String pullFrom, String pullFrom,
int milestoneId, int milestoneId,
List<String> assignees) { List<String> assignees,
String prDueDate) {
ArrayList<Long> labelIds = new ArrayList<>(); ArrayList<Long> labelIds = new ArrayList<>();
for (Integer i : labelsIds) { for (Integer i : labelsIds) {
@ -210,7 +207,15 @@ public class CreatePullRequestActivity extends BaseActivity
createPullRequest.setBase(mergeInto); createPullRequest.setBase(mergeInto);
createPullRequest.setHead(pullFrom); createPullRequest.setHead(pullFrom);
createPullRequest.setLabels(labelIds); createPullRequest.setLabels(labelIds);
createPullRequest.setDueDate(currentDate); String[] date = prDueDate.split("-");
if (!prDueDate.equalsIgnoreCase("")) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, Integer.parseInt(date[0]));
calendar.set(Calendar.MONTH, Integer.parseInt(date[1]));
calendar.set(Calendar.DATE, Integer.parseInt(date[2]));
Date dueDate = calendar.getTime();
createPullRequest.setDueDate(dueDate);
}
Call<PullRequest> transferCall = Call<PullRequest> transferCall =
RetrofitClient.getApiInterface(ctx) RetrofitClient.getApiInterface(ctx)
@ -225,40 +230,71 @@ public class CreatePullRequestActivity extends BaseActivity
@NonNull Call<PullRequest> call, @NonNull Call<PullRequest> call,
@NonNull retrofit2.Response<PullRequest> response) { @NonNull retrofit2.Response<PullRequest> response) {
disableProcessButton();
if (response.code() == 201) { if (response.code() == 201) {
Toasty.success(ctx, getString(R.string.prCreateSuccess)); SnackBar.success(
ctx,
findViewById(android.R.id.content),
getString(R.string.prCreateSuccess));
RepoDetailActivity.updateRepo = true; RepoDetailActivity.updateRepo = true;
PullRequestsFragment.resumePullRequests = true; PullRequestsFragment.resumePullRequests = true;
MainActivity.reloadRepos = true; MainActivity.reloadRepos = true;
finish(); new Handler().postDelayed(() -> finish(), 3000);
} else if (response.code() == 409 } else if (response.code() == 409
|| response.message().equals("Conflict")) { || response.message().equals("Conflict")) {
enableProcessButton(); SnackBar.error(
Toasty.error(ctx, getString(R.string.prAlreadyExists)); ctx,
findViewById(android.R.id.content),
getString(R.string.prAlreadyExists));
} else if (response.code() == 404) { } else if (response.code() == 404) {
enableProcessButton(); SnackBar.error(
Toasty.error(ctx, getString(R.string.apiNotFound)); ctx,
findViewById(android.R.id.content),
getString(R.string.apiNotFound));
} else { } else {
enableProcessButton(); SnackBar.error(
Toasty.error(ctx, getString(R.string.genericError)); ctx,
findViewById(android.R.id.content),
getString(R.string.genericError));
} }
} }
@Override @Override
public void onFailure(@NonNull Call<PullRequest> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<PullRequest> call, @NonNull Throwable t) {
enableProcessButton(); SnackBar.error(
Toasty.error(ctx, getString(R.string.genericServerResponseError)); ctx,
findViewById(android.R.id.content),
getString(R.string.genericServerResponseError));
} }
}); });
} }
private void showDatePickerDialog() {
MaterialDatePicker.Builder<Long> builder = MaterialDatePicker.Builder.datePicker();
builder.setSelection(Calendar.getInstance().getTimeInMillis());
builder.setTitleText(R.string.newIssueDueDateTitle);
MaterialDatePicker<Long> materialDatePicker = builder.build();
viewBinding.prDueDate.setOnClickListener(
v -> materialDatePicker.show(getSupportFragmentManager(), "DATE_PICKER"));
materialDatePicker.addOnPositiveButtonClickListener(
selection -> {
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
calendar.setTimeInMillis(selection);
SimpleDateFormat format =
new SimpleDateFormat(
"yyyy-MM-dd", new Locale(tinyDB.getString("locale")));
String formattedDate = format.format(calendar.getTime());
viewBinding.prDueDate.setText(formattedDate);
});
}
@Override @Override
public void labelsInterface(List<String> data) { public void labelsInterface(List<String> data) {
@ -325,7 +361,6 @@ public class CreatePullRequestActivity extends BaseActivity
viewBinding.mergeIntoBranchSpinner.setAdapter(adapter); viewBinding.mergeIntoBranchSpinner.setAdapter(adapter);
viewBinding.pullFromBranchSpinner.setAdapter(adapter); viewBinding.pullFromBranchSpinner.setAdapter(adapter);
enableProcessButton();
} }
} }
} }
@ -333,7 +368,10 @@ public class CreatePullRequestActivity extends BaseActivity
@Override @Override
public void onFailure(@NonNull Call<List<Branch>> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<List<Branch>> call, @NonNull Throwable t) {
Toasty.error(ctx, getString(R.string.genericServerResponseError)); SnackBar.error(
ctx,
findViewById(android.R.id.content),
getString(R.string.genericServerResponseError));
} }
}); });
} }
@ -382,7 +420,6 @@ public class CreatePullRequestActivity extends BaseActivity
new ArrayList<>(milestonesList.keySet())); new ArrayList<>(milestonesList.keySet()));
viewBinding.milestonesSpinner.setAdapter(adapter); viewBinding.milestonesSpinner.setAdapter(adapter);
enableProcessButton();
viewBinding.milestonesSpinner.setOnItemClickListener( viewBinding.milestonesSpinner.setOnItemClickListener(
(parent, view, position, id) -> { (parent, view, position, id) -> {
@ -407,51 +444,14 @@ public class CreatePullRequestActivity extends BaseActivity
public void onFailure( public void onFailure(
@NonNull Call<List<Milestone>> call, @NonNull Throwable t) { @NonNull Call<List<Milestone>> call, @NonNull Throwable t) {
Toasty.error(ctx, getString(R.string.genericServerResponseError)); SnackBar.error(
ctx,
findViewById(android.R.id.content),
getString(R.string.genericServerResponseError));
} }
}); });
} }
private void setDueDate() {
final Calendar c = Calendar.getInstance();
int mYear = c.get(Calendar.YEAR);
final int mMonth = c.get(Calendar.MONTH);
final int mDay = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog =
new DatePickerDialog(
this,
(view, year, monthOfYear, dayOfMonth) -> {
viewBinding.prDueDate.setText(
getString(
R.string.setDueDate,
year,
(monthOfYear + 1),
dayOfMonth));
currentDate = new Date(year - 1900, monthOfYear, dayOfMonth);
},
mYear,
mMonth,
mDay);
datePickerDialog.show();
}
private void initCloseListener() {
onClickListener = view -> finish();
}
private void disableProcessButton() {
viewBinding.createPr.setEnabled(false);
}
private void enableProcessButton() {
viewBinding.createPr.setEnabled(true);
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();

View File

@ -601,11 +601,12 @@ public class IssueDetailActivity extends BaseActivity
private void getSingleIssue(String repoOwner, String repoName, int issueIndex) { private void getSingleIssue(String repoOwner, String repoName, int issueIndex) {
getAttachments();
if (issue.hasIssue()) { if (issue.hasIssue()) {
viewBinding.progressBar.setVisibility(View.GONE); viewBinding.progressBar.setVisibility(View.GONE);
getSubscribed(); getSubscribed();
initWithIssue(); initWithIssue();
getAttachments();
return; return;
} }

View File

@ -41,6 +41,7 @@ public class ProfileActivity extends BaseActivity implements BottomSheetListener
private String username; private String username;
private boolean following; private boolean following;
public ViewPager2 viewPager;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -64,7 +65,7 @@ public class ProfileActivity extends BaseActivity implements BottomSheetListener
Objects.requireNonNull(getSupportActionBar()).setTitle(username); Objects.requireNonNull(getSupportActionBar()).setTitle(username);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ViewPager2 viewPager = findViewById(R.id.profileContainer); viewPager = findViewById(R.id.profileContainer);
viewPager.setOffscreenPageLimit(1); viewPager.setOffscreenPageLimit(1);
TabLayout tabLayout = findViewById(R.id.tabs); TabLayout tabLayout = findViewById(R.id.tabs);

View File

@ -101,18 +101,18 @@ public class RepoInfoFragment extends Fragment {
binding.fileContentsFrameHeader.setOnClickListener(v1 -> toggleExpandView()); binding.fileContentsFrameHeader.setOnClickListener(v1 -> toggleExpandView());
binding.repoMetaFrameHeader.setOnClickListener(v12 -> toggleExpandViewMeta()); binding.repoMetaFrameHeader.setOnClickListener(v12 -> toggleExpandViewMeta());
binding.repoMetaStarsFrame.setOnClickListener( binding.repoMetaStars.setOnClickListener(
metaStars -> metaStars ->
ctx.startActivity(repository.getIntent(ctx, RepoStargazersActivity.class))); ctx.startActivity(repository.getIntent(ctx, RepoStargazersActivity.class)));
binding.repoMetaWatchersFrame.setOnClickListener( binding.repoMetaWatchers.setOnClickListener(
metaWatchers -> metaWatchers ->
ctx.startActivity(repository.getIntent(ctx, RepoWatchersActivity.class))); ctx.startActivity(repository.getIntent(ctx, RepoWatchersActivity.class)));
binding.repoMetaForksFrame.setOnClickListener( binding.repoMetaForks.setOnClickListener(
metaForks -> ctx.startActivity(repository.getIntent(ctx, RepoForksActivity.class))); metaForks -> ctx.startActivity(repository.getIntent(ctx, RepoForksActivity.class)));
binding.repoMetaPullRequestsFrame.setOnClickListener( binding.repoMetaPullRequests.setOnClickListener(
metaPR -> ((RepoDetailActivity) requireActivity()).viewPager.setCurrentItem(3)); metaPR -> ((RepoDetailActivity) requireActivity()).viewPager.setCurrentItem(3));
setLanguageStatistics(); setLanguageStatistics();
@ -405,7 +405,7 @@ public class RepoInfoFragment extends Fragment {
if (repoInfo.getOpenPrCounter() != null) { if (repoInfo.getOpenPrCounter() != null) {
binding.repoMetaPullRequests.setText(String.valueOf(repoInfo.getOpenPrCounter())); binding.repoMetaPullRequests.setText(String.valueOf(repoInfo.getOpenPrCounter()));
} else { } else {
binding.repoMetaPullRequestsFrame.setVisibility(View.GONE); binding.repoMetaPullRequests.setVisibility(View.GONE);
} }
binding.repoMetaForks.setText(String.valueOf(repoInfo.getForksCount())); binding.repoMetaForks.setText(String.valueOf(repoInfo.getForksCount()));

View File

@ -13,6 +13,7 @@ import okhttp3.ResponseBody;
import org.gitnex.tea4j.v2.models.Repository; import org.gitnex.tea4j.v2.models.Repository;
import org.gitnex.tea4j.v2.models.User; import org.gitnex.tea4j.v2.models.User;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.ProfileActivity;
import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentProfileDetailBinding; import org.mian.gitnex.databinding.FragmentProfileDetailBinding;
@ -69,6 +70,16 @@ public class DetailFragment extends Fragment {
getProfileDetail(username); getProfileDetail(username);
getProfileRepository(username); getProfileRepository(username);
binding.userFollowersCount.setOnClickListener(
metaFollowersFrame ->
((ProfileActivity) requireActivity()).viewPager.setCurrentItem(4));
binding.userFollowingCount.setOnClickListener(
metaFollowingFrame ->
((ProfileActivity) requireActivity()).viewPager.setCurrentItem(5));
binding.userStarredReposCount.setOnClickListener(
metaStarredReposFrame ->
((ProfileActivity) requireActivity()).viewPager.setCurrentItem(2));
return binding.getRoot(); return binding.getRoot();
} }
@ -106,11 +117,22 @@ public class DetailFragment extends Fragment {
binding.userEmail.setText(email); binding.userEmail.setText(email);
binding.userFollowersCount.setText( binding.userFollowersCount.setText(
String.valueOf(response.body().getFollowersCount())); String.valueOf(
response.body().getFollowersCount()
+ " "
+ getString(
R.string.profileTabFollowers)));
binding.userFollowingCount.setText( binding.userFollowingCount.setText(
String.valueOf(response.body().getFollowingCount())); String.valueOf(
response.body().getFollowingCount()
+ " "
+ getString(
R.string.profileTabFollowing)));
binding.userStarredReposCount.setText( binding.userStarredReposCount.setText(
String.valueOf(response.body().getStarredReposCount())); String.valueOf(
response.body().getStarredReposCount()
+ " "
+ getString(R.string.starredRepos)));
String[] userLanguageCodes = String[] userLanguageCodes =
response.body().getLanguage().split("-"); response.body().getLanguage().split("-");

View File

@ -1,48 +1,36 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor" android:background="?attr/primaryBackgroundColor"
android:orientation="vertical"> xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appBarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/Widget.AppCompat.SearchView" android:background="?attr/primaryBackgroundColor"
app:elevation="@dimen/dimen0dp"> android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/toolbar" style="?attr/collapsingToolbarLayoutLargeStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
android:background="?attr/primaryBackgroundColor"> app:contentScrim="?attr/primaryBackgroundColor"
android:layout_height="?attr/collapsingToolbarLayoutLargeSize">
<ImageView <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/close" android:id="@+id/topAppBar"
android:layout_width="@dimen/dimen26dp" android:layout_width="match_parent"
android:layout_height="@dimen/dimen26dp" android:elevation="0dp"
android:layout_marginStart="@dimen/dimen16dp" android:layout_height="?attr/actionBarSize"
android:layout_marginEnd="@dimen/dimen16dp" app:title="@string/pageTitleNewPullRequest"
android:background="?android:attr/selectableItemBackgroundBorderless" app:layout_collapseMode="pin"
android:clickable="true" app:menu="@menu/create_issue_menu"
android:contentDescription="@string/close" app:navigationIcon="@drawable/ic_close" />
android:focusable="true"
android:gravity="center_vertical"
android:src="@drawable/ic_close"/>
<TextView </com.google.android.material.appbar.CollapsingToolbarLayout>
android:id="@+id/toolbarTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:text="@string/pageTitleNewPullRequest"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen20sp"/>
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
@ -53,12 +41,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" android:indeterminate="true"
android:visibility="gone" android:visibility="gone"
app:indicatorColor="?attr/progressIndicatorColor"/> app:indicatorColor="?attr/progressIndicatorColor" />
<ScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -74,7 +62,6 @@
android:layout_marginBottom="@dimen/dimen8dp" android:layout_marginBottom="@dimen/dimen8dp"
android:hint="@string/newIssueTitle" android:hint="@string/newIssueTitle"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
app:boxBackgroundColor="?attr/inputBackgroundColor"
app:boxStrokeErrorColor="@color/darkRed" app:boxStrokeErrorColor="@color/darkRed"
app:counterEnabled="true" app:counterEnabled="true"
app:counterMaxLength="255" app:counterMaxLength="255"
@ -105,7 +92,6 @@
android:layout_marginBottom="@dimen/dimen8dp" android:layout_marginBottom="@dimen/dimen8dp"
android:hint="@string/newIssueDescriptionTitle" android:hint="@string/newIssueDescriptionTitle"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
app:boxBackgroundColor="?attr/inputBackgroundColor"
app:boxStrokeErrorColor="@color/darkRed" app:boxStrokeErrorColor="@color/darkRed"
app:endIconMode="clear_text" app:endIconMode="clear_text"
app:endIconTint="?attr/iconsColor" app:endIconTint="?attr/iconsColor"
@ -146,7 +132,6 @@
android:layout_marginBottom="@dimen/dimen8dp" android:layout_marginBottom="@dimen/dimen8dp"
android:hint="@string/mergeIntoBranch" android:hint="@string/mergeIntoBranch"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
app:boxBackgroundColor="?attr/inputBackgroundColor"
app:endIconTint="?attr/iconsColor" app:endIconTint="?attr/iconsColor"
app:hintTextColor="?attr/hintColor"> app:hintTextColor="?attr/hintColor">
@ -170,7 +155,6 @@
android:layout_marginBottom="@dimen/dimen8dp" android:layout_marginBottom="@dimen/dimen8dp"
android:hint="@string/pullFromBranch" android:hint="@string/pullFromBranch"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
app:boxBackgroundColor="?attr/inputBackgroundColor"
app:endIconTint="?attr/iconsColor" app:endIconTint="?attr/iconsColor"
app:hintTextColor="?attr/hintColor"> app:hintTextColor="?attr/hintColor">
@ -194,7 +178,6 @@
android:layout_marginBottom="@dimen/dimen8dp" android:layout_marginBottom="@dimen/dimen8dp"
android:hint="@string/newIssueMilestoneTitle" android:hint="@string/newIssueMilestoneTitle"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
app:boxBackgroundColor="?attr/inputBackgroundColor"
app:endIconTint="?attr/iconsColor" app:endIconTint="?attr/iconsColor"
app:hintTextColor="?attr/hintColor"> app:hintTextColor="?attr/hintColor">
@ -217,7 +200,6 @@
android:layout_marginBottom="@dimen/dimen8dp" android:layout_marginBottom="@dimen/dimen8dp"
android:hint="@string/newIssueLabelsTitle" android:hint="@string/newIssueLabelsTitle"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
app:boxBackgroundColor="?attr/inputBackgroundColor"
app:hintTextColor="?attr/hintColor"> app:hintTextColor="?attr/hintColor">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
@ -240,7 +222,6 @@
android:layout_marginBottom="@dimen/dimen8dp" android:layout_marginBottom="@dimen/dimen8dp"
android:hint="@string/newIssueDueDateTitle" android:hint="@string/newIssueDueDateTitle"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
app:boxBackgroundColor="?attr/inputBackgroundColor"
app:boxStrokeErrorColor="@color/darkRed" app:boxStrokeErrorColor="@color/darkRed"
app:endIconMode="clear_text" app:endIconMode="clear_text"
app:endIconTint="?attr/iconsColor" app:endIconTint="?attr/iconsColor"
@ -259,17 +240,8 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/createPr"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen54dp"
android:layout_marginTop="@dimen/dimen8dp"
android:text="@string/newCreateButtonCopy"
android:textColor="?attr/materialCardBackgroundColor"
android:textStyle="bold"/>
</LinearLayout> </LinearLayout>
</ScrollView> </androidx.core.widget.NestedScrollView>
</LinearLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -101,85 +101,39 @@
android:layout_marginTop="@dimen/dimen20dp" android:layout_marginTop="@dimen/dimen20dp"
android:layout_marginBottom="@dimen/dimen0dp" android:layout_marginBottom="@dimen/dimen0dp"
android:orientation="horizontal" android:orientation="horizontal"
android:gravity="center"
android:baselineAligned="false"> android:baselineAligned="false">
<LinearLayout <com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/followers_section" android:id="@+id/metaInfoGroup"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:text="@string/profileTabFollowers"
android:textSize="@dimen/dimen14sp" />
<TextView
android:id="@+id/user_followers_count" android:id="@+id/user_followers_count"
style="?attr/materialButtonToggleGroupStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor" android:textSize="@dimen/dimen12sp"
android:paddingTop="@dimen/dimen6dp" android:text="@string/profileTabFollowers" />
android:textStyle="bold"
android:textSize="@dimen/dimen14sp" />
</LinearLayout> <Button
<LinearLayout
android:id="@+id/following_section"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:text="@string/profileTabFollowing"
android:textSize="@dimen/dimen14sp" />
<TextView
android:id="@+id/user_following_count" android:id="@+id/user_following_count"
style="?attr/materialButtonToggleGroupStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor" android:textSize="@dimen/dimen12sp"
android:paddingTop="@dimen/dimen6dp" android:text="@string/profileTabFollowing" />
android:textStyle="bold"
android:textSize="@dimen/dimen14sp" />
</LinearLayout> <Button
<LinearLayout
android:id="@+id/starred_repos_section"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:text="@string/starredRepos"
android:textSize="@dimen/dimen14sp" />
<TextView
android:id="@+id/user_starred_repos_count" android:id="@+id/user_starred_repos_count"
style="?attr/materialButtonToggleGroupStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor" android:textSize="@dimen/dimen12sp"
android:paddingTop="@dimen/dimen6dp" android:text="@string/starredRepos" />
android:textStyle="bold"
android:textSize="@dimen/dimen14sp" />
</LinearLayout> </com.google.android.material.button.MaterialButtonToggleGroup>
</LinearLayout> </LinearLayout>

View File

@ -160,110 +160,51 @@
android:layout_marginTop="@dimen/dimen20dp" android:layout_marginTop="@dimen/dimen20dp"
android:layout_marginBottom="@dimen/dimen20dp" android:layout_marginBottom="@dimen/dimen20dp"
android:baselineAligned="false" android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/repoMetaStarsFrame" android:id="@+id/metaInfoGroup"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:layout_weight="1"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:focusable="true"
android:clickable="true"
android:gravity="center"
android:orientation="vertical">
<ImageView <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/repoStargazersInMenu"
app:srcCompat="@drawable/ic_star_unfilled"/>
<TextView
android:id="@+id/repoMetaStars" android:id="@+id/repoMetaStars"
style="?attr/materialButtonToggleGroupStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor" android:textSize="@dimen/dimen12sp"
android:textSize="@dimen/dimen14sp"/> app:icon="@drawable/ic_star_unfilled"
android:text="@string/repoStars" />
</LinearLayout> <Button
<LinearLayout
android:id="@+id/repoMetaPullRequestsFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:focusable="true"
android:clickable="true"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/tabPullRequests"
app:srcCompat="@drawable/ic_pull_request"/>
<TextView
android:id="@+id/repoMetaPullRequests" android:id="@+id/repoMetaPullRequests"
style="?attr/materialButtonToggleGroupStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor" android:textSize="@dimen/dimen12sp"
android:textSize="@dimen/dimen14sp"/> app:icon="@drawable/ic_pull_request"
</LinearLayout> android:text="@string/repoStars" />
<LinearLayout <Button
android:id="@+id/repoMetaForksFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:focusable="true"
android:clickable="true"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/infoTabRepoForksCount"
app:srcCompat="@drawable/ic_fork"/>
<TextView
android:id="@+id/repoMetaForks" android:id="@+id/repoMetaForks"
style="?attr/materialButtonToggleGroupStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor" android:textSize="@dimen/dimen12sp"
android:textSize="@dimen/dimen14sp"/> app:icon="@drawable/ic_fork"
android:text="@string/repoStars" />
</LinearLayout> <Button
<LinearLayout
android:id="@+id/repoMetaWatchersFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:focusable="true"
android:clickable="true"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/repoWatchersInMenu"
app:srcCompat="@drawable/ic_watchers"/>
<TextView
android:id="@+id/repoMetaWatchers" android:id="@+id/repoMetaWatchers"
style="?attr/materialButtonToggleGroupStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor" android:textSize="@dimen/dimen12sp"
android:textSize="@dimen/dimen14sp"/> app:icon="@drawable/ic_watchers"
android:text="@string/repoStars" />
</LinearLayout> </com.google.android.material.button.MaterialButtonToggleGroup>
</LinearLayout> </LinearLayout>