DevStore首页 > DEV资源 > 源码下载 > 源码详情

QuickNews新闻客户端源码

 
guoshen | 2015-11-25 11:52    浏览量(5822)    评论(9)    收藏(18)
功能分类:新闻 支持平台:Android 运行环境:Android
开发语言:Java 开发工具:Eclipse 源码大小:13.10MB
下载源码 857 人下载

源码简介

QuickNews新闻客户端源码,本项目主要采用slidingmenu实现侧滑NineOldAndroids , androidannotations ,discrollview ,ListViewAnimations ,PhotoView 等等来实现 ViewPager和ScrollView头部效果,PhotoView 来实现预览大图,本项目适合做开源框架使用, 开发的小伙伴们你们争取把这个项目熟悉,什么框架都是小菜了

源码截图

  • 运行效果图
DevStore所有源码来自用户上传分享,版权问题及牵扯到商业纠纷均与DevStore无关。

源码片段

package com.tiger.quicknews.activity;

import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Xml.Encoding;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.widget.Toast;

import com.tiger.quicknews.R;
import com.tiger.quicknews.http.HttpUtil;
import com.tiger.quicknews.http.Url;
import com.tiger.quicknews.listener.BackGestureListener;
import com.tiger.quicknews.utils.ACache;
import com.tiger.quicknews.utils.DialogUtil;
import com.tiger.quicknews.utils.StringUtils;
import com.tiger.quicknews.wedget.crouton.Crouton;
import com.tiger.quicknews.wedget.crouton.Style;
import com.tiger.quicknews.wedget.gesture.BaseActivityHelper;
import com.tiger.quicknews.wedget.slideingactivity.IntentUtils;
import com.tiger.quicknews.wedget.slideingactivity.SlidingActivity;

import org.apache.http.util.EncodingUtils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class BaseActivity extends SlidingActivity {

    /** 手势监听 */
    // private GestureDetector mGestureDetector;
    /** 是否需要监听手势关闭功能 */
    private boolean mNeedBackGesture = false;
    // private BaseActivityHelper baseActivityHelper;
    private Dialog progressDialog;
    public static final int REQUEST_CODE = 1000;

    @Override
    public void onResume() {
        super.onResume();
        // baseActivityHelper.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
        // baseActivityHelper.onPause();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        // baseActivityHelper.onDestroy();
    }

    public boolean isSupportSlide() {
        return true;
    }

    public String getUrl(String newId) {
        return Url.NewDetail + newId + Url.endDetailUrl;
    }

    public String getMsgUrl(String index, String itemId) {
        String urlString = Url.CommonUrl + itemId + "/" + index + "-40.html";
        return urlString;
    }

    public String getWeatherUrl(String cityName) throws UnsupportedEncodingException {
        // + Url.WeatherKey
        String urlString = Url.WeatherHost + URLEncoder.encode(cityName, "utf-8");
        return urlString;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 无标题栏
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        initGestureDetector();
        // baseActivityHelper = new BaseActivityHelper(this, isSupportSlide());
        // baseActivityHelper.onCreate();
    }

    private void initGestureDetector() {
        // if (mGestureDetector == null) {
        // mGestureDetector = new GestureDetector(getApplicationContext(),
        // new BackGestureListener(this));
        // }
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (mNeedBackGesture) {
            // return mGestureDetector.onTouchEvent(ev) ||
            // super.dispatchTouchEvent(ev);
        }
        return super.dispatchTouchEvent(ev);
    }

    /*
     * 设置是否进行手势监听
     */
    public void setNeedBackGesture(boolean mNeedBackGesture) {
        this.mNeedBackGesture = mNeedBackGesture;
    }

    /**
     * 显示dialog
     * 
     * @param msg 显示内容
     */
    public void showProgressDialog() {
        try {

            if (progressDialog == null) {
                progressDialog = DialogUtil.createLoadingDialog(this);

            }
            progressDialog.show();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    /**
     * 隐藏dialog
     */
    public void dismissProgressDialog() {
        try {

            if (progressDialog != null && progressDialog.isShowing()) {
                progressDialog.dismiss();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * dialog是否显示
     */
    public boolean isShow() {
        try {

            if (progressDialog != null && progressDialog.isShowing()) {
                return true;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }

    /**
     * 更具类打开acitvity
     */
    public void openActivity(Class pClass) {
        openActivity(pClass, null, 0);

    }

    public void openActivityForResult(Class pClass, int requestCode) {
        openActivity(pClass, null, requestCode);
    }

    /**
     * 更具类打开acitvity,并携带参数
     */
    public void openActivity(Class pClass, Bundle pBundle, int requestCode) {
        Intent intent = new Intent(this, pClass);
        if (pBundle != null) {
            intent.putExtras(pBundle);
        }
        if (requestCode == 0) {
            IntentUtils.startPreviewActivity(this, intent, 0);
            // startActivity(intent);
        } else {
            IntentUtils.startPreviewActivity(this, intent, requestCode);
            // startActivityForResult(intent, requestCode);
        }
        // actityAnim();
    }

    /**
     * 判断是否有网络
     * 
     * @return
     */
    public boolean hasNetWork() {
        return HttpUtil.isNetworkAvailable(this);
    }

    /**
     * 显示LongToast
     */
    public void showShortToast(String pMsg) {
        // ToastUtil.createCustomToast(this, pMsg, Toast.LENGTH_LONG).show();
        Toast.makeText(this, pMsg, Toast.LENGTH_SHORT).show();
    }

    /**
     * 显示ShortToast
     */
    public void showCustomToast(String pMsg) {
        // ToastUtil.createCustomToast(this, pMsg, Toast.LENGTH_SHORT).show();
        // Crouton.makeText(this, pMsg, Style.ALERT, R.id.toast_conten).show();
        Crouton.makeText(this, pMsg, Style.ALERT, R.id.toast_conten).show();

    }

    /**
     * 设置缓存数据(key,value)
     */
    public void setCacheStr(String key, String value) {
        if (!StringUtils.isEmpty(value)) {
            ACache.get(this).put(key, value);
        }
    }

    /**
     * 获取缓存数据更具key
     */
    public String getCacheStr(String key) {
        return ACache.get(this).getAsString(key);
    }

    /**
     * 带动画效果的关闭
     */
    @Override
    public void finish() {
        super.finish();
        // baseActivityHelper.finish();
        actityAnim();
    }

    /**
     * 系统默认关闭
     */
    public void defaultFinish() {
        super.finish();
        // baseActivityHelper.finish();
    }

    /**
     * 系统默认关闭
     */
    public void defaultFinishNotActivityHelper() {
        super.finish();
    }

    public void actityAnim() {
        // overridePendingTransition(R.anim.slide_in_right,
        // R.anim.slide_right_out);
    }

    /**
     * 返回
     */
    public void doBack(View view) {
        onBackPressed();
    }

}
  •   赞(6) 赞 +1 赞(6) 已赞
  •   收藏(18) 收藏 +1 已收藏 取消
  •   下载(857)
评论(9)
987527879

987527879 2017-06-22 13:57:09

要怎么运行啊 提示出错
回复(0) 赞(0) 赞(1)
千年木

千年木 2016-12-22 01:09:10

谢谢楼猪,下来看看
回复(0) 赞(0) 赞(1)
hellow_hp

hellow_hp 2016-06-01 14:25:50

特别好的资源,感谢楼主
回复(0) 赞(0) 赞(1)
jinzongke

jinzongke 2016-01-08 14:53:24

非常不错,感谢分享
回复(0) 赞(0) 赞(1)
HUAQING181

HUAQING181 2015-12-01 09:07:07

赞赞赞赞赞赞赞赞赞赞赞赞赞赞赞
回复(0) 赞(0) 赞(1)
  • 推荐
  • 审核
  • 收录
  • 获取活力值

源码上传作者

  • 252 能力值
  • 55 源码
  • 0 评测
  • 0 资料

热门源码