Skip to content

Commit 30f75d2

Browse files
update
1 parent 03c0526 commit 30f75d2

File tree

14 files changed

+265
-89
lines changed

14 files changed

+265
-89
lines changed

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/build
2+
.iml

app/build.gradle

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
apply plugin: 'com.android.application'
2+
apply plugin: 'com.neenbedankt.android-apt'//增加这一句
23

34
android {
45
compileSdkVersion 23
56
buildToolsVersion "23.0.1"
67

78
defaultConfig {
89
applicationId "com.jorge.circleviewpager"
9-
minSdkVersion 15
10+
minSdkVersion 14
1011
targetSdkVersion 23
1112
versionCode 1
1213
versionName "1.0"
@@ -20,9 +21,16 @@ android {
2021
}
2122

2223
dependencies {
23-
compile fileTree(dir: 'libs', include: ['*.jar'])
24+
compile fileTree(include: ['*.jar'], dir: 'libs')
2425
testCompile 'junit:junit:4.12'
25-
compile 'com.android.support:appcompat-v7:23.1.1'
26+
compile 'com.android.support:appcompat-v7:22.2.1'
2627
compile project(':circlelibrary')
2728
compile files('libs/imageloder.jar')
29+
// compile 'com.google.android.gms:play-services-analytics:9.0.0'
30+
compile 'com.github.bumptech.glide:glide:3.7.0'
31+
compile 'com.jakewharton:butterknife:8.1.0'
32+
apt 'com.jakewharton:butterknife-compiler:8.1.0' //增加这一句
33+
2834
}
35+
36+
//apply plugin: 'com.google.gms.google-services'

app/src/main/AndroidManifest.xml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.jorge.circleviewpager">
4-
<uses-permission android:name="android.permission.WAKE_LOCK" />
4+
5+
<!--//添加权限-->
56
<uses-permission android:name="android.permission.INTERNET" />
67
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
7-
<uses-permission android:name="android.permission.INTERNET" />
8+
9+
<uses-permission android:name="android.permission.WAKE_LOCK" />
810
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
911
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
1012
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
@@ -25,6 +27,13 @@
2527
android:label="@string/app_name"
2628
android:supportsRtl="true"
2729
android:theme="@style/AppTheme">
30+
<!--//加载google play services-->
31+
<!--<meta-data-->
32+
<!--android:name="com.google.android.gms.version"-->
33+
<!--android:value="@integer/google_play_services_version" />-->
34+
35+
36+
2837
<activity android:name=".MainActivity">
2938
<intent-filter>
3039
<action android:name="android.intent.action.MAIN" />

app/src/main/java/com/jorge/circleviewpager/MainActivity.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
package com.jorge.circleviewpager;
22

3+
import android.app.Activity;
34
import android.content.Context;
4-
import android.support.v7.app.AppCompatActivity;
55
import android.os.Bundle;
66
import android.util.DisplayMetrics;
77
import android.view.View;
88
import android.widget.ImageView;
99
import android.widget.LinearLayout;
10+
import android.widget.Toast;
11+
1012
import com.jorge.circlelibrary.ImageCycleView;
13+
1114
import java.util.ArrayList;
1215

13-
public class MainActivity extends AppCompatActivity {
16+
import butterknife.ButterKnife;
17+
18+
public class MainActivity extends Activity {
1419
ImageCycleView imageCycleView;
1520
@Override
1621
protected void onCreate(Bundle savedInstanceState) {
1722
super.onCreate(savedInstanceState);
1823
setContentView(R.layout.activity_main);
24+
1925
/** 找到轮播控件*/
2026
imageCycleView= (ImageCycleView) findViewById(R.id.cycleView);
27+
28+
imageCycleView.setCycle_T(ImageCycleView.CYCLE_T.CYCLE_VIEW_THREE_SCALE);
2129
/**装在数据的集合 文字描述*/
2230
ArrayList<String> imageDescList=new ArrayList<>();
2331
/**装在数据的集合 图片地址*/
@@ -49,6 +57,7 @@ public void initCarsuelView(ArrayList<String> imageDescList,ArrayList<String>url
4957
@Override
5058
public void onImageClick(int position, View imageView) {
5159
/**实现点击事件*/
60+
Toast.makeText(MainActivity.this,"position="+position,Toast.LENGTH_SHORT).show();
5261
}
5362
@Override
5463
public void displayImage(String imageURL, ImageView imageView) {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
xmlns:tools="http://schemas.android.com/tools"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6-
android:paddingBottom="@dimen/activity_vertical_margin"
7-
android:paddingLeft="@dimen/activity_horizontal_margin"
8-
android:paddingRight="@dimen/activity_horizontal_margin"
9-
android:paddingTop="@dimen/activity_vertical_margin"
106
tools:context="com.jorge.circleviewpager.MainActivity">
117

128
<com.jorge.circlelibrary.ImageCycleView

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ buildscript {
88
classpath 'com.android.tools.build:gradle:1.5.0'
99
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
1010
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
11+
// classpath 'com.google.gms:google-services:3.0.0'
1112
// NOTE: Do not place your application dependencies here; they belong
1213
// in the individual module build.gradle files
14+
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' //增加这一句
1315
}
1416
}
1517

circlelibrary/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/build
2+
/local.properties

circlelibrary/build.gradle

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ apply plugin: 'com.android.library'
22
apply plugin: 'com.github.dcendents.android-maven'
33
apply plugin: 'com.jfrog.bintray'
44

5-
version = "1.0.0"
5+
version = "1.0.1"
66
android {
7-
compileSdkVersion 23
7+
compileSdkVersion 22
88
buildToolsVersion "23.0.1"
99

1010
defaultConfig {
11-
minSdkVersion 15
11+
minSdkVersion 14
1212
targetSdkVersion 23
1313
versionCode 1
1414
versionName "1.0"
@@ -23,9 +23,8 @@ android {
2323

2424

2525
dependencies {
26-
compile fileTree(dir: 'libs', include: ['*.jar'])
27-
28-
compile 'com.android.support:appcompat-v7:23.1.1'
26+
compile fileTree(include: ['*.jar'], dir: 'libs')
27+
compile 'com.android.support:appcompat-v7:22.2.1'
2928
}
3029

3130
def siteUrl = 'https://github.com/CodingForAndroid/CircleViewPager' // 项目的主页

circlelibrary/src/main/java/com/jorge/circlelibrary/ClickableImageView.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import android.view.View;
88
import android.widget.ImageView;
99

10-
/** 有按压效果的ImageView
11-
* @author:Jorge on 2015/9/10 12:40
10+
/** 有按压效果的ImageView
11+
* @author:Jorge on 2015/9/10 12:40
1212
*/
1313
public class ClickableImageView extends ImageView {
1414
public ClickableImageView(Context context) {
@@ -26,7 +26,7 @@ public ClickableImageView(Context context, AttributeSet attrs, int defStyleAttr)
2626
this.setOnTouchListener(VIEW_TOUCH_DARK);
2727
}
2828
public OnTouchListener VIEW_TOUCH_DARK = new OnTouchListener() {
29-
// 变暗(三个-50,值越大则效果越深)
29+
// 变暗(三个-50,值越大则效果越深)
3030
public final float[] BT_SELECTED_DARK = new float[] { 1, 0, 0, 0, -50,
3131
0, 1, 0, 0, -50, 0, 0, 1, 0, -50, 0, 0, 0, 1, 0 };
3232
@Override
@@ -42,7 +42,7 @@ public boolean onTouch(View v, MotionEvent event) {
4242
ImageView iv = (ImageView) v;
4343
iv.clearColorFilter();
4444
}
45-
return true; // 如为false,执行ACTION_DOWN后不再往下执行
45+
return true; // 如为false,执行ACTION_DOWN后不再往下执行
4646
}
4747
};
4848
private void mPerformClick() {
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.jorge.circlelibrary;
2+
3+
import android.app.Activity;
4+
import android.content.Context;
5+
6+
/**
7+
* 这个工具类用来说明一些尺寸通用操作
8+
*/
9+
public final class DemiUitls {
10+
11+
public static int dip2px(Context context, float dpValue)
12+
{
13+
final float scale = context.getResources().getDisplayMetrics().density;
14+
return (int) (dpValue * scale + 0.5f);
15+
}
16+
17+
18+
public static int px2dip(Context context, float pxValue)
19+
{
20+
final float scale = context.getResources().getDisplayMetrics().density;
21+
return (int) (pxValue / scale + 0.5f);
22+
}
23+
24+
public static int getScreenWidth(Activity context){
25+
return context.getWindowManager().getDefaultDisplay().getWidth();
26+
}
27+
28+
public static int getScreenHeight(Activity context){
29+
return context.getWindowManager().getDefaultDisplay().getHeight();
30+
}
31+
32+
33+
}

0 commit comments

Comments
 (0)