(context, textViewResId, strings);
- }
-
- /**
- * {@inheritDoc}
- */
- public Filter getFilter() {
- if (mFilter == null) {
- mFilter = new ArrayFilter();
- }
- return mFilter;
- }
-
- /**
- * An array filter constrains the content of the array adapter with
- * a prefix. Each item that does not start with the supplied prefix
- * is removed from the list.
- */
- private class ArrayFilter extends Filter {
- @Override
- protected FilterResults performFiltering(CharSequence prefix) {
- FilterResults results = new FilterResults();
-
- if (mOriginalValues == null) {
- synchronized (mLock) {
- mOriginalValues = new ArrayList(mObjects);
- }
- }
-
- if (prefix == null || prefix.length() == 0) {
- synchronized (mLock) {
- ArrayList list = new ArrayList(mOriginalValues);
- results.values = list;
- results.count = list.size();
- }
- } else {
- String prefixString = prefix.toString().toLowerCase();
-
- final ArrayList values = mOriginalValues;
- final int count = values.size();
-
- final ArrayList newValues = new ArrayList(count);
-
- for (int i = 0; i < count; i++) {
- final T value = values.get(i);
- final String valueText = value.toString().toLowerCase();
-
- // First match against the whole, non-splitted value
- if (valueText.contains(prefixString)) {
- newValues.add(value);
- } else {
- final String[] words = valueText.split(" ");
- final int wordCount = words.length;
-
- for (int k = 0; k < wordCount; k++) {
- if (words[k].contains(prefixString)) {
- newValues.add(value);
- break;
- }
- }
- }
- }
-
- results.values = newValues;
- results.count = newValues.size();
- }
-
- return results;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void publishResults(CharSequence constraint, FilterResults results) {
- //noinspection unchecked
-
- mObjects = (List) results.values;
- if (results.count > 0) {
- notifyDataSetChanged();
- } else {
- notifyDataSetInvalidated();
- }
- }
- }
-}
diff --git a/3rdparth/joy_20121011_client/src/com/joy/Tools/ImageAndText.java b/3rdparth/joy_20121011_client/src/com/joy/Tools/ImageAndText.java
deleted file mode 100755
index 406dc5d..0000000
--- a/3rdparth/joy_20121011_client/src/com/joy/Tools/ImageAndText.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.joy.Tools;
-
-public class ImageAndText {
- private String imageUrl;
- private String text;
-
- public ImageAndText(String imageUrl, String text) {
- this.imageUrl = imageUrl;
- this.text = text;
- }
- public String getImageUrl() {
- return imageUrl;
- }
- public String getText() {
- return text;
- }
-}
diff --git a/3rdparth/joy_20121011_client/src/com/joy/Tools/MyEditText.java b/3rdparth/joy_20121011_client/src/com/joy/Tools/MyEditText.java
deleted file mode 100755
index e5f3047..0000000
--- a/3rdparth/joy_20121011_client/src/com/joy/Tools/MyEditText.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.joy.Tools;
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.drawable.Drawable;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.style.ImageSpan;
-import android.util.AttributeSet;
-import android.widget.EditText;
-
-
-public class MyEditText extends EditText {
-
- public MyEditText(Context context) {
- super(context);
- }
-
- public MyEditText(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- super.onDraw(canvas);
- }
-
- //在编辑框顶部添加图片
- public void setDrawableTop(Drawable top) {
- setCompoundDrawablesWithIntrinsicBounds(null, top, null, null);
- }
- //在编辑框顶部添加图片
- public void setDrawableTop(int top) {
- setCompoundDrawablesWithIntrinsicBounds(0, top, 0, 0);
- }
- //在编辑框顶部左边图片
- public void setDrawableRight(int right) {
- setCompoundDrawablesWithIntrinsicBounds(0, 0, right, 0);
- }
- public void setDrawableRight(Drawable right) {
- setCompoundDrawablesWithIntrinsicBounds(null, null, right, null);
-}
- //在编辑框左边添加图片
- public void setDrawableLeft(int left) {
- setCompoundDrawablesWithIntrinsicBounds(left, 0, 0, 0);
- }
- //在编辑框底部添加图片
- public void setDrawableButtom(int buttom) {
- setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, buttom);
- }
-
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- }
- //在编辑框内添加图片或者表情
- public void insertIcon(int id) {
- SpannableString ss = new SpannableString(getText().toString()
- + "[smile]");//new一个SpannableString里面包含EditText已有内容,另外添加一个字符串[smile]用于在后面替换一个图片
- Drawable d = getResources().getDrawable(id);
- d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
- ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE);//将图片实例化为一个ImageSpan型
- ss.setSpan(span, getText().length(),
- getText().length() + "[smile]".length(),
- Spannable.SPAN_INCLUSIVE_EXCLUSIVE);//将ImageSpan代替之前添加的[smile]字符串
- setText(ss);
- }
-}
-
diff --git a/3rdparth/joy_20121011_client/src/com/joy/Tools/MyGridView.java b/3rdparth/joy_20121011_client/src/com/joy/Tools/MyGridView.java
deleted file mode 100755
index 18b6919..0000000
--- a/3rdparth/joy_20121011_client/src/com/joy/Tools/MyGridView.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.joy.Tools;
-import android.content.Context;
-import android.util.AttributeSet;
-import android.widget.GridView;
-
-public class MyGridView extends GridView {
- public MyGridView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public MyGridView(Context context) {
- super(context);
- }
-
- public MyGridView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- @Override
- public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-
- int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
- MeasureSpec.AT_MOST);
- super.onMeasure(widthMeasureSpec, expandSpec);
- }
-
-}
\ No newline at end of file
diff --git a/3rdparth/joy_20121011_client/src/com/joy/Tools/SearchAdapter.java b/3rdparth/joy_20121011_client/src/com/joy/Tools/SearchAdapter.java
deleted file mode 100755
index add9190..0000000
--- a/3rdparth/joy_20121011_client/src/com/joy/Tools/SearchAdapter.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package com.joy.Tools;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Checkable;
-import android.widget.ImageView;
-import android.widget.SimpleAdapter;
-import android.widget.TextView;
-
-public class SearchAdapter extends SimpleAdapter {
-
- private AsyncImageLoader imageLoader = new AsyncImageLoader();
- private Map viewMap = new HashMap();
- private ViewBinder mViewBinder;
- private List extends Map> mData;
- private int mResource;
- private LayoutInflater mInflater;
- private String[] mFrom;
- private int[] mTo;
-
- public SearchAdapter(Context context, List extends Map> data,int resource, String[] from, int[] to) {
- super(context, data, resource, from, to);
- mData = data;
- mResource = resource;
- mFrom = from;
- mTo = to;
- mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- }
-
- public View getView(int position, View convertView, ViewGroup parent) {
- return createViewFromResource(position, convertView, parent, mResource);
- }
-
-
- private View createViewFromResource(int position, View convertView, ViewGroup parent, int resource) {
- View rowView = this.viewMap.get(position);
-
- if (rowView == null) {
- rowView = mInflater.inflate(resource, null);
-
- final int[] to = mTo;
- final int count = to.length;
- final View[] holder = new View[count];
-
- for (int i = 0; i < count; i++) {
- holder[i] = rowView.findViewById(to[i]);
- }
- rowView.setTag(holder);
- bindView(position, rowView);
- viewMap.put(position, rowView);
- }
- return rowView;
- }
-
- private void bindView(int position, View view) {
- final Map, ?> dataSet = mData.get(position);
- if (dataSet == null) {
- return;
- }
-
- final ViewBinder binder = mViewBinder;
- final View[] holder = (View[]) view.getTag();
- final String[] from = mFrom;
- final int[] to = mTo;
- final int count = to.length;
-
- for (int i = 0; i < count; i++) {
- final View v = holder[i];
- if (v != null) {
- final Object data = dataSet.get(from[i]);
- String urlText = null;
-
- if (data == null) {
- urlText = "";
- } else {
- urlText = data.toString();
- }
-
- boolean bound = false;
- if (binder != null) {
- bound = binder.setViewValue(v, data, urlText);
- }
-
- if (!bound) {
- if (v instanceof Checkable) {
- if (data instanceof Boolean) {
- ((Checkable) v).setChecked((Boolean) data);
- } else {
- throw new IllegalStateException(v.getClass()
- .getName()
- + " should be bound to a Boolean, not a "
- + data.getClass());
- }
- } else if (v instanceof TextView) {
- setViewText((TextView) v, urlText);
- } else if (v instanceof ImageView) {
- if (data instanceof Integer) {
- setViewImage((ImageView) v, (Integer) data);
- } else {
- setViewImage((ImageView) v, urlText);
- }
- } else {
- throw new IllegalStateException(
- v.getClass().getName()
- + " is not a "
- + " view that can be bounds by this SimpleAdapter");
- }
- }
- }
- }
- }
-
-
- public void setViewImage(ImageView v, int value) {
- v.setImageResource(value);
- }
-
- public void setViewImage(final ImageView v, String url) {
-// Bitmap bitmap = WebImageBuilder.returnBitMap(url);
-// ((ImageView) v).setImageBitmap(bitmap);
-
- imageLoader.loadDrawable(url, new AsyncImageLoader.ImageCallback() {
- public void imageLoaded(Drawable imageDrawable) {
- if(imageDrawable!=null && imageDrawable.getIntrinsicWidth()>0 ) {
-// BitmapDrawable bDrawable=(BitmapDrawable)imageDrawable;
-// Bitmap drawable=bDrawable.getBitmap();
-// Matrix matrix=new Matrix();
-// float pecentw=70.0f/drawable.getWidth();
-// float pecenth=70.0f/drawable.getHeight();
-// matrix.postScale(pecentw, pecenth);
-// Bitmap btm=Bitmap.createBitmap(drawable, 0, 0, drawable.getWidth(), drawable.getHeight(), matrix, true);
-//
-// v.setImageBitmap(btm);
- v.setImageDrawable(imageDrawable);
- }
- }
- });
- }
-
- }
diff --git a/3rdparth/joy_20121011_client/src/com/joy/Tools/Tools.java b/3rdparth/joy_20121011_client/src/com/joy/Tools/Tools.java
deleted file mode 100755
index 9e06931..0000000
--- a/3rdparth/joy_20121011_client/src/com/joy/Tools/Tools.java
+++ /dev/null
@@ -1,474 +0,0 @@
-package com.joy.Tools;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-import java.util.TimeZone;
-import java.util.Vector;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.ColorMatrix;
-import android.graphics.ColorMatrixColorFilter;
-import android.graphics.Paint;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.Bitmap.Config;
-import android.graphics.PorterDuff.Mode;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.os.Environment;
-import android.os.Handler;
-import android.os.StatFs;
-import android.telephony.TelephonyManager;
-import android.util.Log;
-import android.widget.ImageView;
-
-public class Tools {
- public Tools(){
-
- }
- public static boolean hasSdcard(){
- String state = Environment.getExternalStorageState();
- if(state.equals(Environment.MEDIA_MOUNTED)){
- return true;
- }else{
- return false;
- }
- }
- public static long getAvailableStore(String filePath) {
- // 取得sdcard文件路径
- StatFs statFs = new StatFs(filePath);
- // 获取block的SIZE
- long blocSize = statFs.getBlockSize();
- // 获取BLOCK数量
- // long totalBlocks = statFs.getBlockCount();
- // 可使用的Block的数量
- long availaBlock = statFs.getAvailableBlocks();
- long availableSpare = availaBlock * blocSize;
- return availableSpare;
- }
- public static void changeLight(ImageView imageView, int brightness) {
- ColorMatrix cMatrix = new ColorMatrix();
- cMatrix.set(new float[] { 1, 0, 0, 0, brightness, 0, 1, 0, 0,
- brightness,// 改变亮度
- 0, 0, 1, 0, brightness, 0, 0, 0, 1, 0 });
- imageView.setColorFilter(new ColorMatrixColorFilter(cMatrix));
-}
- public static Bitmap drawableToBitamp(Drawable drawable){
- BitmapDrawable bd = (BitmapDrawable) drawable;
- return bd.getBitmap();
- }
- public static Drawable BitampTodrawable(Bitmap bitmap){
- BitmapDrawable bd=new BitmapDrawable(bitmap);
- return bd;
- }
- public static boolean isNetworkAvailable(Context context) {
- ConnectivityManager cm = (ConnectivityManager) context
- .getSystemService(Context.CONNECTIVITY_SERVICE);
- if (cm == null) {
- } else {
- //如果仅仅是用来判断网络连接 ,则可以使用 cm.getActiveNetworkInfo().isAvailable();
- NetworkInfo[] info = cm.getAllNetworkInfo();
- if (info != null) {
- for (int i = 0; i < info.length; i++) {
- if (info[i].getState() == NetworkInfo.State.CONNECTED) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- public static InputStream getStreamFromURL(String imageURL) {
- InputStream in=null;
- try {
- URL url=new URL(imageURL);
- HttpURLConnection connection=(HttpURLConnection) url.openConnection();
- in=connection.getInputStream();
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return in;
-
- }
- public static boolean isSimExist(Context context){ //是否插卡
- TelephonyManager mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
- if(mTelephonyManager.getSimState()==TelephonyManager.SIM_STATE_READY){
- return true;
- }
- return false;
- }
- public static List readFileList(String imgPath,String endwith){
- List fileList = new ArrayList();
- File fileDir = new File(imgPath);
- File[] files = fileDir.listFiles();
- if(files!=null){
- for(File file:files){
- //fileList.add(file.getPath());
- String fileName = file.getName();
- if (fileName.endsWith(endwith)){
- fileList.add(file.getPath());
- }
- }
- }
- return fileList;
- }
- public static int isspecial(String str){
- int t=0;
- for(int i=0;i='a')&&(ch <='z'))||((ch>='A')&&(ch<='Z'))||((ch>='0')&&(ch<='9'))||(ch=='/')||
- ch=='|'||ch=='~'||ch=='^'||ch=='#'||ch==';'||ch=='*'||ch=='%'||ch=='"'||ch=='_'))
- {
- return true;
- }
- }
- return false;
- }
- public static int isOk(String str) {
- int ok=0;
- if(str.charAt(0)==47)//接受的STRING为NULL或�??�长度为0
- {
- ok=0;
- }
- else if((str.charAt(0)>=65&&str.charAt(0)<=90)||(str.charAt(0)>=97&&str.charAt(0)<=122))//接受的STRING以字母开�??
- {
- ok=1;
- }
- else//其他
- {
- ok=2;
- }
- return ok;
- }
- public static byte[] readStream(InputStream inStream) throws Exception{
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- byte[] buffer = new byte[1024];
- int len = 0;
- while( (len=inStream.read(buffer)) != -1){
- outStream.write(buffer, 0, len);
- }
- outStream.close();
- inStream.close();
- return outStream.toByteArray();
- }
- public static byte[] getFileToByte(File file) {
- byte[] by = new byte[(int) file.length()];
- try {
- InputStream is = new FileInputStream(file);
- ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
- byte[] bb = new byte[2048];
- int ch;
- ch = is.read(bb);
- while (ch != -1) {
- bytestream.write(bb, 0, ch);
- ch = is.read(bb);
- }
- by = bytestream.toByteArray();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return by;
- }
- public static String replace(String from, String to, String source){
- if(source == null || from == null || to == null){
- return null;
- }
- StringBuffer bf = new StringBuffer();
- int index = -1;
- while((index = source.indexOf(from)) != -1){
- bf.append(source.substring(0, index) + to);
- source = source.substring(index + from.length());
- index = -1;
- }
- bf.append(source);
- return bf.toString();
- }
- public static String savecurrentDate() {
- TimeZone t = TimeZone.getTimeZone("GMT+08:00");
- Calendar calendar = Calendar.getInstance(t);
- int year = calendar.get( Calendar.YEAR );
- int month = calendar.get( Calendar.MONTH ) + 1;
- int day = calendar.get( Calendar.DATE );
- int h=calendar.get(Calendar.HOUR_OF_DAY);
- int m=calendar.get(Calendar.MINUTE);
- int mm=calendar.get(Calendar.SECOND);
- String sb = "";
- sb=year+"-"+month+"-"+day+" "+h+":"+m+":"+mm;
- return sb;
- }
- public static String currentDate() {
- TimeZone t = TimeZone.getTimeZone("GMT+08:00");
- Calendar calendar = Calendar.getInstance(t);
- int year = calendar.get( Calendar.YEAR );
- int month = calendar.get( Calendar.MONTH ) + 1;
- int day = calendar.get( Calendar.DATE );
- String sb = "";
- sb=year+"年"+month+"月"+day+"日";
- return sb;
- }
- public static String McurrentDate() {
- TimeZone t = TimeZone.getTimeZone("GMT+08:00");
- Calendar calendar = Calendar.getInstance(t);
- int year = calendar.get( Calendar.YEAR );
- int month = calendar.get( Calendar.MONTH ) + 1;
- String sb = "";
- sb=year+"-"+month;
- return sb;
- }
-
- public static void creat(String sdname)
- {
- File sd=Environment.getExternalStorageDirectory();
- String path=sd.getPath()+"/"+sdname;
- File file=new File(path);
- if(!file.exists()){
- file.mkdir();
- }
-
- }
- public static void SaveFile(String s,String filename,String sdname)
- {
- try
- {
- FileOutputStream outStream = new FileOutputStream(Environment.getExternalStorageDirectory()+sdname+"/"+filename,true);
- OutputStreamWriter writer = new OutputStreamWriter(outStream,"UTF-8");
- writer.write(s);
- writer.write("\n");
- writer.flush();
- writer.close();//记得关闭
-
- outStream.close();
- }
- catch (Exception e)
- {
- Log.e("m", "file write error");
- }
- }
-
- public static void saveMyBitmap(String sdname,String bitName,Bitmap mBitmap){
- File f = new File(Environment.getExternalStorageDirectory()+"/"+sdname+"/" + bitName );
- try {
- f.createNewFile();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- // DebugMessage.put("在保存图片时出错�??"+e.toString());
- }
- FileOutputStream fOut = null;
- try {
- fOut = new FileOutputStream(f);
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fOut);
- try {
- fOut.flush();
- } catch (IOException e) {
- e.printStackTrace();
- }
- try {
- fOut.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public static String[] Bigfo(String t,char big)
- {
- int len = t.length();
- int pos = -1;
-// int widths = 0;
- int lineStart = 0;
- int lineEnd = -1;
- Vector v = new Vector();
- while(++pos 0)
- {
- int subEnd = lineEnd;
- if(c == big)
- subEnd--;
- if(lineStart < subEnd)
- v.addElement(t.substring(lineStart,subEnd));
- lineStart = lineEnd;
- lineEnd = -1;
-// widths = 0 ;
- }
- }
- if(lineStart < len)
- {
- v.addElement(t.substring(lineStart,len));
- }
- String []ret = new String[v.size()];
- v.copyInto(ret);
- return ret;
- }
- public static boolean notPass(String base,String[] str)
- {
- boolean notpass=false;
- for(int i=0;i 0) t = aSplit; //第一次,不用拷贝数组
-
- iCount++;
- aSplit = new String[iCount]; //新的数组,
-
- if (iCount > 1) { //不是第一次,拷贝数组
- for (int i = 0; i < t.length; i++) aSplit[i] = t[i];
- }
-
- aSplit[iCount - 1] = sTemp.substring(0, iPos);
- sTemp = sTemp.substring(iPos + iLength); // 取余下的字符串
- }
- }
-
- if( (sTemp.length() >= 0) || bEnd) { // 判断最后剩余的 String,如果最后的字符是分割符号
- if (iCount > 0) t = aSplit;
- iCount++;
- aSplit = new String[iCount];
- if (iCount > 1) {
- for (int i = 0; i < t.length; i++) aSplit[i] = t[i];
- }
-
- aSplit[iCount - 1] = sTemp;
- }
-
- return aSplit;
- }
- public Bitmap getImage(String path,Handler mHandler){
- try{
- URL url = new URL(path);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.setConnectTimeout(5 * 1000);
- conn.setRequestMethod("GET");
- InputStream inStream = conn.getInputStream();
- if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){
- if (readStream(inStream) != null) {
- return BitmapFactory.decodeByteArray(readStream(inStream), 0, readStream(inStream).length);//
- }
- else
- {
- return null;
- }
- }
- else
- {
- return null;
- }
- }catch(Exception e)
- {
- return null;
- }
-
- }
- public static void ClearBitmap(Bitmap bitmap){
- if (bitmap!=null&&!bitmap.isRecycled()) {
- bitmap.recycle();
- bitmap=null;
- }
- System.gc();
- }
- public static Bitmap toRoundCorner(Bitmap bitmap, int pixels) {
-
- Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
- Canvas canvas = new Canvas(output);
-
- final int color = 0xff424242;
- final Paint paint = new Paint();
- final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
- final RectF rectF = new RectF(rect);
- final float roundPx = pixels;
-
- paint.setAntiAlias(true);
- canvas.drawARGB(0, 0, 0, 0);
- paint.setColor(color);
- canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
-
- paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
- canvas.drawBitmap(bitmap, rect, rect, paint);
-
- return output;
- }
- public static float getWidth(String text)
- {
- Paint mPaint = new Paint();
- mPaint.setTextSize(16);
- float FontSpace = mPaint.getFontSpacing();
- return text.length()*FontSpace;
- }
-}
diff --git a/3rdparth/joy_20121011_client/src/com/joy/Tools/ViewCache.java b/3rdparth/joy_20121011_client/src/com/joy/Tools/ViewCache.java
deleted file mode 100755
index 2714a64..0000000
--- a/3rdparth/joy_20121011_client/src/com/joy/Tools/ViewCache.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.joy.Tools;
-
-import com.joy.R;
-
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-
-public class ViewCache {
-
- private View baseView;
- private TextView textView;
- private ImageView imageView;
-
- public ViewCache(View baseView) {
- this.baseView = baseView;
- }
-
- public TextView getTextView() {
- if (textView == null) {
- textView = (TextView) baseView.findViewById(R.id.text_item);
- }
- return textView;
- }
-
- public ImageView getImageView() {
- if (imageView == null) {
- imageView = (ImageView) baseView.findViewById(R.id.image_item);
- }
- return imageView;
- }
-
-}
diff --git a/3rdparth/joy_20121011_client/src/com/joy/Welcome.java b/3rdparth/joy_20121011_client/src/com/joy/Welcome.java
deleted file mode 100755
index 7895a15..0000000
--- a/3rdparth/joy_20121011_client/src/com/joy/Welcome.java
+++ /dev/null
@@ -1,885 +0,0 @@
-package com.joy;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.graphics.drawable.Drawable;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnTouchListener;
-import android.widget.Button;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-import android.widget.ScrollView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.joy.Tools.AsyncBitmapLoader;
-import com.joy.Tools.AsyncBitmapLoader.ImageCallBack;
-import com.joy.Tools.AsyncImageLoader;
-import com.joy.Tools.BitmapZoom;
-import com.joy.Tools.Tools;
-import com.joy.view.PullToRefreshView;
-import com.joy.view.PullToRefreshView.OnFooterRefreshListener;
-import com.joy.view.PullToRefreshView.OnHeaderRefreshListener;
-import com.joy.weibo.net.AccessToken;
-import com.joy.weibo.net.Oauth2AccessTokenHeader;
-import com.joy.weibo.net.Utility;
-import com.joy.weibo.net.Weibo;
-import com.mobclick.android.MobclickAgent;
-
-public class Welcome extends Activity implements OnHeaderRefreshListener,OnFooterRefreshListener{
- Button btn_dianying,btn_juji,btn_shipin,btn_zongyi;
- private LinearLayout linearLayout1 = null;
- private LinearLayout linearLayout2 = null;
- private LinearLayout linearLayout3 = null;
- private ScrollView scrollView=null;
- PullToRefreshView mPullToRefreshView;
- List list;
- Context context;
- AsyncBitmapLoader asyncBitmapLoader;
- private int USE_LINEAR_INTERVAL = 0;//控制图片添加到那一个LinearLayout中
- private int linearlayoutWidth = 0;//根据屏幕的大小来计算每一张图片的宽度
- private int page_count = 9;// 每次加载x张图片
- private int current_page = 0;// 当前页数
- private int index =0;//加载的张数
- int select_index=1;//记录在哪一种类型的电影中
- Bitmap BigBitmap;
- ProgressDialog progressBar;
- long overPlus=100;//判断剩余SD卡剩余MB
- private String images_dianying[] = {
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg",
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg",
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg"
- };
- private String images_juji[] = {
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg",
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg",
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg"
- };
- private String images_zongyi[] = {
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg",
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg",
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg"
- };
- private String images_shipin[] = {
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg",
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg",
- "http://img16.pplive.cn/2009/12/08/13521044515_230X306.jpg",
- "http://img15.pplive.cn/2009/11/13/18032661617_230X306.jpg",
- "http://img11.pplive.cn/2009/01/29/14123973014_230X306.jpg",
- "http://img5.pplive.cn/2008/11/26/15290531087_230X306.jpg",
- "http://img11.pplive.cn/2009/05/15/17152279731_230X306.jpg",
- "http://img5.pplive.cn/2011/09/23/10405710241_230X306.jpg",
- "http://img15.pplive.cn/2010/04/06/13492503957_230X306.jpg",
- "http://img11.pplive.cn/2010/05/18/14370589655_230X306.jpg",
- "http://img7.pplive.cn/2010/05/08/10045437836_230X306.jpg"
- };
- private String name_dianying[] = {
- "电影1",
- "电影2",
- "电影3",
- "电影4",
- "电影5",
- "电影6",
- "电影7",
- "电影8",
- "电影9",
- "电影10",
- "电影11",
- "电影12",
- "电影13",
- "电影14",
- "电影15",
- "电影16",
- "电影17",
- "电影18",
- "电影19",
- "电影20",
- "电影21",
- "电影22",
- "电影23",
- "电影24",
- "电影25",
- "电影26",
- "电影27"
-
- };
- private String name_juji[] = {
- "剧集1",
- "剧集2",
- "剧集3",
- "剧集4",
- "剧集5",
- "剧集6",
- "剧集7",
- "剧集8",
- "剧集9",
- "剧集10",
- "剧集11",
- "剧集12",
- "剧集13",
- "剧集14",
- "剧集15",
- "剧集16",
- "剧集17",
- "剧集18",
- "剧集19",
- "剧集20",
- "剧集21",
- "剧集22",
- "剧集23",
- "剧集24",
- "剧集25",
- "剧集26",
- "剧集27"
- };
- private String name_zongyi[] = {
- "综艺1",
- "综艺2",
- "综艺3",
- "综艺4",
- "综艺5",
- "综艺6",
- "综艺7",
- "综艺8",
- "综艺9",
- "综艺10",
- "综艺11",
- "综艺12",
- "综艺13",
- "综艺14",
- "综艺15",
- "综艺16",
- "综艺17",
- "综艺18",
- "综艺19",
- "综艺20",
- "综艺21",
- "综艺22",
- "综艺23",
- "综艺24",
- "综艺25",
- "综艺26",
- "综艺27"
- };
- private String name_shipin[]={
- "视频1",
- "视频2",
- "视频3",
- "视频4",
- "视频5",
- "视频6",
- "视频7",
- "视频8",
- "视频9",
- "视频10",
- "视频11",
- "视频12",
- "视频13",
- "视频14",
- "视频15",
- "视频16",
- "视频17",
- "视频18",
- "视频19",
- "视频20",
- "视频21",
- "视频22",
- "视频23",
- "视频24",
- "视频25",
- "视频26",
- "视频27"
- };
- /*private String images_dianying[];
- private String images_juji[];
- private String images_zongyi[];
- private String images_shipin[];*/
- GetThird_AccessToken getThird_AccessToken;
- String where="where_0_1";
- final Handler handler = new Handler(){
- public void handleMessage(Message msg) {
- super.handleMessage(msg);
- switch (msg.what) {
- case 1:
- addBitmaps(++current_page, page_count,images_dianying,name_dianying);
- break;
- case 2:
- addBitmaps(++current_page, page_count,images_juji,name_juji);
- break;
- case 3:
- addBitmaps(++current_page, page_count,images_zongyi,name_zongyi);
- break;
- case 4:
- addBitmaps(++current_page, page_count,images_shipin,name_shipin);
- break;
- case 10:
- linearLayout1.removeAllViews();
- linearLayout2.removeAllViews();
- linearLayout3.removeAllViews();
- Tools.ClearBitmap(BigBitmap);
- current_page=0;
- index=0;
- addBitmaps(current_page, page_count,images_dianying,name_dianying);
- scrollView.fullScroll(ScrollView.FOCUS_UP);
- Toast.makeText(context, getResources().getString(R.string.shuaxin), Toast.LENGTH_SHORT).show();
- break;
- case 20:
- linearLayout1.removeAllViews();
- linearLayout2.removeAllViews();
- linearLayout3.removeAllViews();
- Tools.ClearBitmap(BigBitmap);
- current_page=0;
- index=0;
- addBitmaps(current_page, page_count,images_juji,name_juji);
- scrollView.fullScroll(ScrollView.FOCUS_UP);
- Toast.makeText(context, getResources().getString(R.string.shuaxin), Toast.LENGTH_SHORT).show();
- break;
- case 30:
- linearLayout1.removeAllViews();
- linearLayout2.removeAllViews();
- linearLayout3.removeAllViews();
- Tools.ClearBitmap(BigBitmap);
- current_page=0;
- index=0;
- addBitmaps(current_page, page_count,images_zongyi,name_zongyi);
- scrollView.fullScroll(ScrollView.FOCUS_UP);
- Toast.makeText(context, getResources().getString(R.string.shuaxin), Toast.LENGTH_SHORT).show();
- break;
- case 40:
- linearLayout1.removeAllViews();
- linearLayout2.removeAllViews();
- linearLayout3.removeAllViews();
- Tools.ClearBitmap(BigBitmap);
- current_page=0;
- index=0;
- addBitmaps(current_page, page_count,images_shipin,name_shipin);
- scrollView.fullScroll(ScrollView.FOCUS_UP);
- Toast.makeText(context, getResources().getString(R.string.shuaxin), Toast.LENGTH_SHORT).show();
- break;
- case 300:
- getThird_AccessToken.setQQ_Token(getThird_AccessToken.getQQ_Token().trim());
- getThird_AccessToken.GetOpenID();
- getThird_AccessToken.setOpenID(getThird_AccessToken.getOpenID());
- System.out.println(getThird_AccessToken.getwhere_gologin());
- if (getThird_AccessToken.getwhere_gologin()==1) {
-
- }
- else
- {
- Intent intent=new Intent();
- intent.setClass(context, JoyActivity.class);
- startActivity(intent);
- finish();
- progressBar.dismiss();
- }
- break;
- case 11:
- linearLayout1.removeAllViews();
- linearLayout2.removeAllViews();
- linearLayout3.removeAllViews();
- Tools.ClearBitmap(BigBitmap);
- current_page=0;
- index=0;
- addBitmaps(current_page, page_count,images_dianying,name_dianying);
- scrollView.fullScroll(ScrollView.FOCUS_UP);
- progressBar.dismiss();
- break;
- case 12:
- linearLayout1.removeAllViews();
- linearLayout2.removeAllViews();
- linearLayout3.removeAllViews();
- Tools.ClearBitmap(BigBitmap);
- current_page=0;
- index=0;
- addBitmaps(current_page, page_count,images_juji,name_juji);
- scrollView.fullScroll(ScrollView.FOCUS_UP);
- progressBar.dismiss();
- break;
- case 13:
- linearLayout1.removeAllViews();
- linearLayout2.removeAllViews();
- linearLayout3.removeAllViews();
- Tools.ClearBitmap(BigBitmap);
- current_page=0;
- index=0;
- addBitmaps(current_page, page_count,images_zongyi,name_zongyi);
- scrollView.fullScroll(ScrollView.FOCUS_UP);
- progressBar.dismiss();
- break;
- case 14:
- linearLayout1.removeAllViews();
- linearLayout2.removeAllViews();
- linearLayout3.removeAllViews();
- Tools.ClearBitmap(BigBitmap);
- current_page=0;
- index=0;
- addBitmaps(current_page, page_count,images_shipin,name_shipin);
- scrollView.fullScroll(ScrollView.FOCUS_UP);
- progressBar.dismiss();
- break;
- case 999:
- Intent intent = new Intent();
- getThird_AccessToken.setcontext(context);
- intent.setClass(context, DetailActivity.class);
- startActivity(intent);
- progressBar.dismiss();
- break;
- }
- }
- };
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.welcome);
- getThird_AccessToken = (GetThird_AccessToken) getApplicationContext();
- context=this;
- getThird_AccessToken=(GetThird_AccessToken)getApplicationContext();
- asyncBitmapLoader=new AsyncBitmapLoader();
- list=new ArrayList();
- mPullToRefreshView = (PullToRefreshView)findViewById(R.id.welcome_main_pull_refresh_view);
- mPullToRefreshView.setOnHeaderRefreshListener(this);
- mPullToRefreshView.setOnFooterRefreshListener(this);
- btn_dianying=(Button)findViewById(R.id.welcome_dianying);
- btn_dianying.setEnabled(false);
- btn_dianying.setBackgroundResource(R.drawable.topleft1);
- btn_juji=(Button)findViewById(R.id.welcome_juji);
- btn_shipin=(Button)findViewById(R.id.welcome_shipin);
- btn_zongyi=(Button)findViewById(R.id.welcome_zongyi);
- linearLayout1 = (LinearLayout)findViewById(R.id.welcome_linearlayout1);
- linearLayout2 = (LinearLayout)findViewById(R.id.welcome_linearlayout2);
- linearLayout3 = (LinearLayout)findViewById(R.id.welcome_linearlayout3);
- scrollView=(ScrollView)findViewById(R.id.welcome_sco);
- linearlayoutWidth = getWindowManager().getDefaultDisplay().getWidth()/3;
-
- images_dianying=SetSaveData(where,images_dianying);
- name_dianying=SetSaveName(where,name_dianying);
-
- addBitmaps(current_page, page_count,images_dianying,name_dianying);
- btn_dianying.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- getThird_AccessToken.setjujiliebiaoXianshi(0);
- where="where_0_1";
- images_dianying=SetSaveData(where,images_dianying);
- name_dianying=SetSaveName(where,name_dianying);
- select_index=1;
- btn_dianying.setBackgroundResource(R.drawable.topleft1);
- btn_juji.setBackgroundResource(R.drawable.topbarmid);
- btn_zongyi.setBackgroundResource(R.drawable.topbarmid);
- btn_shipin.setBackgroundResource(R.drawable.topbarright);
- btn_dianying.setEnabled(false);
- btn_juji.setEnabled(true);
- btn_zongyi.setEnabled(true);
- btn_shipin.setEnabled(true);
- progressBar = ProgressDialog.show(context, getResources().getString(R.string.shaohou), getResources().getString(R.string.pull_to_refresh_footer_refreshing_label));
- new Handler().postDelayed(new Runnable(){
- @Override
- public void run(){
- Message msg = new Message();
- msg.what = 11;
- handler.sendMessage(msg);
- }
- }, 1000);
-
- }
- });
- btn_juji.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- getThird_AccessToken.setjujiliebiaoXianshi(1);
- where="where_0_2";
- images_juji=SetSaveData(where,images_juji);
- name_juji=SetSaveName(where,name_juji);
- select_index=2;
- btn_dianying.setBackgroundResource(R.drawable.topleft);
- btn_juji.setBackgroundResource(R.drawable.topbarmid1);
- btn_zongyi.setBackgroundResource(R.drawable.topbarmid);
- btn_shipin.setBackgroundResource(R.drawable.topbarright);
- btn_dianying.setEnabled(true);
- btn_zongyi.setEnabled(true);
- btn_juji.setEnabled(false);
- btn_shipin.setEnabled(true);
- progressBar = ProgressDialog.show(context, getResources().getString(R.string.shaohou), getResources().getString(R.string.pull_to_refresh_footer_refreshing_label));
- new Handler().postDelayed(new Runnable(){
- @Override
- public void run(){
- Message msg = new Message();
- msg.what = 12;
- handler.sendMessage(msg);
- }
- }, 1000);
-
- }
- });
- btn_zongyi.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- getThird_AccessToken.setjujiliebiaoXianshi(2);
- where="where_0_3";
- images_zongyi=SetSaveData(where,images_zongyi);
- name_zongyi=SetSaveName(where,name_zongyi);
- select_index=3;
- btn_dianying.setBackgroundResource(R.drawable.topleft);
- btn_juji.setBackgroundResource(R.drawable.topbarmid);
- btn_zongyi.setBackgroundResource(R.drawable.topbarmid1);
- btn_shipin.setBackgroundResource(R.drawable.topbarright);
- btn_dianying.setEnabled(true);
- btn_juji.setEnabled(true);
- btn_shipin.setEnabled(true);
- btn_zongyi.setEnabled(false);
- progressBar = ProgressDialog.show(context, getResources().getString(R.string.shaohou), getResources().getString(R.string.pull_to_refresh_footer_refreshing_label));
- new Handler().postDelayed(new Runnable(){
- @Override
- public void run(){
- Message msg = new Message();
- msg.what = 13;
- handler.sendMessage(msg);
- }
- }, 1000);
-
- }
- });
- btn_shipin.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- getThird_AccessToken.setjujiliebiaoXianshi(0);
- where="where_0_4";
- images_shipin=SetSaveData(where,images_shipin);
- name_shipin=SetSaveName(where,name_shipin);
- select_index=4;
- btn_dianying.setBackgroundResource(R.drawable.topleft);
- btn_juji.setBackgroundResource(R.drawable.topbarmid);
- btn_zongyi.setBackgroundResource(R.drawable.topbarmid);
- btn_shipin.setBackgroundResource(R.drawable.topbarright1);
- btn_zongyi.setEnabled(true);
- btn_dianying.setEnabled(true);
- btn_juji.setEnabled(true);
- btn_shipin.setEnabled(false);
- progressBar = ProgressDialog.show(context, getResources().getString(R.string.shaohou), getResources().getString(R.string.pull_to_refresh_footer_refreshing_label));
- new Handler().postDelayed(new Runnable(){
- @Override
- public void run(){
- Message msg = new Message();
- msg.what = 14;
- handler.sendMessage(msg);
- }
- }, 1000);
-
- }
- });
- }
-
- @Override
- protected void onDestroy() {
- Tools.ClearBitmap(BigBitmap);
- super.onDestroy();
- }
- //主界面添加图片
- private void addBitmaps(int pageindex, int pagecount,String img[],String name[]){
- list=Arrays.asList(img);
- LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- try {
- for(int i = index; i < pagecount * (pageindex + 1)&&i>20)=img.length) {
- Toast.makeText(context, getResources().getString(R.string.jiazai), Toast.LENGTH_SHORT).show();
- }
- USE_LINEAR_INTERVAL++;
- USE_LINEAR_INTERVAL= USE_LINEAR_INTERVAL%3;
-
- } catch (Exception e) {
- System.out.println(e.toString());
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println(e.toString());
- }
- }
- //异步加载图片
- public Bitmap setImage(ImageView imageView,String imageURL){
- return asyncBitmapLoader.loadBitmap(imageView, imageURL, linearlayoutWidth,new ImageCallBack() {
-
- @Override
- public void imageLoad(ImageView imageView, Bitmap bitmap) {
- if (bitmap!=null) {
- BigBitmap = BitmapZoom.bitmapZoomByWidth(bitmap, linearlayoutWidth);
- imageView.setImageBitmap(BigBitmap);
- RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(BigBitmap.getWidth(), BigBitmap.getHeight()+40);
- layoutParams.setMargins(4, 1, 4, 1);
- imageView.setLayoutParams(layoutParams);
- }
- else {
- imageView.setBackgroundResource(R.drawable.pic_bg);
- }
- }
- });
- }
- public void setViewImage(final ImageView v, String url) {
- new AsyncImageLoader().loadDrawable(url, new AsyncImageLoader.ImageCallback() {
- public void imageLoaded(Drawable imageDrawable) {
- if(imageDrawable!=null) {
- BigBitmap=BitmapZoom.bitmapZoomByWidth(Tools.drawableToBitamp(imageDrawable), linearlayoutWidth);
- v.setImageBitmap(BigBitmap);
- RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(BigBitmap.getWidth(), BigBitmap.getHeight()+40);
- layoutParams.setMargins(4, 1, 4, 1);
- v.setLayoutParams(layoutParams);
- }
- else {
- v.setImageResource(R.drawable.pic_bg);
- }
- }
- });
- }
- //登录按钮
- public void Btndenglu(View v){
- Intent intent=new Intent();
- getThird_AccessToken.setlogin_where(getString(R.string.sinawb));
- getThird_AccessToken.GetAccessToken();
- if (getThird_AccessToken.getAccessToken().trim().length()==0) {
- getThird_AccessToken.setlogin_where(getString(R.string.tencent));
- getThird_AccessToken.GetQQAccessToken();
- if (getThird_AccessToken.getQQ_Token().trim().length()==0) {
- intent.setClass(Welcome.this, Login_Activity.class);
- startActivity(intent);
- finish();
- }
- else
- {
- progressBar = ProgressDialog.show(context, getResources().getString(R.string.shaohou), getResources().getString(R.string.pull_to_refresh_footer_refreshing_label));
- new Handler().postDelayed(new Runnable(){
- @Override
- public void run(){
- Message msg = new Message();
- msg.what = 300;
- handler.sendMessage(msg);
- }
- }, 1000);
- }
- }
- else
- {
- Weibo.getInstance().setupConsumerConfig(getString(R.string.SINA_CONSUMER_KEY), getString(R.string.SINA_CONSUMER_SECRET));
- getThird_AccessToken.setAccessToken(getThird_AccessToken.getAccessToken().trim());
- getThird_AccessToken.GetExpires_in();
- Utility.setAuthorization(new Oauth2AccessTokenHeader());
- AccessToken accessToken = new AccessToken(getThird_AccessToken.getAccessToken().trim(), getString(R.string.SINA_CONSUMER_SECRET));
- accessToken.setExpiresIn(getThird_AccessToken.getExpires_in());
- Weibo.getInstance().setAccessToken(accessToken);
- System.out.println(getThird_AccessToken.getwhere_gologin());
- if (getThird_AccessToken.getwhere_gologin()==1) {
-
- }
- else
- {
- intent.setClass(context, JoyActivity.class);
- startActivity(intent);
- }
- finish();
- }
- }
- @Override
- public void onFooterRefresh(PullToRefreshView view) {
- mPullToRefreshView.postDelayed(new Runnable() {
-
- @Override
- public void run() {
- Message msg = new Message();
- msg.what = select_index;
- handler.sendMessage(msg);
- mPullToRefreshView.onFooterRefreshComplete();
- }
- }, 1000);
- }
- @Override
- public void onHeaderRefresh(PullToRefreshView view) {
- mPullToRefreshView.postDelayed(new Runnable() {
-
- @Override
- public void run() {
- Message msg = new Message();
- msg.what = select_index*10;
- handler.sendMessage(msg);
- mPullToRefreshView.onHeaderRefreshComplete();
- }
- },1000);
- }
- //保存URL地址,没网络的情况从内存拿之前保存过的地址来显示图片
- public String[] SetSaveData(String where,String URL[]){
- if (Tools.isNetworkAvailable(context)==false) {
- getThird_AccessToken.GetImageName(where);
- String Img_URL=getThird_AccessToken.getIMG_Name();
- URL=Tools.Split(Img_URL, "$URL$");
- }
- else {
- int a=0;
- String iMG_Name="";
- for (int i = 0; i < URL.length; i++) {
- if (a==0) {
- iMG_Name+=URL[i];
- a=1;
- }
- else {
- iMG_Name+="$URL$"+URL[i];
- }
- }
- getThird_AccessToken.setIMG_Name(iMG_Name);
- getThird_AccessToken.SaveImageName(where);
- }
- return URL;
- }
- public String[] SetSaveName(String where,String Name[]){
- if (Tools.isNetworkAvailable(context)==false) {
- getThird_AccessToken.GetName(where);
- String Name_URL=getThird_AccessToken.getName_URL();
- Name=Tools.Split(Name_URL, "$URL$");
- }
- else {
- int a=0;
- String Name_URL="";
- for (int i = 0; i < Name.length; i++) {
- if (a==0) {
- Name_URL+=Name[i];
- a=1;
- }
- else {
- Name_URL+="$URL$"+Name[i];
- }
- }
- getThird_AccessToken.setName_URL(Name_URL);
- getThird_AccessToken.SaveName(where);
- }
- return Name;
- }
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
- AlertDialog.Builder builder=new AlertDialog.Builder(context);
- builder.setTitle(getResources().getString(R.string.tishi));
- builder.setMessage(getResources().getString(R.string.shifoutuichu)).setPositiveButton(getResources().getString(R.string.queding), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- getThird_AccessToken.setexit(getString(R.string.exit_true));
- getThird_AccessToken.SaveExit();
- finish();
- android.os.Process.killProcess(android.os.Process.myPid());
- System.exit(0);
- }
- })
- .setNegativeButton(getResources().getString(R.string.quxiao), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
-
- }
- });
- AlertDialog ad = builder.create();
- ad.show();
- return true;
- }
- return super.onKeyDown(keyCode, event);
- }
- @Override
- public void onResume() {
- super.onResume();
- MobclickAgent.onResume(this);
- }
- @Override
- public void onPause() {
- super.onPause();
- MobclickAgent.onPause(this);
- }
-}
diff --git a/3rdparth/joy_20121011_client/src/com/joy/Xiaoxi.java b/3rdparth/joy_20121011_client/src/com/joy/Xiaoxi.java
deleted file mode 100755
index 2100dda..0000000
--- a/3rdparth/joy_20121011_client/src/com/joy/Xiaoxi.java
+++ /dev/null
@@ -1,355 +0,0 @@
-package com.joy;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.drawable.Drawable;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.joy.Tools.AsyncBitmapLoader;
-import com.joy.Tools.AsyncImageLoader;
-import com.joy.Tools.BitmapZoom;
-import com.joy.Tools.Tools;
-import com.joy.Tools.AsyncBitmapLoader.ImageCallBack;
-import com.joy.view.PullToRefreshView;
-import com.joy.view.PullToRefreshView.OnFooterRefreshListener;
-import com.joy.view.PullToRefreshView.OnHeaderRefreshListener;
-import com.mobclick.android.MobclickAgent;
-
-
-
-public class Xiaoxi extends Activity implements OnHeaderRefreshListener,OnFooterRefreshListener {
- Context context;
- ListView listView;
- PullToRefreshView mPullToRefreshView;
- MyAdapter adapter;
- AsyncBitmapLoader asyncBitmapLoader=new AsyncBitmapLoader();
- List