Removed the DailyKingFeatures comics as per the request made by its authors :(

This commit is contained in:
Tejaswi 2013-02-22 22:38:20 +05:30
parent 83bb9cc187
commit 693d155cad
6 changed files with 93 additions and 45 deletions

View File

@ -49,6 +49,8 @@ public class ActivityComicSelector extends ComicActivity {
protected static PreviewLauncher mPL = null;
/** web page display activity */
protected static ComicMainWebPageDisplay mWP = null;
/** to display a message describing why we had to disable this comic! */
protected static ComicHasBeenDisabled mDis = null;
/** sort type */
protected int mType;
@ -57,18 +59,28 @@ public class ActivityComicSelector extends ComicActivity {
private boolean mStoreList = true;
/** to launch the strip viewer activity in preview mode */
private class PreviewLauncher implements OnClickListener {
@Override
public void onClick(View v) {
Log.d(TAG, "PreviewLauncher getting triggered...");
Intent i = new Intent();
i.setClass(ActivityComicSelector.this, ComicStripViewer.class);
i.putExtra("title", (String)v.getTag());
i.putExtra("mode", Comic.TYPE_PREVIEW);
startActivityForResult(i, 0);
}
}
/** to launch the strip viewer activity in preview mode */
private class PreviewLauncher implements OnClickListener {
@Override
public void onClick(View v) {
Log.d(TAG, "PreviewLauncher getting triggered...");
Intent i = new Intent();
i.setClass(ActivityComicSelector.this, ComicStripViewer.class);
i.putExtra("title", (String)v.getTag());
i.putExtra("mode", Comic.TYPE_PREVIEW);
startActivityForResult(i, 0);
}
}
/** to display a message to the user */
private class ComicHasBeenDisabled implements OnClickListener {
@Override
public void onClick(View v) {
Log.d(TAG, "ComicHasBeenDisabled getting triggered...");
String msg = "SORRY! Comic:'" + (String)v.getTag() + "' had to be removed from the list based on the request from its authors!";
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
}
}
/** to launch the alertdialog for opening the comic in a web page */
private class ComicMainWebPageDisplay implements OnLongClickListener {
@ -125,31 +137,29 @@ public class ActivityComicSelector extends ComicActivity {
public long getItemId(int position) {
return position;
}
/** comic select checkbox */
OnClickListener ocl = new OnClickListener() {
public void onClick(View v) {
try {
int pos = (Integer) v.getTag();
mList.toggleSelected(pos);
}
catch (ComicNotFoundException e) {
e.printStackTrace();
}
notifyDataSetChanged();
}
};
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.comic_selector_listview_content, null);
holder = new ViewHolder();
// comic select checkbox
OnClickListener ocl = new OnClickListener() {
public void onClick(View v) {
try {
int pos = (Integer) v.getTag();
mList.toggleSelected(pos);
}
catch (ComicNotFoundException e) {
e.printStackTrace();
}
notifyDataSetChanged();
}
};
holder.text_name = (TextView) convertView.findViewById(R.id.comic_settings_item_name);
holder.text_name.setOnLongClickListener(mWP);
holder.sel = (CheckBox) convertView.findViewById(R.id.comic_settings_item);
holder.sel.setOnClickListener(ocl);
holder.preview = (Button) convertView.findViewById(R.id.comic_settings_item_preview);
holder.preview.setOnClickListener(mPL);
convertView.setTag(holder);
}
else {
@ -159,14 +169,20 @@ public class ActivityComicSelector extends ComicActivity {
ComicClass clz = mList.getComicClassFromIndex(position);
holder.text_name.setText(clz.mName);
holder.text_name.setTag(clz.mName);
holder.sel.setChecked(clz.mSel);
holder.sel.setChecked(clz.mSel && clz.mCanDisplay);
holder.sel.setTag(position);
holder.preview.setTag(clz.mName);
if(clz.mCanDisplay) {
holder.setEnabledListeners();
}
else {
holder.setDisabledListeners();
}
}
catch(ComicNotFoundException e) {
e.printStackTrace();
}
convertView.setBackgroundColor((position & 1) == 1 ? mColor1 : mColor2);
convertView.setBackgroundColor((position & 1) == 1 ? mColor1 : mColor2);
return convertView;
}
@ -180,6 +196,20 @@ public class ActivityComicSelector extends ComicActivity {
CheckBox sel;
/** preview button */
Button preview;
/** Set the holder to respond to the events correctly */
void setEnabledListeners() {
text_name.setOnLongClickListener(mWP);
text_name.setTextColor(mEnabledColor);
preview.setOnClickListener(mPL);
sel.setEnabled(true);
}
/** Set the holder to not respond to the events (this occurs when we have to remove the comic!) */
void setDisabledListeners() {
text_name.setOnClickListener(mDis);
text_name.setTextColor(mDisabledColor);
sel.setEnabled(false);
preview.setOnClickListener(mDis);
}
}
}
@ -193,6 +223,9 @@ public class ActivityComicSelector extends ComicActivity {
if(mWP == null) {
mWP = new ComicMainWebPageDisplay();
}
if(mDis == null) {
mDis = new ComicHasBeenDisabled();
}
GetAllComicsTask get_task = new GetAllComicsTask();
get_task.execute((Void[])null);
}

View File

@ -2,23 +2,18 @@ package com.blogspot.applications4android.comicreader.comics;
import java.io.BufferedReader;
import java.io.IOException;
import java.net.URI;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import android.util.Log;
import com.blogspot.applications4android.comicreader.comictypes.ArchivedComic;
import com.blogspot.applications4android.comicreader.core.Bound;
import com.blogspot.applications4android.comicreader.core.Downloader;
import com.blogspot.applications4android.comicreader.core.Strip;
public class LeastICouldDo extends ArchivedComic {
private static final int mFirstYr = 2003;
private int mCurrYr;
// private static final int mFirstYr = 2003;
// private int mCurrYr;
@Override
public String getComicWebPageUrl() {
@ -47,7 +42,6 @@ public class LeastICouldDo extends ArchivedComic {
// for (c.set(2003, 2, 10); c.get(Calendar.MONTH) <= 2004;
// c.add(Calendar.DAY_OF_YEAR, 1)) {
for (c.set(2003, 2, 10); c.compareTo(today) <= -1; c.add(Calendar.DAY_OF_YEAR, 1)) {
String surl = String.format("http://leasticoulddo.com/comic/%4d%02d%02d/", c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1,
c.get(Calendar.DAY_OF_MONTH));
all_yrs.add(surl);

View File

@ -22,7 +22,7 @@ public abstract class DailyKingFeaturesComic extends DailyComic {
protected Calendar mFirstCal = null;
/** list of month names */
private static final String[] MONTH_NAMES = { "january", "febraury", "march",
private static final String[] MONTH_NAMES = { "january", "february", "march",
"april", "may", "june", "july",
"august", "september", "october",
"november", "december" };

View File

@ -32,6 +32,10 @@ public class ComicActivity extends Activity {
protected static int mColor1 = Color.parseColor("#222222");
/** color2 for the list view row */
protected static int mColor2 = Color.parseColor("#333333");
/** color for disabled comic's text */
protected static int mDisabledColor = Color.parseColor("#722020");
/** color for enabled comic's text */
protected static int mEnabledColor = Color.parseColor("#ffffff");
/** the broadcast receiver for network connectivity check */
//private ConnectivityCheck mNetworkChk;

View File

@ -16,6 +16,8 @@ public class ComicClass {
public boolean mSel;
/** num unread strips */
public int mUnread;
/** can be displayed in the main list or not */
public boolean mCanDisplay;
/**
* Constructor
@ -27,5 +29,6 @@ public class ComicClass {
mNew = false;
mSel = false;
mUnread = 0;
mCanDisplay = true;
}
}

View File

@ -57,10 +57,23 @@ public class ComicClassList {
//// NOTE NOTE NOTE NOTE ////
/// Before releasing to market, do remember to set the below flag to 'true'!!!!!!!!
/** flag which will tell whether to use the below array to filtering the comics! */
private static boolean FILTER_COMICS = false;
private static boolean FILTER_COMICS = true;
/** list of comics that cannot be shown to the users! */
private static final String[] FILTER_COMICS_LIST = { "Cyanide and Happiness" };
private static final String[] FILTER_COMICS_LIST = {
"Cyanide and Happiness",
"Arctic Circle",
"Beetle Bailey",
"Bleeker",
"Brilliant Mind Of Edison Lee",
"Gil",
"Pajama Diaries",
"Popeye",
"Retail Comic",
"Rhymes With Orange",
"Tina's Groove",
"Zits"
};
/**
@ -315,7 +328,7 @@ public class ComicClassList {
int i = 0;
int j = 0;
for(ComicClass clz : mClasses) {
if(clz.mSel) {
if(clz.mSel && clz.mCanDisplay) {
sel[j] = i;
++j;
}
@ -381,7 +394,7 @@ public class ComicClassList {
public int numSelected() {
int i = 0;
for(ComicClass clz : mClasses) {
if(clz.mSel) {
if(clz.mSel && clz.mCanDisplay) {
++i;
}
}
@ -461,9 +474,9 @@ public class ComicClassList {
for(int i=0;i<numClasses;i++) {
JSONObject clz = classes.getJSONObject(i);
String key = clz.getString("name");
if(!_canAdd(key)) {
Log.d(TAG, "Not adding the comic '" + key + "' to the list...");
continue;
boolean canAdd = _canAdd(key);
if(!canAdd) {
Log.d(TAG, "Comic '" + key + "' cannot be displayed due to request from the comic-authors...");
}
ComicClass cl = new ComicClass();
cl.mClass = clz.getString("class");
@ -476,6 +489,7 @@ public class ComicClassList {
cl.mNew = false;
}
cl.mSel = false;
cl.mCanDisplay = canAdd;
com_arr.add(cl);
mIdxs.put(key, j);
j++;