fixed icon color on tab editor dialog
moved reply count to left of retweets count fixed drag handle in account manager try to fix wrong profile image/preview media changed some text adjusting profile image size fixed account popup style on compose dialog trying to fix api version suffix
This commit is contained in:
parent
e5d2e3861d
commit
b52ee59b76
|
@ -28,7 +28,7 @@ package org.mariotaku.twidere;
|
|||
public interface Constants extends TwidereConstants {
|
||||
|
||||
public static final String DATABASES_NAME = "twidere.sqlite";
|
||||
public static final int DATABASES_VERSION = 69;
|
||||
public static final int DATABASES_VERSION = 70;
|
||||
|
||||
public static final int MENU_GROUP_STATUS_EXTENSION = 10;
|
||||
public static final int MENU_GROUP_COMPOSE_EXTENSION = 11;
|
||||
|
|
|
@ -583,7 +583,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
mMenuBar.setOnMenuItemClickListener(this);
|
||||
mEditText.setOnEditorActionListener(mPreferences.getBoolean(KEY_QUICK_SEND, false) ? this : null);
|
||||
mEditText.addTextChangedListener(this);
|
||||
final AccountSelectorAdapter accountAdapter = new AccountSelectorAdapter(this);
|
||||
final AccountSelectorAdapter accountAdapter = new AccountSelectorAdapter(mMenuBar.getPopupContext());
|
||||
accountAdapter.addAll(Account.getAccountsList(this, false));
|
||||
mAccountSelectorPopup = IListPopupWindow.InstanceHelper.getInstance(mMenuBar.getPopupContext());
|
||||
mAccountSelectorPopup.setInputMethodMode(IListPopupWindow.INPUT_METHOD_NOT_NEEDED);
|
||||
|
|
|
@ -19,12 +19,6 @@
|
|||
|
||||
package org.mariotaku.twidere.activity.support;
|
||||
|
||||
import static org.mariotaku.twidere.util.CustomTabUtils.findTabIconKey;
|
||||
import static org.mariotaku.twidere.util.CustomTabUtils.getIconMap;
|
||||
import static org.mariotaku.twidere.util.CustomTabUtils.getTabConfiguration;
|
||||
import static org.mariotaku.twidere.util.CustomTabUtils.getTabTypeName;
|
||||
import static org.mariotaku.twidere.util.UserColorNicknameUtils.getUserNickname;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
@ -32,6 +26,7 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.text.TextUtils;
|
||||
|
@ -61,7 +56,6 @@ import org.mariotaku.twidere.model.ParcelableUserList;
|
|||
import org.mariotaku.twidere.util.ImageLoaderWrapper;
|
||||
import org.mariotaku.twidere.util.ParseUtils;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.accessor.ViewAccessor;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.Comparator;
|
||||
|
@ -69,472 +63,483 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static org.mariotaku.twidere.util.CustomTabUtils.findTabIconKey;
|
||||
import static org.mariotaku.twidere.util.CustomTabUtils.getIconMap;
|
||||
import static org.mariotaku.twidere.util.CustomTabUtils.getTabConfiguration;
|
||||
import static org.mariotaku.twidere.util.CustomTabUtils.getTabTypeName;
|
||||
import static org.mariotaku.twidere.util.UserColorNicknameUtils.getUserNickname;
|
||||
|
||||
public class CustomTabEditorActivity extends BaseSupportDialogActivity implements OnClickListener {
|
||||
|
||||
private ImageLoaderWrapper mImageLoader;
|
||||
private SharedPreferences mPreferences;
|
||||
private ImageLoaderWrapper mImageLoader;
|
||||
private SharedPreferences mPreferences;
|
||||
|
||||
private AccountsSpinnerAdapter mAccountsAdapter;
|
||||
private CustomTabIconsAdapter mTabIconsAdapter;
|
||||
private AccountsSpinnerAdapter mAccountsAdapter;
|
||||
private CustomTabIconsAdapter mTabIconsAdapter;
|
||||
|
||||
private View mAccountContainer, mSecondaryFieldContainer, mExtraConfigurationsContainer;
|
||||
private Spinner mTabIconSpinner, mAccountSpinner;
|
||||
private EditText mEditTabName;
|
||||
private TextView mSecondaryFieldLabel;
|
||||
private TextView mTabTypeName;
|
||||
private LinearLayout mExtraConfigurationsContent;
|
||||
private View mAccountContainer, mSecondaryFieldContainer, mExtraConfigurationsContainer;
|
||||
private Spinner mTabIconSpinner, mAccountSpinner;
|
||||
private EditText mEditTabName;
|
||||
private TextView mSecondaryFieldLabel;
|
||||
private TextView mTabTypeName;
|
||||
private LinearLayout mExtraConfigurationsContent;
|
||||
|
||||
private long mTabId;
|
||||
private String mTabType;
|
||||
private CustomTabConfiguration mTabConfiguration;
|
||||
private Object mSecondaryFieldValue;
|
||||
private final Bundle mExtrasBundle = new Bundle();
|
||||
private long mTabId;
|
||||
private String mTabType;
|
||||
private CustomTabConfiguration mTabConfiguration;
|
||||
private Object mSecondaryFieldValue;
|
||||
private final Bundle mExtrasBundle = new Bundle();
|
||||
|
||||
private final View.OnClickListener mOnExtraConfigurationClickListener = new View.OnClickListener() {
|
||||
private final View.OnClickListener mOnExtraConfigurationClickListener = new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
final Object tag = v.getTag();
|
||||
if (tag instanceof ExtraConfiguration) {
|
||||
final ExtraConfiguration conf = (ExtraConfiguration) tag;
|
||||
switch (conf.getType()) {
|
||||
case BOOLEAN: {
|
||||
final CheckBox checkBox = (CheckBox) v.findViewById(android.R.id.checkbox);
|
||||
checkBox.toggle();
|
||||
mExtrasBundle.putBoolean(conf.getKey(), checkBox.isChecked());
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
final Object tag = v.getTag();
|
||||
if (tag instanceof ExtraConfiguration) {
|
||||
final ExtraConfiguration conf = (ExtraConfiguration) tag;
|
||||
switch (conf.getType()) {
|
||||
case BOOLEAN: {
|
||||
final CheckBox checkBox = (CheckBox) v.findViewById(android.R.id.checkbox);
|
||||
checkBox.toggle();
|
||||
mExtrasBundle.putBoolean(conf.getKey(), checkBox.isChecked());
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
final CustomTabConfiguration conf = mTabConfiguration;
|
||||
final Object value = mSecondaryFieldValue;
|
||||
switch (v.getId()) {
|
||||
case R.id.secondary_field: {
|
||||
if (conf == null) return;
|
||||
switch (conf.getSecondaryFieldType()) {
|
||||
case CustomTabConfiguration.FIELD_TYPE_USER: {
|
||||
final Intent intent = new Intent(this, UserListSelectorActivity.class);
|
||||
intent.setAction(INTENT_ACTION_SELECT_USER);
|
||||
intent.putExtra(EXTRA_ACCOUNT_ID, getAccountId());
|
||||
startActivityForResult(intent, REQUEST_SELECT_USER);
|
||||
break;
|
||||
}
|
||||
case CustomTabConfiguration.FIELD_TYPE_USER_LIST: {
|
||||
final Intent intent = new Intent(this, UserListSelectorActivity.class);
|
||||
intent.setAction(INTENT_ACTION_SELECT_USER_LIST);
|
||||
intent.putExtra(EXTRA_ACCOUNT_ID, getAccountId());
|
||||
startActivityForResult(intent, REQUEST_SELECT_USER_LIST);
|
||||
break;
|
||||
}
|
||||
case CustomTabConfiguration.FIELD_TYPE_TEXT: {
|
||||
final int title = conf.getSecondaryFieldTitle();
|
||||
SecondaryFieldEditTextDialogFragment.show(this, ParseUtils.parseString(value),
|
||||
getString(title > 0 ? title : R.string.content));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case R.id.save: {
|
||||
if (!isEditMode()) {
|
||||
if (conf == null) return;
|
||||
final boolean account_id_required = conf.getAccountRequirement() == CustomTabConfiguration.ACCOUNT_REQUIRED;
|
||||
final boolean no_account_id = conf.getAccountRequirement() == CustomTabConfiguration.ACCOUNT_NONE;
|
||||
final boolean secondaryFieldRequired = conf.getSecondaryFieldType() != CustomTabConfiguration.FIELD_TYPE_NONE;
|
||||
final boolean account_id_invalid = getAccountId() <= 0;
|
||||
final boolean secondary_field_invalid = mSecondaryFieldValue == null;
|
||||
if (account_id_required && account_id_invalid || secondaryFieldRequired && secondary_field_invalid) {
|
||||
Toast.makeText(this, R.string.invalid_settings, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
final Intent data = new Intent();
|
||||
final Bundle args = new Bundle();
|
||||
if (!no_account_id) {
|
||||
args.putLong(EXTRA_ACCOUNT_ID, getAccountId());
|
||||
}
|
||||
if (secondaryFieldRequired) {
|
||||
addSecondaryFieldValueToArguments(args);
|
||||
}
|
||||
data.putExtra(EXTRA_TYPE, mTabType);
|
||||
data.putExtra(EXTRA_NAME, ParseUtils.parseString(mEditTabName.getText()));
|
||||
data.putExtra(EXTRA_ICON, getIconKey());
|
||||
data.putExtra(EXTRA_ARGUMENTS, ParseUtils.bundleToJSON(args));
|
||||
data.putExtra(EXTRA_EXTRAS, ParseUtils.bundleToJSON(mExtrasBundle));
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
} else {
|
||||
if (mTabId < 0) return;
|
||||
final Intent data = new Intent();
|
||||
data.putExtra(EXTRA_NAME, ParseUtils.parseString(mEditTabName.getText()));
|
||||
data.putExtra(EXTRA_ICON, getIconKey());
|
||||
data.putExtra(EXTRA_ID, mTabId);
|
||||
data.putExtra(EXTRA_EXTRAS, ParseUtils.bundleToJSON(mExtrasBundle));
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
final CustomTabConfiguration conf = mTabConfiguration;
|
||||
final Object value = mSecondaryFieldValue;
|
||||
switch (v.getId()) {
|
||||
case R.id.secondary_field: {
|
||||
if (conf == null) return;
|
||||
switch (conf.getSecondaryFieldType()) {
|
||||
case CustomTabConfiguration.FIELD_TYPE_USER: {
|
||||
final Intent intent = new Intent(this, UserListSelectorActivity.class);
|
||||
intent.setAction(INTENT_ACTION_SELECT_USER);
|
||||
intent.putExtra(EXTRA_ACCOUNT_ID, getAccountId());
|
||||
startActivityForResult(intent, REQUEST_SELECT_USER);
|
||||
break;
|
||||
}
|
||||
case CustomTabConfiguration.FIELD_TYPE_USER_LIST: {
|
||||
final Intent intent = new Intent(this, UserListSelectorActivity.class);
|
||||
intent.setAction(INTENT_ACTION_SELECT_USER_LIST);
|
||||
intent.putExtra(EXTRA_ACCOUNT_ID, getAccountId());
|
||||
startActivityForResult(intent, REQUEST_SELECT_USER_LIST);
|
||||
break;
|
||||
}
|
||||
case CustomTabConfiguration.FIELD_TYPE_TEXT: {
|
||||
final int title = conf.getSecondaryFieldTitle();
|
||||
SecondaryFieldEditTextDialogFragment.show(this, ParseUtils.parseString(value),
|
||||
getString(title > 0 ? title : R.string.content));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case R.id.save: {
|
||||
if (!isEditMode()) {
|
||||
if (conf == null) return;
|
||||
final boolean account_id_required = conf.getAccountRequirement() == CustomTabConfiguration.ACCOUNT_REQUIRED;
|
||||
final boolean no_account_id = conf.getAccountRequirement() == CustomTabConfiguration.ACCOUNT_NONE;
|
||||
final boolean secondaryFieldRequired = conf.getSecondaryFieldType() != CustomTabConfiguration.FIELD_TYPE_NONE;
|
||||
final boolean account_id_invalid = getAccountId() <= 0;
|
||||
final boolean secondary_field_invalid = mSecondaryFieldValue == null;
|
||||
if (account_id_required && account_id_invalid || secondaryFieldRequired && secondary_field_invalid) {
|
||||
Toast.makeText(this, R.string.invalid_settings, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
final Intent data = new Intent();
|
||||
final Bundle args = new Bundle();
|
||||
if (!no_account_id) {
|
||||
args.putLong(EXTRA_ACCOUNT_ID, getAccountId());
|
||||
}
|
||||
if (secondaryFieldRequired) {
|
||||
addSecondaryFieldValueToArguments(args);
|
||||
}
|
||||
data.putExtra(EXTRA_TYPE, mTabType);
|
||||
data.putExtra(EXTRA_NAME, ParseUtils.parseString(mEditTabName.getText()));
|
||||
data.putExtra(EXTRA_ICON, getIconKey());
|
||||
data.putExtra(EXTRA_ARGUMENTS, ParseUtils.bundleToJSON(args));
|
||||
data.putExtra(EXTRA_EXTRAS, ParseUtils.bundleToJSON(mExtrasBundle));
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
} else {
|
||||
if (mTabId < 0) return;
|
||||
final Intent data = new Intent();
|
||||
data.putExtra(EXTRA_NAME, ParseUtils.parseString(mEditTabName.getText()));
|
||||
data.putExtra(EXTRA_ICON, getIconKey());
|
||||
data.putExtra(EXTRA_ID, mTabId);
|
||||
data.putExtra(EXTRA_EXTRAS, ParseUtils.bundleToJSON(mExtrasBundle));
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
mAccountContainer = findViewById(R.id.account_container);
|
||||
mSecondaryFieldContainer = findViewById(R.id.secondary_field_container);
|
||||
mExtraConfigurationsContainer = findViewById(R.id.extra_configurations_container);
|
||||
mTabTypeName = (TextView) findViewById(R.id.tab_type_name);
|
||||
mEditTabName = (EditText) findViewById(R.id.tab_name);
|
||||
mSecondaryFieldLabel = (TextView) findViewById(R.id.secondary_field_label);
|
||||
mTabIconSpinner = (Spinner) findViewById(R.id.tab_icon_spinner);
|
||||
mAccountSpinner = (Spinner) findViewById(R.id.account_spinner);
|
||||
mExtraConfigurationsContent = (LinearLayout) findViewById(R.id.extra_configurations_content);
|
||||
}
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
mAccountContainer = findViewById(R.id.account_container);
|
||||
mSecondaryFieldContainer = findViewById(R.id.secondary_field_container);
|
||||
mExtraConfigurationsContainer = findViewById(R.id.extra_configurations_container);
|
||||
mTabTypeName = (TextView) findViewById(R.id.tab_type_name);
|
||||
mEditTabName = (EditText) findViewById(R.id.tab_name);
|
||||
mSecondaryFieldLabel = (TextView) findViewById(R.id.secondary_field_label);
|
||||
mTabIconSpinner = (Spinner) findViewById(R.id.tab_icon_spinner);
|
||||
mAccountSpinner = (Spinner) findViewById(R.id.account_spinner);
|
||||
mExtraConfigurationsContent = (LinearLayout) findViewById(R.id.extra_configurations_content);
|
||||
}
|
||||
|
||||
public void setExtraFieldSelectText(final View view, final int text) {
|
||||
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
final TextView text2 = (TextView) view.findViewById(android.R.id.text2);
|
||||
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
|
||||
text1.setVisibility(View.VISIBLE);
|
||||
text2.setVisibility(View.GONE);
|
||||
icon.setVisibility(View.GONE);
|
||||
text1.setText(text);
|
||||
}
|
||||
public void setExtraFieldSelectText(final View view, final int text) {
|
||||
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
final TextView text2 = (TextView) view.findViewById(android.R.id.text2);
|
||||
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
|
||||
text1.setVisibility(View.VISIBLE);
|
||||
text2.setVisibility(View.GONE);
|
||||
icon.setVisibility(View.GONE);
|
||||
text1.setText(text);
|
||||
}
|
||||
|
||||
public void setExtraFieldView(final View view, final Object value) {
|
||||
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
final TextView text2 = (TextView) view.findViewById(android.R.id.text2);
|
||||
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
|
||||
final boolean display_profile_image = mPreferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true);
|
||||
final boolean nickname_only = mPreferences.getBoolean(KEY_NICKNAME_ONLY, false);
|
||||
final boolean display_name = mPreferences.getBoolean(KEY_NAME_FIRST, true);
|
||||
text1.setVisibility(View.VISIBLE);
|
||||
text2.setVisibility(View.VISIBLE);
|
||||
icon.setVisibility(display_profile_image ? View.VISIBLE : View.GONE);
|
||||
if (value instanceof ParcelableUser) {
|
||||
final ParcelableUser user = (ParcelableUser) value;
|
||||
final String nick = getUserNickname(this, user.id);
|
||||
text1.setText(TextUtils.isEmpty(nick) ? user.name : nickname_only ? nick : getString(
|
||||
R.string.name_with_nickname, user.name, nick));
|
||||
text2.setText("@" + user.screen_name);
|
||||
if (display_profile_image) {
|
||||
mImageLoader.displayProfileImage(icon, user.profile_image_url);
|
||||
}
|
||||
} else if (value instanceof ParcelableUserList) {
|
||||
final ParcelableUserList user_list = (ParcelableUserList) value;
|
||||
final String created_by;
|
||||
if (display_name) {
|
||||
created_by = "@" + user_list.user_screen_name;
|
||||
} else {
|
||||
final String nick = getUserNickname(this, user_list.user_id);
|
||||
created_by = TextUtils.isEmpty(nick) ? user_list.user_name : nickname_only ? nick : getString(
|
||||
R.string.name_with_nickname, user_list.user_name, nick);
|
||||
}
|
||||
text1.setText(user_list.name);
|
||||
text2.setText(getString(R.string.created_by, created_by));
|
||||
if (display_profile_image) {
|
||||
mImageLoader.displayProfileImage(icon, user_list.user_profile_image_url);
|
||||
}
|
||||
} else if (value instanceof CharSequence) {
|
||||
text2.setVisibility(View.GONE);
|
||||
icon.setVisibility(View.GONE);
|
||||
text1.setText((CharSequence) value);
|
||||
}
|
||||
}
|
||||
public void setExtraFieldView(final View view, final Object value) {
|
||||
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
final TextView text2 = (TextView) view.findViewById(android.R.id.text2);
|
||||
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
|
||||
final boolean display_profile_image = mPreferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true);
|
||||
final boolean nickname_only = mPreferences.getBoolean(KEY_NICKNAME_ONLY, false);
|
||||
final boolean display_name = mPreferences.getBoolean(KEY_NAME_FIRST, true);
|
||||
text1.setVisibility(View.VISIBLE);
|
||||
text2.setVisibility(View.VISIBLE);
|
||||
icon.setVisibility(display_profile_image ? View.VISIBLE : View.GONE);
|
||||
if (value instanceof ParcelableUser) {
|
||||
final ParcelableUser user = (ParcelableUser) value;
|
||||
final String nick = getUserNickname(this, user.id);
|
||||
text1.setText(TextUtils.isEmpty(nick) ? user.name : nickname_only ? nick : getString(
|
||||
R.string.name_with_nickname, user.name, nick));
|
||||
text2.setText("@" + user.screen_name);
|
||||
if (display_profile_image) {
|
||||
mImageLoader.displayProfileImage(icon, user.profile_image_url);
|
||||
}
|
||||
} else if (value instanceof ParcelableUserList) {
|
||||
final ParcelableUserList user_list = (ParcelableUserList) value;
|
||||
final String created_by;
|
||||
if (display_name) {
|
||||
created_by = "@" + user_list.user_screen_name;
|
||||
} else {
|
||||
final String nick = getUserNickname(this, user_list.user_id);
|
||||
created_by = TextUtils.isEmpty(nick) ? user_list.user_name : nickname_only ? nick : getString(
|
||||
R.string.name_with_nickname, user_list.user_name, nick);
|
||||
}
|
||||
text1.setText(user_list.name);
|
||||
text2.setText(getString(R.string.created_by, created_by));
|
||||
if (display_profile_image) {
|
||||
mImageLoader.displayProfileImage(icon, user_list.user_profile_image_url);
|
||||
}
|
||||
} else if (value instanceof CharSequence) {
|
||||
text2.setVisibility(View.GONE);
|
||||
icon.setVisibility(View.GONE);
|
||||
text1.setText((CharSequence) value);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSecondaryFieldValue(final Object value) {
|
||||
mSecondaryFieldValue = value;
|
||||
setExtraFieldView(mSecondaryFieldContainer, value);
|
||||
}
|
||||
public void setSecondaryFieldValue(final Object value) {
|
||||
mSecondaryFieldValue = value;
|
||||
setExtraFieldView(mSecondaryFieldContainer, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
|
||||
if (resultCode != RESULT_OK) return;
|
||||
switch (requestCode) {
|
||||
case REQUEST_SELECT_USER: {
|
||||
setSecondaryFieldValue(data.getParcelableExtra(EXTRA_USER));
|
||||
break;
|
||||
}
|
||||
case REQUEST_SELECT_USER_LIST: {
|
||||
setSecondaryFieldValue(data.getParcelableExtra(EXTRA_USER_LIST));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
|
||||
if (resultCode != RESULT_OK) return;
|
||||
switch (requestCode) {
|
||||
case REQUEST_SELECT_USER: {
|
||||
setSecondaryFieldValue(data.getParcelableExtra(EXTRA_USER));
|
||||
break;
|
||||
}
|
||||
case REQUEST_SELECT_USER_LIST: {
|
||||
setSecondaryFieldValue(data.getParcelableExtra(EXTRA_USER_LIST));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE);
|
||||
mImageLoader = TwidereApplication.getInstance(this).getImageLoaderWrapper();
|
||||
final Intent intent = getIntent();
|
||||
final String type = mTabType = intent.getStringExtra(EXTRA_TYPE);
|
||||
final CustomTabConfiguration conf = getTabConfiguration(type);
|
||||
if (type == null || conf == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
mTabId = intent.getLongExtra(EXTRA_ID, -1);
|
||||
setTitle(isEditMode() ? R.string.edit_tab : R.string.add_tab);
|
||||
setContentView(R.layout.activity_custom_tab_editor);
|
||||
mTabTypeName.setText(getTabTypeName(this, type));
|
||||
mTabIconsAdapter = new CustomTabIconsAdapter(this);
|
||||
mTabIconsAdapter.setData(getIconMap());
|
||||
mAccountsAdapter = new AccountsSpinnerAdapter(this);
|
||||
mAccountSpinner.setAdapter(mAccountsAdapter);
|
||||
mTabIconSpinner.setAdapter(mTabIconsAdapter);
|
||||
final String iconKey;
|
||||
if (savedInstanceState != null) {
|
||||
mExtrasBundle.putAll(savedInstanceState.getBundle(EXTRA_EXTRAS));
|
||||
}
|
||||
if (!isEditMode()) {
|
||||
mTabConfiguration = conf;
|
||||
final boolean has_secondary_field = conf.getSecondaryFieldType() != CustomTabConfiguration.FIELD_TYPE_NONE;
|
||||
final boolean account_id_none = conf.getAccountRequirement() == CustomTabConfiguration.ACCOUNT_NONE;
|
||||
mAccountContainer.setVisibility(account_id_none ? View.GONE : View.VISIBLE);
|
||||
mSecondaryFieldContainer.setVisibility(has_secondary_field ? View.VISIBLE : View.GONE);
|
||||
final boolean accountIdRequired = conf.getAccountRequirement() == CustomTabConfiguration.ACCOUNT_REQUIRED;
|
||||
if (!accountIdRequired) {
|
||||
mAccountsAdapter.add(Account.dummyInstance());
|
||||
}
|
||||
final boolean officialKeyOnly = intent.getBooleanExtra(EXTRA_OFFICIAL_KEY_ONLY, false);
|
||||
mAccountsAdapter.addAll(Account.getAccountsList(this, false, officialKeyOnly));
|
||||
switch (conf.getSecondaryFieldType()) {
|
||||
case CustomTabConfiguration.FIELD_TYPE_USER: {
|
||||
mSecondaryFieldLabel.setText(R.string.user);
|
||||
setExtraFieldSelectText(mSecondaryFieldContainer, R.string.select_user);
|
||||
break;
|
||||
}
|
||||
case CustomTabConfiguration.FIELD_TYPE_USER_LIST: {
|
||||
mSecondaryFieldLabel.setText(R.string.user_list);
|
||||
setExtraFieldSelectText(mSecondaryFieldContainer, R.string.select_user_list);
|
||||
break;
|
||||
}
|
||||
case CustomTabConfiguration.FIELD_TYPE_TEXT: {
|
||||
mSecondaryFieldLabel.setText(R.string.content);
|
||||
setExtraFieldSelectText(mSecondaryFieldContainer, R.string.input_text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (conf.getSecondaryFieldTitle() != 0) {
|
||||
mSecondaryFieldLabel.setText(conf.getSecondaryFieldTitle());
|
||||
}
|
||||
iconKey = findTabIconKey(conf.getDefaultIcon());
|
||||
mEditTabName.setText(mTabConfiguration.getDefaultTitle());
|
||||
} else {
|
||||
if (mTabId < 0) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
mAccountContainer.setVisibility(View.GONE);
|
||||
mSecondaryFieldContainer.setVisibility(View.GONE);
|
||||
iconKey = intent.getStringExtra(EXTRA_ICON);
|
||||
mEditTabName.setText(intent.getStringExtra(EXTRA_NAME));
|
||||
if (savedInstanceState == null && intent.hasExtra(EXTRA_EXTRAS)) {
|
||||
mExtrasBundle.putAll(ParseUtils.jsonToBundle(intent.getStringExtra(EXTRA_EXTRAS)));
|
||||
}
|
||||
}
|
||||
final int selection = mTabIconsAdapter.getIconPosition(iconKey);
|
||||
mTabIconSpinner.setSelection(selection > 0 ? selection : 0);
|
||||
final LayoutInflater inflater = getLayoutInflater();
|
||||
final ExtraConfiguration[] extraConfigurations = conf.getExtraConfigurations();
|
||||
if (extraConfigurations == null || extraConfigurations.length == 0) {
|
||||
mExtraConfigurationsContainer.setVisibility(View.GONE);
|
||||
} else {
|
||||
mExtraConfigurationsContainer.setVisibility(View.VISIBLE);
|
||||
for (final ExtraConfiguration config : extraConfigurations) {
|
||||
final boolean hasCheckBox = config.getType() == ExtraConfiguration.Type.BOOLEAN;
|
||||
final View view = inflater.inflate(R.layout.list_item_extra_config, mExtraConfigurationsContent, false);
|
||||
final TextView title = (TextView) view.findViewById(android.R.id.title);
|
||||
final CheckBox checkBox = (CheckBox) view.findViewById(android.R.id.checkbox);
|
||||
title.setText(config.getTitleRes());
|
||||
checkBox.setVisibility(hasCheckBox ? View.VISIBLE : View.GONE);
|
||||
if (hasCheckBox) {
|
||||
checkBox.setChecked(mExtrasBundle.getBoolean(config.getKey(), config.defaultBoolean()));
|
||||
}
|
||||
view.setTag(config);
|
||||
view.setOnClickListener(mOnExtraConfigurationClickListener);
|
||||
mExtraConfigurationsContent.addView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE);
|
||||
mImageLoader = TwidereApplication.getInstance(this).getImageLoaderWrapper();
|
||||
final Intent intent = getIntent();
|
||||
final String type = mTabType = intent.getStringExtra(EXTRA_TYPE);
|
||||
final CustomTabConfiguration conf = getTabConfiguration(type);
|
||||
if (type == null || conf == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
mTabId = intent.getLongExtra(EXTRA_ID, -1);
|
||||
setTitle(isEditMode() ? R.string.edit_tab : R.string.add_tab);
|
||||
setContentView(R.layout.activity_custom_tab_editor);
|
||||
mTabTypeName.setText(getTabTypeName(this, type));
|
||||
mTabIconsAdapter = new CustomTabIconsAdapter(this);
|
||||
mTabIconsAdapter.setData(getIconMap());
|
||||
mAccountsAdapter = new AccountsSpinnerAdapter(this);
|
||||
mAccountSpinner.setAdapter(mAccountsAdapter);
|
||||
mTabIconSpinner.setAdapter(mTabIconsAdapter);
|
||||
final String iconKey;
|
||||
if (savedInstanceState != null) {
|
||||
mExtrasBundle.putAll(savedInstanceState.getBundle(EXTRA_EXTRAS));
|
||||
}
|
||||
if (!isEditMode()) {
|
||||
mTabConfiguration = conf;
|
||||
final boolean has_secondary_field = conf.getSecondaryFieldType() != CustomTabConfiguration.FIELD_TYPE_NONE;
|
||||
final boolean account_id_none = conf.getAccountRequirement() == CustomTabConfiguration.ACCOUNT_NONE;
|
||||
mAccountContainer.setVisibility(account_id_none ? View.GONE : View.VISIBLE);
|
||||
mSecondaryFieldContainer.setVisibility(has_secondary_field ? View.VISIBLE : View.GONE);
|
||||
final boolean accountIdRequired = conf.getAccountRequirement() == CustomTabConfiguration.ACCOUNT_REQUIRED;
|
||||
if (!accountIdRequired) {
|
||||
mAccountsAdapter.add(Account.dummyInstance());
|
||||
}
|
||||
final boolean officialKeyOnly = intent.getBooleanExtra(EXTRA_OFFICIAL_KEY_ONLY, false);
|
||||
mAccountsAdapter.addAll(Account.getAccountsList(this, false, officialKeyOnly));
|
||||
switch (conf.getSecondaryFieldType()) {
|
||||
case CustomTabConfiguration.FIELD_TYPE_USER: {
|
||||
mSecondaryFieldLabel.setText(R.string.user);
|
||||
setExtraFieldSelectText(mSecondaryFieldContainer, R.string.select_user);
|
||||
break;
|
||||
}
|
||||
case CustomTabConfiguration.FIELD_TYPE_USER_LIST: {
|
||||
mSecondaryFieldLabel.setText(R.string.user_list);
|
||||
setExtraFieldSelectText(mSecondaryFieldContainer, R.string.select_user_list);
|
||||
break;
|
||||
}
|
||||
case CustomTabConfiguration.FIELD_TYPE_TEXT: {
|
||||
mSecondaryFieldLabel.setText(R.string.content);
|
||||
setExtraFieldSelectText(mSecondaryFieldContainer, R.string.input_text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (conf.getSecondaryFieldTitle() != 0) {
|
||||
mSecondaryFieldLabel.setText(conf.getSecondaryFieldTitle());
|
||||
}
|
||||
iconKey = findTabIconKey(conf.getDefaultIcon());
|
||||
mEditTabName.setText(mTabConfiguration.getDefaultTitle());
|
||||
} else {
|
||||
if (mTabId < 0) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
mAccountContainer.setVisibility(View.GONE);
|
||||
mSecondaryFieldContainer.setVisibility(View.GONE);
|
||||
iconKey = intent.getStringExtra(EXTRA_ICON);
|
||||
mEditTabName.setText(intent.getStringExtra(EXTRA_NAME));
|
||||
if (savedInstanceState == null && intent.hasExtra(EXTRA_EXTRAS)) {
|
||||
mExtrasBundle.putAll(ParseUtils.jsonToBundle(intent.getStringExtra(EXTRA_EXTRAS)));
|
||||
}
|
||||
}
|
||||
final int selection = mTabIconsAdapter.getIconPosition(iconKey);
|
||||
mTabIconSpinner.setSelection(selection > 0 ? selection : 0);
|
||||
final LayoutInflater inflater = getLayoutInflater();
|
||||
final ExtraConfiguration[] extraConfigurations = conf.getExtraConfigurations();
|
||||
if (extraConfigurations == null || extraConfigurations.length == 0) {
|
||||
mExtraConfigurationsContainer.setVisibility(View.GONE);
|
||||
} else {
|
||||
mExtraConfigurationsContainer.setVisibility(View.VISIBLE);
|
||||
for (final ExtraConfiguration config : extraConfigurations) {
|
||||
final boolean hasCheckBox = config.getType() == ExtraConfiguration.Type.BOOLEAN;
|
||||
final View view = inflater.inflate(R.layout.list_item_extra_config, mExtraConfigurationsContent, false);
|
||||
final TextView title = (TextView) view.findViewById(android.R.id.title);
|
||||
final CheckBox checkBox = (CheckBox) view.findViewById(android.R.id.checkbox);
|
||||
title.setText(config.getTitleRes());
|
||||
checkBox.setVisibility(hasCheckBox ? View.VISIBLE : View.GONE);
|
||||
if (hasCheckBox) {
|
||||
checkBox.setChecked(mExtrasBundle.getBoolean(config.getKey(), config.defaultBoolean()));
|
||||
}
|
||||
view.setTag(config);
|
||||
view.setOnClickListener(mOnExtraConfigurationClickListener);
|
||||
mExtraConfigurationsContent.addView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(final Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBundle(EXTRA_EXTRAS, mExtrasBundle);
|
||||
}
|
||||
@Override
|
||||
protected void onSaveInstanceState(final Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBundle(EXTRA_EXTRAS, mExtrasBundle);
|
||||
}
|
||||
|
||||
private void addFieldValueToArguments(final Object value, final Bundle args) {
|
||||
final CustomTabConfiguration conf = mTabConfiguration;
|
||||
if (value == null || args == null || conf == null) return;
|
||||
if (value instanceof ParcelableUser) {
|
||||
final ParcelableUser user = (ParcelableUser) value;
|
||||
args.putLong(EXTRA_USER_ID, user.id);
|
||||
args.putString(EXTRA_SCREEN_NAME, user.screen_name);
|
||||
args.putString(EXTRA_NAME, user.name);
|
||||
} else if (value instanceof ParcelableUserList) {
|
||||
final ParcelableUserList user_list = (ParcelableUserList) value;
|
||||
args.putLong(EXTRA_LIST_ID, user_list.id);
|
||||
args.putString(EXTRA_LIST_NAME, user_list.name);
|
||||
args.putLong(EXTRA_USER_ID, user_list.user_id);
|
||||
args.putString(EXTRA_SCREEN_NAME, user_list.user_screen_name);
|
||||
} else if (value instanceof CharSequence) {
|
||||
final String key = conf.getSecondaryFieldTextKey();
|
||||
args.putString(TextUtils.isEmpty(key) ? EXTRA_TEXT : key, value.toString());
|
||||
}
|
||||
}
|
||||
private void addFieldValueToArguments(final Object value, final Bundle args) {
|
||||
final CustomTabConfiguration conf = mTabConfiguration;
|
||||
if (value == null || args == null || conf == null) return;
|
||||
if (value instanceof ParcelableUser) {
|
||||
final ParcelableUser user = (ParcelableUser) value;
|
||||
args.putLong(EXTRA_USER_ID, user.id);
|
||||
args.putString(EXTRA_SCREEN_NAME, user.screen_name);
|
||||
args.putString(EXTRA_NAME, user.name);
|
||||
} else if (value instanceof ParcelableUserList) {
|
||||
final ParcelableUserList user_list = (ParcelableUserList) value;
|
||||
args.putLong(EXTRA_LIST_ID, user_list.id);
|
||||
args.putString(EXTRA_LIST_NAME, user_list.name);
|
||||
args.putLong(EXTRA_USER_ID, user_list.user_id);
|
||||
args.putString(EXTRA_SCREEN_NAME, user_list.user_screen_name);
|
||||
} else if (value instanceof CharSequence) {
|
||||
final String key = conf.getSecondaryFieldTextKey();
|
||||
args.putString(TextUtils.isEmpty(key) ? EXTRA_TEXT : key, value.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void addSecondaryFieldValueToArguments(final Bundle args) {
|
||||
final Object value = mSecondaryFieldValue;
|
||||
addFieldValueToArguments(value, args);
|
||||
}
|
||||
private void addSecondaryFieldValueToArguments(final Bundle args) {
|
||||
final Object value = mSecondaryFieldValue;
|
||||
addFieldValueToArguments(value, args);
|
||||
}
|
||||
|
||||
private long getAccountId() {
|
||||
final int pos = mAccountSpinner.getSelectedItemPosition();
|
||||
if (mAccountSpinner.getCount() > pos && pos >= 0) return mAccountsAdapter.getItem(pos).account_id;
|
||||
return -1;
|
||||
}
|
||||
private long getAccountId() {
|
||||
final int pos = mAccountSpinner.getSelectedItemPosition();
|
||||
if (mAccountSpinner.getCount() > pos && pos >= 0)
|
||||
return mAccountsAdapter.getItem(pos).account_id;
|
||||
return -1;
|
||||
}
|
||||
|
||||
private String getIconKey() {
|
||||
final int pos = mTabIconSpinner.getSelectedItemPosition();
|
||||
if (mTabIconsAdapter.getCount() > pos && pos >= 0) return mTabIconsAdapter.getItem(pos).getKey();
|
||||
return null;
|
||||
}
|
||||
private String getIconKey() {
|
||||
final int pos = mTabIconSpinner.getSelectedItemPosition();
|
||||
if (mTabIconsAdapter.getCount() > pos && pos >= 0)
|
||||
return mTabIconsAdapter.getItem(pos).getKey();
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isEditMode() {
|
||||
return INTENT_ACTION_EDIT_TAB.equals(getIntent().getAction());
|
||||
}
|
||||
private boolean isEditMode() {
|
||||
return INTENT_ACTION_EDIT_TAB.equals(getIntent().getAction());
|
||||
}
|
||||
|
||||
public static class SecondaryFieldEditTextDialogFragment extends BaseSupportDialogFragment implements
|
||||
DialogInterface.OnClickListener {
|
||||
private static final String FRAGMENT_TAG_EDIT_SECONDARY_FIELD = "edit_secondary_field";
|
||||
private EditText mEditText;
|
||||
public static class SecondaryFieldEditTextDialogFragment extends BaseSupportDialogFragment implements
|
||||
DialogInterface.OnClickListener {
|
||||
private static final String FRAGMENT_TAG_EDIT_SECONDARY_FIELD = "edit_secondary_field";
|
||||
private EditText mEditText;
|
||||
|
||||
@Override
|
||||
public void onClick(final DialogInterface dialog, final int which) {
|
||||
final FragmentActivity activity = getActivity();
|
||||
if (activity instanceof CustomTabEditorActivity) {
|
||||
((CustomTabEditorActivity) activity)
|
||||
.setSecondaryFieldValue(ParseUtils.parseString(mEditText.getText()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onClick(final DialogInterface dialog, final int which) {
|
||||
final FragmentActivity activity = getActivity();
|
||||
if (activity instanceof CustomTabEditorActivity) {
|
||||
((CustomTabEditorActivity) activity)
|
||||
.setSecondaryFieldValue(ParseUtils.parseString(mEditText.getText()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||
final Bundle args = getArguments();
|
||||
final Context wrapped = ThemeUtils.getDialogThemedContext(getActivity());
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped);
|
||||
builder.setTitle(args.getString(EXTRA_TITLE));
|
||||
builder.setPositiveButton(android.R.string.ok, this);
|
||||
builder.setNegativeButton(android.R.string.cancel, null);
|
||||
final FrameLayout view = new FrameLayout(getActivity());
|
||||
mEditText = new EditText(getActivity());
|
||||
final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
lp.leftMargin = lp.topMargin = lp.bottomMargin = lp.rightMargin = getResources().getDimensionPixelSize(
|
||||
R.dimen.element_spacing_normal);
|
||||
view.addView(mEditText, lp);
|
||||
builder.setView(view);
|
||||
mEditText.setText(args.getString(EXTRA_TEXT));
|
||||
return builder.create();
|
||||
}
|
||||
@Override
|
||||
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||
final Bundle args = getArguments();
|
||||
final Context wrapped = ThemeUtils.getDialogThemedContext(getActivity());
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped);
|
||||
builder.setTitle(args.getString(EXTRA_TITLE));
|
||||
builder.setPositiveButton(android.R.string.ok, this);
|
||||
builder.setNegativeButton(android.R.string.cancel, null);
|
||||
final FrameLayout view = new FrameLayout(getActivity());
|
||||
mEditText = new EditText(getActivity());
|
||||
final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
lp.leftMargin = lp.topMargin = lp.bottomMargin = lp.rightMargin = getResources().getDimensionPixelSize(
|
||||
R.dimen.element_spacing_normal);
|
||||
view.addView(mEditText, lp);
|
||||
builder.setView(view);
|
||||
mEditText.setText(args.getString(EXTRA_TEXT));
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
public static SecondaryFieldEditTextDialogFragment show(final FragmentActivity activity, final String text,
|
||||
final String title) {
|
||||
final SecondaryFieldEditTextDialogFragment f = new SecondaryFieldEditTextDialogFragment();
|
||||
final Bundle args = new Bundle();
|
||||
args.putString(EXTRA_TEXT, text);
|
||||
args.putString(EXTRA_TITLE, title);
|
||||
f.setArguments(args);
|
||||
f.show(activity.getSupportFragmentManager(), FRAGMENT_TAG_EDIT_SECONDARY_FIELD);
|
||||
return f;
|
||||
}
|
||||
}
|
||||
public static SecondaryFieldEditTextDialogFragment show(final FragmentActivity activity, final String text,
|
||||
final String title) {
|
||||
final SecondaryFieldEditTextDialogFragment f = new SecondaryFieldEditTextDialogFragment();
|
||||
final Bundle args = new Bundle();
|
||||
args.putString(EXTRA_TEXT, text);
|
||||
args.putString(EXTRA_TITLE, title);
|
||||
f.setArguments(args);
|
||||
f.show(activity.getSupportFragmentManager(), FRAGMENT_TAG_EDIT_SECONDARY_FIELD);
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
static class CustomTabIconsAdapter extends ArrayAdapter<Entry<String, Integer>> {
|
||||
static class CustomTabIconsAdapter extends ArrayAdapter<Entry<String, Integer>> {
|
||||
|
||||
private final Resources mResources;
|
||||
private final Resources mResources;
|
||||
private final int mIconColor;
|
||||
|
||||
public CustomTabIconsAdapter(final Context context) {
|
||||
super(context, R.layout.spinner_item_custom_tab_icon);
|
||||
setDropDownViewResource(R.layout.list_item_two_line_small);
|
||||
mResources = context.getResources();
|
||||
}
|
||||
public CustomTabIconsAdapter(final Context context) {
|
||||
super(context, R.layout.spinner_item_custom_tab_icon);
|
||||
setDropDownViewResource(R.layout.list_item_two_line_small);
|
||||
mResources = context.getResources();
|
||||
mIconColor = ThemeUtils.getThemeForegroundColor(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = super.getDropDownView(position, convertView, parent);
|
||||
view.findViewById(android.R.id.text2).setVisibility(View.GONE);
|
||||
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
final Entry<String, Integer> item = getItem(position);
|
||||
final int value = item.getValue();
|
||||
if (value > 0) {
|
||||
final String key = item.getKey();
|
||||
text1.setText(key.substring(0, 1).toUpperCase(Locale.US) + key.substring(1, key.length()));
|
||||
} else {
|
||||
text1.setText(R.string.customize);
|
||||
}
|
||||
bindView(position, item, view);
|
||||
return view;
|
||||
}
|
||||
@Override
|
||||
public View getDropDownView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = super.getDropDownView(position, convertView, parent);
|
||||
view.findViewById(android.R.id.text2).setVisibility(View.GONE);
|
||||
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
final Entry<String, Integer> item = getItem(position);
|
||||
final int value = item.getValue();
|
||||
if (value > 0) {
|
||||
final String key = item.getKey();
|
||||
text1.setText(key.substring(0, 1).toUpperCase(Locale.US) + key.substring(1, key.length()));
|
||||
} else {
|
||||
text1.setText(R.string.customize);
|
||||
}
|
||||
bindIconView(position, item, view);
|
||||
return view;
|
||||
}
|
||||
|
||||
public int getIconPosition(final String key) {
|
||||
if (key == null) return -1;
|
||||
for (int i = 0, j = getCount(); i < j; i++) {
|
||||
if (key.equals(getItem(i).getKey())) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
public int getIconPosition(final String key) {
|
||||
if (key == null) return -1;
|
||||
for (int i = 0, j = getCount(); i < j; i++) {
|
||||
if (key.equals(getItem(i).getKey())) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = super.getView(position, convertView, parent);
|
||||
bindView(position, getItem(position), view);
|
||||
return view;
|
||||
}
|
||||
@Override
|
||||
public View getView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = super.getView(position, convertView, parent);
|
||||
bindIconView(position, getItem(position), view);
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setData(final Map<String, Integer> map) {
|
||||
clear();
|
||||
if (map == null) return;
|
||||
addAll(map.entrySet());
|
||||
sort(new LocationComparator(mResources));
|
||||
}
|
||||
public void setData(final Map<String, Integer> map) {
|
||||
clear();
|
||||
if (map == null) return;
|
||||
addAll(map.entrySet());
|
||||
sort(new LocationComparator(mResources));
|
||||
}
|
||||
|
||||
private void bindView(final int position, final Entry<String, Integer> item, final View view) {
|
||||
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
|
||||
final int value = item.getValue();
|
||||
if (value > 0) {
|
||||
ViewAccessor.setBackground(icon, mResources.getDrawable(value));
|
||||
} else {
|
||||
ViewAccessor.setBackground(icon, null);
|
||||
}
|
||||
}
|
||||
private void bindIconView(final int position, final Entry<String, Integer> item, final View view) {
|
||||
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
|
||||
icon.setColorFilter(mIconColor, Mode.SRC_ATOP);
|
||||
final int value = item.getValue();
|
||||
if (value > 0) {
|
||||
icon.setImageResource(item.getValue());
|
||||
} else {
|
||||
icon.setImageDrawable(null);
|
||||
}
|
||||
}
|
||||
|
||||
private static class LocationComparator implements Comparator<Entry<String, Integer>> {
|
||||
private final Collator mCollator;
|
||||
private static class LocationComparator implements Comparator<Entry<String, Integer>> {
|
||||
private final Collator mCollator;
|
||||
|
||||
LocationComparator(final Resources res) {
|
||||
mCollator = Collator.getInstance(res.getConfiguration().locale);
|
||||
}
|
||||
LocationComparator(final Resources res) {
|
||||
mCollator = Collator.getInstance(res.getConfiguration().locale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(final Entry<String, Integer> object1, final Entry<String, Integer> object2) {
|
||||
if (object1.getValue() <= 0) return Integer.MAX_VALUE;
|
||||
if (object2.getValue() <= 0) return Integer.MIN_VALUE;
|
||||
return mCollator.compare(object1.getKey(), object2.getKey());
|
||||
}
|
||||
@Override
|
||||
public int compare(final Entry<String, Integer> object1, final Entry<String, Integer> object2) {
|
||||
if (object1.getValue() <= 0) return Integer.MAX_VALUE;
|
||||
if (object2.getValue() <= 0) return Integer.MIN_VALUE;
|
||||
return mCollator.compare(object1.getKey(), object2.getKey());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -455,6 +455,7 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
&& mUpdateUnreadCountTask.getStatus() == AsyncTask.Status.RUNNING) return;
|
||||
mUpdateUnreadCountTask = new UpdateUnreadCountTask(mTabIndicator);
|
||||
mUpdateUnreadCountTask.execute();
|
||||
mTabIndicator.setDisplayBadge(mPreferences.getBoolean(KEY_UNREAD_COUNT, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -536,7 +537,7 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
mTabIndicator.setDisplayLabel(false);
|
||||
mTabIndicator.setDisplayIcon(true);
|
||||
}
|
||||
mTabIndicator.setDisplayBadge(mPreferences.getBoolean(KEY_UNREAD_COUNT, true));
|
||||
// mTabIndicator.setDisplayBadge(mPreferences.getBoolean(KEY_UNREAD_COUNT, true));
|
||||
mActionsButton.setOnClickListener(this);
|
||||
mActionsButton.setOnLongClickListener(this);
|
||||
setTabPosition(initialTabPosition);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.mariotaku.twidere.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
@ -30,59 +31,60 @@ import org.mariotaku.twidere.app.TwidereApplication;
|
|||
import org.mariotaku.twidere.fragment.support.DirectMessagesConversationFragment;
|
||||
import org.mariotaku.twidere.model.Account;
|
||||
import org.mariotaku.twidere.util.ImageLoaderWrapper;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class AccountsSpinnerAdapter extends ArrayAdapter<Account> {
|
||||
|
||||
private final ImageLoaderWrapper mImageLoader;
|
||||
private final boolean mDisplayProfileImage;
|
||||
private final ImageLoaderWrapper mImageLoader;
|
||||
private final boolean mDisplayProfileImage;
|
||||
|
||||
public AccountsSpinnerAdapter(final Context context) {
|
||||
super(context, R.layout.list_item_two_line_small);
|
||||
setDropDownViewResource(R.layout.list_item_two_line_small);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mDisplayProfileImage = context.getSharedPreferences(DirectMessagesConversationFragment.SHARED_PREFERENCES_NAME,
|
||||
Context.MODE_PRIVATE).getBoolean(DirectMessagesConversationFragment.KEY_DISPLAY_PROFILE_IMAGE, true);
|
||||
}
|
||||
public AccountsSpinnerAdapter(final Context context) {
|
||||
super(context, R.layout.list_item_two_line_small);
|
||||
setDropDownViewResource(R.layout.list_item_two_line_small);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mDisplayProfileImage = context.getSharedPreferences(DirectMessagesConversationFragment.SHARED_PREFERENCES_NAME,
|
||||
Context.MODE_PRIVATE).getBoolean(DirectMessagesConversationFragment.KEY_DISPLAY_PROFILE_IMAGE, true);
|
||||
}
|
||||
|
||||
public AccountsSpinnerAdapter(final Context context, final Collection<Account> accounts) {
|
||||
this(context);
|
||||
addAll(accounts);
|
||||
}
|
||||
public AccountsSpinnerAdapter(final Context context, final Collection<Account> accounts) {
|
||||
this(context);
|
||||
addAll(accounts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = super.getDropDownView(position, convertView, parent);
|
||||
bindView(view, getItem(position));
|
||||
return view;
|
||||
}
|
||||
@Override
|
||||
public View getDropDownView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = super.getDropDownView(position, convertView, parent);
|
||||
bindView(view, getItem(position));
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = super.getView(position, convertView, parent);
|
||||
bindView(view, getItem(position));
|
||||
return view;
|
||||
}
|
||||
@Override
|
||||
public View getView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = super.getView(position, convertView, parent);
|
||||
bindView(view, getItem(position));
|
||||
return view;
|
||||
}
|
||||
|
||||
private void bindView(final View view, final Account item) {
|
||||
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
final TextView text2 = (TextView) view.findViewById(android.R.id.text2);
|
||||
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
|
||||
text2.setVisibility(item.is_dummy ? View.GONE : View.VISIBLE);
|
||||
icon.setVisibility(item.is_dummy ? View.GONE : View.VISIBLE);
|
||||
if (!item.is_dummy) {
|
||||
text1.setText(item.name);
|
||||
text2.setText(String.format("@%s", item.screen_name));
|
||||
if (mDisplayProfileImage) {
|
||||
mImageLoader.displayProfileImage(icon, item.profile_image_url);
|
||||
} else {
|
||||
private void bindView(final View view, final Account item) {
|
||||
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
final TextView text2 = (TextView) view.findViewById(android.R.id.text2);
|
||||
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
|
||||
text2.setVisibility(item.is_dummy ? View.GONE : View.VISIBLE);
|
||||
icon.setVisibility(item.is_dummy ? View.GONE : View.VISIBLE);
|
||||
if (!item.is_dummy) {
|
||||
text1.setText(item.name);
|
||||
text2.setText(String.format("@%s", item.screen_name));
|
||||
if (mDisplayProfileImage) {
|
||||
mImageLoader.displayProfileImage(icon, item.profile_image_url);
|
||||
} else {
|
||||
mImageLoader.cancelDisplayTask(icon);
|
||||
icon.setImageResource(R.drawable.ic_profile_image_default);
|
||||
}
|
||||
} else {
|
||||
text1.setText(R.string.none);
|
||||
}
|
||||
}
|
||||
icon.setImageResource(R.drawable.ic_profile_image_default);
|
||||
}
|
||||
} else {
|
||||
text1.setText(R.string.none);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -226,6 +226,7 @@ public class CursorStatusesAdapter extends BaseCursorAdapter implements IStatuse
|
|||
holder.image_preview.setImageDrawable(null);
|
||||
holder.image_preview.setBackgroundResource(R.drawable.image_preview_nsfw);
|
||||
holder.image_preview_progress.setVisibility(View.GONE);
|
||||
mImageLoader.cancelDisplayTask(holder.image_preview);
|
||||
} else if (!firstMedia.equals(mImageLoadingHandler.getLoadingUri(holder.image_preview))) {
|
||||
holder.image_preview.setBackgroundResource(0);
|
||||
mImageLoader.displayPreviewImage(holder.image_preview, firstMedia, mImageLoadingHandler);
|
||||
|
|
|
@ -201,6 +201,7 @@ public class AccountsManagerFragment extends BaseSupportListFragment implements
|
|||
mPreferences.registerOnSharedPreferenceChangeListener(this);
|
||||
mAdapter = new AccountsAdapter(activity);
|
||||
Utils.configBaseAdapter(activity, mAdapter);
|
||||
mAdapter.setSortEnabled(true);
|
||||
setListAdapter(mAdapter);
|
||||
final DragSortListView listView = (DragSortListView) getListView();
|
||||
listView.setDragEnabled(true);
|
||||
|
|
|
@ -35,6 +35,7 @@ import android.location.Address;
|
|||
import android.location.Geocoder;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
|
@ -58,7 +59,6 @@ import android.view.View.OnClickListener;
|
|||
import android.view.ViewGroup;
|
||||
import android.webkit.URLUtil;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
@ -100,8 +100,6 @@ import org.mariotaku.twidere.view.StatusTextView;
|
|||
import org.mariotaku.twidere.view.TwidereMenuBar;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -162,8 +160,8 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
private AsyncTwitterWrapper mTwitterWrapper;
|
||||
private ImageLoaderWrapper mImageLoader;
|
||||
private Handler mHandler;
|
||||
private TextView mNameView, mScreenNameView, mTimeSourceView, mInReplyToView, mLocationView, mRepliesView;
|
||||
private TextView mRetweetsCountView, mFavoritesCountView;
|
||||
private TextView mNameView, mScreenNameView, mTimeSourceView, mInReplyToView, mLocationView;
|
||||
private TextView mRepliesCountView, mRetweetsCountView, mFavoritesCountView;
|
||||
private StatusTextView mTextView;
|
||||
|
||||
private ImageView mProfileImageView, mMapView;
|
||||
|
@ -176,7 +174,7 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
private LinearLayout mImagePreviewGrid;
|
||||
private View mHeaderView;
|
||||
private View mLoadImagesIndicator;
|
||||
private View mRetweetsContainer, mFavoritesContainer;
|
||||
private View mRepliesContainer, mRetweetsContainer, mFavoritesContainer;
|
||||
private ExtendedFrameLayout mDetailsContainer;
|
||||
private ListView mListView;
|
||||
|
||||
|
@ -395,6 +393,8 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
loadPreviewImages();
|
||||
}
|
||||
mRetweetsContainer.setVisibility(!status.user_is_protected ? View.VISIBLE : View.GONE);
|
||||
mRepliesContainer.setVisibility(status.reply_count < 0 ? View.GONE : View.VISIBLE);
|
||||
mRepliesCountView.setText(getLocalizedNumber(mLocale, status.reply_count));
|
||||
mRetweetsCountView.setText(getLocalizedNumber(mLocale, status.retweet_count));
|
||||
mFavoritesCountView.setText(getLocalizedNumber(mLocale, status.favorite_count));
|
||||
final ParcelableLocation location = status.location;
|
||||
|
@ -438,7 +438,7 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
final int start = mTextView.getSelectionStart(), end = mTextView.getSelectionEnd();
|
||||
final SpannableString string = SpannableString.valueOf(mTextView.getText());
|
||||
final URLSpan[] spans = string.getSpans(start, end, URLSpan.class);
|
||||
if (spans == null || spans.length != 1) return true;
|
||||
if (spans.length != 1) return true;
|
||||
ClipboardUtils.setText(getActivity(), spans[0].getURL());
|
||||
mode.finish();
|
||||
return true;
|
||||
|
@ -468,10 +468,10 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
mLoadMoreAutomatically = mPreferences.getBoolean(KEY_LOAD_MORE_AUTOMATICALLY, false);
|
||||
mLoadImagesIndicator.setOnClickListener(this);
|
||||
mInReplyToView.setOnClickListener(this);
|
||||
mRepliesView.setOnClickListener(this);
|
||||
mFollowButton.setOnClickListener(this);
|
||||
mProfileView.setOnClickListener(this);
|
||||
mLocationContainer.setOnClickListener(this);
|
||||
mRepliesContainer.setOnClickListener(this);
|
||||
mRetweetsContainer.setOnClickListener(this);
|
||||
mFavoritesContainer.setOnClickListener(this);
|
||||
mMenuBar.setVisibility(shouldUseNativeMenu() ? View.GONE : View.VISIBLE);
|
||||
|
@ -524,7 +524,7 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
showConversation();
|
||||
break;
|
||||
}
|
||||
case R.id.replies_view: {
|
||||
case R.id.replies_container: {
|
||||
openStatusReplies(getActivity(), status.account_id, status.id, status.user_screen_name);
|
||||
break;
|
||||
}
|
||||
|
@ -580,12 +580,12 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
|
||||
@Override
|
||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
|
||||
final View view = inflater.inflate(R.layout.fragment_details_page, null, false);
|
||||
final View view = inflater.inflate(R.layout.fragment_details_page, container, false);
|
||||
mMainContent = view.findViewById(R.id.content);
|
||||
mDetailsLoadProgress = (ProgressBar) view.findViewById(R.id.details_load_progress);
|
||||
mMenuBar = (TwidereMenuBar) view.findViewById(R.id.menu_bar);
|
||||
mDetailsContainer = (ExtendedFrameLayout) view.findViewById(R.id.details_container);
|
||||
mDetailsContainer.addView(super.onCreateView(inflater, container, savedInstanceState));
|
||||
mDetailsContainer.addView(super.onCreateView(inflater, mDetailsContainer, savedInstanceState));
|
||||
mHeaderView = inflater.inflate(R.layout.header_status, null, false);
|
||||
mImagePreviewContainer = mHeaderView.findViewById(R.id.image_preview);
|
||||
mLocationContainer = mHeaderView.findViewById(R.id.location_container);
|
||||
|
@ -598,14 +598,15 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
mProfileImageView = (ImageView) mHeaderView.findViewById(R.id.profile_image);
|
||||
mTimeSourceView = (TextView) mHeaderView.findViewById(R.id.time_source);
|
||||
mInReplyToView = (TextView) mHeaderView.findViewById(R.id.in_reply_to);
|
||||
mRepliesView = (TextView) mHeaderView.findViewById(R.id.replies_view);
|
||||
mFollowButton = (Button) mHeaderView.findViewById(R.id.follow);
|
||||
mFollowIndicator = mHeaderView.findViewById(R.id.follow_indicator);
|
||||
mFollowInfoProgress = (ProgressBar) mHeaderView.findViewById(R.id.follow_info_progress);
|
||||
mProfileView = (ColorLabelRelativeLayout) mHeaderView.findViewById(R.id.profile);
|
||||
mImagePreviewGrid = (LinearLayout) mHeaderView.findViewById(R.id.image_grid);
|
||||
mRepliesContainer = mHeaderView.findViewById(R.id.replies_container);
|
||||
mRetweetsContainer = mHeaderView.findViewById(R.id.retweets_container);
|
||||
mFavoritesContainer = mHeaderView.findViewById(R.id.favorites_container);
|
||||
mRepliesCountView = (TextView) mHeaderView.findViewById(R.id.replies_count);
|
||||
mRetweetsCountView = (TextView) mHeaderView.findViewById(R.id.retweets_count);
|
||||
mFavoritesCountView = (TextView) mHeaderView.findViewById(R.id.favorites_count);
|
||||
mLoadImagesIndicator = mHeaderView.findViewById(R.id.load_images);
|
||||
|
@ -661,7 +662,7 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
final int start = mTextView.getSelectionStart(), end = mTextView.getSelectionEnd();
|
||||
final SpannableString string = SpannableString.valueOf(mTextView.getText());
|
||||
final URLSpan[] spans = string.getSpans(start, end, URLSpan.class);
|
||||
final boolean avail = spans != null && spans.length == 1 && URLUtil.isValidUrl(spans[0].getURL());
|
||||
final boolean avail = spans.length == 1 && URLUtil.isValidUrl(spans[0].getURL());
|
||||
Utils.setMenuItemAvailability(menu, android.R.id.copyUrl, avail);
|
||||
return false;
|
||||
}
|
||||
|
@ -706,7 +707,6 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
mInReplyToView.setTextSize(text_size * 0.85f);
|
||||
mLocationView.setTextSize(text_size * 0.85f);
|
||||
// mRetweetView.setTextSize(text_size * 0.85f);
|
||||
mRepliesView.setTextSize(text_size * 0.85f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1010,6 +1010,7 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||
final Context wrapped = ThemeUtils.getDialogThemedContext(getActivity());
|
||||
|
@ -1078,56 +1079,6 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
}
|
||||
}
|
||||
|
||||
static class ImagesAdapter extends BaseAdapter {
|
||||
|
||||
private final List<ParcelableMedia> mImages = new ArrayList<ParcelableMedia>();
|
||||
private final ImageLoaderWrapper mImageLoader;
|
||||
private final LayoutInflater mInflater;
|
||||
|
||||
public ImagesAdapter(final Context context) {
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
public boolean addAll(final Collection<? extends ParcelableMedia> images) {
|
||||
final boolean ret = images != null && mImages.addAll(images);
|
||||
notifyDataSetChanged();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
mImages.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mImages.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParcelableMedia getItem(final int position) {
|
||||
return mImages.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(final int position) {
|
||||
final ParcelableMedia spec = getItem(position);
|
||||
return spec != null ? spec.hashCode() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = convertView != null ? convertView : mInflater.inflate(
|
||||
R.layout.gallery_item_image_preview, null);
|
||||
final ImageView image = (ImageView) view.findViewById(R.id.image);
|
||||
final ParcelableMedia spec = getItem(position);
|
||||
mImageLoader.displayPreviewImage(image, spec != null ? spec.media_url : null);
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class LoadConversationTask extends AsyncTask<ParcelableStatus, Void, SingleResponse<Boolean>> {
|
||||
|
||||
final Handler handler;
|
||||
|
@ -1143,7 +1094,7 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
@Override
|
||||
protected SingleResponse<Boolean> doInBackground(final ParcelableStatus... params) {
|
||||
if (params == null || params.length != 1)
|
||||
return new SingleResponse<Boolean>(false, null);
|
||||
return new SingleResponse<>(false, null);
|
||||
try {
|
||||
final long account_id = params[0].account_id;
|
||||
ParcelableStatus status = params[0];
|
||||
|
@ -1155,9 +1106,9 @@ public class StatusFragment extends ParcelableStatusesListFragment implements On
|
|||
handler.post(new AddStatusRunnable(status));
|
||||
}
|
||||
} catch (final TwitterException e) {
|
||||
return new SingleResponse<Boolean>(false, e);
|
||||
return new SingleResponse<>(false, e);
|
||||
}
|
||||
return new SingleResponse<Boolean>(true, null);
|
||||
return new SingleResponse<>(true, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -93,7 +93,8 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
};
|
||||
|
||||
public final long id, account_id, timestamp, user_id, retweet_id, retweeted_by_id, retweet_timestamp,
|
||||
retweet_count, favorite_count, in_reply_to_status_id, in_reply_to_user_id, my_retweet_id;
|
||||
retweet_count, favorite_count, reply_count, descendent_reply_count, in_reply_to_status_id,
|
||||
in_reply_to_user_id, my_retweet_id;
|
||||
|
||||
public final boolean is_gap, is_retweet, is_favorite, is_possibly_sensitive, user_is_following, user_is_protected,
|
||||
user_is_verified;
|
||||
|
@ -137,6 +138,8 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
source = values.getAsString(Statuses.SOURCE);
|
||||
retweet_count = getAsInteger(values, Statuses.RETWEET_COUNT, 0);
|
||||
favorite_count = getAsInteger(values, Statuses.FAVORITE_COUNT, 0);
|
||||
reply_count = getAsInteger(values, Statuses.REPLY_COUNT, 0);
|
||||
descendent_reply_count = getAsInteger(values, Statuses.DESCENDENT_REPLY_COUNT, 0);
|
||||
text_unescaped = values.getAsString(Statuses.TEXT_UNESCAPED);
|
||||
media = ParcelableMedia.fromJSONString(values.getAsString(Statuses.MEDIA));
|
||||
is_possibly_sensitive = getAsBoolean(values, Statuses.IS_POSSIBLY_SENSITIVE, false);
|
||||
|
@ -155,6 +158,8 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
retweeted_by_id = idx.retweeted_by_user_id != -1 ? c.getLong(idx.retweeted_by_user_id) : -1;
|
||||
retweet_count = idx.retweet_count != -1 ? c.getLong(idx.retweet_count) : -1;
|
||||
favorite_count = idx.favorite_count != -1 ? c.getLong(idx.favorite_count) : -1;
|
||||
reply_count = idx.reply_count != -1 ? c.getLong(idx.reply_count) : -1;
|
||||
descendent_reply_count = idx.descendent_reply_count != -1 ? c.getLong(idx.descendent_reply_count) : -1;
|
||||
in_reply_to_status_id = idx.in_reply_to_status_id != -1 ? c.getLong(idx.in_reply_to_status_id) : -1;
|
||||
in_reply_to_user_id = idx.in_reply_to_user_id != -1 ? c.getLong(idx.in_reply_to_user_id) : -1;
|
||||
is_gap = idx.is_gap != -1 && c.getInt(idx.is_gap) == 1;
|
||||
|
@ -194,6 +199,8 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
retweeted_by_id = in.readLong("retweeted_by_id");
|
||||
retweet_count = in.readLong("retweet_count");
|
||||
favorite_count = in.readLong("favorite_count");
|
||||
reply_count = in.readLong("reply_count");
|
||||
descendent_reply_count = in.readLong("descendent_reply_count");
|
||||
in_reply_to_status_id = in.readLong("in_reply_to_status_id");
|
||||
in_reply_to_user_id = in.readLong("in_reply_to_user_id");
|
||||
is_gap = in.readBoolean("is_gap");
|
||||
|
@ -231,6 +238,8 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
retweeted_by_id = in.readLong();
|
||||
retweet_count = in.readLong();
|
||||
favorite_count = in.readLong();
|
||||
reply_count = in.readLong();
|
||||
descendent_reply_count = in.readLong();
|
||||
in_reply_to_status_id = in.readLong();
|
||||
is_gap = in.readInt() == 1;
|
||||
is_retweet = in.readInt() == 1;
|
||||
|
@ -285,6 +294,8 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
text_plain = status.getText();
|
||||
retweet_count = status.getRetweetCount();
|
||||
favorite_count = status.getFavoriteCount();
|
||||
reply_count = status.getReplyCount();
|
||||
descendent_reply_count = status.getDescendentReplyCount();
|
||||
in_reply_to_name = getInReplyToName(status);
|
||||
in_reply_to_screen_name = status.getInReplyToScreenName();
|
||||
in_reply_to_status_id = status.getInReplyToStatusId();
|
||||
|
@ -359,6 +370,8 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
out.writeLong("retweeted_by_id", retweeted_by_id);
|
||||
out.writeLong("retweet_count", retweet_count);
|
||||
out.writeLong("favorite_count", favorite_count);
|
||||
out.writeLong("reply_count", reply_count);
|
||||
out.writeLong("descendent_reply_count", descendent_reply_count);
|
||||
out.writeLong("in_reply_to_status_id", in_reply_to_status_id);
|
||||
out.writeLong("in_reply_to_user_id", in_reply_to_user_id);
|
||||
out.writeBoolean("is_gap", is_gap);
|
||||
|
@ -396,6 +409,8 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
out.writeLong(retweeted_by_id);
|
||||
out.writeLong(retweet_count);
|
||||
out.writeLong(favorite_count);
|
||||
out.writeLong(reply_count);
|
||||
out.writeLong(descendent_reply_count);
|
||||
out.writeLong(in_reply_to_status_id);
|
||||
out.writeInt(is_gap ? 1 : 0);
|
||||
out.writeInt(is_retweet ? 1 : 0);
|
||||
|
@ -428,13 +443,57 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
|
||||
public static final class CursorIndices {
|
||||
|
||||
public final int _id, account_id, status_id, status_timestamp, user_name, user_screen_name, text_html,
|
||||
text_plain, text_unescaped, user_profile_image_url, is_favorite, is_retweet, is_gap, location,
|
||||
is_protected, is_verified, in_reply_to_status_id, in_reply_to_user_id, in_reply_to_user_name,
|
||||
in_reply_to_user_screen_name, my_retweet_id, retweeted_by_user_name, retweeted_by_user_screen_name,
|
||||
retweet_id, retweet_timestamp, retweeted_by_user_id, user_id, source, retweet_count, favorite_count,
|
||||
public final int _id, account_id, status_id, status_timestamp, user_name, user_screen_name,
|
||||
text_html, text_plain, text_unescaped, user_profile_image_url, is_favorite, is_retweet,
|
||||
is_gap, location, is_protected, is_verified, in_reply_to_status_id, in_reply_to_user_id,
|
||||
in_reply_to_user_name, in_reply_to_user_screen_name, my_retweet_id, retweeted_by_user_name,
|
||||
retweeted_by_user_screen_name, retweet_id, retweet_timestamp, retweeted_by_user_id,
|
||||
user_id, source, retweet_count, favorite_count, reply_count, descendent_reply_count,
|
||||
is_possibly_sensitive, is_following, media, first_media, mentions;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CursorIndices{" +
|
||||
"_id=" + _id +
|
||||
", account_id=" + account_id +
|
||||
", status_id=" + status_id +
|
||||
", status_timestamp=" + status_timestamp +
|
||||
", user_name=" + user_name +
|
||||
", user_screen_name=" + user_screen_name +
|
||||
", text_html=" + text_html +
|
||||
", text_plain=" + text_plain +
|
||||
", text_unescaped=" + text_unescaped +
|
||||
", user_profile_image_url=" + user_profile_image_url +
|
||||
", is_favorite=" + is_favorite +
|
||||
", is_retweet=" + is_retweet +
|
||||
", is_gap=" + is_gap +
|
||||
", location=" + location +
|
||||
", is_protected=" + is_protected +
|
||||
", is_verified=" + is_verified +
|
||||
", in_reply_to_status_id=" + in_reply_to_status_id +
|
||||
", in_reply_to_user_id=" + in_reply_to_user_id +
|
||||
", in_reply_to_user_name=" + in_reply_to_user_name +
|
||||
", in_reply_to_user_screen_name=" + in_reply_to_user_screen_name +
|
||||
", my_retweet_id=" + my_retweet_id +
|
||||
", retweeted_by_user_name=" + retweeted_by_user_name +
|
||||
", retweeted_by_user_screen_name=" + retweeted_by_user_screen_name +
|
||||
", retweet_id=" + retweet_id +
|
||||
", retweet_timestamp=" + retweet_timestamp +
|
||||
", retweeted_by_user_id=" + retweeted_by_user_id +
|
||||
", user_id=" + user_id +
|
||||
", source=" + source +
|
||||
", retweet_count=" + retweet_count +
|
||||
", favorite_count=" + favorite_count +
|
||||
", reply_count=" + reply_count +
|
||||
", descendent_reply_count=" + descendent_reply_count +
|
||||
", is_possibly_sensitive=" + is_possibly_sensitive +
|
||||
", is_following=" + is_following +
|
||||
", media=" + media +
|
||||
", first_media=" + first_media +
|
||||
", mentions=" + mentions +
|
||||
'}';
|
||||
}
|
||||
|
||||
public CursorIndices(final Cursor cursor) {
|
||||
_id = cursor.getColumnIndex(Statuses._ID);
|
||||
account_id = cursor.getColumnIndex(Statuses.ACCOUNT_ID);
|
||||
|
@ -466,6 +525,8 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
source = cursor.getColumnIndex(Statuses.SOURCE);
|
||||
retweet_count = cursor.getColumnIndex(Statuses.RETWEET_COUNT);
|
||||
favorite_count = cursor.getColumnIndex(Statuses.FAVORITE_COUNT);
|
||||
reply_count = cursor.getColumnIndex(Statuses.REPLY_COUNT);
|
||||
descendent_reply_count = cursor.getColumnIndex(Statuses.DESCENDENT_REPLY_COUNT);
|
||||
is_possibly_sensitive = cursor.getColumnIndex(Statuses.IS_POSSIBLY_SENSITIVE);
|
||||
is_following = cursor.getColumnIndex(Statuses.IS_FOLLOWING);
|
||||
media = cursor.getColumnIndex(Statuses.MEDIA);
|
||||
|
@ -473,24 +534,5 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
mentions = cursor.getColumnIndex(Statuses.MENTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CursorIndices{_id=" + _id + ", account_id=" + account_id + ", status_id=" + status_id
|
||||
+ ", status_timestamp=" + status_timestamp + ", user_name=" + user_name + ", user_screen_name="
|
||||
+ user_screen_name + ", text_html=" + text_html + ", text_plain=" + text_plain
|
||||
+ ", text_unescaped=" + text_unescaped + ", user_profile_image_url=" + user_profile_image_url
|
||||
+ ", is_favorite=" + is_favorite + ", is_retweet=" + is_retweet + ", is_gap=" + is_gap
|
||||
+ ", location=" + location + ", is_protected=" + is_protected + ", is_verified=" + is_verified
|
||||
+ ", in_reply_to_status_id=" + in_reply_to_status_id + ", in_reply_to_user_id="
|
||||
+ in_reply_to_user_id + ", in_reply_to_user_name=" + in_reply_to_user_name
|
||||
+ ", in_reply_to_user_screen_name=" + in_reply_to_user_screen_name + ", my_retweet_id="
|
||||
+ my_retweet_id + ", retweeted_by_user_name=" + retweeted_by_user_name
|
||||
+ ", retweeted_by_user_screen_name=" + retweeted_by_user_screen_name + ", retweet_id=" + retweet_id
|
||||
+ ", retweet_timestamp=" + retweet_timestamp + ", retweeted_by_user_id=" + retweeted_by_user_id
|
||||
+ ", user_id=" + user_id + ", source=" + source + ", retweet_count=" + retweet_count
|
||||
+ ", favorite_count=" + favorite_count + ", is_possibly_sensitive=" + is_possibly_sensitive
|
||||
+ ", is_following=" + is_following + ", media=" + media + ", first_media=" + first_media
|
||||
+ ", mentions=" + mentions + "}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,8 +115,6 @@ public class ThemePreviewPreference extends Preference implements Constants, OnS
|
|||
final TextView timeSourceView = (TextView) statusContentView.findViewById(R.id.time_source);
|
||||
// final TextView retweetView = (TextView)
|
||||
// statusContentView.findViewById(R.id.retweet_view);
|
||||
final TextView repliesView = (TextView) statusContentView.findViewById(R.id.replies_view);
|
||||
|
||||
cardView.setItemSelector(null);
|
||||
|
||||
nameView.setTextSize(defaultTextSize * 1.25f);
|
||||
|
@ -124,11 +122,9 @@ public class ThemePreviewPreference extends Preference implements Constants, OnS
|
|||
screenNameView.setTextSize(defaultTextSize * 0.85f);
|
||||
timeSourceView.setTextSize(defaultTextSize * 0.85f);
|
||||
// retweetView.setTextSize(defaultTextSize * 0.85f);
|
||||
repliesView.setTextSize(defaultTextSize * 0.85f);
|
||||
|
||||
profileView.setBackgroundResource(0);
|
||||
// retweetView.setBackgroundResource(0);
|
||||
repliesView.setBackgroundResource(0);
|
||||
textView.setTextIsSelectable(false);
|
||||
|
||||
profileImageView.setImageResource(R.drawable.ic_launcher);
|
||||
|
|
|
@ -642,6 +642,8 @@ public interface TweetStore {
|
|||
*/
|
||||
public static final String RETWEET_COUNT = "retweet_count";
|
||||
public static final String FAVORITE_COUNT = "favorite_count";
|
||||
public static final String REPLY_COUNT = "reply_count";
|
||||
public static final String DESCENDENT_REPLY_COUNT = "descendent_reply_count";
|
||||
|
||||
/**
|
||||
* Set to an non-zero integer if the status is a retweet, set to
|
||||
|
@ -718,18 +720,21 @@ public interface TweetStore {
|
|||
|
||||
public static final String DEFAULT_SORT_ORDER = SORT_ORDER_TIMESTAMP_DESC;
|
||||
|
||||
public static final String[] COLUMNS = new String[]{_ID, ACCOUNT_ID, STATUS_ID, USER_ID, STATUS_TIMESTAMP,
|
||||
TEXT_HTML, TEXT_PLAIN, TEXT_UNESCAPED, USER_NAME, USER_SCREEN_NAME, USER_PROFILE_IMAGE_URL,
|
||||
IN_REPLY_TO_STATUS_ID, IN_REPLY_TO_USER_ID, IN_REPLY_TO_USER_NAME, IN_REPLY_TO_USER_SCREEN_NAME,
|
||||
SOURCE, LOCATION, RETWEET_COUNT, FAVORITE_COUNT, RETWEET_ID, RETWEET_TIMESTAMP, RETWEETED_BY_USER_ID,
|
||||
RETWEETED_BY_USER_NAME, RETWEETED_BY_USER_SCREEN_NAME, MY_RETWEET_ID, IS_RETWEET, IS_FAVORITE,
|
||||
IS_PROTECTED, IS_VERIFIED, IS_FOLLOWING, IS_GAP, IS_POSSIBLY_SENSITIVE, MEDIA, FIRST_MEDIA, MENTIONS};
|
||||
public static final String[] COLUMNS = new String[]{_ID, ACCOUNT_ID, STATUS_ID, USER_ID,
|
||||
STATUS_TIMESTAMP, TEXT_HTML, TEXT_PLAIN, TEXT_UNESCAPED, USER_NAME, USER_SCREEN_NAME,
|
||||
USER_PROFILE_IMAGE_URL, IN_REPLY_TO_STATUS_ID, IN_REPLY_TO_USER_ID, IN_REPLY_TO_USER_NAME,
|
||||
IN_REPLY_TO_USER_SCREEN_NAME, SOURCE, LOCATION, RETWEET_COUNT, FAVORITE_COUNT,
|
||||
REPLY_COUNT, DESCENDENT_REPLY_COUNT, RETWEET_ID, RETWEET_TIMESTAMP,
|
||||
RETWEETED_BY_USER_ID, RETWEETED_BY_USER_NAME, RETWEETED_BY_USER_SCREEN_NAME,
|
||||
MY_RETWEET_ID, IS_RETWEET, IS_FAVORITE, IS_PROTECTED, IS_VERIFIED, IS_FOLLOWING,
|
||||
IS_GAP, IS_POSSIBLY_SENSITIVE, MEDIA, FIRST_MEDIA, MENTIONS};
|
||||
|
||||
public static final String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
|
||||
TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_INT, TYPE_INT,
|
||||
TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_TEXT,
|
||||
TYPE_TEXT, TYPE_INT, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN,
|
||||
TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT};
|
||||
public static final String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_INT, TYPE_INT,
|
||||
TYPE_INT, TYPE_INT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT,
|
||||
TYPE_INT, TYPE_INT, TYPE_INT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_INT,
|
||||
TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_TEXT, TYPE_TEXT, TYPE_INT,
|
||||
TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN,
|
||||
TYPE_BOOLEAN, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -294,6 +294,8 @@ public final class ContentValuesCreator implements TwidereConstants {
|
|||
values.put(Statuses.TEXT_PLAIN, status.getText());
|
||||
values.put(Statuses.TEXT_UNESCAPED, toPlainText(text_html));
|
||||
values.put(Statuses.RETWEET_COUNT, status.getRetweetCount());
|
||||
values.put(Statuses.REPLY_COUNT, status.getReplyCount());
|
||||
values.put(Statuses.DESCENDENT_REPLY_COUNT, status.getDescendentReplyCount());
|
||||
values.put(Statuses.IN_REPLY_TO_STATUS_ID, status.getInReplyToStatusId());
|
||||
values.put(Statuses.IN_REPLY_TO_USER_ID, status.getInReplyToUserId());
|
||||
values.put(Statuses.IN_REPLY_TO_USER_NAME, Utils.getInReplyToName(status));
|
||||
|
|
|
@ -48,10 +48,12 @@ public class ImageLoaderWrapper implements Constants {
|
|||
profileOptsBuilder.showImageOnFail(R.drawable.ic_profile_image_default);
|
||||
profileOptsBuilder.showImageOnLoading(R.drawable.ic_profile_image_default);
|
||||
profileOptsBuilder.bitmapConfig(Bitmap.Config.ARGB_8888);
|
||||
profileOptsBuilder.resetViewBeforeLoading(true);
|
||||
final DisplayImageOptions.Builder imageOptsBuilder = new DisplayImageOptions.Builder();
|
||||
imageOptsBuilder.cacheInMemory(true);
|
||||
imageOptsBuilder.cacheOnDisk(true);
|
||||
imageOptsBuilder.bitmapConfig(Bitmap.Config.RGB_565);
|
||||
imageOptsBuilder.resetViewBeforeLoading(true);
|
||||
final DisplayImageOptions.Builder bannerOptsBuilder = new DisplayImageOptions.Builder();
|
||||
bannerOptsBuilder.cacheInMemory(true);
|
||||
bannerOptsBuilder.cacheOnDisk(true);
|
||||
|
|
|
@ -84,7 +84,6 @@ import android.view.Window;
|
|||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.webkit.URLUtil;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
|
@ -2421,7 +2420,8 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
}
|
||||
|
||||
public static Twitter getTwitterInstance(final Context context, final long accountId,
|
||||
final boolean includeEntities, final boolean includeRetweets, final boolean apacheHttp) {
|
||||
final boolean includeEntities,
|
||||
final boolean includeRetweets, final boolean apacheHttp) {
|
||||
if (context == null) return null;
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
|
@ -2459,10 +2459,12 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
final String consumerKey = trim(c.getString(c.getColumnIndex(Accounts.CONSUMER_KEY)));
|
||||
final String consumerSecret = trim(c.getString(c.getColumnIndex(Accounts.CONSUMER_SECRET)));
|
||||
final boolean sameOAuthSigningUrl = c.getInt(c.getColumnIndex(Accounts.SAME_OAUTH_SIGNING_URL)) == 1;
|
||||
final boolean noVersionSuffix = c.getInt(c.getColumnIndex(Accounts.NO_VERSION_SUFFIX)) == 1;
|
||||
if (!isEmpty(apiUrlFormat)) {
|
||||
cb.setRestBaseURL(getApiUrl(apiUrlFormat, "api", "/1.1/"));
|
||||
final String versionSuffix = noVersionSuffix ? null : "/1.1/";
|
||||
cb.setRestBaseURL(getApiUrl(apiUrlFormat, "api", versionSuffix));
|
||||
cb.setOAuthBaseURL(getApiUrl(apiUrlFormat, "api", "/oauth/"));
|
||||
cb.setUploadBaseURL(getApiUrl(apiUrlFormat, "upload", "/1.1/"));
|
||||
cb.setUploadBaseURL(getApiUrl(apiUrlFormat, "upload", versionSuffix));
|
||||
if (!sameOAuthSigningUrl) {
|
||||
cb.setSigningRestBaseURL(DEFAULT_SIGNING_REST_BASE_URL);
|
||||
cb.setSigningOAuthBaseURL(DEFAULT_SIGNING_OAUTH_BASE_URL);
|
||||
|
@ -2477,6 +2479,8 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
|
||||
cb.setIncludeEntitiesEnabled(includeEntities);
|
||||
cb.setIncludeRTsEnabled(includeRetweets);
|
||||
cb.setIncludeReplyCountEnabled(true);
|
||||
cb.setIncludeDescendentReplyCountEnabled(true);
|
||||
switch (c.getInt(c.getColumnIndexOrThrow(Accounts.AUTH_TYPE))) {
|
||||
case Accounts.AUTH_TYPE_OAUTH:
|
||||
case Accounts.AUTH_TYPE_XAUTH: {
|
||||
|
@ -2849,27 +2853,6 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValidImage(final File image) {
|
||||
if (image == null) return false;
|
||||
final BitmapFactory.Options o = new BitmapFactory.Options();
|
||||
o.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeFile(image.getPath(), o);
|
||||
return o.outHeight > 0 && o.outWidth > 0;
|
||||
}
|
||||
|
||||
public static boolean isValidImage(final InputStream is) {
|
||||
if (is == null) return false;
|
||||
final BitmapFactory.Options o = new BitmapFactory.Options();
|
||||
o.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeStream(is, new Rect(), o);
|
||||
return o.outHeight > 0 && o.outWidth > 0;
|
||||
}
|
||||
|
||||
public static boolean isValidUrl(final CharSequence text) {
|
||||
if (TextUtils.isEmpty(text)) return false;
|
||||
return URLUtil.isValidUrl(text.toString());
|
||||
}
|
||||
|
||||
public static final int matcherEnd(final Matcher matcher, final int group) {
|
||||
try {
|
||||
return matcher.end(group);
|
||||
|
|
|
@ -19,18 +19,22 @@
|
|||
|
||||
package org.mariotaku.twidere.view;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.view.iface.IExtendedView;
|
||||
|
||||
public class ProfileBannerImageView extends ForegroundImageView implements IExtendedView, Constants {
|
||||
|
@ -52,15 +56,19 @@ public class ProfileBannerImageView extends ForegroundImageView implements IExte
|
|||
public ProfileBannerImageView(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
if (isInEditMode()) return;
|
||||
ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, null);
|
||||
setScaleType(ScaleType.CENTER_CROP);
|
||||
// setForeground(ThemeUtils.getImageHighlightDrawable(context));
|
||||
mClipPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, null);
|
||||
} else {
|
||||
setOutlineProvider(new CropOutlineProvider(this));
|
||||
setClipToOutline(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
return true;
|
||||
return Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -109,7 +117,7 @@ public class ProfileBannerImageView extends ForegroundImageView implements IExte
|
|||
@Override
|
||||
protected void dispatchDraw(final Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
if (mBottomClip != 0) {
|
||||
if (mBottomClip != 0 && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
canvas.drawRect(getLeft(), getBottom() - mBottomClip - getTranslationY(), getRight(), getBottom(), mClipPaint);
|
||||
}
|
||||
}
|
||||
|
@ -117,5 +125,27 @@ public class ProfileBannerImageView extends ForegroundImageView implements IExte
|
|||
public void setBottomClip(int bottom) {
|
||||
mBottomClip = bottom;
|
||||
invalidate();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
invalidateOutline();
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private static class CropOutlineProvider extends ViewOutlineProvider {
|
||||
|
||||
private final ProfileBannerImageView mImageView;
|
||||
|
||||
CropOutlineProvider(ProfileBannerImageView imageView) {
|
||||
mImageView = imageView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
final int left = view.getLeft();
|
||||
final int top = view.getTop();
|
||||
final int right = view.getRight();
|
||||
final int bottom = Math.round(view.getBottom() - mImageView.mBottomClip - view.getTranslationY());
|
||||
outline.setRect(left, top, right, bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,147 +21,151 @@ import java.util.Date;
|
|||
|
||||
/**
|
||||
* A data interface representing one single status of a user.
|
||||
*
|
||||
*
|
||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
||||
*/
|
||||
public interface Status extends Comparable<Status>, TwitterResponse, ExtendedEntitySupport, Serializable {
|
||||
|
||||
/**
|
||||
* Returns an array of contributors, or null if no contributor is associated
|
||||
* with this status.
|
||||
*
|
||||
* @since Twitter4J 2.2.3
|
||||
*/
|
||||
long[] getContributors();
|
||||
/**
|
||||
* Returns an array of contributors, or null if no contributor is associated
|
||||
* with this status.
|
||||
*
|
||||
* @since Twitter4J 2.2.3
|
||||
*/
|
||||
long[] getContributors();
|
||||
|
||||
/**
|
||||
* returns the created_at
|
||||
*
|
||||
* @return the created_at
|
||||
*/
|
||||
Date getCreatedAt();
|
||||
long getReplyCount();
|
||||
|
||||
long getCurrentUserRetweet();
|
||||
long getDescendentReplyCount();
|
||||
|
||||
long getFavoriteCount();
|
||||
/**
|
||||
* returns the created_at
|
||||
*
|
||||
* @return the created_at
|
||||
*/
|
||||
Date getCreatedAt();
|
||||
|
||||
/**
|
||||
* Returns The location that this tweet refers to if available.
|
||||
*
|
||||
* @return returns The location that this tweet refers to if available (can
|
||||
* be null)
|
||||
*/
|
||||
GeoLocation getGeoLocation();
|
||||
long getCurrentUserRetweet();
|
||||
|
||||
/**
|
||||
* returns the status id of the tweet
|
||||
*
|
||||
* @return the status id
|
||||
*/
|
||||
long getId();
|
||||
long getFavoriteCount();
|
||||
|
||||
/**
|
||||
* Returns the in_reply_to_screen_name
|
||||
*
|
||||
* @return the in_in_reply_to_screen_name
|
||||
* @since Twitter4J 2.0.4
|
||||
*/
|
||||
String getInReplyToScreenName();
|
||||
/**
|
||||
* Returns The location that this tweet refers to if available.
|
||||
*
|
||||
* @return returns The location that this tweet refers to if available (can
|
||||
* be null)
|
||||
*/
|
||||
GeoLocation getGeoLocation();
|
||||
|
||||
/**
|
||||
* Returns the in_reply_tostatus_id
|
||||
*
|
||||
* @return the in_reply_tostatus_id
|
||||
*/
|
||||
long getInReplyToStatusId();
|
||||
/**
|
||||
* returns the status id of the tweet
|
||||
*
|
||||
* @return the status id
|
||||
*/
|
||||
long getId();
|
||||
|
||||
/**
|
||||
* Returns the in_reply_user_id
|
||||
*
|
||||
* @return the in_reply_tostatus_id
|
||||
* @since Twitter4J 1.0.4
|
||||
*/
|
||||
long getInReplyToUserId();
|
||||
/**
|
||||
* Returns the in_reply_to_screen_name
|
||||
*
|
||||
* @return the in_in_reply_to_screen_name
|
||||
* @since Twitter4J 2.0.4
|
||||
*/
|
||||
String getInReplyToScreenName();
|
||||
|
||||
/**
|
||||
* Returns the place associated with the Tweet.
|
||||
*
|
||||
* @return The place associated with the Tweet
|
||||
*/
|
||||
Place getPlace();
|
||||
/**
|
||||
* Returns the in_reply_tostatus_id
|
||||
*
|
||||
* @return the in_reply_tostatus_id
|
||||
*/
|
||||
long getInReplyToStatusId();
|
||||
|
||||
/**
|
||||
* returns the raw text
|
||||
*
|
||||
* @return the raw text
|
||||
*/
|
||||
String getRawText();
|
||||
/**
|
||||
* Returns the in_reply_user_id
|
||||
*
|
||||
* @return the in_reply_tostatus_id
|
||||
* @since Twitter4J 1.0.4
|
||||
*/
|
||||
long getInReplyToUserId();
|
||||
|
||||
/**
|
||||
* Returns the number of times this tweet has been retweeted, or -1 when the
|
||||
* tweet was created before this feature was enabled.
|
||||
*
|
||||
* @return the retweet count.
|
||||
*/
|
||||
long getRetweetCount();
|
||||
/**
|
||||
* Returns the place associated with the Tweet.
|
||||
*
|
||||
* @return The place associated with the Tweet
|
||||
*/
|
||||
Place getPlace();
|
||||
|
||||
/**
|
||||
* @since Twitter4J 2.1.0
|
||||
*/
|
||||
Status getRetweetedStatus();
|
||||
/**
|
||||
* returns the raw text
|
||||
*
|
||||
* @return the raw text
|
||||
*/
|
||||
String getRawText();
|
||||
|
||||
/**
|
||||
* returns the source of the tweet
|
||||
*
|
||||
* @return the source of the tweet
|
||||
*/
|
||||
String getSource();
|
||||
/**
|
||||
* Returns the number of times this tweet has been retweeted, or -1 when the
|
||||
* tweet was created before this feature was enabled.
|
||||
*
|
||||
* @return the retweet count.
|
||||
*/
|
||||
long getRetweetCount();
|
||||
|
||||
/**
|
||||
* returns the text
|
||||
*
|
||||
* @return the text
|
||||
*/
|
||||
String getText();
|
||||
/**
|
||||
* @since Twitter4J 2.1.0
|
||||
*/
|
||||
Status getRetweetedStatus();
|
||||
|
||||
/**
|
||||
* Return the user associated with the status.<br>
|
||||
* This can be null if the instance if from User.getStatus().
|
||||
*
|
||||
* @return the user
|
||||
*/
|
||||
User getUser();
|
||||
/**
|
||||
* returns the source of the tweet
|
||||
*
|
||||
* @return the source of the tweet
|
||||
*/
|
||||
String getSource();
|
||||
|
||||
/**
|
||||
* Test if the status is favorited
|
||||
*
|
||||
* @return true if favorited
|
||||
* @since Twitter4J 1.0.4
|
||||
*/
|
||||
boolean isFavorited();
|
||||
/**
|
||||
* returns the text
|
||||
*
|
||||
* @return the text
|
||||
*/
|
||||
String getText();
|
||||
|
||||
boolean isPossiblySensitive();
|
||||
/**
|
||||
* Return the user associated with the status.<br>
|
||||
* This can be null if the instance if from User.getStatus().
|
||||
*
|
||||
* @return the user
|
||||
*/
|
||||
User getUser();
|
||||
|
||||
/**
|
||||
* @since Twitter4J 2.0.10
|
||||
*/
|
||||
boolean isRetweet();
|
||||
/**
|
||||
* Test if the status is favorited
|
||||
*
|
||||
* @return true if favorited
|
||||
* @since Twitter4J 1.0.4
|
||||
*/
|
||||
boolean isFavorited();
|
||||
|
||||
/**
|
||||
* Returns true if the authenticating user has retweeted this tweet, or
|
||||
* false when the tweet was created before this feature was enabled.
|
||||
*
|
||||
* @return whether the authenticating user has retweeted this tweet.
|
||||
* @since Twitter4J 2.1.4
|
||||
*/
|
||||
boolean isRetweetedByMe();
|
||||
boolean isPossiblySensitive();
|
||||
|
||||
/**
|
||||
* Test if the status is truncated
|
||||
*
|
||||
* @return true if truncated
|
||||
* @since Twitter4J 1.0.4
|
||||
*/
|
||||
boolean isTruncated();
|
||||
/**
|
||||
* @since Twitter4J 2.0.10
|
||||
*/
|
||||
boolean isRetweet();
|
||||
|
||||
/**
|
||||
* Returns true if the authenticating user has retweeted this tweet, or
|
||||
* false when the tweet was created before this feature was enabled.
|
||||
*
|
||||
* @return whether the authenticating user has retweeted this tweet.
|
||||
* @since Twitter4J 2.1.4
|
||||
*/
|
||||
boolean isRetweetedByMe();
|
||||
|
||||
/**
|
||||
* Test if the status is truncated
|
||||
*
|
||||
* @return true if truncated
|
||||
* @since Twitter4J 1.0.4
|
||||
*/
|
||||
boolean isTruncated();
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,48 +24,52 @@ import twitter4j.http.HttpClientWrapperConfiguration;
|
|||
* @author Yusuke Yamamoto - yusuke at mac.com
|
||||
*/
|
||||
public interface Configuration extends HttpClientConfiguration, HttpClientWrapperConfiguration,
|
||||
AuthorizationConfiguration {
|
||||
AuthorizationConfiguration {
|
||||
|
||||
String getClientName();
|
||||
String getClientName();
|
||||
|
||||
String getClientURL();
|
||||
String getClientURL();
|
||||
|
||||
String getClientVersion();
|
||||
String getClientVersion();
|
||||
|
||||
String getOAuthAccessTokenURL();
|
||||
String getOAuthAccessTokenURL();
|
||||
|
||||
String getOAuthAuthenticationURL();
|
||||
String getOAuthAuthenticationURL();
|
||||
|
||||
String getOAuthAuthorizationURL();
|
||||
String getOAuthAuthorizationURL();
|
||||
|
||||
String getOAuthBaseURL();
|
||||
String getOAuthBaseURL();
|
||||
|
||||
String getOAuthRequestTokenURL();
|
||||
String getOAuthRequestTokenURL();
|
||||
|
||||
String getRestBaseURL();
|
||||
String getRestBaseURL();
|
||||
|
||||
String getSigningOAuthAccessTokenURL();
|
||||
String getSigningOAuthAccessTokenURL();
|
||||
|
||||
String getSigningOAuthAuthenticationURL();
|
||||
String getSigningOAuthAuthenticationURL();
|
||||
|
||||
String getSigningOAuthAuthorizationURL();
|
||||
String getSigningOAuthAuthorizationURL();
|
||||
|
||||
String getSigningOAuthBaseURL();
|
||||
String getSigningOAuthBaseURL();
|
||||
|
||||
String getSigningOAuthRequestTokenURL();
|
||||
String getSigningOAuthRequestTokenURL();
|
||||
|
||||
String getSigningRestBaseURL();
|
||||
String getSigningRestBaseURL();
|
||||
|
||||
String getSigningUploadBaseURL();
|
||||
String getSigningUploadBaseURL();
|
||||
|
||||
String getUploadBaseURL();
|
||||
String getUploadBaseURL();
|
||||
|
||||
boolean isDebugEnabled();
|
||||
boolean isDebugEnabled();
|
||||
|
||||
boolean isIncludeEntitiesEnabled();
|
||||
boolean isIncludeEntitiesEnabled();
|
||||
|
||||
boolean isIncludeRTsEnabled();
|
||||
boolean isIncludeRTsEnabled();
|
||||
|
||||
boolean isTwitterClientHeaderIncluded();
|
||||
boolean isIncludeReplyCountEnabled();
|
||||
|
||||
boolean isIncludeDescendentReplyCountEnabled();
|
||||
|
||||
boolean isTwitterClientHeaderIncluded();
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,285 +25,301 @@ import twitter4j.http.HttpClientFactory;
|
|||
* {@code new ConfigurationBuilder().build()} would create a usable
|
||||
* configuration. This configuration builder is useful for clients that wish to
|
||||
* configure twitter4j in unit tests or from command line flags for example.
|
||||
*
|
||||
*
|
||||
* @author John Sirois - john.sirois at gmail.com
|
||||
*/
|
||||
public final class ConfigurationBuilder {
|
||||
|
||||
private ConfigurationBase configuration = new ConfigurationBase();
|
||||
private ConfigurationBase configuration = new ConfigurationBase();
|
||||
|
||||
public ConfigurationBuilder() {
|
||||
public ConfigurationBuilder() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public ConfigurationBuilder(final Configuration conf) {
|
||||
configuration.setClientName(conf.getClientName());
|
||||
configuration.setClientURL(conf.getClientURL());
|
||||
configuration.setClientVersion(conf.getClientVersion());
|
||||
configuration.setDebug(conf.isDebugEnabled());
|
||||
configuration.setGZIPEnabled(conf.isGZIPEnabled());
|
||||
configuration.setHostAddressResolverFactory(conf.getHostAddressResolverFactory());
|
||||
configuration.setHttpClientFactory(conf.getHttpClientFactory());
|
||||
configuration.setHttpConnectionTimeout(conf.getHttpConnectionTimeout());
|
||||
configuration.setHttpDefaultMaxPerRoute(conf.getHttpDefaultMaxPerRoute());
|
||||
configuration.setHttpMaxTotalConnections(conf.getHttpMaxTotalConnections());
|
||||
configuration.setHttpProxyHost(conf.getHttpProxyHost());
|
||||
configuration.setHttpProxyPassword(conf.getHttpProxyPassword());
|
||||
configuration.setHttpProxyPort(conf.getHttpProxyPort());
|
||||
configuration.setHttpProxyUser(conf.getHttpProxyUser());
|
||||
configuration.setHttpReadTimeout(conf.getHttpReadTimeout());
|
||||
configuration.setHttpRetryCount(conf.getHttpRetryCount());
|
||||
configuration.setHttpRetryIntervalSeconds(conf.getHttpRetryIntervalSeconds());
|
||||
configuration.setHttpUserAgent(conf.getHttpUserAgent());
|
||||
configuration.setIgnoreSSLError(conf.isSSLErrorIgnored());
|
||||
configuration.setIncludeEntitiesEnbled(conf.isIncludeEntitiesEnabled());
|
||||
configuration.setIncludeRTsEnbled(conf.isIncludeRTsEnabled());
|
||||
configuration.setIncludeTwitterClientHeader(conf.isTwitterClientHeaderIncluded());
|
||||
configuration.setOAuthAccessToken(conf.getOAuthAccessToken());
|
||||
configuration.setOAuthAccessTokenSecret(conf.getOAuthAccessTokenSecret());
|
||||
configuration.setOAuthBaseURL(conf.getOAuthBaseURL());
|
||||
configuration.setOAuthConsumerKey(conf.getOAuthConsumerKey());
|
||||
configuration.setOAuthConsumerSecret(conf.getOAuthConsumerSecret());
|
||||
configuration.setPassword(conf.getPassword());
|
||||
configuration.setPrettyDebugEnabled(conf.isPrettyDebugEnabled());
|
||||
configuration.setRestBaseURL(conf.getRestBaseURL());
|
||||
configuration.setSigningOAuthBaseURL(conf.getSigningOAuthBaseURL());
|
||||
configuration.setSigningRestBaseURL(conf.getSigningRestBaseURL());
|
||||
configuration.setUploadBaseURL(conf.getUploadBaseURL());
|
||||
configuration.setSigningUploadBaseURL(conf.getSigningUploadBaseURL());
|
||||
configuration.setUser(conf.getUser());
|
||||
configuration.setUseSSL(conf.isSSLEnabled());
|
||||
public ConfigurationBuilder(final Configuration conf) {
|
||||
configuration.setClientName(conf.getClientName());
|
||||
configuration.setClientURL(conf.getClientURL());
|
||||
configuration.setClientVersion(conf.getClientVersion());
|
||||
configuration.setDebug(conf.isDebugEnabled());
|
||||
configuration.setGZIPEnabled(conf.isGZIPEnabled());
|
||||
configuration.setHostAddressResolverFactory(conf.getHostAddressResolverFactory());
|
||||
configuration.setHttpClientFactory(conf.getHttpClientFactory());
|
||||
configuration.setHttpConnectionTimeout(conf.getHttpConnectionTimeout());
|
||||
configuration.setHttpDefaultMaxPerRoute(conf.getHttpDefaultMaxPerRoute());
|
||||
configuration.setHttpMaxTotalConnections(conf.getHttpMaxTotalConnections());
|
||||
configuration.setHttpProxyHost(conf.getHttpProxyHost());
|
||||
configuration.setHttpProxyPassword(conf.getHttpProxyPassword());
|
||||
configuration.setHttpProxyPort(conf.getHttpProxyPort());
|
||||
configuration.setHttpProxyUser(conf.getHttpProxyUser());
|
||||
configuration.setHttpReadTimeout(conf.getHttpReadTimeout());
|
||||
configuration.setHttpRetryCount(conf.getHttpRetryCount());
|
||||
configuration.setHttpRetryIntervalSeconds(conf.getHttpRetryIntervalSeconds());
|
||||
configuration.setHttpUserAgent(conf.getHttpUserAgent());
|
||||
configuration.setIgnoreSSLError(conf.isSSLErrorIgnored());
|
||||
configuration.setIncludeEntitiesEnabled(conf.isIncludeEntitiesEnabled());
|
||||
configuration.setIncludeRTsEnabled(conf.isIncludeRTsEnabled());
|
||||
configuration.setIncludeReplyCountEnabled(conf.isIncludeReplyCountEnabled());
|
||||
configuration.setIncludeDescendentReplyCountEnabled(conf.isIncludeDescendentReplyCountEnabled());
|
||||
configuration.setIncludeRTsEnabled(conf.isIncludeRTsEnabled());
|
||||
configuration.setIncludeTwitterClientHeader(conf.isTwitterClientHeaderIncluded());
|
||||
configuration.setOAuthAccessToken(conf.getOAuthAccessToken());
|
||||
configuration.setOAuthAccessTokenSecret(conf.getOAuthAccessTokenSecret());
|
||||
configuration.setOAuthBaseURL(conf.getOAuthBaseURL());
|
||||
configuration.setOAuthConsumerKey(conf.getOAuthConsumerKey());
|
||||
configuration.setOAuthConsumerSecret(conf.getOAuthConsumerSecret());
|
||||
configuration.setPassword(conf.getPassword());
|
||||
configuration.setPrettyDebugEnabled(conf.isPrettyDebugEnabled());
|
||||
configuration.setRestBaseURL(conf.getRestBaseURL());
|
||||
configuration.setSigningOAuthBaseURL(conf.getSigningOAuthBaseURL());
|
||||
configuration.setSigningRestBaseURL(conf.getSigningRestBaseURL());
|
||||
configuration.setUploadBaseURL(conf.getUploadBaseURL());
|
||||
configuration.setSigningUploadBaseURL(conf.getSigningUploadBaseURL());
|
||||
configuration.setUser(conf.getUser());
|
||||
configuration.setUseSSL(conf.isSSLEnabled());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Configuration build() {
|
||||
checkNotBuilt();
|
||||
configuration.cacheInstance();
|
||||
try {
|
||||
return configuration;
|
||||
} finally {
|
||||
configuration = null;
|
||||
}
|
||||
}
|
||||
public Configuration build() {
|
||||
checkNotBuilt();
|
||||
configuration.cacheInstance();
|
||||
try {
|
||||
return configuration;
|
||||
} finally {
|
||||
configuration = null;
|
||||
}
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setClientName(final String clientName) {
|
||||
checkNotBuilt();
|
||||
configuration.setClientName(clientName);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setClientName(final String clientName) {
|
||||
checkNotBuilt();
|
||||
configuration.setClientName(clientName);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setClientURL(final String clientURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setClientURL(clientURL);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setClientURL(final String clientURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setClientURL(clientURL);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setClientVersion(final String clientVersion) {
|
||||
checkNotBuilt();
|
||||
configuration.setClientVersion(clientVersion);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setClientVersion(final String clientVersion) {
|
||||
checkNotBuilt();
|
||||
configuration.setClientVersion(clientVersion);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setDebugEnabled(final boolean debugEnabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setDebug(debugEnabled);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setDebugEnabled(final boolean debugEnabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setDebug(debugEnabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setGZIPEnabled(final boolean gzipEnabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setGZIPEnabled(gzipEnabled);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setGZIPEnabled(final boolean gzipEnabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setGZIPEnabled(gzipEnabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHostAddressResolverFactory(final HostAddressResolverFactory factory) {
|
||||
checkNotBuilt();
|
||||
configuration.setHostAddressResolverFactory(factory);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHostAddressResolverFactory(final HostAddressResolverFactory factory) {
|
||||
checkNotBuilt();
|
||||
configuration.setHostAddressResolverFactory(factory);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpClientFactory(final HttpClientFactory factory) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpClientFactory(factory);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpClientFactory(final HttpClientFactory factory) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpClientFactory(factory);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpConnectionTimeout(final int httpConnectionTimeout) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpConnectionTimeout(httpConnectionTimeout);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpConnectionTimeout(final int httpConnectionTimeout) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpConnectionTimeout(httpConnectionTimeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpDefaultMaxPerRoute(final int httpDefaultMaxPerRoute) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpDefaultMaxPerRoute(httpDefaultMaxPerRoute);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpDefaultMaxPerRoute(final int httpDefaultMaxPerRoute) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpDefaultMaxPerRoute(httpDefaultMaxPerRoute);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpMaxTotalConnections(final int httpMaxConnections) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpMaxTotalConnections(httpMaxConnections);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpMaxTotalConnections(final int httpMaxConnections) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpMaxTotalConnections(httpMaxConnections);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpProxyHost(final String httpProxyHost) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpProxyHost(httpProxyHost);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpProxyHost(final String httpProxyHost) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpProxyHost(httpProxyHost);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpProxyPassword(final String httpProxyPassword) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpProxyPassword(httpProxyPassword);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpProxyPassword(final String httpProxyPassword) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpProxyPassword(httpProxyPassword);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpProxyPort(final int httpProxyPort) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpProxyPort(httpProxyPort);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpProxyPort(final int httpProxyPort) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpProxyPort(httpProxyPort);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpProxyUser(final String httpProxyUser) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpProxyUser(httpProxyUser);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpProxyUser(final String httpProxyUser) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpProxyUser(httpProxyUser);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpReadTimeout(final int httpReadTimeout) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpReadTimeout(httpReadTimeout);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpReadTimeout(final int httpReadTimeout) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpReadTimeout(httpReadTimeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpRetryCount(final int httpRetryCount) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpRetryCount(httpRetryCount);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpRetryCount(final int httpRetryCount) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpRetryCount(httpRetryCount);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpRetryIntervalSeconds(final int httpRetryIntervalSeconds) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpRetryIntervalSeconds(httpRetryIntervalSeconds);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpRetryIntervalSeconds(final int httpRetryIntervalSeconds) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpRetryIntervalSeconds(httpRetryIntervalSeconds);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setHttpUserAgent(final String userAgent) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpUserAgent(userAgent);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setHttpUserAgent(final String userAgent) {
|
||||
checkNotBuilt();
|
||||
configuration.setHttpUserAgent(userAgent);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setIgnoreSSLError(final boolean ignoreSSLError) {
|
||||
checkNotBuilt();
|
||||
configuration.setIgnoreSSLError(ignoreSSLError);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setIgnoreSSLError(final boolean ignoreSSLError) {
|
||||
checkNotBuilt();
|
||||
configuration.setIgnoreSSLError(ignoreSSLError);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setIncludeEntitiesEnabled(final boolean enabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setIncludeEntitiesEnbled(enabled);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setIncludeEntitiesEnabled(final boolean enabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setIncludeEntitiesEnabled(enabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setIncludeRTsEnabled(final boolean enabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setIncludeRTsEnbled(enabled);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setIncludeRTsEnabled(final boolean enabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setIncludeRTsEnabled(enabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setIncludeTwitterClientHeader(final boolean includeTwitterClientHeader) {
|
||||
checkNotBuilt();
|
||||
configuration.setIncludeTwitterClientHeader(includeTwitterClientHeader);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setOAuthAccessToken(final String oAuthAccessToken) {
|
||||
checkNotBuilt();
|
||||
configuration.setOAuthAccessToken(oAuthAccessToken);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setIncludeReplyCountEnabled(final boolean enabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setIncludeReplyCountEnabled(enabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setOAuthAccessTokenSecret(final String oAuthAccessTokenSecret) {
|
||||
checkNotBuilt();
|
||||
configuration.setOAuthAccessTokenSecret(oAuthAccessTokenSecret);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setIncludeDescendentReplyCountEnabled(final boolean enabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setIncludeDescendentReplyCountEnabled(enabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setOAuthBaseURL(final String oAuthBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setOAuthBaseURL(oAuthBaseURL);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setIncludeTwitterClientHeader(final boolean includeTwitterClientHeader) {
|
||||
checkNotBuilt();
|
||||
configuration.setIncludeTwitterClientHeader(includeTwitterClientHeader);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setOAuthConsumerKey(final String oAuthConsumerKey) {
|
||||
checkNotBuilt();
|
||||
configuration.setOAuthConsumerKey(oAuthConsumerKey);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setOAuthAccessToken(final String oAuthAccessToken) {
|
||||
checkNotBuilt();
|
||||
configuration.setOAuthAccessToken(oAuthAccessToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setOAuthConsumerSecret(final String oAuthConsumerSecret) {
|
||||
checkNotBuilt();
|
||||
configuration.setOAuthConsumerSecret(oAuthConsumerSecret);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setOAuthAccessTokenSecret(final String oAuthAccessTokenSecret) {
|
||||
checkNotBuilt();
|
||||
configuration.setOAuthAccessTokenSecret(oAuthAccessTokenSecret);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setPassword(final String password) {
|
||||
checkNotBuilt();
|
||||
configuration.setPassword(password);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setOAuthBaseURL(final String oAuthBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setOAuthBaseURL(oAuthBaseURL);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setPrettyDebugEnabled(final boolean prettyDebugEnabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setPrettyDebugEnabled(prettyDebugEnabled);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setOAuthConsumerKey(final String oAuthConsumerKey) {
|
||||
checkNotBuilt();
|
||||
configuration.setOAuthConsumerKey(oAuthConsumerKey);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setRestBaseURL(final String restBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setRestBaseURL(restBaseURL);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setOAuthConsumerSecret(final String oAuthConsumerSecret) {
|
||||
checkNotBuilt();
|
||||
configuration.setOAuthConsumerSecret(oAuthConsumerSecret);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setSigningOAuthBaseURL(final String signingOAuthBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setSigningOAuthBaseURL(signingOAuthBaseURL);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setPassword(final String password) {
|
||||
checkNotBuilt();
|
||||
configuration.setPassword(password);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setSigningRestBaseURL(final String signingRestBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setSigningRestBaseURL(signingRestBaseURL);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setPrettyDebugEnabled(final boolean prettyDebugEnabled) {
|
||||
checkNotBuilt();
|
||||
configuration.setPrettyDebugEnabled(prettyDebugEnabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setSigningUploadBaseURL(final String signingUploadBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setSigningUploadBaseURL(signingUploadBaseURL);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setRestBaseURL(final String restBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setRestBaseURL(restBaseURL);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setUploadBaseURL(final String uploadBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setUploadBaseURL(uploadBaseURL);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setSigningOAuthBaseURL(final String signingOAuthBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setSigningOAuthBaseURL(signingOAuthBaseURL);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setUser(final String user) {
|
||||
checkNotBuilt();
|
||||
configuration.setUser(user);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setSigningRestBaseURL(final String signingRestBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setSigningRestBaseURL(signingRestBaseURL);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setUseSSL(final boolean useSSL) {
|
||||
checkNotBuilt();
|
||||
configuration.setUseSSL(useSSL);
|
||||
return this;
|
||||
}
|
||||
public ConfigurationBuilder setSigningUploadBaseURL(final String signingUploadBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setSigningUploadBaseURL(signingUploadBaseURL);
|
||||
return this;
|
||||
}
|
||||
|
||||
private void checkNotBuilt() {
|
||||
if (configuration == null)
|
||||
throw new IllegalStateException("Cannot use this builder any longer, build() has already been called");
|
||||
}
|
||||
public ConfigurationBuilder setUploadBaseURL(final String uploadBaseURL) {
|
||||
checkNotBuilt();
|
||||
configuration.setUploadBaseURL(uploadBaseURL);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setUser(final String user) {
|
||||
checkNotBuilt();
|
||||
configuration.setUser(user);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationBuilder setUseSSL(final boolean useSSL) {
|
||||
checkNotBuilt();
|
||||
configuration.setUseSSL(useSSL);
|
||||
return this;
|
||||
}
|
||||
|
||||
private void checkNotBuilt() {
|
||||
if (configuration == null)
|
||||
throw new IllegalStateException("Cannot use this builder any longer, build() has already been called");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,17 @@ final class StatusJSONImpl extends TwitterResponseImpl implements Status {
|
|||
private Place place = null;
|
||||
private long retweetCount;
|
||||
private long favoriteCount;
|
||||
|
||||
public long getReplyCount() {
|
||||
return replyCount;
|
||||
}
|
||||
|
||||
public long getDescendentReplyCount() {
|
||||
return descendentReplyCount;
|
||||
}
|
||||
|
||||
private long replyCount;
|
||||
private long descendentReplyCount;
|
||||
private boolean wasRetweetedByMe;
|
||||
private boolean isPossiblySensitive;
|
||||
|
||||
|
@ -350,6 +361,8 @@ final class StatusJSONImpl extends TwitterResponseImpl implements Status {
|
|||
isPossiblySensitive = getBoolean("possibly_sensitive", json);
|
||||
retweetCount = getLong("retweet_count", json);
|
||||
favoriteCount = getLong("favorite_count", json);
|
||||
replyCount = getLong("reply_count", json);
|
||||
descendentReplyCount = getLong("descendent_reply_count", json);
|
||||
try {
|
||||
if (!json.isNull("user")) {
|
||||
user = new UserJSONImpl(json.getJSONObject("user"));
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#00000000"
|
||||
android:centerColor="#00000000"
|
||||
android:startColor="#80000000"/>
|
||||
|
||||
</shape>
|
|
@ -1,245 +1,259 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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="wrap_content">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<org.mariotaku.twidere.view.CardItemLinearLayout
|
||||
android:id="@+id/card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
<org.mariotaku.twidere.view.CardItemLinearLayout
|
||||
android:id="@+id/card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
||||
android:id="@+id/profile"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
app:ignorePadding="true">
|
||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
||||
android:id="@+id/profile"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
app:ignorePadding="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_image"
|
||||
android:layout_width="@dimen/icon_size_card_details"
|
||||
android:layout_height="@dimen/icon_size_card_details"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
<ImageView
|
||||
android:id="@+id/profile_image"
|
||||
android:layout_width="@dimen/icon_size_card_details"
|
||||
android:layout_height="@dimen/icon_size_card_details"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@+id/follow_indicator"
|
||||
android:layout_toRightOf="@+id/profile_image"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="4dp">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@+id/follow_indicator"
|
||||
android:layout_toRightOf="@+id/profile_image"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="4dp">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/screen_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/screen_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/follow_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="gone">
|
||||
<FrameLayout
|
||||
android:id="@+id/follow_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<Button
|
||||
android:id="@+id/follow"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/follow"/>
|
||||
<Button
|
||||
android:id="@+id/follow"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/follow"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/follow_info_progress"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"/>
|
||||
</FrameLayout>
|
||||
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
|
||||
<ProgressBar
|
||||
android:id="@+id/follow_info_progress"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"/>
|
||||
</FrameLayout>
|
||||
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:background="#40808080"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:background="#40808080"/>
|
||||
|
||||
<include
|
||||
layout="@layout/image_preview_grid"
|
||||
android:visibility="gone"/>
|
||||
<include
|
||||
layout="@layout/image_preview_grid"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<org.mariotaku.twidere.view.StatusTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:singleLine="false"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textIsSelectable="true"/>
|
||||
<org.mariotaku.twidere.view.StatusTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:singleLine="false"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/location_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
<RelativeLayout
|
||||
android:id="@+id/location_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<org.mariotaku.twidere.view.MapImageView
|
||||
android:id="@+id/map_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_map"
|
||||
android:contentDescription="@string/location"
|
||||
android:duplicateParentState="true"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:scaleType="centerCrop"/>
|
||||
<org.mariotaku.twidere.view.MapImageView
|
||||
android:id="@+id/map_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_map"
|
||||
android:contentDescription="@string/location"
|
||||
android:duplicateParentState="true"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/location_background_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/location_view"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignTop="@+id/location_view"
|
||||
android:alpha="0.5"
|
||||
android:background="?cardItemBackgroundColor"/>
|
||||
<View
|
||||
android:id="@+id/location_background_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/location_view"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignTop="@+id/location_view"
|
||||
android:alpha="0.5"
|
||||
android:background="?cardItemBackgroundColor"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/location_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:drawableLeft="@drawable/ic_indicator_location"
|
||||
android:drawablePadding="4dp"
|
||||
android:duplicateParentState="true"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:singleLine="true"
|
||||
android:text="@string/view_map"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</RelativeLayout>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/location_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:drawableLeft="@drawable/ic_indicator_location"
|
||||
android:drawablePadding="4dp"
|
||||
android:duplicateParentState="true"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:singleLine="true"
|
||||
android:text="@string/view_map"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/time_source"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_indicator_twitter"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/time_source"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_indicator_twitter"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/button_bar_height"
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/button_bar_height"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/favorites_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:minWidth="@dimen/button_width_content_min"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
<LinearLayout
|
||||
android:id="@+id/replies_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:minWidth="@dimen/button_width_content_min"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/favorites_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/replies_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/favorites"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/replies"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/retweets_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:minWidth="@dimen/button_width_content_min"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
<LinearLayout
|
||||
android:id="@+id/favorites_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:minWidth="@dimen/button_width_content_min"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/retweets_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/favorites_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/retweets"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/favorites"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/replies_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:drawableLeft="@drawable/ic_indicator_reply"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:singleLine="true"
|
||||
android:text="@string/view_replies"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/retweets_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:minWidth="@dimen/button_width_content_min"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/in_reply_to"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:drawableLeft="@drawable/ic_indicator_conversation"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:visibility="gone"/>
|
||||
</org.mariotaku.twidere.view.CardItemLinearLayout>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/retweets_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/retweets"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/in_reply_to"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:drawableLeft="@drawable/ic_indicator_conversation"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:visibility="gone"/>
|
||||
</org.mariotaku.twidere.view.CardItemLinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -5,5 +5,5 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:foreground="@drawable/shadow_bottom"
|
||||
android:foreground="@drawable/shadow_user_banner_image"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<dimen name="pane_spacing_left">150dp</dimen>
|
||||
<dimen name="pane_spacing_right">150dp</dimen>
|
||||
<dimen name="icon_size_wizard_large">480dp</dimen>
|
||||
<dimen name="icon_size_user_profile">96dp</dimen>
|
||||
<dimen name="icon_size_user_profile">108dp</dimen>
|
||||
<dimen name="drawer_width_home">320dp</dimen>
|
||||
<dimen name="accounts_drawer_name_size">18sp</dimen>
|
||||
<dimen name="accounts_drawer_screen_name_size">16sp</dimen>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<dimen name="icon_size_card_list_item">48dp</dimen>
|
||||
<dimen name="icon_size_card_details">56dp</dimen>
|
||||
<dimen name="icon_size_wizard_large">240dp</dimen>
|
||||
<dimen name="icon_size_user_profile">64dp</dimen>
|
||||
<dimen name="icon_size_user_profile">84dp</dimen>
|
||||
<dimen name="profile_image_size_activity_small">32dp</dimen>
|
||||
<dimen name="default_sliding_menu_shadow_width">8dp</dimen>
|
||||
<dimen name="default_sliding_menu_margin_threshold">16dp</dimen>
|
||||
|
|
|
@ -662,5 +662,11 @@
|
|||
<string name="mute_user_confirm_message">Mute <xliff:g id="name">%s</xliff:g>? You will no longer see tweets from this user while keep following this user.</string>
|
||||
<string name="remove_from_filter">Remove from filter</string>
|
||||
<string name="sort_timeline_by_id">Sort timeline by ID</string>
|
||||
<string name="style">Style</string>
|
||||
<string name="color">Color</string>
|
||||
<string name="font_family">Font family</string>
|
||||
<string name="appearance">Appearance</string>
|
||||
<string name="function">Function</string>
|
||||
<string name="replies">Replies</string>
|
||||
|
||||
</resources>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<header android:title="@string/look_and_feel"/>
|
||||
<header android:title="@string/appearance"/>
|
||||
<header
|
||||
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
|
||||
android:icon="@drawable/ic_action_color_palette"
|
||||
|
@ -26,7 +26,7 @@
|
|||
android:name="resid"
|
||||
android:value="@xml/settings_cards"/>
|
||||
</header>
|
||||
<header android:title="@string/settings"/>
|
||||
<header android:title="@string/function"/>
|
||||
<header
|
||||
android:fragment="org.mariotaku.twidere.fragment.CustomTabsFragment"
|
||||
android:icon="@drawable/ic_action_tab"
|
||||
|
|
|
@ -6,10 +6,6 @@
|
|||
android:defaultValue="true"
|
||||
android:key="unread_count"
|
||||
android:title="@string/unread_count"/>
|
||||
<org.mariotaku.twidere.preference.AutoFixCheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="bottom_send_button"
|
||||
android:title="@string/bottom_send_button"/>
|
||||
|
||||
<org.mariotaku.twidere.preference.LeftsideComposeButtonPreference
|
||||
android:defaultValue="false"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
android:entryValues="@array/values_theme"
|
||||
android:key="theme"
|
||||
android:order="21"
|
||||
android:title="@string/theme"/>
|
||||
android:title="@string/style"/>
|
||||
|
||||
<org.mariotaku.twidere.preference.ThemeBackgroundPreference
|
||||
android:defaultValue="default"
|
||||
|
@ -27,13 +27,13 @@
|
|||
android:defaultValue="@android:color/holo_blue_light"
|
||||
android:key="theme_color"
|
||||
android:order="25"
|
||||
android:title="@string/theme_color"/>
|
||||
android:title="@string/color"/>
|
||||
|
||||
<org.mariotaku.twidere.preference.ThemeFontFamilyPreference
|
||||
android:defaultValue="sans-serif-light"
|
||||
android:enabled="@bool/has_font_family"
|
||||
android:key="theme_font_family"
|
||||
android:order="26"
|
||||
android:title="@string/theme_font_family"/>
|
||||
android:title="@string/font_family"/>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue