iammert / StatusView

Custom status view for Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Layout not working

bhupalreddykokkanti opened this issue · comments

Hi, I am trying to add my own layout. I followed the steps you provide but not working

Can you please provide your custom layout and StatusView implementation? @bhupalreddykokkanti

Custom Layout I have to implement while clicking Loader

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Loading"
    android:textSize="20sp"
    android:gravity="center"/>

Main Activity

@OverRide
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

    statusView = (StatusView) findViewById(R.id.status);
    complete = (Button) findViewById(R.id.complete);
    error = (Button) findViewById(R.id.error);
    loading = (Button) findViewById(R.id.loading);
    idle = (Button) findViewById(R.id.idle);

    statusView.setStatus(Status.LOADING);


    complete.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            statusView.setStatus(Status.COMPLETE);
        }
    });

    error.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            statusView.setStatus(Status.ERROR);
        }
    });

    loading.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            statusView.setStatus(Status.LOADING);
        }
    });

    idle.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            statusView.setStatus(Status.IDLE);
        }
    });

}

activity_main.xml

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="8dp"
    android:text="NABER YAAAA"/>

<iammert.com.library.StatusView
    android:id="@+id/status"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    app:dismissOnComplete="true"
    app:loading="@layout/loading"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_alignParentBottom="true"
    android:gravity="center">


    <Button
        android:id="@+id/complete"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="complete" />

    <Button
        android:id="@+id/error"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="error" />

    <Button
        android:id="@+id/loading"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="loading" />

    <Button
        android:id="@+id/idle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="idle" />

</LinearLayout>

If you want to use your own layouts for statuses, you need to customize three of them. It looks like you only want to change loading view. This is not supported yet. @bhupalreddykokkanti

Hey @bhupalreddykokkanti,
I just fixed that. You can use version 1.3. I updated readme file.