mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-30 16:35:00 +01:00
updated libraries
This commit is contained in:
parent
7c6d4dd4ec
commit
0e1b71c7b6
@ -77,10 +77,10 @@ dependencies {
|
||||
compile 'dnsjava:dnsjava:2.1.7'
|
||||
compile 'com.commonsware.cwac:merge:1.1.1'
|
||||
compile 'com.diegocarloslima:byakugallery:0.1.0'
|
||||
compile 'com.rengwuxian.materialedittext:library:1.8.3'
|
||||
compile 'com.pnikosis:materialish-progress:1.4'
|
||||
compile 'com.rengwuxian.materialedittext:library:2.0.3'
|
||||
compile 'com.pnikosis:materialish-progress:1.5'
|
||||
compile 'com.squareup.okhttp:okhttp:2.3.0'
|
||||
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.2'
|
||||
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.3'
|
||||
compile 'com.github.mariotaku:MessageBubbleView:1.0'
|
||||
compile 'com.github.mariotaku:DragSortListView:0.6.1'
|
||||
compile 'com.github.mariotaku:SlidingMenu:1.3'
|
||||
@ -88,7 +88,7 @@ dependencies {
|
||||
googleCompile 'com.google.android.gms:play-services-maps:7.0.0'
|
||||
googleCompile 'com.google.maps.android:android-maps-utils:0.3.4'
|
||||
fdroidCompile 'org.osmdroid:osmdroid-android:4.3'
|
||||
fdroidCompile 'org.slf4j:slf4j-simple:1.7.10'
|
||||
fdroidCompile 'org.slf4j:slf4j-simple:1.7.12'
|
||||
compile project(':twidere.component.common')
|
||||
compile project(':twidere.component.nyan')
|
||||
compile fileTree(dir: 'libs/main', include: ['*.jar'])
|
||||
|
@ -624,7 +624,7 @@ public class ComposeActivity extends ThemedFragmentActivity implements TextWatch
|
||||
mTwitterWrapper = app.getTwitterWrapper();
|
||||
mResolver = getContentResolver();
|
||||
mValidator = new TwidereValidator(this);
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
setContentView(R.layout.activity_compose);
|
||||
// setSupportProgressBarIndeterminateVisibility(false);
|
||||
setFinishOnTouchOutside(false);
|
||||
@ -1231,7 +1231,7 @@ public class ComposeActivity extends ThemedFragmentActivity implements TextWatch
|
||||
public AccountIconsAdapter(ComposeActivity activity) {
|
||||
mActivity = activity;
|
||||
mInflater = LayoutInflater.from(activity);
|
||||
mImageLoader = TwidereApplication.getInstance(activity).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(activity).getMediaLoaderWrapper();
|
||||
mSelection = new LongSparseArray<>();
|
||||
}
|
||||
|
||||
@ -1493,7 +1493,7 @@ public class ComposeActivity extends ThemedFragmentActivity implements TextWatch
|
||||
|
||||
public MediaPreviewAdapter(final Context context) {
|
||||
super(context, R.layout.grid_item_media_editor);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
|
||||
}
|
||||
|
||||
public List<ParcelableMediaUpdate> getAsList() {
|
||||
|
@ -270,7 +270,7 @@ public class CustomTabEditorActivity extends BaseSupportDialogActivity implement
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE);
|
||||
mImageLoader = TwidereApplication.getInstance(this).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(this).getMediaLoaderWrapper();
|
||||
final Intent intent = getIntent();
|
||||
final String type = mTabType = intent.getStringExtra(EXTRA_TYPE);
|
||||
final CustomTabConfiguration conf = getTabConfiguration(type);
|
||||
|
@ -40,11 +40,11 @@ import android.view.View.OnClickListener;
|
||||
import android.view.View.OnLayoutChangeListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.diegocarloslima.byakugallery.lib.TileBitmapDrawable;
|
||||
import com.diegocarloslima.byakugallery.lib.TileBitmapDrawable.OnInitializeListener;
|
||||
import com.pnikosis.materialishprogress.ProgressWheel;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
@ -287,16 +287,16 @@ public final class MediaViewerActivity extends ThemedActionBarActivity implement
|
||||
implements DownloadListener, LoaderCallbacks<Result>, OnLayoutChangeListener, OnClickListener, ZoomListener {
|
||||
|
||||
private TouchImageView mImageView;
|
||||
private ProgressBar mProgressBar;
|
||||
private ProgressWheel mProgressBar;
|
||||
private boolean mLoaderInitialized;
|
||||
private long mContentLength;
|
||||
private float mContentLength;
|
||||
private SaveImageTask mSaveImageTask;
|
||||
|
||||
@Override
|
||||
public void onBaseViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onBaseViewCreated(view, savedInstanceState);
|
||||
mImageView = (TouchImageView) view.findViewById(R.id.image_view);
|
||||
mProgressBar = (ProgressBar) view.findViewById(R.id.progress);
|
||||
mProgressBar = (ProgressWheel) view.findViewById(R.id.progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -308,7 +308,7 @@ public final class MediaViewerActivity extends ThemedActionBarActivity implement
|
||||
@Override
|
||||
public Loader<Result> onCreateLoader(final int id, final Bundle args) {
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
mProgressBar.setIndeterminate(true);
|
||||
mProgressBar.spin();
|
||||
invalidateOptionsMenu();
|
||||
final ParcelableMedia media = getMedia();
|
||||
final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
|
||||
@ -491,18 +491,18 @@ public final class MediaViewerActivity extends ThemedActionBarActivity implement
|
||||
@Override
|
||||
public void onDownloadStart(final long total) {
|
||||
mContentLength = total;
|
||||
mProgressBar.setIndeterminate(total <= 0);
|
||||
mProgressBar.setMax(total > 0 ? (int) (total / 1024) : 0);
|
||||
mProgressBar.spin();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgressUpdate(final long downloaded) {
|
||||
if (mContentLength == 0) {
|
||||
mProgressBar.setIndeterminate(true);
|
||||
if (mContentLength <= 0) {
|
||||
if (!mProgressBar.isSpinning()) {
|
||||
mProgressBar.spin();
|
||||
}
|
||||
return;
|
||||
}
|
||||
mProgressBar.setIndeterminate(false);
|
||||
mProgressBar.setProgress((int) (downloaded / 1024));
|
||||
mProgressBar.setProgress(downloaded / mContentLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -468,7 +468,7 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On
|
||||
SuggestionsAdapter(Context context) {
|
||||
mContext = context;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
|
||||
}
|
||||
|
||||
public boolean canDismiss(int position) {
|
||||
|
@ -130,7 +130,7 @@ public class UserProfileEditorActivity extends BaseActionBarActivity implements
|
||||
return;
|
||||
}
|
||||
mAsyncTaskManager = TwidereApplication.getInstance(this).getAsyncTaskManager();
|
||||
mLazyImageLoader = TwidereApplication.getInstance(this).getImageLoaderWrapper();
|
||||
mLazyImageLoader = TwidereApplication.getInstance(this).getMediaLoaderWrapper();
|
||||
mAccountId = accountId;
|
||||
|
||||
|
||||
|
@ -83,7 +83,7 @@ public abstract class AbsActivitiesAdapter<Data> extends Adapter<ViewHolder> imp
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mCardBackgroundColor = ThemeUtils.getCardBackgroundColor(context);
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
mLoadingHandler = new ImageLoadingHandler(R.id.media_preview_progress);
|
||||
mTwitterWrapper = app.getTwitterWrapper();
|
||||
final SharedPreferencesWrapper preferences = SharedPreferencesWrapper.getInstance(context,
|
||||
|
@ -60,7 +60,7 @@ public abstract class AbsStatusesAdapter<D> extends Adapter<ViewHolder> implemen
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mCardBackgroundColor = ThemeUtils.getCardBackgroundColor(context);
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
mLoadingHandler = new ImageLoadingHandler(R.id.media_preview_progress);
|
||||
mTwitterWrapper = app.getTwitterWrapper();
|
||||
final SharedPreferencesWrapper preferences = SharedPreferencesWrapper.getInstance(context,
|
||||
|
@ -52,7 +52,7 @@ public class AccountsAdapter extends SimpleDragSortCursorAdapter implements Cons
|
||||
super(context, R.layout.list_item_account, null, new String[]{Accounts.NAME},
|
||||
new int[]{android.R.id.text1}, 0);
|
||||
final TwidereApplication application = TwidereApplication.getInstance(context);
|
||||
mImageLoader = application.getImageLoaderWrapper();
|
||||
mImageLoader = application.getMediaLoaderWrapper();
|
||||
mPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class AccountsSpinnerAdapter extends ArrayAdapter<ParcelableAccount> {
|
||||
public AccountsSpinnerAdapter(final Context context, int itemViewResource) {
|
||||
super(context, itemViewResource);
|
||||
mContext = context;
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
|
||||
mDisplayProfileImage = context.getSharedPreferences(DirectMessagesConversationFragment.SHARED_PREFERENCES_NAME,
|
||||
Context.MODE_PRIVATE).getBoolean(DirectMessagesConversationFragment.KEY_DISPLAY_PROFILE_IMAGE, true);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class BaseArrayAdapter<T> extends ArrayAdapter<T> implements IBaseAdapter
|
||||
super(context, layoutRes, collection);
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mLinkify = new TwidereLinkify(new OnLinkClickHandler(context, app.getMultiSelectManager()));
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
mNicknamePrefs = context.getSharedPreferences(USER_NICKNAME_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
mColorPrefs = context.getSharedPreferences(USER_COLOR_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
mNicknamePrefs.registerOnSharedPreferenceChangeListener(this);
|
||||
|
@ -56,7 +56,7 @@ public class BaseCursorAdapter extends SimpleCursorAdapter implements IBaseAdapt
|
||||
super(context, layout, c, from, to, flags);
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mLinkify = new TwidereLinkify(new OnLinkClickHandler(context, app.getMultiSelectManager()));
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
mNicknamePrefs = context.getSharedPreferences(USER_NICKNAME_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
mColorPrefs = context.getSharedPreferences(USER_COLOR_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
mNicknamePrefs.registerOnSharedPreferenceChangeListener(this);
|
||||
|
@ -54,7 +54,7 @@ public class DraftsAdapter extends SimpleCursorAdapter implements Constants {
|
||||
|
||||
public DraftsAdapter(final Context context) {
|
||||
super(context, R.layout.list_item_draft, null, new String[0], new int[0], 0);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
|
||||
mImageLoadingHandler = new ImageLoadingHandler(R.id.media_preview_progress);
|
||||
final SharedPreferencesWrapper preferences = SharedPreferencesWrapper.getInstance(context,
|
||||
SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
|
@ -43,7 +43,7 @@ public class MediaPreviewAdapter extends ArrayAdapter<String> implements Constan
|
||||
|
||||
public MediaPreviewAdapter(final Context context) {
|
||||
super(context, R.layout.gallery_item_image_preview);
|
||||
mImageLoader = ((TwidereApplication) context.getApplicationContext()).getImageLoaderWrapper();
|
||||
mImageLoader = ((TwidereApplication) context.getApplicationContext()).getMediaLoaderWrapper();
|
||||
mPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
mImageLoadingHandler = new ImageLoadingHandler();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class MessageConversationAdapter extends Adapter<ViewHolder>
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mLinkify = new TwidereLinkify(new DirectMessageOnLinkClickHandler(context, null));
|
||||
mMultiSelectManager = app.getMultiSelectManager();
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
mImageLoadingHandler = new ImageLoadingHandler(R.id.media_preview_progress);
|
||||
mIncomingMessageColor = ThemeUtils.getUserAccentColor(context);
|
||||
mOutgoingMessageColor = ThemeUtils.getCardBackgroundColor(context);
|
||||
|
@ -73,7 +73,7 @@ public class MessageEntriesAdapter extends Adapter<ViewHolder> implements Consta
|
||||
mInflater = LayoutInflater.from(context);
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mMultiSelectManager = app.getMultiSelectManager();
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
final SharedPreferencesWrapper preferences = SharedPreferencesWrapper.getInstance(context,
|
||||
SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
mProfileImageStyle = Utils.getProfileImageStyle(preferences.getString(KEY_PROFILE_IMAGE_STYLE, null));
|
||||
|
@ -60,7 +60,7 @@ public class ParcelableUserListsListAdapter extends BaseArrayAdapter<ParcelableU
|
||||
mContext = context;
|
||||
mLocale = context.getResources().getConfiguration().locale;
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
mMultiSelectManager = app.getMultiSelectManager();
|
||||
configBaseCardAdapter(context, this);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class ParcelableUsersAdapter extends BaseArrayAdapter<ParcelableUser> imp
|
||||
mContext = context;
|
||||
mLocale = context.getResources().getConfiguration().locale;
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mProfileImageLoader = app.getImageLoaderWrapper();
|
||||
mProfileImageLoader = app.getMediaLoaderWrapper();
|
||||
mMultiSelectManager = app.getMultiSelectManager();
|
||||
configBaseCardAdapter(context, this);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class SimpleParcelableUserListsAdapter extends BaseArrayAdapter<Parcelabl
|
||||
super(context, R.layout.list_item_two_line);
|
||||
mContext = context;
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
configBaseAdapter(context, this);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class SimpleParcelableUsersAdapter extends BaseArrayAdapter<ParcelableUse
|
||||
super(context, layoutRes);
|
||||
mContext = context;
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
configBaseAdapter(context, this);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class UserHashtagAutoCompleteAdapter extends SimpleCursorAdapter implemen
|
||||
mUserNicknamePreferences = context.getSharedPreferences(USER_NICKNAME_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
mResolver = context.getContentResolver();
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mProfileImageLoader = app.getImageLoaderWrapper();
|
||||
mProfileImageLoader = app.getMediaLoaderWrapper();
|
||||
mDatabase = app.getSQLiteDatabase();
|
||||
mDisplayProfileImage = mPreferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true);
|
||||
}
|
||||
|
@ -77,8 +77,9 @@ import static org.mariotaku.twidere.util.Utils.startUsageStatisticsServiceIfNeed
|
||||
public class TwidereApplication extends MultiDexApplication implements Constants,
|
||||
OnSharedPreferenceChangeListener {
|
||||
|
||||
public static final String KEY_UCD_DATA_PROFILING = "ucd_data_profiling";
|
||||
public static final String KEY_SPICE_DATA_PROFILING = "spice_data_profiling";
|
||||
private static final String KEY_UCD_DATA_PROFILING = "ucd_data_profiling";
|
||||
private static final String KEY_SPICE_DATA_PROFILING = "spice_data_profiling";
|
||||
|
||||
private Handler mHandler;
|
||||
private MediaLoaderWrapper mMediaLoaderWrapper;
|
||||
private ImageLoader mImageLoader;
|
||||
@ -156,7 +157,7 @@ public class TwidereApplication extends MultiDexApplication implements Constants
|
||||
return mVideoLoader = loader;
|
||||
}
|
||||
|
||||
public MediaLoaderWrapper getImageLoaderWrapper() {
|
||||
public MediaLoaderWrapper getMediaLoaderWrapper() {
|
||||
if (mMediaLoaderWrapper != null) return mMediaLoaderWrapper;
|
||||
return mMediaLoaderWrapper = new MediaLoaderWrapper(getImageLoader(), getVideoLoader());
|
||||
}
|
||||
@ -284,6 +285,9 @@ public class TwidereApplication extends MultiDexApplication implements Constants
|
||||
if (mImageDownloader != null) {
|
||||
mImageDownloader.reloadConnectivitySettings();
|
||||
}
|
||||
if (mFullImageDownloader != null) {
|
||||
mFullImageDownloader.reloadConnectivitySettings();
|
||||
}
|
||||
}
|
||||
|
||||
private DiskCache createDiskCache(final String dirName) {
|
||||
|
@ -251,6 +251,7 @@ public abstract class AbsStatusesFragment<Data> extends BaseSupportFragment impl
|
||||
protected void fitSystemWindows(Rect insets) {
|
||||
super.fitSystemWindows(insets);
|
||||
mRecyclerView.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
||||
mProgressContainer.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
||||
mSystemWindowsInsets.set(insets);
|
||||
updateRefreshProgressOffset();
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
||||
final View view = getView();
|
||||
if (view == null) throw new AssertionError();
|
||||
final Context context = view.getContext();
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
|
||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||
final ListView listView = getListView();
|
||||
mAdapter = new MergeAdapter();
|
||||
@ -607,7 +607,7 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
||||
|
||||
AccountSelectorAdapter(Context context, AccountsDashboardFragment fragment) {
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
|
||||
mFragment = fragment;
|
||||
setHasStableIds(true);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public class DirectMessagesConversationFragment extends BaseSupportFragment impl
|
||||
final BaseActionBarActivity activity = (BaseActionBarActivity) getActivity();
|
||||
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
mMessageDrafts = getSharedPreferences(MESSAGE_DRAFTS_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
mImageLoader = TwidereApplication.getInstance(activity).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(activity).getMediaLoaderWrapper();
|
||||
mReadStateManager = getReadStateManager();
|
||||
mTwitterWrapper = getTwitterWrapper();
|
||||
mValidator = new TwidereValidator(activity);
|
||||
|
@ -83,7 +83,7 @@ public class RetweetQuoteDialogFragment extends BaseSupportDialogFragment implem
|
||||
final Context context = builder.getContext();
|
||||
final SharedPreferencesWrapper preferences = SharedPreferencesWrapper.getInstance(context,
|
||||
SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
final MediaLoaderWrapper loader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
final MediaLoaderWrapper loader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
|
||||
final ImageLoadingHandler handler = new ImageLoadingHandler(R.id.media_preview_progress);
|
||||
final AsyncTwitterWrapper twitter = getTwitterWrapper();
|
||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||
|
@ -498,7 +498,7 @@ public class StatusFragment extends BaseSupportFragment
|
||||
mFragment = fragment;
|
||||
mContext = context;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
|
||||
mImageLoadingHandler = new ImageLoadingHandler(R.id.media_preview_progress);
|
||||
mCardBackgroundColor = ThemeUtils.getCardBackgroundColor(context);
|
||||
mNameFirst = preferences.getBoolean(KEY_NAME_FIRST, true);
|
||||
|
@ -128,7 +128,7 @@ public class StatusTranslateDialogFragment extends BaseSupportDialogFragment imp
|
||||
if (status == null || translated == null) return;
|
||||
final FragmentActivity activity = getActivity();
|
||||
final TwidereApplication application = getApplication();
|
||||
final MediaLoaderWrapper loader = application.getImageLoaderWrapper();
|
||||
final MediaLoaderWrapper loader = application.getMediaLoaderWrapper();
|
||||
final ImageLoadingHandler handler = new ImageLoadingHandler(R.id.media_preview_progress);
|
||||
final AsyncTwitterWrapper twitter = getTwitterWrapper();
|
||||
final SharedPreferencesWrapper preferences = SharedPreferencesWrapper.getInstance(activity,
|
||||
|
@ -653,7 +653,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
userId = args.getLong(EXTRA_USER_ID, -1);
|
||||
screenName = args.getString(EXTRA_SCREEN_NAME);
|
||||
}
|
||||
mProfileImageLoader = getApplication().getImageLoaderWrapper();
|
||||
mProfileImageLoader = getApplication().getMediaLoaderWrapper();
|
||||
final FragmentActivity activity = getActivity();
|
||||
|
||||
Utils.setNdefPushMessageCallback(activity, new CreateNdefMessageCallback() {
|
||||
|
@ -321,7 +321,7 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
||||
}
|
||||
|
||||
mTwitterWrapper = getApplication().getTwitterWrapper();
|
||||
mProfileImageLoader = getApplication().getImageLoaderWrapper();
|
||||
mProfileImageLoader = getApplication().getMediaLoaderWrapper();
|
||||
mProfileImageView.setOnClickListener(this);
|
||||
mUserListDetails.setOnClickListener(this);
|
||||
mRetryButton.setOnClickListener(this);
|
||||
|
@ -167,7 +167,7 @@ public class UserMediaTimelineFragment extends BaseSupportFragment
|
||||
|
||||
MediaTimelineAdapter(Context context) {
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
|
||||
mLoadingHandler = new ImageLoadingHandler(R.id.media_image_progress);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class ViewStatusDialogFragment extends BaseSupportDialogFragment {
|
||||
}
|
||||
final TwidereApplication application = getApplication();
|
||||
final FragmentActivity activity = getActivity();
|
||||
final MediaLoaderWrapper loader = application.getImageLoaderWrapper();
|
||||
final MediaLoaderWrapper loader = application.getMediaLoaderWrapper();
|
||||
final ImageLoadingHandler handler = new ImageLoadingHandler(R.id.media_preview_progress);
|
||||
final AsyncTwitterWrapper twitter = getTwitterWrapper();
|
||||
final SharedPreferencesWrapper preferences = SharedPreferencesWrapper.getInstance(activity,
|
||||
|
@ -150,7 +150,7 @@ public class AccountSelectorPopupWindow {
|
||||
|
||||
public AccountsGridAdapter(Context context) {
|
||||
super(context, R.layout.grid_item_selector_account);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
mImageLoader = TwidereApplication.getInstance(context).getMediaLoaderWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,7 +116,7 @@ public abstract class AccountsListPreference extends PreferenceCategory implemen
|
||||
mAccount = account;
|
||||
mSwitchPreference = context.getSharedPreferences(switchPreferenceName, Context.MODE_PRIVATE);
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
mSwitchKey = switchKey;
|
||||
mSwitchDefault = switchDefault;
|
||||
mSwitchPreference.registerOnSharedPreferenceChangeListener(this);
|
||||
|
@ -19,11 +19,13 @@
|
||||
|
||||
package org.mariotaku.twidere.util.net;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSession;
|
||||
|
||||
public final class HostResolvedHostnameVerifier implements HostnameVerifier {
|
||||
public HostResolvedHostnameVerifier(boolean ignoreSSLError) {
|
||||
public HostResolvedHostnameVerifier(Context context, boolean ignoreSSLError) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -29,12 +29,14 @@ import twitter4j.http.HttpClientFactory;
|
||||
* Created by mariotaku on 15/1/22.
|
||||
*/
|
||||
public class OkHttpClientFactory implements HttpClientFactory {
|
||||
public OkHttpClientFactory(Context context) {
|
||||
private final Context context;
|
||||
|
||||
public OkHttpClientFactory(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpClient getInstance(HttpClientConfiguration conf) {
|
||||
return new OkHttpClientImpl(conf);
|
||||
return new OkHttpClientImpl(context, conf);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package org.mariotaku.twidere.util.net;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.SSLCertificateSocketFactory;
|
||||
import android.net.Uri;
|
||||
|
||||
@ -51,6 +52,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import javax.net.SocketFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import okio.BufferedSink;
|
||||
import twitter4j.TwitterException;
|
||||
@ -69,11 +71,13 @@ import twitter4j.http.RequestMethod;
|
||||
public class OkHttpClientImpl implements HttpClient, TwidereConstants {
|
||||
|
||||
public static final MediaType APPLICATION_FORM_URLENCODED = MediaType.parse("application/x-www-form-urlencoded; charset=UTF-8");
|
||||
private final Context context;
|
||||
private final HttpClientConfiguration conf;
|
||||
private final OkHttpClient client;
|
||||
private final HostAddressResolver resolver;
|
||||
|
||||
public OkHttpClientImpl(HttpClientConfiguration conf) {
|
||||
public OkHttpClientImpl(Context context, HttpClientConfiguration conf) {
|
||||
this.context = context;
|
||||
this.conf = conf;
|
||||
this.resolver = conf.getHostAddressResolverFactory().getInstance(conf);
|
||||
this.client = createHttpClient(conf);
|
||||
@ -109,11 +113,15 @@ public class OkHttpClientImpl implements HttpClient, TwidereConstants {
|
||||
private OkHttpClient createHttpClient(HttpClientConfiguration conf) {
|
||||
final OkHttpClient client = new OkHttpClient();
|
||||
final boolean ignoreSSLError = conf.isSSLErrorIgnored();
|
||||
final SSLCertificateSocketFactory sslSocketFactory;
|
||||
if (ignoreSSLError) {
|
||||
client.setSslSocketFactory(SSLCertificateSocketFactory.getInsecure(0, null));
|
||||
sslSocketFactory = (SSLCertificateSocketFactory) SSLCertificateSocketFactory.getInsecure(0, null);
|
||||
} else {
|
||||
client.setSslSocketFactory(SSLCertificateSocketFactory.getDefault(0, null));
|
||||
sslSocketFactory = (SSLCertificateSocketFactory) SSLCertificateSocketFactory.getDefault(0, null);
|
||||
}
|
||||
// sslSocketFactory.setTrustManagers(new TrustManager[]{new TwidereTrustManager(context)});
|
||||
// client.setHostnameVerifier(new HostResolvedHostnameVerifier(context, ignoreSSLError));
|
||||
client.setSslSocketFactory(sslSocketFactory);
|
||||
client.setSocketFactory(SocketFactory.getDefault());
|
||||
client.setConnectTimeout(conf.getHttpConnectionTimeout(), TimeUnit.MILLISECONDS);
|
||||
|
||||
@ -121,7 +129,6 @@ public class OkHttpClientImpl implements HttpClient, TwidereConstants {
|
||||
client.setProxy(new Proxy(Type.HTTP, InetSocketAddress.createUnresolved(conf.getHttpProxyHost(),
|
||||
conf.getHttpProxyPort())));
|
||||
}
|
||||
// client.setHostnameVerifier(new HostResolvedHostnameVerifier());
|
||||
Internal.instance.setNetwork(client, new Network() {
|
||||
@Override
|
||||
public InetAddress[] resolveInetAddresses(String host) throws UnknownHostException {
|
||||
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 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.net;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/3/31.
|
||||
*/
|
||||
public class TwidereTrustManager implements X509TrustManager {
|
||||
public TwidereTrustManager(Context context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return new X509Certificate[0];
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
-->
|
||||
<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="match_parent">
|
||||
|
||||
@ -27,11 +28,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<ProgressBar
|
||||
<com.pnikosis.materialishprogress.ProgressWheel
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="@dimen/element_size_normal"
|
||||
android:layout_height="@dimen/element_size_normal"
|
||||
android:layout_gravity="center"/>
|
||||
android:layout_gravity="center"
|
||||
app:matProg_barColor="@color/branding_color"/>
|
||||
|
||||
|
||||
</FrameLayout>
|
@ -53,9 +53,9 @@
|
||||
android:hint="@string/consumer_key"
|
||||
android:inputType="text|textVisiblePassword"
|
||||
android:singleLine="true"
|
||||
app:baseColor="?android:textColorPrimary"
|
||||
app:floatingLabel="normal"
|
||||
app:floatingLabelText="@string/consumer_key"/>
|
||||
app:met_baseColor="?android:textColorPrimary"
|
||||
app:met_floatingLabel="normal"
|
||||
app:met_floatingLabelText="@string/consumer_key"/>
|
||||
|
||||
<com.rengwuxian.materialedittext.MaterialEditText
|
||||
android:id="@+id/consumer_secret"
|
||||
@ -65,8 +65,8 @@
|
||||
android:hint="@string/consumer_secret"
|
||||
android:inputType="text|textVisiblePassword"
|
||||
android:singleLine="true"
|
||||
app:baseColor="?android:textColorPrimary"
|
||||
app:floatingLabel="normal"
|
||||
app:floatingLabelText="@string/consumer_secret"/>
|
||||
app:met_baseColor="?android:textColorPrimary"
|
||||
app:met_floatingLabel="normal"
|
||||
app:met_floatingLabelText="@string/consumer_secret"/>
|
||||
|
||||
</LinearLayout>
|
Loading…
x
Reference in New Issue
Block a user