Skip to content

Commit c1aee94

Browse files
committed
Initial commit
0 parents  commit c1aee94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1257
-0
lines changed

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.externalNativeBuild

.idea/compiler.xml

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+62
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apply plugin: 'com.android.application'
2+
android {
3+
compileSdkVersion 24
4+
buildToolsVersion "24.0.0"
5+
defaultConfig {
6+
applicationId "com.example.administrator.webviewlist"
7+
minSdkVersion 15
8+
targetSdkVersion 24
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
compile fileTree(include: ['*.jar'], dir: 'libs')
23+
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
24+
exclude group: 'com.android.support', module: 'support-annotations'
25+
})
26+
compile 'com.android.support:appcompat-v7:24.2.0'
27+
testCompile 'junit:junit:4.12'
28+
compile 'com.android.support:recyclerview-v7:24.2.0'
29+
compile project(':webviewscroll')
30+
}
31+
//publish {
32+
// userOrg = 'sgsd63584'//bintray.com用户名
33+
// groupId = 'com.sgsd63584'//jcenter上的路径
34+
// artifactId = 'webviewlist'//项目名称
35+
// publishVersion = '0.1.0'//版本号
36+
// desc = 'Oh hi, this is a nice description for a project, right?'//描述,不重要
37+
// website = 'https://github.com/348476129'//网站,不重要;尽量模拟github上的地址,例如我这样的;当然你有地址最好了
38+
//}

app/proguard-rules.pro

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in D:\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+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.example.administrator.webviewlist;
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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
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.example.administrator.webviewlist", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.administrator.webviewlist">
4+
<uses-permission android:name="android.permission.INTERNET"/>
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:supportsRtl="true"
10+
android:theme="@style/AppTheme">
11+
<activity android:name=".MainActivity">
12+
<intent-filter>
13+
<action android:name="android.intent.action.MAIN" />
14+
15+
<category android:name="android.intent.category.LAUNCHER" />
16+
</intent-filter>
17+
</activity>
18+
</application>
19+
20+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.example.administrator.webviewlist;
2+
3+
import android.support.v7.app.AppCompatActivity;
4+
import android.os.Bundle;
5+
import android.support.v7.widget.LinearLayoutManager;
6+
import android.support.v7.widget.RecyclerView;
7+
8+
import com.example.webviewscroll.WebScrollLayout;
9+
import com.example.webviewscroll.WebViewAdapter;
10+
11+
public class MainActivity extends AppCompatActivity {
12+
private RecyclerView recyclerView;
13+
private WebScrollLayout webScrollLayout;
14+
private LinearLayoutManager linearLayoutManager;
15+
@Override
16+
protected void onCreate(Bundle savedInstanceState) {
17+
super.onCreate(savedInstanceState);
18+
setContentView(R.layout.activity_main);
19+
webScrollLayout = (WebScrollLayout)findViewById(R.id.my_layout);
20+
recyclerView = (RecyclerView)findViewById(R.id.recycler);
21+
linearLayoutManager = new LinearLayoutManager(this);
22+
recyclerView.setLayoutManager(linearLayoutManager);
23+
WebViewAdapter webViewAdapter = new WebViewAdapter(new MyAdapter(),"http://wap.4c.cn");
24+
webViewAdapter.attchLayout(webScrollLayout);
25+
recyclerView.setAdapter(webViewAdapter);
26+
27+
}
28+
29+
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.example.administrator.webviewlist;
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+
10+
/**
11+
* Created by 康颢曦 on 2016/8/23.
12+
*/
13+
14+
public class MyAdapter extends RecyclerView.Adapter {
15+
16+
@Override
17+
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
18+
19+
20+
return new MyHolder(LayoutInflater.from(
21+
parent.getContext()).inflate(R.layout.view, parent,
22+
false));
23+
24+
}
25+
26+
@Override
27+
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
28+
if (getItemViewType(position)==0){
29+
((MyHolder)holder).textView.setText("1");
30+
}else {
31+
((MyHolder)holder).textView.setText("2");
32+
}
33+
34+
}
35+
36+
class MyHolder extends RecyclerView.ViewHolder {
37+
TextView textView;
38+
39+
public MyHolder(View itemView) {
40+
super(itemView);
41+
textView = (TextView) itemView.findViewById(R.id.textview);
42+
}
43+
}
44+
45+
@Override
46+
public int getItemViewType(int position) {
47+
if (position%2==1){
48+
return 0;
49+
}
50+
if (position%2==0){
51+
return 1;
52+
}
53+
return 1;
54+
}
55+
56+
@Override
57+
public int getItemCount() {
58+
return 21;
59+
}
60+
61+
62+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<com.example.webviewscroll.WebScrollLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:id="@+id/my_layout"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
tools:context="com.example.administrator.webviewlist.MainActivity">
8+
<android.support.v7.widget.RecyclerView
9+
android:id="@+id/recycler"
10+
android:fadingEdge="none"
11+
android:overScrollMode="never"
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
14+
</com.example.webviewscroll.WebScrollLayout>

app/src/main/res/layout/view.xml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:orientation="vertical" android:layout_width="match_parent"
4+
android:layout_height="wrap_content">
5+
<TextView
6+
android:id="@+id/textview"
7+
android:textSize="16sp"
8+
android:layout_margin="16dp"
9+
android:layout_gravity="center"
10+
android:text="dididididdi"
11+
android:layout_width="wrap_content"
12+
android:layout_height="wrap_content" />
13+
</LinearLayout>
3.34 KB
Loading
2.15 KB
Loading
4.73 KB
Loading
7.54 KB
Loading
10.2 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<resources>
2+
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
3+
(such as screen margins) for screens with more than 820dp of available width. This
4+
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
5+
<dimen name="activity_horizontal_margin">64dp</dimen>
6+
</resources>

app/src/main/res/values/colors.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="colorPrimary">#3F51B5</color>
4+
<color name="colorPrimaryDark">#303F9F</color>
5+
<color name="colorAccent">#FF4081</color>
6+
</resources>

0 commit comments

Comments
 (0)