updated version
This commit is contained in:
parent
fb00cc9ed0
commit
f3756b9c0a
|
@ -34,8 +34,8 @@ android {
|
|||
applicationId "org.mariotaku.twidere"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 25
|
||||
versionCode 274
|
||||
versionName '3.4.12'
|
||||
versionCode 275
|
||||
versionName '3.4.13'
|
||||
multiDexEnabled true
|
||||
|
||||
buildConfigField 'boolean', 'LEAK_CANARY_ENABLED', 'Boolean.parseBoolean("true")'
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package android.support.v4.app;
|
||||
|
||||
import android.support.v4.view.LayoutInflaterFactory;
|
||||
|
||||
public class FragmentManagerAccessor {
|
||||
|
||||
private FragmentManagerAccessor() {
|
||||
}
|
||||
|
||||
public static boolean isStateSaved(final FragmentManager fm) {
|
||||
if (fm instanceof FragmentManagerImpl) return ((FragmentManagerImpl) fm).mStateSaved;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static LayoutInflaterFactory getLayoutInflaterFactory(final FragmentManager fm) {
|
||||
if (fm instanceof FragmentManagerImpl)
|
||||
return ((FragmentManagerImpl) fm).getLayoutInflaterFactory();
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -24,7 +24,6 @@ import android.text.TextUtils;
|
|||
import android.util.Log;
|
||||
|
||||
import com.bluelinelabs.logansquare.LoganSquare;
|
||||
import com.fasterxml.jackson.core.TreeNode;
|
||||
|
||||
import org.mariotaku.commons.logansquare.LoganSquareMapperFinder;
|
||||
import org.mariotaku.microblog.library.MicroBlogException;
|
||||
|
@ -153,10 +152,6 @@ public abstract class UserStreamCallback implements RawCallback {
|
|||
}
|
||||
|
||||
|
||||
private static <T> T parse(final Class<T> cls, final TreeNode json) throws IOException {
|
||||
return LoganSquareMapperFinder.mapperFor(cls).parse(json.traverse());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void error(final Exception cause) {
|
||||
onException(cause);
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
package org.mariotaku.twidere.preference;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.ListPreference;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
public class AutoFixListPreference extends ListPreference {
|
||||
|
||||
public AutoFixListPreference(final Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AutoFixListPreference(final Context context, final AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSetInitialValue(final boolean restoreValue, final Object defaultValue) {
|
||||
try {
|
||||
super.onSetInitialValue(restoreValue, defaultValue);
|
||||
} catch (final ClassCastException e) {
|
||||
final SharedPreferences prefs = getSharedPreferences();
|
||||
if (prefs != null) {
|
||||
prefs.edit().remove(getKey()).apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.util;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.ImageSpan;
|
||||
|
||||
public final class ClipboardUtils {
|
||||
|
||||
private ClipboardUtils() {
|
||||
}
|
||||
|
||||
public static boolean setText(final Context context, final CharSequence text) {
|
||||
if (context == null) return false;
|
||||
final ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
clipboardManager.setPrimaryClip(ClipData.newPlainText(text, text));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getImageUrl(final Context context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return null;
|
||||
return ClipboardUtilsAPI16.getImageUrl(context);
|
||||
}
|
||||
|
||||
private static class ClipboardUtilsAPI16 {
|
||||
private ClipboardUtilsAPI16() {
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
public static String getImageUrl(final Context context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return null;
|
||||
final ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
final ClipData primaryClip = cm.getPrimaryClip();
|
||||
if (primaryClip.getItemCount() > 0) {
|
||||
final ClipData.Item item = primaryClip.getItemAt(0);
|
||||
final CharSequence styledText = item.coerceToStyledText(context);
|
||||
if (styledText instanceof Spanned) {
|
||||
final Spanned spanned = (Spanned) styledText;
|
||||
final ImageSpan[] imageSpans = spanned.getSpans(0, spanned.length(), ImageSpan.class);
|
||||
if (imageSpans.length == 1) return imageSpans[0].getSource();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,26 +17,18 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.preference;
|
||||
package org.mariotaku.twidere.util
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
|
||||
public class AutoInvalidateListPreference extends AutoFixListPreference {
|
||||
object ClipboardUtils {
|
||||
|
||||
public AutoInvalidateListPreference(final Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AutoInvalidateListPreference(final Context context, final AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldPersist() {
|
||||
if (!super.shouldPersist()) return false;
|
||||
notifyChanged();
|
||||
return true;
|
||||
}
|
||||
fun setText(context: Context, text: CharSequence): Boolean {
|
||||
val clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
clipboardManager.primaryClip = ClipData.newPlainText(text, text)
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue