├── .gitignore ├── .idea ├── codeStyles │ └── Project.xml ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── loopswitch │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable │ │ ├── image_shader.png │ │ ├── point1.xml │ │ ├── point2.xml │ │ ├── point3.xml │ │ ├── point4.xml │ │ └── point5.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── content_main.xml │ │ ├── loopview_item_view0.xml │ │ ├── loopview_item_view1.xml │ │ ├── loopview_item_view2.xml │ │ ├── loopview_item_view4.xml │ │ └── loopview_item_view5.xml │ │ ├── menu │ │ └── menu_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── image0.png │ │ ├── image1.png │ │ ├── image2.png │ │ ├── image3.png │ │ ├── image4.png │ │ ├── image5.png │ │ ├── image6.png │ │ └── image7.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-v21 │ │ └── styles.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── example │ └── loopswitch │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── image ├── shot1.jpg └── shot2.jpg ├── loopplay ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── slidemove │ │ └── library │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── slidemove │ │ │ └── library │ │ │ ├── listener │ │ │ ├── OnItemClickListener.java │ │ │ ├── OnItemSelectedListener.java │ │ │ └── OnLoopViewTouchListener.java │ │ │ └── view │ │ │ ├── LoopRotarySwitchView.java │ │ │ └── LoopRotarySwitchViewHandler.java │ └── res │ │ └── values │ │ ├── attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── slidemove │ └── library │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 47 | 48 | 1.8 49 | 50 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 效果图 2 | ![image](https://github.com/shenpeibao/Loop3DRotation-master/blob/master/image/shot1.jpg) 3 | 4 | 5 | ## 介绍 6 | 7 | *1. 3d旋转 8 | 可以无限循环,自动旋转,停靠的3D旋转布局控件,无需编写代码,直接在布局中加入自己的布局即可。 9 | 控件继承相对布局RelativeLayout直接可以当做布局使用。 10 | 11 | *2.支持自动旋转 12 | 13 | *3.可直接在xml添加元素即可添加列数据。也可以动态代码添加view 14 | 15 | *4.优良的兼容性,和可以自己尺寸控制 16 | 17 | *5.添加了点击切换和点击中间监听,适合目前app的需求 18 | 19 | *6.优化控件点击切换效果,使用更加的方法实用 20 | 21 | ## 如何使用 22 | 23 | 24 | 在你的项目Gradle 直接引入库文件 25 | 26 | 27 | implementation project(':loopplay') 28 | 29 | 30 | 31 | ## 配置view 32 | 33 | 布局xml里: 34 | 35 | 42 | 46 | 50 | 54 | 58 | 59 | 60 | 61 | 代码设置: 62 | 63 | mLoopRotarySwitchView 64 | .setR(300)//设置R的大小 65 | .setAutoRotation(true)//是否自动切换 66 | .setAutoScrollDirection(LoopRotarySwitchView.AutoScrollDirection.left)//切换方向 67 | .setAutoRotationTime(2000);//自动切换的时间 单位毫秒 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "28.0.3" 6 | 7 | defaultConfig { 8 | applicationId "com.example.looprotaryswitch" 9 | minSdkVersion 14 10 | targetSdkVersion 28 11 | versionCode 1 12 | versionName "1.0.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | implementation fileTree(include: ['*.jar'], dir: 'libs') 24 | testImplementation 'junit:junit:4.12' 25 | implementation 'com.android.support:appcompat-v7:28.image0.image0' 26 | implementation 'com.android.support:design:28.0.0' 27 | // compile 'com.dalong:loopview:image1.image0.image3' 28 | implementation project(':loopplay') 29 | } 30 | -------------------------------------------------------------------------------- /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 /Users/zhouweilong/Library/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 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/loopswitch/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.loopswitch; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.util.DisplayMetrics; 7 | import android.util.Log; 8 | import android.view.View; 9 | import android.view.WindowManager; 10 | import android.widget.CheckBox; 11 | import android.widget.CompoundButton; 12 | import android.widget.SeekBar; 13 | import android.widget.Switch; 14 | 15 | import com.slidemove.library.listener.OnItemSelectedListener; 16 | import com.slidemove.library.view.LoopRotarySwitchView; 17 | 18 | public class MainActivity extends AppCompatActivity { 19 | 20 | private static final String TAG = MainActivity.class.getSimpleName(); 21 | private LoopRotarySwitchView mLoopRotarySwitchView; 22 | 23 | private int width; 24 | private SeekBar mSeekBarX, mSeekBarZ; 25 | private CheckBox mCheckbox; 26 | private Switch mSwitchLeftright; 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_main); 32 | 33 | initView(); 34 | initLoopRotarySwitchView(); 35 | initLinstener(); 36 | } 37 | 38 | private void initLinstener() { 39 | /** 40 | * 选中回调 41 | */ 42 | mLoopRotarySwitchView.setOnItemSelectedListener(new OnItemSelectedListener() { 43 | @Override 44 | public void selected(int position, View view) { 45 | } 46 | }); 47 | /** 48 | * 设置子view的x坐标 49 | */ 50 | mSeekBarX.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { 51 | @Override 52 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 53 | int i = seekBar.getMax() / 2; 54 | Log.e(TAG, "i----" + i + " ,progress----" + progress+ " ,progress----> " + (progress-i)); 55 | mLoopRotarySwitchView.setLoopRotationX(progress - seekBar.getMax() / 2); 56 | mLoopRotarySwitchView.initView(); 57 | } 58 | 59 | @Override 60 | public void onStartTrackingTouch(SeekBar seekBar) { 61 | } 62 | 63 | @Override 64 | public void onStopTrackingTouch(SeekBar seekBar) { 65 | } 66 | }); 67 | /** 68 | * 设置子view的z坐标 69 | */ 70 | mSeekBarZ.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { 71 | @Override 72 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 73 | mLoopRotarySwitchView.setLoopRotationZ(progress - seekBar.getMax() / 2); 74 | mLoopRotarySwitchView.initView(); 75 | } 76 | 77 | @Override 78 | public void onStartTrackingTouch(SeekBar seekBar) { 79 | 80 | } 81 | 82 | @Override 83 | public void onStopTrackingTouch(SeekBar seekBar) { 84 | } 85 | }); 86 | /** 87 | * 设置是否自动旋转 88 | */ 89 | mCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 90 | @Override 91 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 92 | mLoopRotarySwitchView.setAutoRotation(isChecked);//启动LoopViewPager自动切换 93 | } 94 | }); 95 | /** 96 | * 设置向左还是向右自动旋转 97 | */ 98 | mSwitchLeftright.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 99 | @Override 100 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 101 | mLoopRotarySwitchView.setAutoScrollDirection(isChecked ? LoopRotarySwitchView.AutoScrollDirection.left 102 | : LoopRotarySwitchView.AutoScrollDirection.right); 103 | } 104 | }); 105 | } 106 | 107 | /** 108 | * 设置LoopRotarySwitchView 109 | */ 110 | private void initLoopRotarySwitchView() { 111 | mLoopRotarySwitchView 112 | .setR(width / 3)//设置R的大小 113 | .setAutoRotation(false)//是否自动切换 114 | .setAutoScrollDirection(LoopRotarySwitchView.AutoScrollDirection.left) 115 | .setAutoRotationTime(1500);//自动切换的时间 单位毫秒 116 | } 117 | 118 | /** 119 | * 初始化布局 120 | */ 121 | private void initView() { 122 | mLoopRotarySwitchView = (LoopRotarySwitchView) findViewById(R.id.mLoopRotarySwitchView); 123 | mSeekBarX = (SeekBar) findViewById(R.id.seekBarX); 124 | mSeekBarZ = (SeekBar) findViewById(R.id.seekBarZ); 125 | mCheckbox = (CheckBox) findViewById(R.id.checkbox); 126 | mSwitchLeftright = (Switch) findViewById(R.id.switchLeftright); 127 | int i = mSeekBarX.getMax() / 2; 128 | Log.e(TAG, "i----" + i); 129 | // mSeekBarX.setProgress(i); 130 | int progress = mSeekBarX.getProgress(); 131 | mLoopRotarySwitchView.setLoopRotationX(progress-i); 132 | // mSeekBarX.setProgress(80); 133 | mSeekBarZ.setProgress(mSeekBarZ.getMax() / 2); 134 | 135 | DisplayMetrics dm = new DisplayMetrics(); 136 | WindowManager windowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE); 137 | windowManager.getDefaultDisplay().getMetrics(dm); 138 | width = dm.widthPixels; 139 | } 140 | 141 | } 142 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/image_shader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/drawable/image_shader.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/point1.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/point2.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/point3.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/point4.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/point5.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 18 | 22 | 26 | 30 | 34 | 38 | 42 | 46 | 50 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 73 | 79 | 86 | 91 | 94 | 102 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/loopview_item_view0.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 21 | 22 | 30 | 31 | 32 | 33 | 34 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/layout/loopview_item_view1.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 21 | 22 | 30 | 31 | 32 | 33 | 34 | 35 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/layout/loopview_item_view2.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 20 | 21 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/layout/loopview_item_view4.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 20 | 21 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/layout/loopview_item_view5.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 20 | 21 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/image0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-xhdpi/image0.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-xhdpi/image1.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-xhdpi/image2.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/image3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-xhdpi/image3.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/image4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-xhdpi/image4.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/image5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-xhdpi/image5.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/image6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-xhdpi/image6.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/image7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-xhdpi/image7.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenpeibao/Loop3DRotation-master/6838442ac8e860a5b01c94b66a2851e008144800/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | > 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | 8 | #803f99f6 9 | #8098bf50 10 | #80f67b7b 11 | #80FF4081 12 | #80303F9F 13 | #fffffffb 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | LoopRotarySwitch 3 | Settings 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 |