Render md in org/repo info (#986) Some checks failed GitLab CI GitLab continuous integration tool
Some checks failed
GitLab CI GitLab continuous integration tool
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org> Co-committed-by: M M Arif <mmarif@noreply.codeberg.org>
This commit is contained in:
parent ba930021e7
commit a08cf13382
12 changed files with 59 additions and 18 deletions
2 .idea/codeStyles/Project.xml generated
2
.idea/codeStyles/Project.xml generated | @ -180,4 +180,4 @@ | |||
</arrangement> | ||||
</codeStyleSettings> | ||||
</code_scheme> | ||||
</component> | ||||
</component> | ||||
| |
| @ -112,9 +112,14 @@ public class ExplorePublicOrganizationsAdapter extends RecyclerView.Adapter<Recy | |||
.resize(120, 120) | ||||
.centerCrop() | ||||
.into(image); | ||||
if (!organization.getDescription().equals("")) { | ||||
orgDescription.setText(organization.getDescription()); | ||||
} | ||||
| ||||
if(!organization.getDescription().equals("")) { | ||||
orgDescription.setVisibility(View.VISIBLE); | ||||
orgDescription.setText(organization.getDescription()); | ||||
} | ||||
else { | ||||
orgDescription.setVisibility(View.GONE); | ||||
} | ||||
} | ||||
} | ||||
| ||||
| |
| @ -105,6 +105,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<RecyclerVie | |||
private CheckBox isRepoAdmin; | ||||
private final TextView repoStars; | ||||
private final TextView repoLastUpdated; | ||||
private final View spacerView; | ||||
| ||||
RepositoriesHolder(View itemView) { | ||||
super(itemView); | ||||
| @ -115,6 +116,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<RecyclerVie | |||
image = itemView.findViewById(R.id.imageAvatar); | ||||
repoStars = itemView.findViewById(R.id.repoStars); | ||||
repoLastUpdated = itemView.findViewById(R.id.repoLastUpdated); | ||||
spacerView = itemView.findViewById(R.id.spacerView); | ||||
| ||||
itemView.setOnClickListener(v -> { | ||||
| ||||
| @ -252,10 +254,13 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<RecyclerVie | |||
} | ||||
| ||||
if(!userRepositories.getDescription().equals("")) { | ||||
repoDescription.setVisibility(View.VISIBLE); | ||||
repoDescription.setText(userRepositories.getDescription()); | ||||
spacerView.setVisibility(View.GONE); | ||||
} | ||||
else { | ||||
repoDescription.setText(context.getString(R.string.noDataDescription)); | ||||
repoDescription.setVisibility(View.GONE); | ||||
spacerView.setVisibility(View.VISIBLE); | ||||
} | ||||
| ||||
if(isRepoAdmin == null) { | ||||
| |
| @ -60,6 +60,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter. | |||
private CheckBox isRepoAdmin; | ||||
private final TextView repoStars; | ||||
private final TextView repoLastUpdated; | ||||
private final View spacerView; | ||||
| ||||
private MyReposViewHolder(View itemView) { | ||||
| ||||
| @ -71,6 +72,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter. | |||
image = itemView.findViewById(R.id.imageAvatar); | ||||
repoStars = itemView.findViewById(R.id.repoStars); | ||||
repoLastUpdated = itemView.findViewById(R.id.repoLastUpdated); | ||||
spacerView = itemView.findViewById(R.id.spacerView); | ||||
| ||||
itemView.setOnClickListener(v -> { | ||||
| ||||
| @ -244,10 +246,13 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter. | |||
} | ||||
| ||||
if(!currentItem.getDescription().equals("")) { | ||||
holder.repoDescription.setVisibility(View.VISIBLE); | ||||
holder.repoDescription.setText(currentItem.getDescription()); | ||||
holder.spacerView.setVisibility(View.GONE); | ||||
} | ||||
else { | ||||
holder.repoDescription.setText(context.getString(R.string.noDataDescription)); | ||||
holder.repoDescription.setVisibility(View.GONE); | ||||
holder.spacerView.setVisibility(View.VISIBLE); | ||||
} | ||||
| ||||
if(holder.isRepoAdmin == null) { | ||||
| |
| @ -88,10 +88,13 @@ public class OrganizationsListAdapter extends RecyclerView.Adapter<Organizations | |||
| ||||
PicassoService.getInstance(context).get().load(currentItem.getAvatar_url()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(imgRadius, 0)).resize(120, 120).centerCrop().into(holder.image); | ||||
| ||||
if (!currentItem.getDescription().equals("")) { | ||||
| ||||
holder.orgDescription.setText(currentItem.getDescription()); | ||||
} | ||||
if(!currentItem.getDescription().equals("")) { | ||||
holder.orgDescription.setVisibility(View.VISIBLE); | ||||
holder.orgDescription.setText(currentItem.getDescription()); | ||||
} | ||||
else { | ||||
holder.orgDescription.setVisibility(View.GONE); | ||||
} | ||||
} | ||||
| ||||
@Override | ||||
| |
| @ -60,6 +60,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo | |||
private CheckBox isRepoAdmin; | ||||
private final TextView repoStars; | ||||
private final TextView repoLastUpdated; | ||||
private final View spacerView; | ||||
| ||||
private ReposViewHolder(View itemView) { | ||||
| ||||
| @ -71,6 +72,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo | |||
image = itemView.findViewById(R.id.imageAvatar); | ||||
repoStars = itemView.findViewById(R.id.repoStars); | ||||
repoLastUpdated = itemView.findViewById(R.id.repoLastUpdated); | ||||
spacerView = itemView.findViewById(R.id.spacerView); | ||||
| ||||
itemView.setOnClickListener(v -> { | ||||
| ||||
| @ -243,10 +245,13 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo | |||
} | ||||
| ||||
if(!currentItem.getDescription().equals("")) { | ||||
holder.repoDescription.setVisibility(View.VISIBLE); | ||||
holder.repoDescription.setText(currentItem.getDescription()); | ||||
holder.spacerView.setVisibility(View.GONE); | ||||
} | ||||
else { | ||||
holder.repoDescription.setText(context.getString(R.string.noDataDescription)); | ||||
holder.repoDescription.setVisibility(View.GONE); | ||||
holder.spacerView.setVisibility(View.VISIBLE); | ||||
} | ||||
| ||||
if(holder.isRepoAdmin == null) { | ||||
| |
| @ -60,6 +60,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB | |||
private CheckBox isRepoAdmin; | ||||
private final TextView repoStars; | ||||
private final TextView repoLastUpdated; | ||||
private final View spacerView; | ||||
| ||||
private OrgReposViewHolder(View itemView) { | ||||
| ||||
| @ -71,6 +72,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB | |||
image = itemView.findViewById(R.id.imageAvatar); | ||||
repoStars = itemView.findViewById(R.id.repoStars); | ||||
repoLastUpdated = itemView.findViewById(R.id.repoLastUpdated); | ||||
spacerView = itemView.findViewById(R.id.spacerView); | ||||
| ||||
itemView.setOnClickListener(v -> { | ||||
| ||||
| @ -247,10 +249,13 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB | |||
} | ||||
| ||||
if(!currentItem.getDescription().equals("")) { | ||||
holder.repoDescription.setVisibility(View.VISIBLE); | ||||
holder.repoDescription.setText(currentItem.getDescription()); | ||||
holder.spacerView.setVisibility(View.GONE); | ||||
} | ||||
else { | ||||
holder.repoDescription.setText(context.getString(R.string.noDataDescription)); | ||||
holder.repoDescription.setVisibility(View.GONE); | ||||
holder.spacerView.setVisibility(View.VISIBLE); | ||||
} | ||||
| ||||
if(holder.isRepoAdmin == null) { | ||||
| |
| @ -60,6 +60,7 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi | |||
private CheckBox isRepoAdmin; | ||||
private final TextView repoStars; | ||||
private final TextView repoLastUpdated; | ||||
private final View spacerView; | ||||
| ||||
private StarredReposViewHolder(View itemView) { | ||||
| ||||
| @ -71,6 +72,7 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi | |||
image = itemView.findViewById(R.id.imageAvatar); | ||||
repoStars = itemView.findViewById(R.id.repoStars); | ||||
repoLastUpdated = itemView.findViewById(R.id.repoLastUpdated); | ||||
spacerView = itemView.findViewById(R.id.spacerView); | ||||
| ||||
itemView.setOnClickListener(v -> { | ||||
| ||||
| @ -248,10 +250,13 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi | |||
} | ||||
| ||||
if(!currentItem.getDescription().equals("")) { | ||||
holder.repoDescription.setVisibility(View.VISIBLE); | ||||
holder.repoDescription.setText(currentItem.getDescription()); | ||||
holder.spacerView.setVisibility(View.GONE); | ||||
} | ||||
else { | ||||
holder.repoDescription.setText(context.getString(R.string.noDataDescription)); | ||||
holder.repoDescription.setVisibility(View.GONE); | ||||
holder.spacerView.setVisibility(View.VISIBLE); | ||||
} | ||||
| ||||
if(holder.isRepoAdmin == null) { | ||||
| |
| @ -19,6 +19,7 @@ import org.mian.gitnex.clients.PicassoService; | |||
import org.mian.gitnex.clients.RetrofitClient; | ||||
import org.mian.gitnex.databinding.FragmentOrganizationInfoBinding; | ||||
import org.mian.gitnex.helpers.Authorization; | ||||
import org.mian.gitnex.helpers.Markdown; | ||||
import org.mian.gitnex.helpers.RoundedTransformation; | ||||
import retrofit2.Call; | ||||
import retrofit2.Callback; | ||||
| @ -112,7 +113,7 @@ public class OrganizationInfoFragment extends Fragment { | |||
.centerCrop().into(orgAvatar); | ||||
| ||||
if(!orgInfo.getDescription().isEmpty()) { | ||||
orgDescInfo.setText(orgInfo.getDescription()); | ||||
Markdown.render(ctx, orgInfo.getDescription(), orgDescInfo); | ||||
} | ||||
else { | ||||
orgDescInfo.setText(getString(R.string.noDataDescription)); | ||||
| |
| @ -42,7 +42,6 @@ public class RepoInfoFragment extends Fragment { | |||
private LinearLayout pageContent; | ||||
private static final String repoNameF = "param2"; | ||||
private static final String repoOwnerF = "param1"; | ||||
private Locale locale; | ||||
| ||||
private FragmentRepoInfoBinding binding; | ||||
| ||||
| @ -77,7 +76,7 @@ public class RepoInfoFragment extends Fragment { | |||
binding = FragmentRepoInfoBinding.inflate(inflater, container, false); | ||||
TinyDB tinyDb = TinyDB.getInstance(getContext()); | ||||
ctx = getContext(); | ||||
locale = getResources().getConfiguration().locale; | ||||
Locale locale = getResources().getConfiguration().locale; | ||||
| ||||
pageContent = binding.repoInfoLayout; | ||||
pageContent.setVisibility(View.GONE); | ||||
| @ -198,7 +197,7 @@ public class RepoInfoFragment extends Fragment { | |||
binding.repoMetaName.setText(repoInfo.getName()); | ||||
| ||||
if(!repoInfo.getDescription().isEmpty()) { | ||||
binding.repoMetaDescription.setText(repoInfo.getDescription()); | ||||
Markdown.render(ctx, repoInfo.getDescription(), binding.repoMetaDescription); | ||||
} | ||||
else { | ||||
binding.repoMetaDescription.setText(getString(R.string.noDataDescription)); | ||||
| |
| @ -13,7 +13,6 @@ | |||
android:id="@+id/orgInfoFrame" | ||||
android:layout_width="match_parent" | ||||
android:layout_height="wrap_content" | ||||
android:layout_marginBottom="8dp" | ||||
android:gravity="center_vertical" | ||||
android:orientation="horizontal" | ||||
tools:ignore="UseCompoundDrawables"> | ||||
| @ -43,6 +42,8 @@ | |||
android:layout_height="wrap_content" | ||||
android:text="@string/noDataDescription" | ||||
android:textColor="?attr/primaryTextColor" | ||||
android:visibility="gone" | ||||
android:layout_marginTop="8dp" | ||||
android:textSize="15sp" /> | ||||
| ||||
</LinearLayout> | ||||
| |
| @ -61,8 +61,15 @@ | |||
android:layout_marginBottom="8dp" | ||||
android:textColor="?attr/primaryTextColor" | ||||
android:textSize="15sp" | ||||
android:visibility="gone" | ||||
android:text="@string/noDataDescription" /> | ||||
| ||||
<View | ||||
android:id="@+id/spacerView" | ||||
android:layout_width="match_parent" | ||||
android:layout_height="match_parent" | ||||
android:layout_marginBottom="8dp" /> | ||||
| ||||
<LinearLayout | ||||
android:id="@+id/repoInfoFrame" | ||||
android:layout_width="match_parent" | ||||
| |
Loading…
Add table
Add a link
Reference in a new issue