removed unused class

This commit is contained in:
Mariotaku Lee 2015-06-09 01:39:01 +08:00
parent f574ae19dc
commit 7d9c4bc0b0
2 changed files with 0 additions and 214 deletions

View File

@ -1,141 +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.adapter;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.database.Cursor;
import android.support.v4.widget.SimpleCursorAdapter;
import org.mariotaku.twidere.adapter.iface.IBaseAdapter;
import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.util.MediaLoaderWrapper;
import org.mariotaku.twidere.util.OnLinkClickHandler;
import org.mariotaku.twidere.util.TwidereLinkify;
import org.mariotaku.twidere.util.Utils;
public class BaseCursorAdapter extends SimpleCursorAdapter implements IBaseAdapter, OnSharedPreferenceChangeListener {
private final TwidereLinkify mLinkify;
private float mTextSize;
private int mLinkHighlightOption, mLinkHighlightColor;
private boolean mDisplayProfileImage, mDisplayNameFirst, mShowAccountColor;
private final SharedPreferences mNicknamePrefs, mColorPrefs;
private final MediaLoaderWrapper mImageLoader;
public BaseCursorAdapter(final Context context, final int layout, final Cursor c, final String[] from,
final int[] to) {
this(context, layout, c, from, to, 0);
}
public BaseCursorAdapter(final Context context, final int layout, final Cursor c, final String[] from,
final int[] to, final int flags) {
super(context, layout, c, from, to, flags);
final TwidereApplication app = TwidereApplication.getInstance(context);
mLinkify = new TwidereLinkify(new OnLinkClickHandler(context, app.getMultiSelectManager()));
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);
mColorPrefs.registerOnSharedPreferenceChangeListener(this);
}
@Override
public MediaLoaderWrapper getImageLoader() {
return mImageLoader;
}
@Override
public final int getLinkHighlightOption() {
return mLinkHighlightOption;
}
public final TwidereLinkify getLinkify() {
return mLinkify;
}
@Override
public final float getTextSize() {
return mTextSize;
}
@Override
public final boolean isDisplayNameFirst() {
return mDisplayNameFirst;
}
@Override
public final boolean isProfileImageDisplayed() {
return mDisplayProfileImage;
}
@Override
public final boolean isShowAccountColor() {
return mShowAccountColor;
}
@Override
public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key) {
notifyDataSetChanged();
}
@Override
public final void setDisplayNameFirst(final boolean name_first) {
if (mDisplayNameFirst == name_first) return;
mDisplayNameFirst = name_first;
notifyDataSetChanged();
}
@Override
public final void setDisplayProfileImage(final boolean display) {
if (display == mDisplayProfileImage) return;
mDisplayProfileImage = display;
notifyDataSetChanged();
}
@Override
public final void setLinkHighlightOption(final String option) {
final int option_int = Utils.getLinkHighlightingStyleInt(option);
if (option_int == mLinkHighlightOption) return;
mLinkHighlightOption = option_int;
mLinkify.setHighlightOption(option_int);
notifyDataSetChanged();
}
@Override
public final void setShowAccountColor(final boolean show) {
if (show == mShowAccountColor) return;
mShowAccountColor = show;
notifyDataSetChanged();
}
@Override
public final void setTextSize(final float textSize) {
if (textSize == mTextSize) return;
mTextSize = textSize;
notifyDataSetChanged();
}
}

View File

@ -1,73 +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.adapter;
import android.content.Context;
import android.content.SharedPreferences;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.util.MediaLoadingHandler;
import org.mariotaku.twidere.util.MediaLoaderWrapper;
import java.util.Collection;
public class MediaPreviewAdapter extends ArrayAdapter<String> implements Constants {
private final MediaLoaderWrapper mImageLoader;
private final SharedPreferences mPreferences;
private final MediaLoadingHandler mMediaLoadingHandler;
private boolean mIsPossiblySensitive;
public MediaPreviewAdapter(final Context context) {
super(context, R.layout.gallery_item_image_preview);
mImageLoader = ((TwidereApplication) context.getApplicationContext()).getMediaLoaderWrapper();
mPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
mMediaLoadingHandler = new MediaLoadingHandler();
}
public void addAll(final Collection<String> data, final boolean is_possibly_sensitive) {
mIsPossiblySensitive = is_possibly_sensitive;
addAll(data);
}
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
final View view = super.getView(position, convertView, parent);
final String link = getItem(position);
final ImageView image_view = (ImageView) view.findViewById(R.id.media_preview_item);
image_view.setTag(link);
if (mIsPossiblySensitive && !mPreferences.getBoolean(KEY_DISPLAY_SENSITIVE_CONTENTS, false)) {
view.findViewById(R.id.media_preview_progress).setVisibility(View.GONE);
image_view.setBackgroundResource(R.drawable.image_preview_nsfw);
mImageLoader.cancelDisplayTask(image_view);
} else if (!link.equals(mMediaLoadingHandler.getLoadingUri(image_view))) {
image_view.setBackgroundResource(0);
mImageLoader.displayPreviewImage(image_view, link, mMediaLoadingHandler);
}
return view;
}
}