Some fixes

This commit is contained in:
tom79 2019-11-16 12:06:05 +01:00
parent 8cef86270a
commit cf5a254b6b
3 changed files with 138 additions and 118 deletions

View File

@ -140,11 +140,13 @@ public class InstanceProfileActivity extends BaseActivity {
SpannableString descriptionSpan;
if( instanceNodeInfo.getNodeDescription() != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
descriptionSpan = new SpannableString(Html.fromHtml(instanceNodeInfo.getNodeDescription(), FROM_HTML_MODE_LEGACY));
else
descriptionSpan = new SpannableString(Html.fromHtml(instanceNodeInfo.getNodeDescription()));
description.setText(descriptionSpan, TextView.BufferType.SPANNABLE);
}
userCount.setText(Helper.withSuffix((instanceNodeInfo.getNumberOfUsers())));
statusCount.setText(Helper.withSuffix((instanceNodeInfo.getNumberOfPosts())));
instanceCount.setText(Helper.withSuffix((instanceNodeInfo.getNumberOfInstance())));

View File

@ -1942,6 +1942,18 @@ public class API {
if( metadata.has("staffAccounts")){
instanceNodeInfo.setStaffAccountStr(metadata.getString("staffAccounts"));
}
if( metadata.has("nodeName")){
instanceNodeInfo.setNodeName(metadata.getString("nodeName"));
}
}
if( resobj.has("usage")){
JSONObject usage = resobj.getJSONObject("usage");
if( usage.has("users") && usage.getJSONObject("users").has("total")){
instanceNodeInfo.setNumberOfUsers(usage.getJSONObject("users").getInt("total"));
}
if( usage.has("localPosts") ){
instanceNodeInfo.setNumberOfPosts(usage.getInt("localPosts"));
}
}
if( instanceNodeInfo.getStaffAccountStr() != null && instanceNodeInfo.getStaffAccount() == null){
APIResponse search = searchAccounts(instanceNodeInfo.getStaffAccountStr(), 1);

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
@ -6,7 +7,7 @@
android:layout_height="450dp"
android:layout_margin="@dimen/fab_margin"
android:fitsSystemWindows="true"
tools:context="app.fedilab.android.activities.InstanceHealthActivity">
tools:context="app.fedilab.android.activities.InstanceProfileActivity">
<RelativeLayout
android:layout_width="match_parent"
@ -21,6 +22,9 @@
android:scaleType="centerCrop" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/instance_container"
android:layout_width="match_parent"
@ -144,6 +148,8 @@
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/loader"