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 <ImageView
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:alpha="0.2"
android:contentDescription="@string/logo_of_the_instance"
<ImageView android:scaleType="centerCrop" />
android:id="@+id/back_ground_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/logo_of_the_instance"
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 <TextView
android:id="@+id/user_count_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_width="match_parent" 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_height="wrap_content"
android:orientation="horizontal"> android:layout_marginTop="20dp"
<LinearLayout android:text="@string/status_count"
android:layout_width="0dp" android:textAlignment="center"
android:layout_weight="1" app:layout_constraintEnd_toStartOf="@id/instance_count_label"
android:layout_height="wrap_content" app:layout_constraintStart_toEndOf="@id/user_count_label"
android:orientation="vertical"> app:layout_constraintTop_toBottomOf="@id/description" />
<TextView
android:layout_width="match_parent" <TextView
android:layout_height="wrap_content" android:id="@+id/instance_count_label"
android:text="@string/user_count"/> android:layout_width="0dp"
<TextView
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_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/status_count"/>
<TextView
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_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/instance_count"/>
<TextView
android:id="@+id/instance_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:layout_marginTop="20dp"
android:gravity="end"> android:text="@string/instance_count"
<TextView android:textAlignment="center"
android:layout_width="wrap_content" app:layout_constraintEnd_toEndOf="parent"
android:layout_height="wrap_content" app:layout_constraintStart_toEndOf="@id/status_count_label"
android:textStyle="italic" app:layout_constraintTop_toBottomOf="@id/description" />
android:textSize="12sp"
android:id="@+id/software"/> <TextView
<TextView android:id="@+id/user_count"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textStyle="italic" android:textAlignment="center"
android:textSize="12sp" app:layout_constraintEnd_toEndOf="@id/user_count_label"
android:id="@+id/version"/> app:layout_constraintStart_toStartOf="@id/user_count_label"
</LinearLayout> app:layout_constraintTop_toBottomOf="@id/user_count_label" />
<TextView
android:id="@+id/status_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="@id/status_count_label"
app:layout_constraintStart_toStartOf="@id/status_count_label"
app:layout_constraintTop_toBottomOf="@id/status_count_label" />
<TextView
android:id="@+id/instance_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="@id/instance_count_label"
app:layout_constraintStart_toStartOf="@id/instance_count_label"
app:layout_constraintTop_toBottomOf="@id/instance_count_label" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_counters_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="user_count,status_count,instance_count" />
<TextView
android:id="@+id/software"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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 <androidx.recyclerview.widget.RecyclerView
android:layout_marginTop="20dp"
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>
<ProgressBar
<RelativeLayout
android:id="@+id/loader" android:id="@+id/loader"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_gravity="center" android:indeterminate="true"
android:gravity="center"> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ProgressBar </androidx.constraintlayout.widget.ConstraintLayout>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
</RelativeLayout>
</RelativeLayout>