Skip to content

Instantly share code, notes, and snippets.

@Haldir65
Haldir65 / Java代码部分两个
Created September 3, 2015 13:21
跟着慕课网老师后面敲的,看到QQ滑动界面做出来,好幸福
这里有两个package:
com.Harris.qqsliding_view/SlidingMenu.java
com.Harris.qqslidingview/MainActivity.java
SlidingMenu.java代码部分
package com.Harris.qqsliding_view;
import android.content.Context;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v4.widget.NestedScrollView
import java.util.Collection;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
mRecyclerView= (RecyclerView) findViewById(R.id.recyclerview);
layoutManager=new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
adapter=new SimpleAdapter(this,mDatas);
mRecyclerView.setAdapter(adapter);
mSwipeRefreshLayout= (SwipeRefreshLayout) findViewById(R.id.swiperefreshlayout);
mSwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light,
android.R.color.holo_orange_light, android.R.color.holo_red_light);
//此处是android自带的只支持下拉刷新
package android.os;
import java.util.ArrayDeque;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.LinkedBlockingQueue;
package test;
import java.util.*;
import java.util.Map.Entry;
public class B {
public static void main(String[] args) {
Map<Integer,Integer> mm = new HashMap<Integer,Integer>();
for(int i=0;i<10;i++) {
mm.put(i, i);
}
for( Entry<Integer, Integer> e : mm.entrySet()) {
/* * 文 件 名: DataCleanManager.java * 描 述: 主要功能有清除内/外缓存,清除数据库,清除sharedPreference,清除files和清除自定义目录 */
import java.io.File;
import android.content.Context;
import android.os.Environment;
/** * 本应用数据清除管理器 */
public class DataCleanManager {
/** * 清除本应用内部缓存(/data/data/com.xxx.xxx/cache) * * @param context */
public static void cleanInternalCache(Context context) {
@Haldir65
Haldir65 / git
Created February 17, 2016 16:48
git clone https://.....
git add .
git commint -m "First Commit"
git push origin master
改变云端文件后,本地需要
git pull origin master
才能进行操作
之后本地更改需要重复上面的add-commit-push操作。
git init将本地文件初始化为一个仓库,也就是生成一个.git隐藏文件。
@Haldir65
Haldir65 / LogUtils
Created February 21, 2016 12:07
常用Utils类
import java.text.SimpleDateFormat;
import java.util.Date;
import android.util.Log;
public class LogUtil {
private static final boolean DEBUG = true;
public static void d(String TAG, String method, String msg) {
Log.d(TAG, "[" + method + "]" + msg);