diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/support/QuickSearchBarActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/support/QuickSearchBarActivity.java
index 54342d546..723d5cfe2 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/activity/support/QuickSearchBarActivity.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/activity/support/QuickSearchBarActivity.java
@@ -417,6 +417,10 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On
return ITEM_VIEW_TYPE;
}
+ public ParcelableUser getUser() {
+ return mUser;
+ }
+
@Override
public void onItemClick(QuickSearchBarActivity activity, int position) {
Utils.openUserProfile(activity, mUser, null);
@@ -440,12 +444,53 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On
final String nick = getUserNickname(context, user.id);
text1.setText(TextUtils.isEmpty(nick) ? user.name : adapter.isNicknameOnly() ? nick :
context.getString(R.string.name_with_nickname, user.name, nick));
+ text2.setVisibility(View.VISIBLE);
text2.setText("@" + user.screen_name);
+ icon.clearColorFilter();
loader.displayProfileImage(icon, user.profile_image_url);
-
}
}
+ static class UserScreenNameItem extends BaseClickableItem {
+
+ static final int ITEM_VIEW_TYPE = 3;
+ private final String mScreenName;
+ private final long mAccountId;
+
+ public UserScreenNameItem(String screenName, long accountId) {
+ mScreenName = screenName;
+ mAccountId = accountId;
+ }
+
+ @Override
+ public int getItemViewType() {
+ return ITEM_VIEW_TYPE;
+ }
+
+ @Override
+ public void onItemClick(QuickSearchBarActivity activity, int position) {
+ Utils.openUserProfile(activity, mAccountId, -1, mScreenName, null);
+ activity.finish();
+ }
+
+ @Override
+ public final int getItemLayoutResource() {
+ return R.layout.list_item_suggestion_user;
+ }
+
+ @Override
+ public void bindView(SuggestionsAdapter adapter, View view, int position) {
+ final ImageLoaderWrapper loader = adapter.getImageLoader();
+ final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
+ final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
+ final TextView text2 = (TextView) view.findViewById(android.R.id.text2);
+ text1.setText('@' + mScreenName);
+ text2.setVisibility(View.GONE);
+ icon.setColorFilter(text1.getCurrentTextColor(), Mode.SRC_ATOP);
+ loader.cancelDisplayTask(icon);
+ icon.setImageResource(R.drawable.ic_action_user);
+ }
+ }
public static class SuggestionsAdapter extends BaseAdapter {
@@ -581,9 +626,19 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On
CachedUsers.COLUMNS, selection != null ? selection.getSQL() : null,
selectionArgs, orderBy.getSQL());
final CachedIndices usersIndices = new CachedIndices(usersCursor);
+ final int screenNamePos = result.size();
+ boolean hasName = false;
for (int i = 0, j = Math.min(5, usersCursor.getCount()); i < j; i++) {
usersCursor.moveToPosition(i);
- result.add(new UserSuggestionItem(usersCursor, usersIndices, mAccountId));
+ final UserSuggestionItem userSuggestionItem = new UserSuggestionItem(usersCursor, usersIndices, mAccountId);
+ final ParcelableUser user = userSuggestionItem.getUser();
+ result.add(userSuggestionItem);
+ if (user.screen_name.equalsIgnoreCase(mQuery)) {
+ hasName = true;
+ }
+ }
+ if (!hasName) {
+ result.add(screenNamePos, new UserScreenNameItem(mQuery, mAccountId));
}
usersCursor.close();
} else {
diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java
index 0a96f3516..40fffe64f 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/UserFragment.java
@@ -338,6 +338,13 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
mPagesErrorContainer.setVisibility(View.VISIBLE);
final String displayName = UserColorNameUtils.getDisplayName(getActivity(), user);
mPagesErrorText.setText(getString(R.string.blocked_by_user_summary, displayName));
+ mPagesErrorIcon.setImageResource(R.drawable.ic_info_error_generic);
+ mPagesContent.setVisibility(View.GONE);
+ } else if (!relationship.isSourceFollowingTarget()) {
+ mPagesErrorContainer.setVisibility(View.VISIBLE);
+ final String displayName = UserColorNameUtils.getDisplayName(getActivity(), user);
+ mPagesErrorText.setText(getString(R.string.user_protected_summary, displayName));
+ mPagesErrorIcon.setImageResource(R.drawable.ic_info_locked);
mPagesContent.setVisibility(View.GONE);
} else {
mPagesErrorContainer.setVisibility(View.GONE);
@@ -1147,6 +1154,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
mUuckyFooter = headerView.findViewById(R.id.uucky_footer);
mPagesContent = view.findViewById(R.id.pages_content);
mPagesErrorContainer = view.findViewById(R.id.pages_error_container);
+ mPagesErrorIcon = (ImageView) view.findViewById(R.id.pages_error_icon);
mPagesErrorText = (TextView) view.findViewById(R.id.pages_error_text);
}
diff --git a/twidere/src/main/res/drawable-hdpi/ic_info_locked.png b/twidere/src/main/res/drawable-hdpi/ic_info_locked.png
new file mode 100755
index 000000000..284da296c
Binary files /dev/null and b/twidere/src/main/res/drawable-hdpi/ic_info_locked.png differ
diff --git a/twidere/src/main/res/drawable-mdpi/ic_info_locked.png b/twidere/src/main/res/drawable-mdpi/ic_info_locked.png
new file mode 100755
index 000000000..e937bf890
Binary files /dev/null and b/twidere/src/main/res/drawable-mdpi/ic_info_locked.png differ
diff --git a/twidere/src/main/res/drawable-xhdpi/ic_info_locked.png b/twidere/src/main/res/drawable-xhdpi/ic_info_locked.png
new file mode 100755
index 000000000..2ddac15e2
Binary files /dev/null and b/twidere/src/main/res/drawable-xhdpi/ic_info_locked.png differ
diff --git a/twidere/src/main/res/drawable-xxhdpi/ic_info_locked.png b/twidere/src/main/res/drawable-xxhdpi/ic_info_locked.png
new file mode 100755
index 000000000..d9480ae98
Binary files /dev/null and b/twidere/src/main/res/drawable-xxhdpi/ic_info_locked.png differ
diff --git a/twidere/src/main/res/layout/fragment_content_pages.xml b/twidere/src/main/res/layout/fragment_content_pages.xml
index a23cb1049..bd0f4f052 100644
--- a/twidere/src/main/res/layout/fragment_content_pages.xml
+++ b/twidere/src/main/res/layout/fragment_content_pages.xml
@@ -58,6 +58,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
+ android:padding="@dimen/element_spacing_large"
android:orientation="vertical"
android:visibility="gone">
diff --git a/twidere/src/main/res/values/strings.xml b/twidere/src/main/res/values/strings.xml
index 37f9a61a0..531a76c3f 100644
--- a/twidere/src/main/res/values/strings.xml
+++ b/twidere/src/main/res/values/strings.xml
@@ -732,5 +732,6 @@
Import/Export settings
Twidere took part in some research project, join these projects will make Twidere and some other application better.
No tab
+ You need to send follow request to this protected user to see tweets
\ No newline at end of file