mirror of https://github.com/tuskyapp/Tusky.git
59 changed files with 548 additions and 652 deletions
@ -1,80 +0,0 @@
|
||||
/* Copyright 2017 Andrew Dawson |
||||
* |
||||
* This file is a part of Tusky. |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the |
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the |
||||
* License, or (at your option) any later version. |
||||
* |
||||
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
||||
* Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License along with Tusky; if not, |
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
package com.keylesspalace.tusky.adapter; |
||||
|
||||
import android.graphics.drawable.Drawable; |
||||
import android.support.v7.content.res.AppCompatResources; |
||||
import android.support.v7.widget.RecyclerView; |
||||
import android.view.View; |
||||
import android.widget.ProgressBar; |
||||
import android.widget.TextView; |
||||
import android.support.v7.widget.RecyclerView.LayoutParams; |
||||
|
||||
import com.keylesspalace.tusky.R; |
||||
|
||||
public class FooterViewHolder extends RecyclerView.ViewHolder { |
||||
public enum State { |
||||
EMPTY, |
||||
END, |
||||
LOADING |
||||
} |
||||
|
||||
private View container; |
||||
private ProgressBar progressBar; |
||||
private TextView endMessage; |
||||
|
||||
FooterViewHolder(View itemView) { |
||||
super(itemView); |
||||
container = itemView.findViewById(R.id.footer_container); |
||||
progressBar = itemView.findViewById(R.id.footer_progress_bar); |
||||
endMessage = itemView.findViewById(R.id.footer_end_message); |
||||
Drawable top = AppCompatResources.getDrawable(itemView.getContext(), |
||||
R.drawable.elephant_friend_empty); |
||||
endMessage.setCompoundDrawablesWithIntrinsicBounds(null, top, null, null); |
||||
} |
||||
|
||||
public void setState(State state) { |
||||
switch (state) { |
||||
case LOADING: { |
||||
RecyclerView.LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, |
||||
LayoutParams.MATCH_PARENT); |
||||
container.setLayoutParams(layoutParams); |
||||
container.setVisibility(View.VISIBLE); |
||||
progressBar.setVisibility(View.VISIBLE); |
||||
endMessage.setVisibility(View.GONE); |
||||
break; |
||||
} |
||||
case END: { |
||||
RecyclerView.LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, |
||||
LayoutParams.WRAP_CONTENT); |
||||
container.setLayoutParams(layoutParams); |
||||
container.setVisibility(View.GONE); |
||||
progressBar.setVisibility(View.GONE); |
||||
endMessage.setVisibility(View.GONE); |
||||
break; |
||||
} |
||||
case EMPTY: { |
||||
RecyclerView.LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, |
||||
LayoutParams.MATCH_PARENT); |
||||
container.setLayoutParams(layoutParams); |
||||
container.setVisibility(View.VISIBLE); |
||||
progressBar.setVisibility(View.GONE); |
||||
endMessage.setVisibility(View.VISIBLE); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,21 @@
|
||||
/* Copyright 2018 Conny Duck |
||||
* |
||||
* This file is a part of Tusky. |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the |
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the |
||||
* License, or (at your option) any later version. |
||||
* |
||||
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
||||
* Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License along with Tusky; if not, |
||||
* see <http://www.gnu.org/licenses>. */ |
||||
|
||||
package com.keylesspalace.tusky.adapter |
||||
|
||||
import android.support.v7.widget.RecyclerView |
||||
import android.view.View |
||||
|
||||
class LoadingFooterViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) |
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:shape="rectangle"> |
||||
<solid android:color="@color/tab_page_margin_black" /> |
||||
</shape> |
||||
@ -1,24 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:id="@+id/footer_container" |
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
android:layout_height="72dp"> |
||||
|
||||
<ProgressBar |
||||
android:id="@+id/footer_progress_bar" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerInParent="true" |
||||
android:layout_gravity="center" |
||||
android:indeterminate="true" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/footer_end_message" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerInParent="true" |
||||
android:drawablePadding="32dp" |
||||
android:text="@string/footer_empty" |
||||
android:textAlignment="center" |
||||
android:textSize="?attr/status_text_medium" /> |
||||
|
||||
</RelativeLayout> |
||||
</FrameLayout> |
||||
Loading…
Reference in new issue