change instance info layout

This commit is contained in:
Kasun 2019-11-16 19:06:08 +05:30
parent 7bef69a72c
commit 5a8d458592
2 changed files with 147 additions and 117 deletions

View File

@ -26,10 +26,10 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
@ -59,9 +59,9 @@ public class InstanceProfileActivity extends BaseActivity {
private TextView name, description, userCount, statusCount, instanceCount, software, version; private TextView name, description, userCount, statusCount, instanceCount, software, version;
private String instance; private String instance;
private RecyclerView lv_accounts; private RecyclerView lv_accounts;
private LinearLayout instance_container; private ConstraintLayout instance_container;
private ImageView back_ground_image; private ImageView back_ground_image;
private RelativeLayout loader; private ProgressBar loader;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {

View File

@ -1,141 +1,171 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container" android:id="@+id/container"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="450dp" android:layout_height="450dp"
android:layout_margin="@dimen/fab_margin" android:layout_margin="@dimen/fab_margin"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context="app.fedilab.android.activities.InstanceProfileActivity"> tools:context="app.fedilab.android.activities.InstanceProfileActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2">
<ImageView <ImageView
android:id="@+id/back_ground_image" android:id="@+id/back_ground_image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:alpha="0.2"
android:contentDescription="@string/logo_of_the_instance" android:contentDescription="@string/logo_of_the_instance"
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />
</RelativeLayout>
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="match_parent">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/instance_container" android:id="@+id/instance_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/fab_margin" android:layout_marginStart="@dimen/fab_margin"
android:layout_marginEnd="@dimen/fab_margin" android:layout_marginEnd="@dimen/fab_margin"
android:orientation="vertical" android:visibility="gone">
android:visibility="gone"
>
<TextView <TextView
android:background="@drawable/blue_border"
android:id="@+id/name" android:id="@+id/name"
android:textColor="@color/mastodonC4"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center"
android:layout_margin="10dp" android:layout_margin="10dp"
android:textSize="20sp" /> android:background="@drawable/blue_border"
android:gravity="center"
android:textColor="@color/mastodonC4"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:layout_margin="5dp"
android:id="@+id/description" android:id="@+id/description"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:autoLink="web" android:autoLink="web"
android:gravity="center" android:gravity="center"
android:textSize="14sp" /> android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/name" />
<LinearLayout
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView <TextView
android:layout_width="match_parent" android:id="@+id/user_count_label"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/user_count"/> android:layout_marginTop="20dp"
android:text="@string/user_count"
android:textAlignment="center"
app:layout_constraintEnd_toStartOf="@id/status_count_label"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/description" />
<TextView
android:id="@+id/status_count_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/status_count"
android:textAlignment="center"
app:layout_constraintEnd_toStartOf="@id/instance_count_label"
app:layout_constraintStart_toEndOf="@id/user_count_label"
app:layout_constraintTop_toBottomOf="@id/description" />
<TextView
android:id="@+id/instance_count_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/instance_count"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/status_count_label"
app:layout_constraintTop_toBottomOf="@id/description" />
<TextView <TextView
android:id="@+id/user_count" android:id="@+id/user_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:textAlignment="center"
<TextView app:layout_constraintEnd_toEndOf="@id/user_count_label"
android:layout_width="match_parent" app:layout_constraintStart_toStartOf="@id/user_count_label"
android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@id/user_count_label" />
android:text="@string/status_count"/>
<TextView <TextView
android:id="@+id/status_count" android:id="@+id/status_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:textAlignment="center"
<TextView app:layout_constraintEnd_toEndOf="@id/status_count_label"
android:layout_width="match_parent" app:layout_constraintStart_toStartOf="@id/status_count_label"
android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@id/status_count_label" />
android:text="@string/instance_count"/>
<TextView <TextView
android:id="@+id/instance_count" android:id="@+id/instance_count"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:textAlignment="center"
/> app:layout_constraintEnd_toEndOf="@id/instance_count_label"
</LinearLayout> app:layout_constraintStart_toStartOf="@id/instance_count_label"
</LinearLayout> app:layout_constraintTop_toBottomOf="@id/instance_count_label" />
<LinearLayout
android:layout_width="match_parent" <androidx.constraintlayout.widget.Barrier
android:layout_marginTop="10dp" android:id="@+id/barrier_counters_bottom"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="end">
<TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textStyle="italic" app:barrierDirection="bottom"
android:textSize="12sp" app:constraint_referenced_ids="user_count,status_count,instance_count" />
android:id="@+id/software"/>
<TextView <TextView
android:id="@+id/software"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textStyle="italic"
android:textSize="12sp"
android:id="@+id/version"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:textSize="12sp"
android:textStyle="italic"
app:layout_constraintEnd_toStartOf="@id/version"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/barrier_counters_bottom" />
<TextView
android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textSize="12sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/software"
app:layout_constraintTop_toBottomOf="@id/barrier_counters_bottom" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_software_version_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="software,version" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/lv_accounts" android:id="@+id/lv_accounts"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="5dp"
android:divider="@null" android:divider="@null"
android:scrollbars="none" /> android:scrollbars="none"
app:layout_constraintTop_toBottomOf="@id/barrier_software_version_bottom" />
<Button <Button
android:id="@+id/close" android:id="@+id/close"
style="@style/Base.Widget.AppCompat.Button.Colored" style="@style/Base.Widget.AppCompat.Button.Colored"
@ -146,23 +176,23 @@
android:text="@string/close" android:text="@string/close"
android:textAllCaps="false" android:textAllCaps="false"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" /> android:textSize="16sp"
</LinearLayout> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/lv_accounts" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>
<RelativeLayout
android:id="@+id/loader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center">
<ProgressBar <ProgressBar
android:id="@+id/loader"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" /> android:indeterminate="true"
</RelativeLayout> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>