forked from upstream-mirrors/quik
Merge pull request #254 from qklabs/empty-state
Empty state for conversation list
This commit is contained in:
+3
-1
@@ -18,4 +18,6 @@ android:
|
||||
- extra-google-m2repository
|
||||
- extra-android-m2repository
|
||||
|
||||
script: "./gradlew build"
|
||||
script:
|
||||
- ./gradlew clean
|
||||
- ./gradlew build
|
||||
|
||||
+22
-4
@@ -20,6 +20,8 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.melnykov.fab.FloatingActionButton;
|
||||
import com.moez.QKSMS.R;
|
||||
import com.moez.QKSMS.common.BlockedConversationHelper;
|
||||
@@ -60,6 +62,8 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
private final int MENU_BLOCK_CONVERSATION = 9;
|
||||
private final int MENU_UNBLOCK_CONVERSATION = 10;
|
||||
|
||||
private View mEmptyState;
|
||||
private ImageView mEmptyStateIcon;
|
||||
private RecyclerView mRecyclerView;
|
||||
private FloatingActionButton mFab;
|
||||
private ConversationListAdapter mAdapter;
|
||||
@@ -69,6 +73,8 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
private MenuItem mBlockedItem;
|
||||
private boolean mShowBlocked = false;
|
||||
|
||||
private boolean mViewHasLoaded = false;
|
||||
|
||||
// This does not hold the current position of the list, rather the position the list is pending being set to
|
||||
private int mPosition;
|
||||
|
||||
@@ -93,6 +99,10 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_conversations, null);
|
||||
|
||||
mEmptyState = view.findViewById(R.id.empty_state);
|
||||
mEmptyStateIcon = (ImageView) view.findViewById(R.id.empty_state_icon);
|
||||
mEmptyStateIcon.setColorFilter(ThemeManager.getTextOnBackgroundPrimary());
|
||||
|
||||
mRecyclerView = (RecyclerView) view.findViewById(R.id.conversations_list);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
@@ -117,6 +127,8 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
}
|
||||
});
|
||||
|
||||
mViewHasLoaded = true;
|
||||
|
||||
initLoaderManager();
|
||||
|
||||
return view;
|
||||
@@ -337,6 +349,8 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
mPosition = 0;
|
||||
}
|
||||
}
|
||||
|
||||
mEmptyState.setVisibility(data != null && data.getCount() > 0 ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
public void onLoaderReset(Loader<Cursor> loader) {
|
||||
@@ -347,12 +361,16 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
if (mFab != null) {
|
||||
mFab.setColorNormal(ThemeManager.getColor());
|
||||
mFab.setColorPressed(ColorUtils.lighten(ThemeManager.getColor()));
|
||||
mFab.getDrawable().setColorFilter(new PorterDuffColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.MULTIPLY));
|
||||
if (!mViewHasLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
mFab.setColorNormal(ThemeManager.getColor());
|
||||
mFab.setColorPressed(ColorUtils.lighten(ThemeManager.getColor()));
|
||||
mFab.getDrawable().setColorFilter(new PorterDuffColorFilter(ThemeManager.getTextOnColorPrimary(), PorterDuff.Mode.MULTIPLY));
|
||||
|
||||
mEmptyStateIcon.setColorFilter(ThemeManager.getTextOnBackgroundPrimary());
|
||||
|
||||
//TODO ListviewHelper.applyCustomScrollbar(mContext, mListView);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="120dp"
|
||||
android:height="120dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M20,2H4c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zM6,9h12v2H6V9zm8,5H6v-2h8v2zm4,-6H6V6h12v2z" />
|
||||
</vector>
|
||||
@@ -1,9 +1,35 @@
|
||||
<RelativeLayout
|
||||
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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/empty_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:alpha="0.5"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="32dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/empty_state_icon"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:src="@drawable/ic_chat" />
|
||||
|
||||
<com.moez.QKSMS.ui.view.QKTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/hint_no_messages"
|
||||
app:type="dialog_title" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/conversations_list"
|
||||
android:layout_width="match_parent"
|
||||
@@ -19,8 +45,8 @@
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_add" />
|
||||
|
||||
|
||||
@@ -731,6 +731,7 @@
|
||||
<string name="date_yesterday">Yesterday</string>
|
||||
<string name="date_just_now">Just now</string>
|
||||
<string name="compose_loading_attachment">Loading attachment</string>
|
||||
<string name="hint_no_messages">No messages yet.\nClick the + to send one!</string>
|
||||
|
||||
<string-array name="resend_menu">
|
||||
<item>Resend</item>
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.3.1'
|
||||
classpath 'com.android.tools.build:gradle:1.4.0-beta3'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user