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;
import android.annotation.SuppressLint;
import android.app.DatePickerDialog;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.google.android.material.datepicker.MaterialDatePicker;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.vdurmont.emoji.EmojiParser;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.TimeZone;
import org.gitnex.tea4j.v2.models.Branch;
import org.gitnex.tea4j.v2.models.CreatePullRequestOption;
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.helpers.Constants;
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 retrofit2.Call;
import retrofit2.Callback;
@ -50,11 +50,9 @@ public class CreatePullRequestActivity extends BaseActivity
LinkedHashMap<String, Milestone> milestonesList = new LinkedHashMap<>();
List<String> branchesList = new ArrayList<>();
List<Label> labelsList = new ArrayList<>();
private View.OnClickListener onClickListener;
private ActivityCreatePrBinding viewBinding;
private List<Integer> labelsIds = new ArrayList<>();
private int milestoneId;
private Date currentDate = null;
private RepositoryContext repository;
private LabelsListAdapter labelsAdapter;
private MaterialAlertDialogBuilder materialAlertDialogBuilder;
@ -69,7 +67,6 @@ public class CreatePullRequestActivity extends BaseActivity
viewBinding = ActivityCreatePrBinding.inflate(getLayoutInflater());
setContentView(viewBinding.getRoot());
setSupportActionBar(viewBinding.toolbar);
repositoryContext = RepositoryContext.fromIntent(getIntent());
@ -95,22 +92,55 @@ public class CreatePullRequestActivity extends BaseActivity
labelsAdapter =
new LabelsListAdapter(labelsList, CreatePullRequestActivity.this, labelsIds);
ImageView closeActivity = findViewById(R.id.close);
showDatePickerDialog();
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
viewBinding.topAppBar.setNavigationOnClickListener(
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);
getBranches(repository.getOwner(), repository.getName());
viewBinding.prLabels.setOnClickListener(prLabels -> showLabels());
viewBinding.createPr.setOnClickListener(createPr -> processPullRequest());
if (!repository.getPermissions().isPush()) {
viewBinding.prDueDateLayout.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() {
String prTitle = String.valueOf(viewBinding.prTitle.getText());
String prDescription = String.valueOf(viewBinding.prBody.getText());
String mergeInto = viewBinding.mergeIntoBranchSpinner.getText().toString();
String pullFrom = viewBinding.pullFromBranchSpinner.getText().toString();
String prDueDate = Objects.requireNonNull(viewBinding.prDueDate.getText()).toString();
assignees.add("");
@ -173,19 +165,23 @@ public class CreatePullRequestActivity extends BaseActivity
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("")) {
Toasty.error(ctx, getString(R.string.mergeIntoError));
SnackBar.error(
ctx, findViewById(android.R.id.content), getString(R.string.mergeIntoError));
} 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)) {
Toasty.error(ctx, getString(R.string.sameBranchesError));
SnackBar.error(
ctx, findViewById(android.R.id.content), getString(R.string.sameBranchesError));
} 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 pullFrom,
int milestoneId,
List<String> assignees) {
List<String> assignees,
String prDueDate) {
ArrayList<Long> labelIds = new ArrayList<>();
for (Integer i : labelsIds) {
@ -210,7 +207,15 @@ public class CreatePullRequestActivity extends BaseActivity
createPullRequest.setBase(mergeInto);
createPullRequest.setHead(pullFrom);
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 =
RetrofitClient.getApiInterface(ctx)
@ -225,40 +230,71 @@ public class CreatePullRequestActivity extends BaseActivity
@NonNull Call<PullRequest> call,
@NonNull retrofit2.Response<PullRequest> response) {
disableProcessButton();
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;
PullRequestsFragment.resumePullRequests = true;
MainActivity.reloadRepos = true;
finish();
new Handler().postDelayed(() -> finish(), 3000);
} else if (response.code() == 409
|| response.message().equals("Conflict")) {
enableProcessButton();
Toasty.error(ctx, getString(R.string.prAlreadyExists));
SnackBar.error(
ctx,
findViewById(android.R.id.content),
getString(R.string.prAlreadyExists));
} else if (response.code() == 404) {
enableProcessButton();
Toasty.error(ctx, getString(R.string.apiNotFound));
SnackBar.error(
ctx,
findViewById(android.R.id.content),
getString(R.string.apiNotFound));
} else {
enableProcessButton();
Toasty.error(ctx, getString(R.string.genericError));
SnackBar.error(
ctx,
findViewById(android.R.id.content),
getString(R.string.genericError));
}
}
@Override
public void onFailure(@NonNull Call<PullRequest> call, @NonNull Throwable t) {
enableProcessButton();
Toasty.error(ctx, getString(R.string.genericServerResponseError));
SnackBar.error(
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
public void labelsInterface(List<String> data) {
@ -325,7 +361,6 @@ public class CreatePullRequestActivity extends BaseActivity
viewBinding.mergeIntoBranchSpinner.setAdapter(adapter);
viewBinding.pullFromBranchSpinner.setAdapter(adapter);
enableProcessButton();
}
}
}
@ -333,7 +368,10 @@ public class CreatePullRequestActivity extends BaseActivity
@Override
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()));
viewBinding.milestonesSpinner.setAdapter(adapter);
enableProcessButton();
viewBinding.milestonesSpinner.setOnItemClickListener(
(parent, view, position, id) -> {
@ -407,51 +444,14 @@ public class CreatePullRequestActivity extends BaseActivity
public void onFailure(
@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
public void onResume() {
super.onResume();

View File

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

View File

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

View File

@ -101,18 +101,18 @@ public class RepoInfoFragment extends Fragment {
binding.fileContentsFrameHeader.setOnClickListener(v1 -> toggleExpandView());
binding.repoMetaFrameHeader.setOnClickListener(v12 -> toggleExpandViewMeta());
binding.repoMetaStarsFrame.setOnClickListener(
binding.repoMetaStars.setOnClickListener(
metaStars ->
ctx.startActivity(repository.getIntent(ctx, RepoStargazersActivity.class)));
binding.repoMetaWatchersFrame.setOnClickListener(
binding.repoMetaWatchers.setOnClickListener(
metaWatchers ->
ctx.startActivity(repository.getIntent(ctx, RepoWatchersActivity.class)));
binding.repoMetaForksFrame.setOnClickListener(
binding.repoMetaForks.setOnClickListener(
metaForks -> ctx.startActivity(repository.getIntent(ctx, RepoForksActivity.class)));
binding.repoMetaPullRequestsFrame.setOnClickListener(
binding.repoMetaPullRequests.setOnClickListener(
metaPR -> ((RepoDetailActivity) requireActivity()).viewPager.setCurrentItem(3));
setLanguageStatistics();
@ -405,7 +405,7 @@ public class RepoInfoFragment extends Fragment {
if (repoInfo.getOpenPrCounter() != null) {
binding.repoMetaPullRequests.setText(String.valueOf(repoInfo.getOpenPrCounter()));
} else {
binding.repoMetaPullRequestsFrame.setVisibility(View.GONE);
binding.repoMetaPullRequests.setVisibility(View.GONE);
}
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.User;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.ProfileActivity;
import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentProfileDetailBinding;
@ -69,6 +70,16 @@ public class DetailFragment extends Fragment {
getProfileDetail(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();
}
@ -106,11 +117,22 @@ public class DetailFragment extends Fragment {
binding.userEmail.setText(email);
binding.userFollowersCount.setText(
String.valueOf(response.body().getFollowersCount()));
String.valueOf(
response.body().getFollowersCount()
+ " "
+ getString(
R.string.profileTabFollowers)));
binding.userFollowingCount.setText(
String.valueOf(response.body().getFollowingCount()));
String.valueOf(
response.body().getFollowingCount()
+ " "
+ getString(
R.string.profileTabFollowing)));
binding.userStarredReposCount.setText(
String.valueOf(response.body().getStarredReposCount()));
String.valueOf(
response.body().getStarredReposCount()
+ " "
+ getString(R.string.starredRepos)));
String[] userLanguageCodes =
response.body().getLanguage().split("-");

View File

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

View File

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

View File

@ -160,110 +160,51 @@
android:layout_marginTop="@dimen/dimen20dp"
android:layout_marginBottom="@dimen/dimen20dp"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/repoMetaStarsFrame"
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">
<com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/metaInfoGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/repoStargazersInMenu"
app:srcCompat="@drawable/ic_star_unfilled"/>
<TextView
<Button
android:id="@+id/repoMetaStars"
style="?attr/materialButtonToggleGroupStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen14sp"/>
android:textSize="@dimen/dimen12sp"
app:icon="@drawable/ic_star_unfilled"
android:text="@string/repoStars" />
</LinearLayout>
<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
<Button
android:id="@+id/repoMetaPullRequests"
style="?attr/materialButtonToggleGroupStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen14sp"/>
</LinearLayout>
android:textSize="@dimen/dimen12sp"
app:icon="@drawable/ic_pull_request"
android:text="@string/repoStars" />
<LinearLayout
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
<Button
android:id="@+id/repoMetaForks"
style="?attr/materialButtonToggleGroupStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen14sp"/>
android:textSize="@dimen/dimen12sp"
app:icon="@drawable/ic_fork"
android:text="@string/repoStars" />
</LinearLayout>
<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
<Button
android:id="@+id/repoMetaWatchers"
style="?attr/materialButtonToggleGroupStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen14sp"/>
android:textSize="@dimen/dimen12sp"
app:icon="@drawable/ic_watchers"
android:text="@string/repoStars" />
</LinearLayout>
</com.google.android.material.button.MaterialButtonToggleGroup>
</LinearLayout>