mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2025-12-08 19:05:54 +00:00
this commit add first gist file to the gistsList while show description in own personal gist instead of file name to fix #84
This commit is contained in:
parent
cd8b2bec62
commit
28cffc5dbe
@ -143,6 +143,7 @@ import rx.Observable;
|
||||
|
||||
@NonNull public SpannableBuilder getDisplayTitle(boolean isFromProfile) {
|
||||
SpannableBuilder spannableBuilder = SpannableBuilder.builder();
|
||||
boolean addDescription = true;
|
||||
if (!isFromProfile) {
|
||||
if (owner != null) {
|
||||
spannableBuilder.bold(owner.getLogin());
|
||||
@ -151,10 +152,19 @@ import rx.Observable;
|
||||
} else {
|
||||
spannableBuilder.bold("Anonymous");
|
||||
}
|
||||
List<FilesListModel> files = getFilesAsList();
|
||||
if (!files.isEmpty()) {
|
||||
FilesListModel filesListModel = files.get(0);
|
||||
if (!InputHelper.isEmpty(filesListModel.getFilename()) && filesListModel.getFilename().trim().length() > 2) {
|
||||
spannableBuilder.append(" ").append("/").append(" ")
|
||||
.append(filesListModel.getFilename());
|
||||
addDescription = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!InputHelper.isEmpty(description)) {
|
||||
if (!InputHelper.isEmpty(description) && addDescription) {
|
||||
if (!InputHelper.isEmpty(spannableBuilder.toString())) {
|
||||
spannableBuilder.append("/");
|
||||
spannableBuilder.append(" ").append("/").append(" ");
|
||||
}
|
||||
spannableBuilder.append(description);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import android.view.ViewGroup;
|
||||
|
||||
import com.fastaccess.R;
|
||||
import com.fastaccess.data.dao.model.Repo;
|
||||
import com.fastaccess.helper.InputHelper;
|
||||
import com.fastaccess.helper.ParseDateFormat;
|
||||
import com.fastaccess.ui.widgets.AvatarLayout;
|
||||
import com.fastaccess.ui.widgets.FontTextView;
|
||||
@ -82,7 +83,10 @@ public class ReposViewHolder extends BaseViewHolder<Repo> {
|
||||
stars.setText(numberFormat.format(repo.getStargazersCount()));
|
||||
forks.setText(numberFormat.format(repo.getForks()));
|
||||
date.setText(ParseDateFormat.getTimeAgo(repo.getUpdatedAt()));
|
||||
language.setText(repo.getLanguage() != null && !repo.getLanguage().trim().isEmpty() ? repo.getLanguage() : "N/A");
|
||||
language.setTextColor(ColorGenerator.MATERIAL.getColor(repo.getId()));
|
||||
if (!InputHelper.isEmpty(repo.getLanguage())) {
|
||||
language.setText(repo.getLanguage());
|
||||
language.setTextColor(ColorGenerator.MATERIAL.getColor(repo.getLanguage()));
|
||||
language.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,8 +211,8 @@ public class RepoPagerView extends BaseActivity<RepoPagerMvp.View, RepoPagerPres
|
||||
Repo repoModel = getPresenter().getRepo();
|
||||
hideProgress();
|
||||
detailsIcon.setVisibility(InputHelper.isEmpty(repoModel.getDescription()) ? View.GONE : View.VISIBLE);
|
||||
language.setVisibility(View.VISIBLE);
|
||||
language.setText(InputHelper.toNA(repoModel.getLanguage()));
|
||||
language.setVisibility(InputHelper.isEmpty(repoModel.getLanguage()) ? View.GONE : View.VISIBLE);
|
||||
if (!InputHelper.isEmpty(repoModel.getLanguage())) language.setText(repoModel.getLanguage());
|
||||
language.setTextColor(ColorGenerator.MATERIAL.getColor(repoModel.getId()));
|
||||
forkRepo.setText(numberFormat.format(repoModel.getForksCount()));
|
||||
starRepo.setText(numberFormat.format(repoModel.getStargazersCount()));
|
||||
|
||||
@ -2,6 +2,8 @@ package com.fastaccess.ui.widgets.color;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Objects;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -35,9 +37,7 @@ public class ColorGenerator {
|
||||
}
|
||||
|
||||
public int getColor(@Nullable Object key) {
|
||||
if (key == null) {
|
||||
key = "default";
|
||||
}
|
||||
key = Objects.toString(key, "default");
|
||||
return colors.get(Math.abs(key.hashCode()) % colors.size());
|
||||
}
|
||||
}
|
||||
@ -54,7 +54,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
android:maxLines="5"
|
||||
tools:text="For a divided large loaf, add some champaign and cinnamon."/>
|
||||
</LinearLayout>
|
||||
</android.support.design.internal.ForegroundLinearLayout>
|
||||
|
||||
@ -50,18 +50,6 @@
|
||||
app:auto_gravity="start"
|
||||
app:auto_orientation="horizontal">
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/language"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_normal"
|
||||
android:drawablePadding="@dimen/spacing_normal"
|
||||
android:gravity="start|center"
|
||||
android:textColor="@color/secondary_text"
|
||||
app:drawableColor="@color/secondary_text"
|
||||
tools:text="Java"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/stars"
|
||||
@ -75,7 +63,7 @@
|
||||
android:gravity="start|center"
|
||||
android:textColor="@color/secondary_text"
|
||||
app:drawableColor="@color/secondary_text"
|
||||
tools:text="1000"/>
|
||||
tools:text="10000"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/forks"
|
||||
@ -89,7 +77,7 @@
|
||||
android:gravity="start|center"
|
||||
android:textColor="@color/secondary_text"
|
||||
app:drawableColor="@color/secondary_text"
|
||||
tools:text="5000"/>
|
||||
tools:text="50000"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/date"
|
||||
@ -97,13 +85,27 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawablePadding="@dimen/spacing_normal"
|
||||
android:drawableStart="@drawable/ic_time_small"
|
||||
android:gravity="start|center"
|
||||
android:textColor="@color/secondary_text"
|
||||
app:drawableColor="@color/secondary_text"
|
||||
tools:text="50 minutes ago"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/language"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/spacing_normal"
|
||||
android:drawablePadding="@dimen/spacing_normal"
|
||||
android:gravity="start|center"
|
||||
android:textColor="@color/secondary_text"
|
||||
android:visibility="gone"
|
||||
app:drawableColor="@color/secondary_text"
|
||||
tools:text="TypeScript"/>
|
||||
|
||||
|
||||
</com.fastaccess.ui.widgets.AutoLinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@ -38,19 +38,6 @@
|
||||
app:auto_gravity="start"
|
||||
app:auto_orientation="horizontal">
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/language"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_normal"
|
||||
android:drawablePadding="@dimen/spacing_normal"
|
||||
android:gravity="start|center"
|
||||
android:textColor="@color/secondary_text"
|
||||
app:drawableColor="@color/secondary_text"
|
||||
tools:text="Java"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/stars"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
@ -85,13 +72,27 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawablePadding="@dimen/spacing_normal"
|
||||
android:drawableStart="@drawable/ic_time_small"
|
||||
android:gravity="start|center"
|
||||
android:textColor="@color/secondary_text"
|
||||
app:drawableColor="@color/secondary_text"
|
||||
tools:text="50 minutes ago"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/language"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/spacing_normal"
|
||||
android:drawablePadding="@dimen/spacing_normal"
|
||||
android:gravity="start|center"
|
||||
android:textColor="@color/secondary_text"
|
||||
android:visibility="gone"
|
||||
app:drawableColor="@color/secondary_text"
|
||||
tools:text="TypeScript"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
</com.fastaccess.ui.widgets.AutoLinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user