├── .gitignore ├── .idea ├── caches │ └── build_file_checksums.ser ├── codeStyles │ └── Project.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ ├── jsoup-1.8.1.jar │ └── juniversalchardet-1.0.3.jar ├── proguard-rules.pro ├── src │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── qianpic │ │ │ └── ExampleInstrumentedTest.java │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ │ └── litepal.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── qianpic │ │ │ │ ├── BaseFragment.java │ │ │ │ ├── ImgActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── MyAppliation.java │ │ │ │ ├── ShortTabActivity.java │ │ │ │ ├── adapter │ │ │ │ ├── CategoryImgAdapter.java │ │ │ │ ├── ImgAdapter.java │ │ │ │ └── NaviAapter.java │ │ │ │ ├── db │ │ │ │ ├── CategoryImg.java │ │ │ │ ├── Img.java │ │ │ │ ├── ImgBig.java │ │ │ │ ├── Navi.java │ │ │ │ └── Page.java │ │ │ │ ├── fragment │ │ │ │ ├── HighDefinitionFragment.java │ │ │ │ ├── PureFragment.java │ │ │ │ ├── SexyFragment.java │ │ │ │ └── StockingsFragment.java │ │ │ │ ├── layout │ │ │ │ └── NavigationLayout.java │ │ │ │ └── util │ │ │ │ ├── CharsetDetector.java │ │ │ │ ├── CommentUtils.java │ │ │ │ ├── FragmentFactory.java │ │ │ │ ├── HttpUtil.java │ │ │ │ ├── ImageViewUtil.java │ │ │ │ ├── LinkFilter.java │ │ │ │ ├── Links.java │ │ │ │ ├── Page.java │ │ │ │ └── PageParserTool.java │ │ └── res │ │ │ ├── layout │ │ │ ├── activity_img.xml │ │ │ ├── activity_main.xml │ │ │ ├── activity_short_tab.xml │ │ │ ├── category.xml │ │ │ ├── footview.xml │ │ │ ├── item.xml │ │ │ ├── item_navi.xml │ │ │ └── navigation.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-ldpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── test │ │ └── java │ │ └── com │ │ └── qianpic │ │ └── ExampleUnitTest.java └── 红花美图.apk ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── 预览.gif /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/README.md -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion '27.0.3' 6 | useLibrary 'org.apache.http.legacy' 7 | defaultConfig { 8 | applicationId "com.qianpic" 9 | minSdkVersion 15 10 | targetSdkVersion 25 11 | versionCode 1 12 | versionName "1.0" 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(include: ['*.jar'], dir: 'libs') 25 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 26 | exclude group: 'com.android.support', module: 'support-annotations' 27 | }) 28 | compile 'com.android.support:appcompat-v7:25.3.1' 29 | compile 'com.android.support:design:25.3.1' 30 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 31 | testCompile 'junit:junit:4.12' 32 | compile 'org.litepal.android:core:1.4.1' 33 | compile 'com.squareup.okhttp3:okhttp:3.6.0' 34 | compile 'com.github.bumptech.glide:glide:3.7.0' 35 | compile files('libs/jsoup-1.8.1.jar') 36 | compile files('libs/juniversalchardet-1.0.3.jar') 37 | compile 'com.android.support:recyclerview-v7:25.3.1' 38 | compile 'org.greenrobot:eventbus:3.0.0' 39 | } 40 | -------------------------------------------------------------------------------- /app/libs/jsoup-1.8.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/app/libs/jsoup-1.8.1.jar -------------------------------------------------------------------------------- /app/libs/juniversalchardet-1.0.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/app/libs/juniversalchardet-1.0.3.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in F:\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/qianpic/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.qianpic; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.qianpic", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/assets/litepal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.qianpic; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.support.v7.widget.StaggeredGridLayoutManager; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | 13 | import com.qianpic.adapter.CategoryImgAdapter; 14 | import com.qianpic.db.CategoryImg; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | /** 20 | * Created by admin on 2018/4/1. 21 | */ 22 | 23 | public abstract class BaseFragment extends Fragment { 24 | 25 | protected Context mContent; 26 | protected List imgList=new ArrayList(); 27 | 28 | @Override 29 | public void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | mContent = getContext();//上下文。 32 | } 33 | 34 | 35 | @Override 36 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 37 | 38 | View view=inflater.inflate(R.layout.category,container,false); 39 | imgList.clear(); 40 | iniData1(); 41 | 42 | if( imgList!=null) { 43 | 44 | RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycle_view); 45 | StaggeredGridLayoutManager layoutManager=new StaggeredGridLayoutManager(1,StaggeredGridLayoutManager.VERTICAL); 46 | recyclerView.setLayoutManager(layoutManager); 47 | CategoryImgAdapter adapter = new CategoryImgAdapter(getContext(),imgList,true); 48 | recyclerView.setAdapter(adapter); 49 | } 50 | 51 | return view;//初始化布局。 52 | } 53 | 54 | @Override 55 | public void onActivityCreated(Bundle savedInstanceState) { 56 | super.onActivityCreated(savedInstanceState); 57 | loadData();//初始化数据。 58 | } 59 | 60 | protected void loadData() { 61 | 62 | } 63 | 64 | protected View initView() { 65 | return null; 66 | } 67 | 68 | protected abstract void iniData1(); 69 | } -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/ImgActivity.java: -------------------------------------------------------------------------------- 1 | package com.qianpic; 2 | 3 | import android.app.ProgressDialog; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.util.Log; 8 | import android.view.GestureDetector; 9 | import android.view.MotionEvent; 10 | import android.widget.ImageView; 11 | import android.widget.Toast; 12 | 13 | import com.bumptech.glide.Glide; 14 | import com.qianpic.db.ImgBig; 15 | import com.qianpic.util.Links; 16 | import com.qianpic.util.Page; 17 | import com.qianpic.util.PageParserTool; 18 | 19 | import org.jsoup.select.Elements; 20 | 21 | import java.io.IOException; 22 | import java.util.List; 23 | 24 | import okhttp3.Call; 25 | import okhttp3.OkHttpClient; 26 | import okhttp3.Request; 27 | import okhttp3.Response; 28 | 29 | import static org.litepal.crud.DataSupport.where; 30 | 31 | /** 32 | * Created by admin on 2018/4/26. 33 | */ 34 | 35 | public class ImgActivity extends AppCompatActivity { 36 | 37 | //手指按下的点为(x1, y1)手指离开屏幕的点为(x2, y2) 38 | float x1 = 0; 39 | float x2 = 0; 40 | float y1 = 0; 41 | float y2 = 0; 42 | ImageView iv; 43 | ProgressDialog pd1; 44 | int p=1; 45 | String category; 46 | GestureDetector mGestureDetector; 47 | @Override 48 | protected void onCreate(Bundle savedInstanceState) { 49 | super.onCreate(savedInstanceState); 50 | setContentView(R.layout.activity_img); 51 | 52 | Intent intent = getIntent(); 53 | category = intent.getStringExtra("img"); 54 | Log.d("aa",category); 55 | iv= (ImageView) findViewById(R.id.image); 56 | //Glide.with(getApplicationContext()).load("http://www.mtyoyo.com"+category).into(iv); 57 | // pd1 = ProgressDialog.show(this, "提示", category); 58 | //DataSupport.deleteAll(ImgBig.class); 59 | List imgBigList= where("cate='"+category+"' and "+"page="+p+"").find(ImgBig.class); 60 | 61 | if ( imgBigList==null||imgBigList.size()==0) { 62 | pd1 = ProgressDialog.show(this, "提示", "正在加载中"); 63 | 64 | crawling(new String[]{"http://www.mtyoyo.com"+category},category,p); 65 | 66 | } 67 | else { 68 | 69 | Glide.with(getApplicationContext()).load(imgBigList.get(0).getLink()).into(iv); 70 | } 71 | } 72 | 73 | private void crawling(String[] seeds,String cate,int page ){ 74 | //初始化 URL 队列 75 | initCrawlerWithSeeds(seeds); 76 | 77 | //循环条件:待抓取的链接不空且抓取的网页不多于 1000 78 | while (!Links.unVisitedUrlQueueIsEmpty() ) { 79 | 80 | //先从待访问的序列中取出第一个; 81 | String visitUrl = (String) Links.removeHeadOfUnVisitedUrlQueue(); 82 | if (visitUrl == null){ 83 | return; 84 | } 85 | 86 | //根据URL得到page; 87 | sendRequstAndGetResponse(visitUrl ,cate,page); 88 | } 89 | 90 | } 91 | 92 | private void initCrawlerWithSeeds(String[] seeds) { 93 | for (int i = 0; i < seeds.length; i++){ 94 | Links.addUnvisitedUrlQueue(seeds[i]); 95 | } 96 | } 97 | 98 | private void sendRequstAndGetResponse(final String url, final String cate,final int p) 99 | { 100 | new Thread(new Runnable() { 101 | @Override 102 | public void run() { 103 | byte[] content=null; 104 | OkHttpClient okHttpClient=new OkHttpClient(); 105 | Request request = new Request.Builder() 106 | .url(url) 107 | .build(); 108 | Call call = okHttpClient.newCall(request); 109 | try{ 110 | 111 | 112 | Response response = call.execute(); 113 | String responseData=response.body().string(); 114 | content=responseData.getBytes(); 115 | 116 | Page page= new Page(content,url,""); 117 | //对page进行处理: 访问DOM的某个标签 118 | Elements es = PageParserTool.select(page,"a"); 119 | 120 | 121 | //将已经访问过的链接放入已访问的链接中; 122 | Links.addVisitedUrlSet(url); 123 | 124 | //得到超链接 125 | // Set links = PageParserTool.getLinks(page,"div.MeinvTuPianBox img"); 126 | PageParserTool.getImgBigLists(page,".articleV2Body a",cate,p,ImgActivity.this); 127 | 128 | 129 | 130 | }catch (IOException e){ 131 | e.printStackTrace(); 132 | } 133 | runOnUiThread(new Runnable() { 134 | @Override 135 | public void run() { 136 | 137 | pd1.dismiss(); 138 | //refresh(category); 139 | List imgBigList= where("cate='"+category+"' and "+"page="+p+"").find(ImgBig.class); 140 | if ( imgBigList!=null&&imgBigList.size()>0) { 141 | Glide.with(getApplicationContext()).load(imgBigList.get(0).getLink()).into(iv); 142 | } 143 | else 144 | { 145 | Toast.makeText(ImgActivity.this, "无更多内容", Toast.LENGTH_SHORT).show(); 146 | } 147 | } 148 | }); 149 | 150 | } 151 | }).start(); 152 | } 153 | 154 | @Override 155 | public boolean onTouchEvent(MotionEvent event) { 156 | //继承了Activity的onTouchEvent方法,直接监听点击事件 157 | if(event.getAction() == MotionEvent.ACTION_DOWN) { 158 | //当手指按下的时候 159 | x1 = event.getX(); 160 | y1 = event.getY(); 161 | } 162 | if(event.getAction() == MotionEvent.ACTION_UP) { 163 | //当手指离开的时候 164 | x2 = event.getX(); 165 | y2 = event.getY(); 166 | if(y1 - y2 > 50) { 167 | Toast.makeText(ImgActivity.this, "向上滑", Toast.LENGTH_SHORT).show(); 168 | } else if(y2 - y1 > 50) { 169 | Toast.makeText(ImgActivity.this, "向下滑", Toast.LENGTH_SHORT).show(); 170 | } else if(x1 - x2 > 50) { 171 | p=p+1; 172 | List imgBigList= where("cate='"+category+"' and "+"page="+p+"").find(ImgBig.class); 173 | 174 | if ( imgBigList==null||imgBigList.size()==0) { 175 | pd1 = ProgressDialog.show(this, "提示", "正在加载中"); 176 | 177 | 178 | crawling(new String[]{"http://www.mtyoyo.com"+category.split("\\.")[0]+"_"+p+".html"},category,p); 179 | 180 | } 181 | else { 182 | 183 | Glide.with(getApplicationContext()).load(imgBigList.get(0).getLink()).into(iv); 184 | } 185 | 186 | } else if(x2 - x1 > 50) { 187 | 188 | 189 | Toast.makeText(ImgActivity.this, "向右滑", Toast.LENGTH_SHORT).show(); 190 | } 191 | } 192 | return super.onTouchEvent(event); 193 | } 194 | 195 | 196 | } 197 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.qianpic; 2 | 3 | import android.app.ProgressDialog; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.os.Handler; 7 | import android.os.Looper; 8 | import android.support.v4.widget.SwipeRefreshLayout; 9 | import android.support.v7.app.AppCompatActivity; 10 | import android.support.v7.widget.DefaultItemAnimator; 11 | import android.support.v7.widget.GridLayoutManager; 12 | import android.support.v7.widget.RecyclerView; 13 | import android.util.Log; 14 | import android.widget.ImageView; 15 | 16 | import com.qianpic.adapter.ImgAdapter; 17 | import com.qianpic.db.Img; 18 | import com.qianpic.util.Links; 19 | import com.qianpic.util.Page; 20 | import com.qianpic.util.PageParserTool; 21 | 22 | import org.jsoup.select.Elements; 23 | import org.litepal.crud.DataSupport; 24 | 25 | import java.io.IOException; 26 | import java.util.List; 27 | 28 | import okhttp3.Call; 29 | import okhttp3.OkHttpClient; 30 | import okhttp3.Request; 31 | import okhttp3.Response; 32 | 33 | 34 | public class MainActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener{ 35 | private SwipeRefreshLayout refreshLayout; 36 | private RecyclerView recyclerView; 37 | private ProgressDialog progressDialog; 38 | private final int PAGE_COUNT = 10; 39 | private GridLayoutManager mLayoutManager; 40 | //private List imgList; 41 | ImageView imgBing; 42 | ProgressDialog pd1; 43 | int p=1; 44 | String category; 45 | private int lastVisibleItem = 0; 46 | private ImgAdapter adapter; 47 | private Handler mHandler = new Handler(Looper.getMainLooper()); 48 | @Override 49 | protected void onCreate(Bundle savedInstanceState) { 50 | super.onCreate(savedInstanceState); 51 | setContentView(R.layout.activity_main); 52 | Intent intent=getIntent(); 53 | category=intent.getStringExtra("category"); 54 | 55 | findView(); 56 | //DataSupport.deleteAll(Img.class); 57 | //imgList = DataSupport.findAll(Img.class); 58 | initRefreshLayout(); 59 | 60 | // imgList = DataSupport.findAll(Img.class); 61 | initRecyclerView(); 62 | 63 | } 64 | 65 | private void initRefreshLayout() { 66 | refreshLayout.setColorSchemeResources(android.R.color.holo_blue_light, android.R.color.holo_red_light, 67 | android.R.color.holo_orange_light, android.R.color.holo_green_light); 68 | refreshLayout.setOnRefreshListener(this); 69 | } 70 | 71 | private void initRecyclerView() { 72 | List imgList= DataSupport.where("cate = '"+category+"'").find(Img.class); 73 | 74 | if ( imgList==null||imgList.size()==0) { 75 | pd1 = ProgressDialog.show(this, "提示", "正在加载中"); 76 | 77 | crawling(new String[]{"http://www.mtyoyo.com"+category},category,p); 78 | 79 | } 80 | adapter = new ImgAdapter(getApplicationContext(),imgList,true); 81 | 82 | RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycle_view); 83 | // LinearLayoutManager layoutManager = new LinearLayoutManager(this); 84 | // 85 | mLayoutManager = new GridLayoutManager(this, 3); 86 | recyclerView.setLayoutManager(mLayoutManager); 87 | 88 | 89 | // StaggeredGridLayoutManager mLayoutManager=new StaggeredGridLayoutManager(3,StaggeredGridLayoutManager.VERTICAL); 90 | // recyclerView.setLayoutManager(mLayoutManager); 91 | 92 | recyclerView.setAdapter(adapter); 93 | 94 | recyclerView.setItemAnimator(new DefaultItemAnimator()); 95 | 96 | recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { 97 | @Override 98 | public void onScrollStateChanged(RecyclerView recyclerView, int newState) { 99 | super.onScrollStateChanged(recyclerView, newState); 100 | if (newState == RecyclerView.SCROLL_STATE_IDLE) { 101 | if (adapter.isFadeTips() == false && lastVisibleItem + 1 == adapter.getItemCount()) { 102 | mHandler.postDelayed(new Runnable() { 103 | @Override 104 | public void run() { 105 | updateRecyclerView(); 106 | } 107 | }, 500); 108 | } 109 | 110 | if (adapter.isFadeTips() == true && lastVisibleItem + 2 == adapter.getItemCount()) { 111 | mHandler.postDelayed(new Runnable() { 112 | @Override 113 | public void run() { 114 | updateRecyclerView(); 115 | } 116 | }, 500); 117 | } 118 | } 119 | } 120 | 121 | @Override 122 | public void onScrolled(RecyclerView recyclerView, int dx, int dy) { 123 | super.onScrolled(recyclerView, dx, dy); 124 | lastVisibleItem = mLayoutManager.findLastVisibleItemPosition(); 125 | } 126 | }); 127 | } 128 | 129 | public void refresh(String category) { 130 | finish(); 131 | Intent intent = new Intent(MainActivity.this, MainActivity.class); 132 | intent.putExtra("category",category); 133 | startActivity(intent); 134 | } 135 | 136 | private void crawling(String[] seeds,String cate,int page ){ 137 | //初始化 URL 队列 138 | initCrawlerWithSeeds(seeds); 139 | 140 | //循环条件:待抓取的链接不空且抓取的网页不多于 1000 141 | while (!Links.unVisitedUrlQueueIsEmpty() ) { 142 | 143 | //先从待访问的序列中取出第一个; 144 | String visitUrl = (String) Links.removeHeadOfUnVisitedUrlQueue(); 145 | if (visitUrl == null){ 146 | return; 147 | } 148 | 149 | //根据URL得到page; 150 | sendRequstAndGetResponse(visitUrl ,cate,page); 151 | } 152 | 153 | } 154 | 155 | /** 156 | * 使用种子初始化 URL 队列 157 | * 158 | * @param seeds 种子 URL 159 | * @return 160 | */ 161 | private void initCrawlerWithSeeds(String[] seeds) { 162 | for (int i = 0; i < seeds.length; i++){ 163 | Links.addUnvisitedUrlQueue(seeds[i]); 164 | } 165 | } 166 | 167 | private void sendRequstAndGetResponse(final String url, final String cate,final int p) 168 | { 169 | new Thread(new Runnable() { 170 | @Override 171 | public void run() { 172 | byte[] content=null; 173 | OkHttpClient okHttpClient=new OkHttpClient(); 174 | Request request = new Request.Builder() 175 | .url(url) 176 | .build(); 177 | Call call = okHttpClient.newCall(request); 178 | try{ 179 | 180 | 181 | Response response = call.execute(); 182 | String responseData=response.body().string(); 183 | content=responseData.getBytes(); 184 | 185 | Page page= new Page(content,url,""); 186 | //对page进行处理: 访问DOM的某个标签 187 | Elements es = PageParserTool.select(page,"a"); 188 | 189 | 190 | //将已经访问过的链接放入已访问的链接中; 191 | Links.addVisitedUrlSet(url); 192 | 193 | //得到超链接 194 | // Set links = PageParserTool.getLinks(page,"div.MeinvTuPianBox img"); 195 | PageParserTool.getImgLists(page,"div.MeinvTuPianBox :eq(0) a",cate,p,MainActivity.this); 196 | 197 | 198 | 199 | }catch (IOException e){ 200 | e.printStackTrace(); 201 | } 202 | runOnUiThread(new Runnable() { 203 | @Override 204 | public void run() { 205 | 206 | pd1.dismiss(); 207 | //refresh(category); 208 | List a=DataSupport.where("cate='"+category+"' and "+"page="+p+"").find(Img.class); 209 | if (a.size() > 0) { 210 | adapter.updateList(a, true); 211 | } else { 212 | adapter.updateList(null, false); 213 | } 214 | } 215 | }); 216 | 217 | } 218 | }).start(); 219 | } 220 | 221 | 222 | @Override 223 | public void onRefresh() { 224 | refreshLayout.setRefreshing(true); 225 | adapter.resetDatas(); 226 | updateRecyclerView(); 227 | mHandler.postDelayed(new Runnable() { 228 | @Override 229 | public void run() { 230 | refreshLayout.setRefreshing(false); 231 | } 232 | }, 1000); 233 | } 234 | 235 | private void updateRecyclerView() { 236 | 237 | p=p+1; 238 | Log.d("aa", p+""); 239 | List newDatas = getDatas(p); 240 | if (newDatas.size() > 0) { 241 | adapter.updateList(newDatas, true); 242 | } else { 243 | adapter.updateList(null, false); 244 | } 245 | } 246 | 247 | public List getDatas(int page) { 248 | List a=DataSupport.where("cate='"+category+"' and "+"page="+p+"").find(Img.class); 249 | if ( a==null||a.size()==0) { 250 | pd1 = ProgressDialog.show(this, "提示", "正在加载中"); 251 | 252 | crawling(new String[]{"http://www.mtyoyo.com"+category+"index_"+page+".html"},category,page); 253 | 254 | } 255 | return a; 256 | } 257 | 258 | 259 | private void findView() { 260 | refreshLayout = (SwipeRefreshLayout) findViewById(R.id.refreshLayout); 261 | recyclerView = (RecyclerView) findViewById(R.id.recycle_view); 262 | 263 | } 264 | } 265 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/MyAppliation.java: -------------------------------------------------------------------------------- 1 | package com.qianpic; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | import org.litepal.LitePal; 7 | 8 | /** 9 | * Created by admin on 2018/3/9. 10 | */ 11 | 12 | public class MyAppliation extends Application { 13 | 14 | private static Context context; 15 | 16 | @Override 17 | public void onCreate() { 18 | super.onCreate(); 19 | context=getApplicationContext(); 20 | LitePal.initialize(context); 21 | } 22 | 23 | public static Context getContext() 24 | { 25 | return context; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/ShortTabActivity.java: -------------------------------------------------------------------------------- 1 | package com.qianpic; 2 | 3 | import android.os.Bundle; 4 | import android.support.design.widget.TabLayout; 5 | import android.support.v4.app.FragmentManager; 6 | import android.support.v4.app.FragmentPagerAdapter; 7 | import android.support.v4.view.ViewPager; 8 | import android.support.v7.app.AppCompatActivity; 9 | 10 | import com.qianpic.util.CommentUtils; 11 | import com.qianpic.util.FragmentFactory; 12 | 13 | /** 14 | * Created by admin on 2018/4/1. 15 | */ 16 | 17 | public class ShortTabActivity extends AppCompatActivity { 18 | private TabLayout mTab; 19 | private ViewPager mViewPager; 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_short_tab); 25 | initView(); 26 | initData(); 27 | } 28 | 29 | private void initData() { 30 | ShortPagerAdapter adapter = new ShortPagerAdapter(getSupportFragmentManager()); 31 | mViewPager.setAdapter(adapter); 32 | mTab.setupWithViewPager(mViewPager); 33 | 34 | } 35 | 36 | private void initView() { 37 | mTab = (TabLayout) findViewById(R.id.tab); 38 | mViewPager = (ViewPager) findViewById(R.id.viewpager); 39 | } 40 | 41 | private class ShortPagerAdapter extends FragmentPagerAdapter { 42 | public String[] mTilte; 43 | 44 | public ShortPagerAdapter(FragmentManager fm) { 45 | super(fm); 46 | mTilte = getResources().getStringArray(R.array.tab_short_Title); 47 | } 48 | 49 | @Override 50 | public CharSequence getPageTitle(int position) { 51 | return mTilte[position]; 52 | } 53 | 54 | @Override 55 | public BaseFragment getItem(int position) { 56 | BaseFragment fragment = FragmentFactory.createFragment(position); 57 | return fragment; 58 | } 59 | 60 | @Override 61 | public int getCount() { 62 | return CommentUtils.TAB_SHORT_COUNT; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/adapter/CategoryImgAdapter.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.adapter; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Handler; 6 | import android.os.Looper; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.ImageView; 12 | import android.widget.TextView; 13 | 14 | import com.bumptech.glide.Glide; 15 | import com.qianpic.MainActivity; 16 | import com.qianpic.R; 17 | import com.qianpic.db.CategoryImg; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * Created by admin on 2018/4/5. 23 | */ 24 | 25 | public class CategoryImgAdapter extends RecyclerView.Adapter{ 26 | 27 | private List imgList; 28 | private Context mContext; 29 | 30 | private int normalType = 0; 31 | private int footType = 1; 32 | private boolean hasMore = true; 33 | private boolean fadeTips = false; 34 | 35 | private Handler mHandler = new Handler(Looper.getMainLooper()); 36 | 37 | public CategoryImgAdapter(Context mContext, List imgList,boolean hasMore){ 38 | 39 | this.mContext=mContext; 40 | this.imgList=imgList; 41 | this.hasMore = hasMore; 42 | } 43 | 44 | @Override 45 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 46 | final RecyclerView.ViewHolder holder; 47 | if (viewType == normalType) { 48 | View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.item,parent,false); 49 | holder=new NormalHolder(view); 50 | 51 | holder.itemView.setOnClickListener(new View.OnClickListener(){ 52 | 53 | @Override 54 | public void onClick(View v) { 55 | int position=holder.getAdapterPosition(); 56 | CategoryImg categoryImg=imgList.get(position); 57 | Intent intent=new Intent(mContext, MainActivity.class); 58 | intent.putExtra("category",categoryImg.getCate()); 59 | mContext.startActivity(intent); 60 | } 61 | }); 62 | return holder; 63 | } 64 | else { 65 | View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.footview,parent,false); 66 | holder=new FootHolder(view); 67 | return holder; 68 | } 69 | 70 | 71 | } 72 | 73 | 74 | 75 | @Override 76 | public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) { 77 | if (holder instanceof NormalHolder) { 78 | CategoryImg img = imgList.get(position); 79 | ((NormalHolder) holder).textView.setText(img.getName()); 80 | Glide.with(mContext).load(img.getLink()).into(((NormalHolder) holder).imageView); 81 | }else { 82 | ((FootHolder) holder).tips.setVisibility(View.VISIBLE); 83 | if (hasMore == true) { 84 | fadeTips = false; 85 | if (imgList.size() > 0) { 86 | ((FootHolder) holder).tips.setText("正在加载更多..."); 87 | } 88 | } else { 89 | if (imgList.size() > 0) { 90 | ((FootHolder) holder).tips.setText("没有更多数据了"); 91 | mHandler.postDelayed(new Runnable() { 92 | @Override 93 | public void run() { 94 | ((FootHolder) holder).tips.setVisibility(View.GONE); 95 | fadeTips = true; 96 | hasMore = true; 97 | } 98 | }, 500); 99 | } 100 | } 101 | } 102 | } 103 | 104 | @Override 105 | public int getItemCount() { 106 | return imgList.size(); 107 | } 108 | 109 | class NormalHolder extends RecyclerView.ViewHolder { 110 | private TextView textView; 111 | ImageView imageView; 112 | public NormalHolder(View itemView) { 113 | super(itemView); 114 | imageView=(ImageView)itemView.findViewById(R.id.image); 115 | textView=(TextView)itemView.findViewById(R.id.textview1); 116 | } 117 | } 118 | 119 | class FootHolder extends RecyclerView.ViewHolder { 120 | private TextView tips; 121 | 122 | public FootHolder(View itemView) { 123 | super(itemView); 124 | tips = (TextView) itemView.findViewById(R.id.tips); 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/adapter/ImgAdapter.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.adapter; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Handler; 6 | import android.os.Looper; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.util.Log; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.ImageView; 13 | import android.widget.TextView; 14 | 15 | import com.bumptech.glide.Glide; 16 | import com.qianpic.ImgActivity; 17 | import com.qianpic.R; 18 | import com.qianpic.db.Img; 19 | 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | /** 24 | * Created by admin on 2018/1/16. 25 | */ 26 | 27 | public class ImgAdapter extends RecyclerView.Adapter { 28 | 29 | private List imgList; 30 | private Context mContext; 31 | 32 | private int normalType = 0; 33 | private int footType = 1; 34 | private boolean hasMore = true; 35 | private boolean fadeTips = false; 36 | 37 | private Handler mHandler = new Handler(Looper.getMainLooper()); 38 | 39 | 40 | public ImgAdapter(Context mContext,List imgList,boolean hasMore){ 41 | this.mContext=mContext; 42 | this.imgList=imgList; 43 | this.hasMore = hasMore; 44 | } 45 | 46 | @Override 47 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 48 | 49 | final RecyclerView.ViewHolder holder; 50 | if (viewType == normalType) { 51 | 52 | 53 | View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.item,parent,false); 54 | holder=new NormalHolder(view); 55 | holder.itemView.setOnClickListener(new View.OnClickListener() { 56 | 57 | @Override 58 | public void onClick(View v) { 59 | int position = holder.getAdapterPosition(); 60 | Img Img = imgList.get(position); 61 | Intent intent = new Intent(mContext, ImgActivity.class); 62 | intent.putExtra("img", Img.getImglink()); 63 | Log.d("aa", Img.getImglink()); 64 | mContext.startActivity(intent); 65 | } 66 | }); 67 | } 68 | else { 69 | View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.footview,parent,false); 70 | holder=new FootHolder(view); 71 | 72 | } 73 | return holder; 74 | } 75 | 76 | @Override 77 | public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) { 78 | Img img=imgList.get(position); 79 | ((NormalHolder) holder).textView.setText(img.getName()); 80 | Glide.with(mContext).load(img.getLink()).into(((NormalHolder) holder).imageView); 81 | 82 | } 83 | 84 | @Override 85 | public int getItemCount() { 86 | return imgList.size(); 87 | } 88 | 89 | class NormalHolder extends RecyclerView.ViewHolder { 90 | private TextView textView; 91 | ImageView imageView; 92 | public NormalHolder(View itemView) { 93 | super(itemView); 94 | imageView=(ImageView)itemView.findViewById(R.id.image); 95 | textView=(TextView)itemView.findViewById(R.id.textview1); 96 | } 97 | } 98 | 99 | class FootHolder extends RecyclerView.ViewHolder { 100 | private TextView tips; 101 | 102 | public FootHolder(View itemView) { 103 | super(itemView); 104 | tips = (TextView) itemView.findViewById(R.id.tips); 105 | } 106 | } 107 | 108 | public boolean isFadeTips() { 109 | return fadeTips; 110 | } 111 | 112 | public int getRealLastPosition() { 113 | return imgList.size(); 114 | } 115 | 116 | public void updateList(List newDatas, boolean hasMore) { 117 | if (newDatas != null) { 118 | imgList.addAll(newDatas); 119 | } 120 | this.hasMore = hasMore; 121 | notifyDataSetChanged(); 122 | } 123 | 124 | public void resetDatas() { 125 | imgList = new ArrayList<>(); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/adapter/NaviAapter.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.adapter; 2 | 3 | 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.TextView; 9 | import android.widget.Toast; 10 | 11 | import com.qianpic.R; 12 | import com.qianpic.db.Navi; 13 | 14 | import java.util.List; 15 | 16 | import static com.qianpic.R.id.navi_name; 17 | 18 | /** 19 | * Created by admin on 2018/3/24. 20 | */ 21 | 22 | public class NaviAapter extends RecyclerView.Adapter { 23 | 24 | private List mNaviList; 25 | 26 | static class ViewHolder extends RecyclerView.ViewHolder{ 27 | 28 | TextView navigationName; 29 | 30 | public ViewHolder(View view){ 31 | super(view); 32 | navigationName=(TextView)view.findViewById(navi_name); 33 | } 34 | } 35 | 36 | public NaviAapter(List naviList){ 37 | mNaviList=naviList; 38 | } 39 | 40 | @Override 41 | public ViewHolder onCreateViewHolder(ViewGroup parent,int viewType){ 42 | 43 | View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.item_navi,parent,false); 44 | final ViewHolder holder=new ViewHolder(view); 45 | 46 | holder.itemView.setOnClickListener(new View.OnClickListener(){ 47 | 48 | 49 | @Override 50 | public void onClick(View v) { 51 | resetTab(); 52 | View textView= v.findViewById(navi_name); 53 | textView.setBackgroundColor(0xffff00ff); 54 | int position=holder.getAdapterPosition(); 55 | 56 | Navi navi=mNaviList.get(position); 57 | Toast.makeText(v.getContext(),"you clicked view"+navi.getName(),Toast.LENGTH_SHORT).show(); 58 | } 59 | }); 60 | return holder; 61 | } 62 | 63 | /** 64 | * 重置所有tab状态为未选中 65 | */ 66 | private void resetTab() { 67 | } 68 | 69 | @Override 70 | public void onBindViewHolder(ViewHolder holder, int position) { 71 | Navi navi=mNaviList.get(position); 72 | holder.navigationName.setText(navi.getName()); 73 | } 74 | 75 | @Override 76 | public int getItemCount() { 77 | return mNaviList.size(); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/db/CategoryImg.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.db; 2 | 3 | /** 4 | * Created by admin on 2018/4/5. 5 | */ 6 | 7 | public class CategoryImg { 8 | 9 | private int id; 10 | private String cate; 11 | 12 | private String name; 13 | private String link; 14 | 15 | public CategoryImg() 16 | { 17 | 18 | } 19 | 20 | public CategoryImg(String name,String link,String cate) 21 | { 22 | this.name=name; 23 | this.link=link; 24 | this.cate=cate; 25 | } 26 | 27 | public int getId() { 28 | return id; 29 | } 30 | 31 | public void setId(int id) { 32 | this.id = id; 33 | } 34 | 35 | public String getCate() { 36 | return cate; 37 | } 38 | 39 | public void setCate(String cate) { 40 | this.cate = cate; 41 | } 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | public void setName(String name) { 48 | this.name = name; 49 | } 50 | 51 | public String getLink() { 52 | return link; 53 | } 54 | 55 | public void setLink(String link) { 56 | this.link = link; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/db/Img.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.db; 2 | 3 | import org.litepal.crud.DataSupport; 4 | 5 | /** 6 | * Created by admin on 2018/1/15. 7 | */ 8 | 9 | public class Img extends DataSupport { 10 | 11 | private int id; 12 | private String cate; 13 | private int page; 14 | private String name; 15 | private String link; 16 | private String imgLink; 17 | 18 | public Img() 19 | { 20 | 21 | } 22 | 23 | public Img(String name,String link,String cate) 24 | { 25 | this.name=name; 26 | this.link=link; 27 | this.cate=cate; 28 | } 29 | 30 | public int getId() { 31 | return id; 32 | } 33 | 34 | public void setId(int id) { 35 | this.id = id; 36 | } 37 | 38 | public String getCate() { 39 | return cate; 40 | } 41 | 42 | public void setCate(String cate) { 43 | this.cate = cate; 44 | } 45 | 46 | public String getName() { 47 | return name; 48 | } 49 | 50 | public void setName(String name) { 51 | this.name = name; 52 | } 53 | 54 | public String getLink() { 55 | return link; 56 | } 57 | 58 | public void setLink(String link) { 59 | this.link = link; 60 | } 61 | 62 | public int getPage() { 63 | return page; 64 | } 65 | 66 | public void setPage(int page) { 67 | this.page = page; 68 | } 69 | 70 | public String getImglink() { 71 | return imgLink; 72 | } 73 | 74 | public void setImgLink(String imgLink) { 75 | this.imgLink = imgLink; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/db/ImgBig.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.db; 2 | 3 | import org.litepal.crud.DataSupport; 4 | 5 | /** 6 | * Created by admin on 2018/5/18. 7 | */ 8 | 9 | public class ImgBig extends DataSupport { 10 | 11 | private int id; 12 | private String cate; 13 | private int page; 14 | private String name; 15 | private String link; 16 | private String imgLink; 17 | 18 | public ImgBig() 19 | { 20 | 21 | } 22 | 23 | public ImgBig(String name,String link,String cate) 24 | { 25 | this.name=name; 26 | this.link=link; 27 | this.cate=cate; 28 | } 29 | 30 | public int getId() { 31 | return id; 32 | } 33 | 34 | public void setId(int id) { 35 | this.id = id; 36 | } 37 | 38 | public String getCate() { 39 | return cate; 40 | } 41 | 42 | public void setCate(String cate) { 43 | this.cate = cate; 44 | } 45 | 46 | public String getName() { 47 | return name; 48 | } 49 | 50 | public void setName(String name) { 51 | this.name = name; 52 | } 53 | 54 | public String getLink() { 55 | return link; 56 | } 57 | 58 | public void setLink(String link) { 59 | this.link = link; 60 | } 61 | 62 | public int getPage() { 63 | return page; 64 | } 65 | 66 | public void setPage(int page) { 67 | this.page = page; 68 | } 69 | 70 | public String getImglink() { 71 | return imgLink; 72 | } 73 | 74 | public void setImgLink(String imgLink) { 75 | this.imgLink = imgLink; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/db/Navi.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.db; 2 | 3 | /** 4 | * Created by admin on 2018/3/24. 5 | */ 6 | 7 | public class Navi { 8 | 9 | 10 | public Navi(String name){ 11 | this.name=name; 12 | } 13 | 14 | private int id; 15 | private int cate; 16 | 17 | private String name; 18 | private String link; 19 | 20 | public int getId() { 21 | return id; 22 | } 23 | 24 | public void setId(int id) { 25 | this.id = id; 26 | } 27 | 28 | public int getCate() { 29 | return cate; 30 | } 31 | 32 | public void setCate(int cate) { 33 | this.cate = cate; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | 44 | public String getLink() { 45 | return link; 46 | } 47 | 48 | public void setLink(String link) { 49 | this.link = link; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/db/Page.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.db; 2 | 3 | import org.litepal.crud.DataSupport; 4 | 5 | /** 6 | * Created by admin on 2018/1/16. 7 | */ 8 | 9 | public class Page extends DataSupport{ 10 | private int id; 11 | private String content; 12 | private String url; 13 | private String contentType; 14 | 15 | 16 | public int getId() { 17 | return id; 18 | } 19 | 20 | public void setId(int id) { 21 | this.id = id; 22 | } 23 | 24 | public String getContent() { 25 | return content; 26 | } 27 | 28 | public void setContent(String content) { 29 | this.content = content; 30 | } 31 | 32 | public String getUrl() { 33 | return url; 34 | } 35 | 36 | public void setUrl(String url) { 37 | this.url = url; 38 | } 39 | 40 | public String getContentType() { 41 | return contentType; 42 | } 43 | 44 | public void setContentType(String contentType) { 45 | this.contentType = contentType; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/fragment/HighDefinitionFragment.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.fragment; 2 | 3 | import com.qianpic.BaseFragment; 4 | import com.qianpic.db.CategoryImg; 5 | 6 | /** 7 | * Created by admin on 2018/4/1. 8 | */ 9 | 10 | public class HighDefinitionFragment extends BaseFragment { 11 | 12 | 13 | @Override 14 | protected void iniData1(){ 15 | 16 | CategoryImg img1=new CategoryImg("尤果网","http://www.mtyoyo.com/d/file/gaoqing/youguo11/20180328/17f56215305ce37235cc06b096275045.jpg", "/gaoqing/youguo11/"); 17 | imgList.add(img1); 18 | CategoryImg img2=new CategoryImg("推女郎","http://www.mtyoyo.com/d/file/bigpic/2017/03/28/yf33kty4xon.jpg", "/gaoqing/tuinvl/"); 19 | imgList.add(img2); 20 | CategoryImg img3=new CategoryImg("魅妍社","http://www.mtyoyo.com/d/file/bigpic/2017/09/04/xudopkoqjxq.jpg", "/gaoqing/meiyans/"); 21 | imgList.add(img3); 22 | CategoryImg img4=new CategoryImg("美媛馆","http://www.mtyoyo.com/d/file/bigpic/2017/05/08/ix0j3eyapgm.jpg", "/gaoqing/meiyuang/"); 23 | imgList.add(img4); 24 | CategoryImg img5=new CategoryImg("秀人网","http://www.mtyoyo.com/d/file/bigpic/2017/05/08/dppdxoy5lnh.jpg", "/gaoqing/xiurenw/"); 25 | imgList.add(img5); 26 | CategoryImg img6=new CategoryImg("模范学院","http://www.mtyoyo.com/d/file/bigpic/2017/05/22/uqhjgr5zzxq.jpg", "/gaoqing/mofanxy/"); 27 | imgList.add(img6); 28 | CategoryImg img7=new CategoryImg("头条女神","http://www.mtyoyo.com/d/file/bigpic/2017/09/04/kzjigqvrfe1.jpg", "/gaoqing/toutiaons/"); 29 | imgList.add(img7); 30 | CategoryImg img8=new CategoryImg("风俗娘","http://www.mtyoyo.com/d/file/bigpic/2017/04/01/k4pipw5xi40.jpg", "/gaoqing/fengsun/"); 31 | imgList.add(img8); 32 | CategoryImg img9=new CategoryImg("青豆客","http://www.mtyoyo.com/d/file/bigpic/2017/09/04/mzasfrv1bvo.jpg", "/gaoqing/qingdouke/"); 33 | imgList.add(img9); 34 | 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/fragment/PureFragment.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.fragment; 2 | 3 | import com.qianpic.BaseFragment; 4 | import com.qianpic.db.CategoryImg; 5 | 6 | /** 7 | * Created by admin on 2018/4/1. 8 | */ 9 | 10 | public class PureFragment extends BaseFragment { 11 | 12 | 13 | @Override 14 | protected void iniData1() { 15 | CategoryImg img1=new CategoryImg("校花美女","http://www.mtyoyo.com/d/file/qingchunmein/xiaohuamn/2017-09-21/6a9a1abd329bd9a5277ad7c75b08a750.jpg", "/qingchunmein/xiaohuamn/"); 16 | imgList.add(img1); 17 | CategoryImg img2=new CategoryImg("萝莉美女","http://www.mtyoyo.com/d/file/qingchunmein/luolimn/2017-08-31/6c459e90342741605922249bff546c00.jpg", "/qingchunmein/luolimn/"); 18 | imgList.add(img2); 19 | CategoryImg img3=new CategoryImg("小清新","http://www.mtyoyo.com/d/file/qingchunmein/xiaoqingx/2017-09-23/f041517fc17cbbe3352d376af84cc188.jpg", "/qingchunmein/xiaoqingx/"); 20 | imgList.add(img3); 21 | CategoryImg img4=new CategoryImg("青春美女","http://www.mtyoyo.com/d/file/bigpic/2017/04/01/bfncopq0j2l.jpg", "/qingchunmein/qingchunmn/"); 22 | imgList.add(img4); 23 | CategoryImg img5=new CategoryImg("cosplay","http://www.mtyoyo.com/d/file/xingganmot/cosplay/2017-08-03/742e57ddd3ea245e885be5ff48e24309.jpg", "/qingchunmein/cosplay/"); 24 | imgList.add(img5); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/fragment/SexyFragment.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.fragment; 2 | 3 | import com.qianpic.BaseFragment; 4 | import com.qianpic.db.CategoryImg; 5 | 6 | /** 7 | * Created by admin on 2018/4/1. 8 | */ 9 | 10 | public class SexyFragment extends BaseFragment { 11 | 12 | @Override 13 | protected void iniData1() { 14 | CategoryImg img1=new CategoryImg("丰乳翘臀","http://www.mtyoyo.com/d/file/xingganmot/fengru/2017-09-18/5f0239cfdadd734b1fa90227fa75a4a6.jpg", "/xingganmot/fengru/"); 15 | imgList.add(img1); 16 | CategoryImg img2=new CategoryImg("日韩美女","http://www.mtyoyo.com/d/file/bigpic/2017/08/11/kcjtzgi0r2g.jpg", "/xingganmot/ribenmt/"); 17 | imgList.add(img2); 18 | CategoryImg img3=new CategoryImg("欧美美女","http://www.mtyoyo.com/d/file/bigpic/2017/09/04/oudhtegbhaq.jpg", "/xingganmot/omeimt/"); 19 | imgList.add(img3); 20 | CategoryImg img4=new CategoryImg("大陆美女","http://www.mtyoyo.com/d/file/xingganmot/dalumn/2017-09-22/a055f447044ee381eb476ff425a73e3d.jpg", "/xingganmot/dalumn/"); 21 | imgList.add(img4); 22 | CategoryImg img5=new CategoryImg("性感车模","http://www.mtyoyo.com/d/file/bigpic/2017/06/01/nvdwf03yzmw.jpg", "/xingganmot/chemo/"); 23 | imgList.add(img5); 24 | 25 | CategoryImg img6=new CategoryImg("制服诱惑","http://www.mtyoyo.com/d/file/bigpic/2017/09/04/p1lpgottmsx.jpg", "/xingganmot/hanguomt/"); 26 | imgList.add(img6); 27 | CategoryImg img7=new CategoryImg("菠萝社","http://www.mtyoyo.com/d/file/bigpic/2017/11/24/0l3wkhxmvbh.jpg", "/gaoqing/boluo/"); 28 | imgList.add(img7); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/fragment/StockingsFragment.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.fragment; 2 | 3 | import com.qianpic.BaseFragment; 4 | import com.qianpic.db.CategoryImg; 5 | 6 | /** 7 | * Created by admin on 2018/4/1. 8 | */ 9 | 10 | public class StockingsFragment extends BaseFragment { 11 | 12 | @Override 13 | protected void iniData1() { 14 | CategoryImg img1=new CategoryImg("丝袜美腿","http://www.mtyoyo.com/d/file/bigpic/2017/09/04/fclgplvnlnr.jpg", "/siwameit/siwamein/"); 15 | imgList.add(img1); 16 | CategoryImg img2=new CategoryImg("Beautyleg","http://www.mtyoyo.com/d/file/bigpic/2017/07/10/jjzgp4f4m1e.jpg", "/siwameit/Beautyleg/"); 17 | imgList.add(img2); 18 | CategoryImg img3=new CategoryImg("丽柜","http://www.mtyoyo.com/d/file/bigpic/2017/04/10/gxxid01o0e5.jpg", "/siwameit/ligui/"); 19 | imgList.add(img3); 20 | CategoryImg img4=new CategoryImg("ROSI写真","http://www.mtyoyo.com/d/file/bigpic/2017/04/10/c1mwaxp5ym1.jpg", "/siwameit/ROSI/"); 21 | imgList.add(img4); 22 | CategoryImg img5=new CategoryImg("AISS写真","http://www.mtyoyo.com/d/file/bigpic/2017/04/10/vhmjvaodtya.jpg", "/siwameit/AISS/"); 23 | imgList.add(img5); 24 | CategoryImg img6=new CategoryImg("美腿宝贝","http://www.mtyoyo.com/d/file/bigpic/2017/07/28/q0wira2qebs.jpg", "/siwameit/meituibb/"); 25 | imgList.add(img6); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/layout/NavigationLayout.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.layout; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.LinearLayoutManager; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.util.AttributeSet; 7 | import android.view.LayoutInflater; 8 | import android.widget.LinearLayout; 9 | 10 | import com.qianpic.R; 11 | import com.qianpic.adapter.NaviAapter; 12 | import com.qianpic.db.Navi; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | /** 18 | * Created by admin on 2018/3/24. 19 | */ 20 | 21 | public class NavigationLayout extends LinearLayout{ 22 | 23 | 24 | public NavigationLayout(Context context, AttributeSet attrs) { 25 | super(context,attrs); 26 | LayoutInflater.from(context).inflate(R.layout.navigation,this); 27 | 28 | initNavis(); 29 | RecyclerView recyclerView=(RecyclerView)findViewById(R.id.recycle_navi); 30 | LinearLayoutManager layoutManager=new LinearLayoutManager(context); 31 | layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); 32 | recyclerView.setLayoutManager(layoutManager); 33 | NaviAapter adapter=new NaviAapter(naviList); 34 | recyclerView.setAdapter(adapter); 35 | } 36 | 37 | private List naviList=new ArrayList<>(); 38 | 39 | private void initNavis(){ 40 | Navi navi1=new Navi("明星"); 41 | naviList.add(navi1); 42 | Navi navi2=new Navi("青纯美女"); 43 | naviList.add(navi2); 44 | Navi navi3=new Navi("高清美女"); 45 | naviList.add(navi3); 46 | Navi navi4=new Navi("丝袜美女"); 47 | naviList.add(navi4); 48 | Navi navi5=new Navi("性感美女"); 49 | naviList.add(navi5); 50 | Navi navi6=new Navi("电影海报"); 51 | naviList.add(navi6); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/util/CharsetDetector.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.util; 2 | 3 | import org.mozilla.universalchardet.UniversalDetector; 4 | import java.io.UnsupportedEncodingException; 5 | import java.util.regex.Matcher; 6 | import java.util.regex.Pattern; 7 | 8 | ; 9 | /** 10 | * Created by admin on 2018/1/14. 11 | */ 12 | 13 | public class CharsetDetector { 14 | 15 | //从Nutch借鉴的网页编码检测代码 16 | private static final int CHUNK_SIZE = 2000; 17 | 18 | private static Pattern metaPattern = Pattern.compile( 19 | "]*http-equiv=(\"|')?content-type(\"|')?[^>]*)>", 20 | Pattern.CASE_INSENSITIVE); 21 | private static Pattern charsetPattern = Pattern.compile( 22 | "charset=\\s*([a-z][_\\-0-9a-z]*)", Pattern.CASE_INSENSITIVE); 23 | private static Pattern charsetPatternHTML5 = Pattern.compile( 24 | "]*>", 25 | Pattern.CASE_INSENSITIVE); 26 | 27 | //从Nutch借鉴的网页编码检测代码 28 | private static String guessEncodingByNutch(byte[] content) { 29 | int length = Math.min(content.length, CHUNK_SIZE); 30 | 31 | String str = ""; 32 | try { 33 | str = new String(content, "ascii"); 34 | } catch (UnsupportedEncodingException e) { 35 | return null; 36 | } 37 | 38 | Matcher metaMatcher = metaPattern.matcher(str); 39 | String encoding = null; 40 | if (metaMatcher.find()) { 41 | Matcher charsetMatcher = charsetPattern.matcher(metaMatcher.group(1)); 42 | if (charsetMatcher.find()) { 43 | encoding = new String(charsetMatcher.group(1)); 44 | } 45 | } 46 | if (encoding == null) { 47 | metaMatcher = charsetPatternHTML5.matcher(str); 48 | if (metaMatcher.find()) { 49 | encoding = new String(metaMatcher.group(1)); 50 | } 51 | } 52 | if (encoding == null) { 53 | if (length >= 3 && content[0] == (byte) 0xEF 54 | && content[1] == (byte) 0xBB && content[2] == (byte) 0xBF) { 55 | encoding = "UTF-8"; 56 | } else if (length >= 2) { 57 | if (content[0] == (byte) 0xFF && content[1] == (byte) 0xFE) { 58 | encoding = "UTF-16LE"; 59 | } else if (content[0] == (byte) 0xFE 60 | && content[1] == (byte) 0xFF) { 61 | encoding = "UTF-16BE"; 62 | } 63 | } 64 | } 65 | 66 | return encoding; 67 | } 68 | 69 | /** 70 | * 根据字节数组,猜测可能的字符集,如果检测失败,返回utf-8 71 | * 72 | * @param bytes 待检测的字节数组 73 | * @return 可能的字符集,如果检测失败,返回utf-8 74 | */ 75 | public static String guessEncodingByMozilla(byte[] bytes) { 76 | String DEFAULT_ENCODING = "UTF-8"; 77 | UniversalDetector detector = new UniversalDetector(null); 78 | detector.handleData(bytes, 0, bytes.length); 79 | detector.dataEnd(); 80 | String encoding = detector.getDetectedCharset(); 81 | detector.reset(); 82 | if (encoding == null) { 83 | encoding = DEFAULT_ENCODING; 84 | } 85 | return encoding; 86 | } 87 | 88 | /** 89 | * 根据字节数组,猜测可能的字符集,如果检测失败,返回utf-8 90 | * @param content 待检测的字节数组 91 | * @return 可能的字符集,如果检测失败,返回utf-8 92 | */ 93 | public static String guessEncoding(byte[] content) { 94 | String encoding; 95 | try { 96 | encoding = guessEncodingByNutch(content); 97 | } catch (Exception ex) { 98 | return guessEncodingByMozilla(content); 99 | } 100 | 101 | if (encoding == null) { 102 | encoding = guessEncodingByMozilla(content); 103 | return encoding; 104 | } else { 105 | return encoding; 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/util/CommentUtils.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.util; 2 | 3 | /** 4 | * Created by admin on 2018/4/1. 5 | */ 6 | 7 | public class CommentUtils { 8 | public static final int TAB_LONG_COUNT=9; 9 | public static final int TAB_SHORT_COUNT=4; 10 | } -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/util/FragmentFactory.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.util; 2 | 3 | import com.qianpic.BaseFragment; 4 | import com.qianpic.fragment.StockingsFragment; 5 | import com.qianpic.fragment.HighDefinitionFragment; 6 | import com.qianpic.fragment.SexyFragment; 7 | import com.qianpic.fragment.PureFragment; 8 | 9 | import java.util.HashMap; 10 | 11 | /** 12 | * Created by admin on 2018/4/1. 13 | */ 14 | 15 | public class FragmentFactory { 16 | private static HashMap mBaseFragments = new HashMap(); 17 | 18 | public static BaseFragment createFragment(int pos) { 19 | BaseFragment baseFragment = mBaseFragments.get(pos); 20 | 21 | if (baseFragment == null) { 22 | switch (pos) { 23 | case 0: 24 | baseFragment = new PureFragment();//青纯美女 25 | break; 26 | case 1: 27 | baseFragment = new HighDefinitionFragment();//高清美女 28 | break; 29 | case 2: 30 | baseFragment = new StockingsFragment();//丝袜美女 31 | break; 32 | case 3: 33 | baseFragment = new SexyFragment();//性感美女 34 | break; 35 | 36 | } 37 | mBaseFragments.put(pos, baseFragment); 38 | } 39 | return baseFragment; 40 | } 41 | } -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/util/HttpUtil.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.util; 2 | 3 | import okhttp3.Callback; 4 | import okhttp3.OkHttpClient; 5 | import okhttp3.Request; 6 | 7 | /** 8 | * Created by admin on 2018/1/13. 9 | */ 10 | 11 | public class HttpUtil { 12 | 13 | public static void sendOkHttpRequest(String url, Callback callback) { 14 | OkHttpClient client = new OkHttpClient(); 15 | Request request = new Request.Builder().url(url).build(); 16 | client.newCall(request).enqueue(callback); 17 | } 18 | 19 | 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/util/ImageViewUtil.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.util; 2 | 3 | import android.content.Context; 4 | import android.graphics.drawable.Drawable; 5 | import android.util.DisplayMetrics; 6 | import android.view.WindowManager; 7 | import android.widget.ImageView; 8 | import android.widget.RelativeLayout; 9 | 10 | /** 11 | * Created by admin on 2018/3/5. 12 | */ 13 | 14 | public class ImageViewUtil { 15 | public static void matchAll(Context context, ImageView imageView) { 16 | int width, height;//ImageView调整后的宽高 17 | //获取屏幕宽高 18 | WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); 19 | DisplayMetrics metrics = new DisplayMetrics(); 20 | manager.getDefaultDisplay().getMetrics(metrics); 21 | int sWidth = metrics.widthPixels; 22 | int sHeight = metrics.heightPixels; 23 | //获取图片宽高 24 | Drawable drawable = imageView.getDrawable(); 25 | int dWidth = drawable.getIntrinsicWidth(); 26 | int dHeight = drawable.getIntrinsicHeight(); 27 | 28 | //屏幕宽高比,一定要先把其中一个转为float 29 | float sScale = (float) sWidth / sHeight; 30 | //图片宽高比 31 | float dScale = (float) dWidth / dHeight; 32 | /* 33 | 缩放比 34 | 如果sScale>dScale,表示在高相等的情况下,控屏幕比较宽,这时候要适应高度,缩放比就是两则的高之比,图片宽度用缩放比计算 35 | 如果sScale dScale) { 39 | scale = (float) dHeight / sHeight; 40 | height = sHeight;//图片高度就是屏幕高度 41 | width = (int) (dWidth * scale);//按照缩放比算出图片缩放后的宽度 42 | } else if (sScale < dScale) { 43 | scale = (float) dWidth / sWidth; 44 | width = sWidth; 45 | height = (int) (dHeight / scale);//这里用除 46 | } else { 47 | //最后两者刚好比例相同,其实可以不用写,刚好充满 48 | width = sWidth; 49 | height = sHeight; 50 | } 51 | //重设ImageView宽高 52 | RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width, height); 53 | imageView.setLayoutParams(params); 54 | //这样就获得了一个既适应屏幕有适应内部图片的ImageView,不用再纠结该给ImageView设定什么尺寸合适了 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/util/LinkFilter.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.util; 2 | 3 | /** 4 | * Created by admin on 2018/1/14. 5 | */ 6 | 7 | public interface LinkFilter { 8 | public boolean accept(String url); 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/util/Links.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.util; 2 | 3 | import java.util.HashSet; 4 | import java.util.LinkedList; 5 | import java.util.Set; 6 | 7 | /** 8 | * Created by admin on 2018/1/14. 9 | */ 10 | 11 | public class Links { 12 | 13 | //已访问的 url 集合 已经访问过的 主要考虑 不能再重复了 使用set来保证不重复; 14 | private static Set visitedUrlSet = new HashSet(); 15 | 16 | //待访问的 url 集合 待访问的主要考虑 1:规定访问顺序;2:保证不提供重复的带访问地址; 17 | private static LinkedList unVisitedUrlQueue = new LinkedList(); 18 | 19 | //获得已经访问的 URL 数目 20 | public static int getVisitedUrlNum() { 21 | return visitedUrlSet.size(); 22 | } 23 | 24 | //添加到访问过的 URL 25 | public static void addVisitedUrlSet(String url) { 26 | visitedUrlSet.add(url); 27 | } 28 | 29 | //移除访问过的 URL 30 | public static void removeVisitedUrlSet(String url) { 31 | visitedUrlSet.remove(url); 32 | } 33 | 34 | 35 | 36 | //获得 待访问的 url 集合 37 | public static LinkedList getUnVisitedUrlQueue() { 38 | return unVisitedUrlQueue; 39 | } 40 | 41 | // 添加到待访问的集合中 保证每个 URL 只被访问一次 42 | public static void addUnvisitedUrlQueue(String url) { 43 | if (url != null && !url.trim().equals("") && !visitedUrlSet.contains(url) && !unVisitedUrlQueue.contains(url)){ 44 | unVisitedUrlQueue.add(url); 45 | } 46 | } 47 | 48 | //删除 待访问的url 49 | public static Object removeHeadOfUnVisitedUrlQueue() { 50 | return unVisitedUrlQueue.removeFirst(); 51 | } 52 | 53 | //判断未访问的 URL 队列中是否为空 54 | public static boolean unVisitedUrlQueueIsEmpty() { 55 | return unVisitedUrlQueue.isEmpty(); 56 | } 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/util/Page.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.util; 2 | 3 | import org.jsoup.Jsoup; 4 | import org.jsoup.nodes.Document; 5 | import java.io.UnsupportedEncodingException; 6 | 7 | /** 8 | * Created by admin on 2018/1/14. 9 | */ 10 | 11 | public class Page { 12 | 13 | private byte[] content ; 14 | private String html ; //网页源码字符串 15 | private Document doc ;//网页Dom文档 16 | private String charset ;//字符编码 17 | private String url ;//url路径 18 | private String contentType ;// 内容类型 19 | 20 | 21 | public Page(byte[] content , String url , String contentType){ 22 | this.content = content ; 23 | this.url = url ; 24 | this.contentType = contentType ; 25 | } 26 | 27 | 28 | 29 | public String getCharset() { 30 | return charset; 31 | } 32 | public String getUrl(){return url ;} 33 | public String getContentType(){ return contentType ;} 34 | public byte[] getContent(){ return content ;} 35 | 36 | /** 37 | * 返回网页的源码字符串 38 | * 39 | * @return 网页的源码字符串 40 | */ 41 | public String getHtml() { 42 | if (html != null) { 43 | return html; 44 | } 45 | if (content == null) { 46 | return null; 47 | } 48 | if(charset==null){ 49 | charset = CharsetDetector.guessEncoding(content); // 根据内容来猜测 字符编码 50 | } 51 | try { 52 | this.html = new String(content, charset); 53 | return html; 54 | } catch (UnsupportedEncodingException ex) { 55 | ex.printStackTrace(); 56 | return null; 57 | } 58 | } 59 | 60 | /* 61 | * 得到文档 62 | * */ 63 | public Document getDoc(){ 64 | if (doc != null) { 65 | return doc; 66 | } 67 | try { 68 | this.doc = Jsoup.parse(getHtml(), url); 69 | return doc; 70 | } catch (Exception ex) { 71 | ex.printStackTrace(); 72 | return null; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/qianpic/util/PageParserTool.java: -------------------------------------------------------------------------------- 1 | package com.qianpic.util; 2 | 3 | import android.content.Context; 4 | 5 | import com.qianpic.db.Img; 6 | import com.qianpic.db.ImgBig; 7 | 8 | import org.jsoup.nodes.Element; 9 | import org.jsoup.select.Elements; 10 | 11 | import java.util.ArrayList; 12 | import java.util.HashSet; 13 | import java.util.Iterator; 14 | import java.util.Set; 15 | 16 | /** 17 | * Created by admin on 2018/1/14. 18 | */ 19 | 20 | public class PageParserTool { 21 | 22 | 23 | private Context mContext; 24 | 25 | 26 | 27 | /* 通过选择器来选取页面的 */ 28 | public static Elements select(Page page , String cssSelector) { 29 | return page.getDoc().select(cssSelector); 30 | } 31 | 32 | /* 33 | * 通过css选择器来得到指定元素; 34 | * 35 | * */ 36 | public static Element select(Page page , String cssSelector, int index) { 37 | Elements eles = select(page , cssSelector); 38 | int realIndex = index; 39 | if (index < 0) { 40 | realIndex = eles.size() + index; 41 | } 42 | return eles.get(realIndex); 43 | } 44 | 45 | 46 | /** 47 | * 获取满足选择器的元素中的链接 选择器cssSelector必须定位到具体的超链接 48 | * 例如我们想抽取id为content的div中的所有超链接,这里 49 | * 就要将cssSelector定义为div[id=content] a 50 | * 放入set 中 防止重复; 51 | * @param cssSelector 52 | * @return 53 | */ 54 | public static Set getLinks(Page page , String cssSelector) { 55 | Set links = new HashSet() ; 56 | Elements es = select(page , cssSelector); 57 | Iterator iterator = es.iterator(); 58 | while(iterator.hasNext()) { 59 | Element element = (Element) iterator.next(); 60 | if ( element.hasAttr("href") ) { 61 | links.add(element.attr("abs:href")); 62 | }else if( element.hasAttr("src") ){ 63 | links.add(element.attr("abs:src")); 64 | } 65 | } 66 | return links; 67 | } 68 | 69 | /** 70 | * 获取满足选择器的元素中的链接 选择器cssSelector必须定位到具体的超链接 71 | * 例如我们想抽取id为content的div中的所有超链接,这里 72 | * 就要将cssSelector定义为div[id=content] a 73 | * 放入set 中 防止重复; 74 | * @param cssSelector 75 | * @return 76 | */ 77 | public static void getImgLists(Page page , String cssSelector,String cate,int p,Context mContext) { 78 | 79 | Set links = new HashSet() ; 80 | Elements es = select(page , cssSelector); 81 | Iterator iterator = es.iterator(); 82 | while(iterator.hasNext()) { 83 | Element element = (Element) iterator.next(); 84 | 85 | if ( element.getElementsByTag("img").hasAttr("href") ) { 86 | if(links.add(element.getElementsByTag("img").attr("abs:href"))) 87 | { 88 | Img img=new Img(); 89 | img.setLink(element.getElementsByTag("img").attr("abs:href")); 90 | img.setName(element.getElementsByTag("a").attr("title")); 91 | img.setCate(cate); 92 | img.setPage(p); 93 | img.setImgLink(element.getElementsByTag("a").attr("href")); 94 | img.save(); 95 | } 96 | }else if( element.getElementsByTag("img").hasAttr("src") ){ 97 | if(links.add(element.getElementsByTag("img").attr("abs:src"))) 98 | { 99 | Img img=new Img(); 100 | img.setLink(element.getElementsByTag("img").attr("abs:src")); 101 | img.setName(element.getElementsByTag("a").attr("title")); 102 | img.setCate(cate); 103 | img.setPage(p); 104 | img.setImgLink(element.getElementsByTag("a").attr("href")); 105 | img.save(); 106 | 107 | } 108 | } 109 | } 110 | 111 | 112 | } 113 | 114 | 115 | /** 116 | * 获取满足选择器的元素中的链接 选择器cssSelector必须定位到具体的超链接 117 | * 例如我们想抽取id为content的div中的所有超链接,这里 118 | * 就要将cssSelector定义为div[id=content] a 119 | * 放入set 中 防止重复; 120 | * @param cssSelector 121 | * @return 122 | */ 123 | public static void getImgBigLists(Page page , String cssSelector,String cate,int p,Context mContext) { 124 | 125 | Set links = new HashSet() ; 126 | Elements es = select(page , cssSelector); 127 | if(es!=null) { 128 | Iterator iterator = es.iterator(); 129 | 130 | while (iterator.hasNext()) { 131 | Element element = (Element) iterator.next(); 132 | 133 | if (element.getElementsByTag("img").hasAttr("href")) { 134 | if (links.add(element.getElementsByTag("img").attr("abs:href"))) { 135 | ImgBig img = new ImgBig(); 136 | img.setLink(element.getElementsByTag("img").attr("abs:href")); 137 | img.setName(element.getElementsByTag("a").attr("title")); 138 | img.setCate(cate); 139 | img.setPage(p); 140 | img.setImgLink(element.getElementsByTag("a").attr("href")); 141 | img.save(); 142 | } 143 | } else if (element.getElementsByTag("img").hasAttr("src")) { 144 | if (links.add(element.getElementsByTag("img").attr("abs:src"))) { 145 | ImgBig img = new ImgBig(); 146 | img.setLink(element.getElementsByTag("img").attr("abs:src")); 147 | img.setName(element.getElementsByTag("a").attr("title")); 148 | img.setCate(cate); 149 | img.setPage(p); 150 | 151 | img.save(); 152 | 153 | } 154 | } 155 | } 156 | } 157 | 158 | } 159 | 160 | /** 161 | * 获取网页中满足指定css选择器的所有元素的指定属性的集合 162 | * 例如通过getAttrs("Img[src]","abs:src")可获取网页中所有图片的链接 163 | * @param cssSelector 164 | * @param attrName 165 | * @return 166 | */ 167 | public static ArrayList getAttrs(Page page , String cssSelector, String attrName) { 168 | ArrayList result = new ArrayList(); 169 | Elements eles = select(page ,cssSelector); 170 | for (Element ele : eles) { 171 | if (ele.hasAttr(attrName)) { 172 | result.add(ele.attr(attrName)); 173 | } 174 | } 175 | return result; 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_img.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 12 | 13 | 14 | 15 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_short_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 21 | 22 | 23 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/category.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/footview.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 17 | 18 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_navi.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/navigation.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/app/src/main/res/mipmap-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 红花美图 3 | 4 | 5 | 青纯美女 6 | 高清美女 7 | 丝袜美女 8 | 性感美女 9 | 10 | 11 | 12 | 头条 13 | 要闻 14 | 娱乐 15 | 体育 16 | 财经 17 | 科技 18 | 时尚 19 | 视频 20 | 直播 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/qianpic/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.qianpic; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/红花美图.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/app/红花美图.apk -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | google() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.1.2' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | jcenter() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } 25 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed May 30 19:45:16 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /预览.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagnali/honghua/d70b7b633a765500e316924f431a994eff16f5d9/预览.gif --------------------------------------------------------------------------------