fixing builtin DNS lookup

force in_reply_to_status_id for quote retweet
This commit is contained in:
Mariotaku Lee 2016-02-11 12:27:48 +08:00
parent 44f71c75e7
commit 306f588054
14 changed files with 87 additions and 118 deletions

View File

@ -181,7 +181,7 @@ public class ParcelableMedia implements Parcelable {
final String mimetype = attachment.getMimetype();
if (mimetype != null && mimetype.startsWith("image/")) {
ParcelableMedia media = new ParcelableMedia();
media.type = Type.TYPE_IMAGE;
media.type = Type.IMAGE;
media.width = attachment.getWidth();
media.height = attachment.getHeight();
media.url = TextUtils.isEmpty(externalUrl) ? attachment.getUrl() : externalUrl;
@ -206,16 +206,16 @@ public class ParcelableMedia implements Parcelable {
media.url = checkUrl(appUrlResolved) ? appUrlResolved.getValue() : card.getUrl();
if ("animated_gif".equals(name)) {
media.media_url = ((StringValue) playerStreamUrl).getValue();
media.type = Type.TYPE_CARD_ANIMATED_GIF;
media.type = Type.CARD_ANIMATED_GIF;
} else if (playerStreamUrl instanceof StringValue) {
media.media_url = ((StringValue) playerStreamUrl).getValue();
media.type = Type.TYPE_VIDEO;
media.type = Type.VIDEO;
} else {
StringValue playerUrl = (StringValue) card.getBindingValue("player_url");
if (playerUrl != null) {
media.media_url = playerUrl.getValue();
}
media.type = Type.TYPE_EXTERNAL_PLAYER;
media.type = Type.EXTERNAL_PLAYER;
}
final BindingValue playerImage = card.getBindingValue("player_image");
if (playerImage instanceof ImageValue) {
@ -247,7 +247,7 @@ public class ParcelableMedia implements Parcelable {
final ParcelableMedia media = new ParcelableMedia();
media.url = card.getUrl();
media.card = ParcelableCardEntity.fromCardEntity(card, -1);
media.type = Type.TYPE_IMAGE;
media.type = Type.IMAGE;
media.media_url = ((ImageValue) photoImageFullSize).getUrl();
media.width = ((ImageValue) photoImageFullSize).getWidth();
media.height = ((ImageValue) photoImageFullSize).getHeight();
@ -279,32 +279,25 @@ public class ParcelableMedia implements Parcelable {
private static int getTypeInt(String type) {
switch (type) {
case MediaEntity.Type.PHOTO:
return Type.TYPE_IMAGE;
return Type.IMAGE;
case MediaEntity.Type.VIDEO:
return Type.TYPE_VIDEO;
return Type.VIDEO;
case MediaEntity.Type.ANIMATED_GIF:
return Type.TYPE_ANIMATED_GIF;
return Type.ANIMATED_GIF;
}
return Type.TYPE_UNKNOWN;
return Type.UNKNOWN;
}
public static ParcelableMedia image(final String url) {
ParcelableMedia media = new ParcelableMedia();
media.type = Type.TYPE_VARIABLE_TYPE;
media.type = Type.IMAGE;
media.url = url;
media.media_url = url;
media.preview_url = url;
return media;
}
public static ParcelableMedia variableType(@NonNull String link) {
ParcelableMedia media = new ParcelableMedia();
media.type = Type.TYPE_VARIABLE_TYPE;
media.url = link;
return media;
}
@OnJsonParseComplete
void onParseComplete() {
if (this.page_url != null) {
@ -381,10 +374,10 @@ public class ParcelableMedia implements Parcelable {
public static boolean hasPlayIcon(@Type int type) {
switch (type) {
case Type.TYPE_VIDEO:
case Type.TYPE_ANIMATED_GIF:
case Type.TYPE_CARD_ANIMATED_GIF:
case Type.TYPE_EXTERNAL_PLAYER:
case Type.VIDEO:
case Type.ANIMATED_GIF:
case Type.CARD_ANIMATED_GIF:
case Type.EXTERNAL_PLAYER:
return true;
}
return false;
@ -398,25 +391,25 @@ public class ParcelableMedia implements Parcelable {
return null;
}
@IntDef({Type.TYPE_UNKNOWN, Type.TYPE_IMAGE, Type.TYPE_VIDEO, Type.TYPE_ANIMATED_GIF,
Type.TYPE_CARD_ANIMATED_GIF, Type.TYPE_EXTERNAL_PLAYER, Type.TYPE_VARIABLE_TYPE})
@IntDef({Type.UNKNOWN, Type.IMAGE, Type.VIDEO, Type.ANIMATED_GIF, Type.CARD_ANIMATED_GIF,
Type.EXTERNAL_PLAYER, Type.VARIABLE_TYPE})
@Retention(RetentionPolicy.SOURCE)
public @interface Type {
@Type
int TYPE_UNKNOWN = 0;
int UNKNOWN = 0;
@Type
int TYPE_IMAGE = 1;
int IMAGE = 1;
@Type
int TYPE_VIDEO = 2;
int VIDEO = 2;
@Type
int TYPE_ANIMATED_GIF = 3;
int ANIMATED_GIF = 3;
@Type
int TYPE_CARD_ANIMATED_GIF = 4;
int CARD_ANIMATED_GIF = 4;
@Type
int TYPE_EXTERNAL_PLAYER = 5;
int EXTERNAL_PLAYER = 5;
@Type
int TYPE_VARIABLE_TYPE = 6;
int VARIABLE_TYPE = 6;
}
@ParcelablePlease

View File

@ -31,7 +31,7 @@ public class InstagramProvider implements Provider {
if (pathSegments.size() < 2 || !"p".equals(pathSegments.get(0))) return null;
final String id = pathSegments.get(1);
final ParcelableMedia media = new ParcelableMedia();
media.type = ParcelableMedia.Type.TYPE_IMAGE;
media.type = ParcelableMedia.Type.IMAGE;
media.url = link;
media.preview_url = String.format(Locale.ROOT, "https://instagram.com/p/%s/media/?size=m", id);
media.media_url = String.format(Locale.ROOT, "https://instagram.com/p/%s/media/?size=l", id);

View File

@ -30,11 +30,11 @@ public class TwitterMediaProvider implements Provider {
// Video is not supported yet
return null;
} else if (path.startsWith("/media/")) {
media.type = ParcelableMedia.Type.TYPE_IMAGE;
media.type = ParcelableMedia.Type.IMAGE;
media.preview_url = String.format(Locale.ROOT, "%s:medium", link);
media.media_url = String.format(Locale.ROOT, "%s:orig", link);
} else {
media.type = ParcelableMedia.Type.TYPE_IMAGE;
media.type = ParcelableMedia.Type.IMAGE;
media.preview_url = link;
media.media_url = link;
}

View File

@ -56,15 +56,15 @@ public class TwidereDataUtils {
public static String getMediaType(int type) {
switch (type) {
case ParcelableMedia.Type.TYPE_IMAGE:
case ParcelableMedia.Type.IMAGE:
return "image";
case ParcelableMedia.Type.TYPE_VIDEO:
case ParcelableMedia.Type.VIDEO:
return "video";
case ParcelableMedia.Type.TYPE_ANIMATED_GIF:
case ParcelableMedia.Type.ANIMATED_GIF:
return "animated_gif";
case ParcelableMedia.Type.TYPE_CARD_ANIMATED_GIF:
case ParcelableMedia.Type.CARD_ANIMATED_GIF:
return "card_animated_gif";
case ParcelableMedia.Type.TYPE_EXTERNAL_PLAYER:
case ParcelableMedia.Type.EXTERNAL_PLAYER:
return "external_player";
default:
return "unknown";
@ -77,11 +77,11 @@ public class TwidereDataUtils {
boolean hasImage = false;
for (ParcelableMedia media : status.media) {
switch (media.type) {
case ParcelableMedia.Type.TYPE_ANIMATED_GIF:
case ParcelableMedia.Type.TYPE_CARD_ANIMATED_GIF:
case ParcelableMedia.Type.TYPE_VIDEO:
case ParcelableMedia.Type.ANIMATED_GIF:
case ParcelableMedia.Type.CARD_ANIMATED_GIF:
case ParcelableMedia.Type.VIDEO:
return TweetType.VIDEO;
case ParcelableMedia.Type.TYPE_IMAGE: {
case ParcelableMedia.Type.IMAGE: {
hasImage = true;
break;
}

View File

@ -232,7 +232,7 @@ public class ComposeActivity extends ThemedFragmentActivity implements OnMenuIte
if (resultCode == Activity.RESULT_OK) {
final Uri src = intent.getData();
mTask = AsyncTaskUtils.executeTask(new AddMediaTask(this, src,
createTempImageUri(), ParcelableMedia.Type.TYPE_IMAGE, true));
createTempImageUri(), ParcelableMedia.Type.IMAGE, true));
}
break;
}
@ -450,12 +450,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements OnMenuIte
updateTextCount();
break;
}
case R.id.link_to_quoted_status: {
final boolean newValue = !item.isChecked();
item.setChecked(newValue);
mPreferences.edit().putBoolean(KEY_LINK_TO_QUOTED_TWEET, newValue).apply();
break;
}
default: {
final Intent intent = item.getIntent();
if (intent != null) {
@ -883,14 +877,14 @@ public class ComposeActivity extends ThemedFragmentActivity implements OnMenuIte
final Uri extraStream = intent.getParcelableExtra(Intent.EXTRA_STREAM);
//TODO handle share_screenshot extra (Bitmap)
if (extraStream != null) {
AsyncTaskUtils.executeTask(new AddMediaTask(this, extraStream, createTempImageUri(), ParcelableMedia.Type.TYPE_IMAGE, false));
AsyncTaskUtils.executeTask(new AddMediaTask(this, extraStream, createTempImageUri(), ParcelableMedia.Type.IMAGE, false));
} else if (data != null) {
AsyncTaskUtils.executeTask(new AddMediaTask(this, data, createTempImageUri(), ParcelableMedia.Type.TYPE_IMAGE, false));
AsyncTaskUtils.executeTask(new AddMediaTask(this, data, createTempImageUri(), ParcelableMedia.Type.IMAGE, false));
} else if (intent.hasExtra(EXTRA_SHARE_SCREENSHOT) && Utils.useShareScreenshot()) {
final Bitmap bitmap = intent.getParcelableExtra(EXTRA_SHARE_SCREENSHOT);
if (bitmap != null) {
try {
AsyncTaskUtils.executeTask(new AddBitmapTask(this, bitmap, createTempImageUri(), ParcelableMedia.Type.TYPE_IMAGE));
AsyncTaskUtils.executeTask(new AddBitmapTask(this, bitmap, createTempImageUri(), ParcelableMedia.Type.IMAGE));
} catch (IOException e) {
// ignore
bitmap.recycle();
@ -1113,13 +1107,11 @@ public class ComposeActivity extends ThemedFragmentActivity implements OnMenuIte
MenuUtils.setMenuItemAvailability(menu, R.id.add_image, !hasMedia);
MenuUtils.setMenuItemAvailability(menu, R.id.media_menu, hasMedia);
MenuUtils.setMenuItemAvailability(menu, R.id.toggle_sensitive, hasMedia);
MenuUtils.setMenuItemAvailability(menu, R.id.link_to_quoted_status, isQuote());
MenuUtils.setMenuItemAvailability(menu, R.id.schedule, isScheduleSupported());
menu.setGroupEnabled(MENU_GROUP_IMAGE_EXTENSION, hasMedia);
menu.setGroupVisible(MENU_GROUP_IMAGE_EXTENSION, hasMedia);
MenuUtils.setMenuItemChecked(menu, R.id.toggle_sensitive, hasMedia && mIsPossiblySensitive);
MenuUtils.setMenuItemChecked(menu, R.id.link_to_quoted_status, mPreferences.getBoolean(KEY_LINK_TO_QUOTED_TWEET));
ThemeUtils.resetCheatSheet(mMenuBar);
// mMenuBar.show();
}
@ -1267,10 +1259,8 @@ public class ComposeActivity extends ThemedFragmentActivity implements OnMenuIte
}
final boolean attachLocation = mPreferences.getBoolean(KEY_ATTACH_LOCATION, false);
final long[] accountIds = mAccountsAdapter.getSelectedAccountIds();
final boolean isQuote = isQuote();
final ParcelableLocation statusLocation = attachLocation ? mRecentLocation : null;
final boolean linkToQuotedTweet = mPreferences.getBoolean(KEY_LINK_TO_QUOTED_TWEET, true);
final long inReplyToStatusId = !isQuote || linkToQuotedTweet ? mInReplyToStatusId : -1;
final long inReplyToStatusId = mInReplyToStatusId;
final boolean isPossiblySensitive = hasMedia && mIsPossiblySensitive;
mTwitterWrapper.updateStatusAsync(accountIds, text, statusLocation, getMedia(), inReplyToStatusId,
isPossiblySensitive);

View File

@ -223,27 +223,27 @@ public final class MediaViewerActivity extends AbsMediaViewerActivity implements
protected MediaViewerFragment instantiateMediaFragment(int position) {
final ParcelableMedia media = getMedia()[position];
switch (media.type) {
case ParcelableMedia.Type.TYPE_IMAGE: {
case ParcelableMedia.Type.IMAGE: {
final Bundle args = new Bundle();
args.putParcelable(ImagePageFragment.EXTRA_MEDIA_URI, Uri.parse(media.media_url));
return (MediaViewerFragment) Fragment.instantiate(this,
ImagePageFragment.class.getName(), args);
}
case ParcelableMedia.Type.TYPE_ANIMATED_GIF:
case ParcelableMedia.Type.TYPE_CARD_ANIMATED_GIF: {
case ParcelableMedia.Type.ANIMATED_GIF:
case ParcelableMedia.Type.CARD_ANIMATED_GIF: {
final Bundle args = new Bundle();
args.putBoolean(VideoPageFragment.EXTRA_LOOP, true);
args.putParcelable(EXTRA_MEDIA, media);
return (MediaViewerFragment) Fragment.instantiate(this,
VideoPageFragment.class.getName(), args);
}
case ParcelableMedia.Type.TYPE_VIDEO: {
case ParcelableMedia.Type.VIDEO: {
final Bundle args = new Bundle();
args.putParcelable(EXTRA_MEDIA, media);
return (MediaViewerFragment) Fragment.instantiate(this,
VideoPageFragment.class.getName(), args);
}
case ParcelableMedia.Type.TYPE_EXTERNAL_PLAYER: {
case ParcelableMedia.Type.EXTERNAL_PLAYER: {
final Bundle args = new Bundle();
args.putParcelable(EXTRA_MEDIA, media);
return (MediaViewerFragment) Fragment.instantiate(this,
@ -999,8 +999,8 @@ public final class MediaViewerActivity extends AbsMediaViewerActivity implements
private Pair<String, String> getBestVideoUrlAndType(ParcelableMedia media) {
if (media == null) return null;
switch (media.type) {
case ParcelableMedia.Type.TYPE_VIDEO:
case ParcelableMedia.Type.TYPE_ANIMATED_GIF: {
case ParcelableMedia.Type.VIDEO:
case ParcelableMedia.Type.ANIMATED_GIF: {
if (media.video_info == null) {
return Pair.create(media.media_url, null);
}
@ -1012,7 +1012,7 @@ public final class MediaViewerActivity extends AbsMediaViewerActivity implements
}
return null;
}
case ParcelableMedia.Type.TYPE_CARD_ANIMATED_GIF: {
case ParcelableMedia.Type.CARD_ANIMATED_GIF: {
return Pair.create(media.media_url, "video/mp4");
}
default: {

View File

@ -16,6 +16,7 @@ import android.widget.Button;
import android.widget.TextView;
import org.mariotaku.restfu.http.Endpoint;
import org.mariotaku.twidere.BuildConfig;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.api.twitter.Twitter;
import org.mariotaku.twidere.api.twitter.TwitterException;
@ -90,6 +91,11 @@ public class NetworkDiagnosticsFragment extends BaseFragment {
@Override
protected Object doInBackground(Object... params) {
publishProgress(new LogText("Build information: "));
publishProgress(new LogText("version_code: " + BuildConfig.VERSION_CODE), LogText.LINEBREAK);
publishProgress(new LogText("version_name: " + BuildConfig.VERSION_NAME), LogText.LINEBREAK);
publishProgress(new LogText("flavor: " + BuildConfig.FLAVOR), LogText.LINEBREAK);
publishProgress(LogText.LINEBREAK);
publishProgress(new LogText("Basic system information: "));
publishProgress(new LogText(String.valueOf(mContext.getResources().getConfiguration())));
publishProgress(LogText.LINEBREAK, LogText.LINEBREAK);

View File

@ -242,10 +242,8 @@ public class AccountsDashboardFragment extends BaseSupportFragment implements Lo
final ParcelableAccount account = mAccountsAdapter.getSelectedAccount();
if (account == null) return;
final FragmentActivity activity = getActivity();
final Bundle activityOption = Utils.makeSceneTransitionOption(activity,
new Pair<View, String>(mAccountProfileImageView, UserFragment.TRANSITION_NAME_PROFILE_IMAGE));
IntentUtils.openUserProfile(activity, account.account_id, account.account_id,
account.screen_name, activityOption, true);
account.screen_name, null, true);
break;
}
}

View File

@ -256,7 +256,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
@Override
public void onClick(View widget) {
final FragmentActivity activity = getActivity();
if (activity == null) return;
if (activity == null || activity.isFinishing()) return;
SupportMessageDialogFragment.show(activity,
getString(R.string.cant_load_all_replies_explanation),
"cant_load_all_replies_explanation");

View File

@ -1248,7 +1248,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
case R.id.profile_image: {
final String url = Utils.getOriginalTwitterProfileImage(user.profile_image_url);
ParcelableMedia profileImage = ParcelableMedia.image(url);
profileImage.type = ParcelableMedia.Type.TYPE_IMAGE;
profileImage.type = ParcelableMedia.Type.IMAGE;
final ParcelableMedia[] media = {profileImage};
Bundle options = Utils.createMediaViewerActivityOption(view);
Utils.openMedia(activity, user.account_id, false, null, media, options);
@ -1258,7 +1258,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
if (user.profile_banner_url == null) return;
final String url = user.profile_banner_url + "/ipad_retina";
ParcelableMedia profileBanner = ParcelableMedia.image(url);
profileBanner.type = ParcelableMedia.Type.TYPE_IMAGE;
profileBanner.type = ParcelableMedia.Type.IMAGE;
final ParcelableMedia[] media = {profileBanner};
Bundle options = Utils.createMediaViewerActivityOption(view);
Utils.openMedia(activity, user.account_id, false, null, media, options);

View File

@ -23,7 +23,6 @@ import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@ -107,8 +106,7 @@ public class OnLinkClickHandler implements OnLinkClickListener, Constants {
protected void openMedia(long accountId, long extraId, boolean sensitive, String link, int start, int end) {
final ParcelableMedia[] media = {ParcelableMedia.image(link)};
//TODO open media animation
Bundle options = null;
Utils.openMedia(context, accountId, sensitive, null, media, options);
Utils.openMedia(context, accountId, sensitive, null, media, null);
}
protected void openLink(final String link) {

View File

@ -63,11 +63,10 @@ public class TwidereDns implements Constants, Dns {
private final SystemHosts mSystemHosts;
private Resolver mResolver;
private TimingLogger mLogger;
private boolean mUseResolver;
public TwidereDns(final Context context, SharedPreferencesWrapper preferences) {
mLogger = new TimingLogger(RESOLVER_LOGTAG, "resolve");
mHostMapping = SharedPreferencesWrapper.getInstance(context, HOST_MAPPING_PREFERENCES_NAME, Context.MODE_PRIVATE);
mSystemHosts = new SystemHosts();
mPreferences = preferences;
@ -75,7 +74,7 @@ public class TwidereDns implements Constants, Dns {
}
@Override
public synchronized List<InetAddress> lookup(String hostname) throws UnknownHostException {
public List<InetAddress> lookup(String hostname) throws UnknownHostException {
try {
return Arrays.asList(resolveInternal(hostname, hostname, 0, mUseResolver));
} catch (IOException e) {
@ -84,7 +83,7 @@ public class TwidereDns implements Constants, Dns {
}
}
public synchronized List<InetAddress> lookupResolver(String hostname) throws UnknownHostException {
public List<InetAddress> lookupResolver(String hostname) throws UnknownHostException {
try {
return Arrays.asList(resolveInternal(hostname, hostname, 0, true));
} catch (IOException e) {
@ -93,7 +92,7 @@ public class TwidereDns implements Constants, Dns {
}
}
public synchronized void reloadDnsSettings() {
public void reloadDnsSettings() {
mResolver = null;
mUseResolver = mPreferences.getBoolean(KEY_BUILTIN_DNS_RESOLVER);
}
@ -101,68 +100,65 @@ public class TwidereDns implements Constants, Dns {
@NonNull
private InetAddress[] resolveInternal(final String originalHost, final String host, final int depth,
final boolean useResolver) throws IOException {
resetLog(originalHost);
final TimingLogger logger = new TimingLogger(RESOLVER_LOGTAG, "resolve");
// Return if host is an address
final InetAddress[] fromAddressString = fromAddressString(originalHost, host);
if (fromAddressString != null) {
if (BuildConfig.DEBUG) {
addLogSplit(originalHost, host, "valid ip address", depth);
dumpLog(fromAddressString);
addLogSplit(logger, host, "valid ip address", depth);
dumpLog(logger, fromAddressString);
}
return fromAddressString;
}
// Load from custom mapping
addLogSplit(originalHost, host, "start custom mapping resolve", depth);
addLogSplit(logger, host, "start custom mapping resolve", depth);
final InetAddress[] fromMapping = getFromMapping(host);
addLogSplit(originalHost, host, "end custom mapping resolve", depth);
addLogSplit(logger, host, "end custom mapping resolve", depth);
if (fromMapping != null) {
if (BuildConfig.DEBUG) {
dumpLog(fromMapping);
dumpLog(logger, fromMapping);
}
return fromMapping;
}
if (useResolver) {
// Load from /etc/hosts, since Dnsjava doesn't support hosts entry lookup
addLogSplit(originalHost, host, "start /etc/hosts resolve", depth);
addLogSplit(logger, host, "start /etc/hosts resolve", depth);
final InetAddress[] fromSystemHosts = fromSystemHosts(host);
addLogSplit(originalHost, host, "end /etc/hosts resolve", depth);
addLogSplit(logger, host, "end /etc/hosts resolve", depth);
if (fromSystemHosts != null) {
if (BuildConfig.DEBUG) {
dumpLog(fromSystemHosts);
dumpLog(logger, fromSystemHosts);
}
return fromSystemHosts;
}
// Use DNS resolver
addLogSplit(originalHost, host, "start resolver resolve", depth);
final InetAddress[] fromResolver = fromResolver(originalHost, host, depth);
addLogSplit(originalHost, host, "end resolver resolve", depth);
addLogSplit(logger, host, "start resolver resolve", depth);
final InetAddress[] fromResolver = fromResolver(originalHost, host);
addLogSplit(logger, host, "end resolver resolve", depth);
if (!ArrayUtils.isEmpty(fromResolver)) {
if (BuildConfig.DEBUG) {
dumpLog(fromResolver);
dumpLog(logger, fromResolver);
}
return fromResolver;
}
}
addLogSplit(originalHost, host, "start system default resolve", depth);
addLogSplit(logger, host, "start system default resolve", depth);
final InetAddress[] fromDefault = InetAddress.getAllByName(host);
addLogSplit(originalHost, host, "end system default resolve", depth);
addLogSplit(logger, host, "end system default resolve", depth);
if (BuildConfig.DEBUG) {
dumpLog(fromDefault);
dumpLog(logger, fromDefault);
}
return fromDefault;
}
private void dumpLog(@NonNull InetAddress[] addresses) {
private void dumpLog(final TimingLogger logger, @NonNull InetAddress[] addresses) {
Log.v(RESOLVER_LOGTAG, "Resolved " + Arrays.toString(addresses));
mLogger.dumpToLog();
logger.dumpToLog();
}
private void resetLog(String originalHost) {
mLogger.reset(RESOLVER_LOGTAG, originalHost);
}
private void addLogSplit(String originalHost, String host, String message, int depth) {
private void addLogSplit(final TimingLogger logger, String host, String message, int depth) {
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < depth; i++) {
sb.append(">");
@ -171,7 +167,7 @@ public class TwidereDns implements Constants, Dns {
sb.append(host);
sb.append(": ");
sb.append(message);
mLogger.addSplit(sb.toString());
logger.addSplit(sb.toString());
}
private InetAddress[] fromSystemHosts(String host) {
@ -183,19 +179,13 @@ public class TwidereDns implements Constants, Dns {
}
@Nullable
private InetAddress[] fromResolver(String originalHost, String host, int depth) throws IOException {
addLogSplit(originalHost, host, "start get resolver", depth);
private InetAddress[] fromResolver(String originalHost, String host) throws IOException {
final Resolver resolver = getResolver();
addLogSplit(originalHost, host, "end get resolver", depth);
addLogSplit(originalHost, host, "start lookup host name", depth);
final Record[] records = lookupHostName(resolver, host, true);
addLogSplit(originalHost, host, "end lookup host name", depth);
addLogSplit(originalHost, host, "start convert record", depth);
InetAddress[] addrs = new InetAddress[records.length];
for (int i = 0; i < records.length; i++) {
addrs[i] = addrFromRecord(originalHost, records[i]);
}
addLogSplit(originalHost, host, "end convert record", depth);
return addrs;
}

View File

@ -429,9 +429,9 @@ public class StatusViewHolder extends ViewHolder implements Constants, IStatusVi
for (ParcelableMedia item : media) {
if (item == null) continue;
switch (item.type) {
case ParcelableMedia.Type.TYPE_VIDEO:
case ParcelableMedia.Type.TYPE_ANIMATED_GIF:
case ParcelableMedia.Type.TYPE_EXTERNAL_PLAYER:
case ParcelableMedia.Type.VIDEO:
case ParcelableMedia.Type.ANIMATED_GIF:
case ParcelableMedia.Type.EXTERNAL_PLAYER:
return true;
}
}

View File

@ -40,12 +40,6 @@
android:title="@string/drafts"
app:showAsAction="always"
tools:ignore="AlwaysShowAction"/>
<item
android:id="@+id/link_to_quoted_status"
android:checkable="true"
android:icon="@drawable/ic_action_link"
android:title="@string/link_to_quoted_status"
app:showAsAction="never"/>
<item
android:id="@+id/schedule"
android:icon="@drawable/ic_action_time"