├── .gitignore ├── .gitmodules ├── FisherView ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── rustfisher │ │ └── view │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── rustfisher │ │ │ └── view │ │ │ ├── BulbView.java │ │ │ ├── DashboardProgressView.java │ │ │ ├── DashboardRoundView.java │ │ │ ├── DotBarChart.java │ │ │ ├── FSUtils.java │ │ │ ├── GridsProgressView.java │ │ │ ├── Info.java │ │ │ ├── MultiLinesChartSView.java │ │ │ ├── OptionCircle.java │ │ │ ├── PieView.java │ │ │ ├── PolygonsTextView.java │ │ │ ├── RoundCornerImageView.java │ │ │ ├── RoundHorBatteryView.java │ │ │ ├── SelectRectView.java │ │ │ ├── ShadowLineChart.java │ │ │ ├── SingleLineChart.java │ │ │ └── fan │ │ │ └── FanView.java │ └── res │ │ └── values │ │ ├── attr_bulb_view.xml │ │ ├── attr_dashboard_progress.xml │ │ ├── attr_fan_view.xml │ │ ├── attr_polygons_tv.xml │ │ ├── attr_shadow_line_chart.xml │ │ ├── pie_view_attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── rustfisher │ └── view │ └── ExampleUnitTest.java ├── License ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── rust │ │ └── aboutview │ │ └── UITest1.java │ ├── main │ ├── AndroidManifest.xml │ ├── aidl │ │ └── com │ │ │ └── rust │ │ │ └── aidl │ │ │ └── IMyService.aidl │ ├── java │ │ └── com │ │ │ └── rust │ │ │ └── aboutview │ │ │ ├── AboutViewConfig.java │ │ │ ├── MyApplication.java │ │ │ ├── activity │ │ │ ├── BulbViewActivity.java │ │ │ ├── CirclesActivity.java │ │ │ ├── ColorBoardActivity.java │ │ │ ├── ColorLinesAct.java │ │ │ ├── DashboardActivity.java │ │ │ ├── DialogDemoActivity.java │ │ │ ├── DrawLineActivity.java │ │ │ ├── FanActivity.java │ │ │ ├── FragContainerActivity.java │ │ │ ├── FragHolderActivity.java │ │ │ ├── FullTextAct.java │ │ │ ├── ImageProcessingActivity.java │ │ │ ├── JoystickActivity.java │ │ │ ├── LineChartAndPieViewActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── Pb1Act.java │ │ │ ├── RadarChart1Act.java │ │ │ ├── RoundCornerActivity.java │ │ │ ├── SelectRectActivity.java │ │ │ ├── SurfaceViewDemoActivity.java │ │ │ └── VKeyboardAct.java │ │ │ ├── adapter │ │ │ ├── ImagePagerAdapter.java │ │ │ ├── ProgressReAdapter.java │ │ │ └── holder │ │ │ │ └── BannerVH.java │ │ │ ├── algochart │ │ │ ├── AlgoChart.java │ │ │ ├── AlgoChartActivity.java │ │ │ ├── AlgoPlayer.java │ │ │ ├── ArraySource.java │ │ │ └── algo │ │ │ │ ├── AlgoStepSlice.java │ │ │ │ ├── BaseSort.java │ │ │ │ └── sort │ │ │ │ └── SelectionSort.java │ │ │ ├── contactview │ │ │ ├── AddDataActivity.java │ │ │ ├── ContactPeopleActivity.java │ │ │ ├── DataListView.java │ │ │ └── PeopleMainActivity.java │ │ │ ├── database │ │ │ └── RustDatabaseHelper.java │ │ │ ├── fragment │ │ │ ├── CustomProgressBarFrag.java │ │ │ ├── DataProgressFragment.java │ │ │ ├── JoystickStyleOneFragment.java │ │ │ ├── JoystickStyleTwoFragment.java │ │ │ ├── MultiItemListViewFragment.java │ │ │ ├── ProgressContentFragment.java │ │ │ └── ShadowLineChartFragment.java │ │ │ ├── msgonbus │ │ │ └── AudioPlayEventOnBus.java │ │ │ ├── multiitemlv │ │ │ ├── MuType.java │ │ │ └── MultiItemAdapter.java │ │ │ ├── service │ │ │ ├── FloatingBarService.java │ │ │ ├── MyDayDream.java │ │ │ └── MyService.java │ │ │ ├── view │ │ │ ├── CircleImageView.java │ │ │ ├── ColorBoardListAdapter.java │ │ │ ├── ColorLinesView.java │ │ │ ├── MarkView.java │ │ │ ├── RadarUxChartView.java │ │ │ └── TrapezoidalPb.java │ │ │ └── widget │ │ │ ├── ConfirmDialog.java │ │ │ ├── DividerLine.java │ │ │ ├── PageListAdapter.java │ │ │ ├── PopUpButtonsDialog.java │ │ │ ├── RoundCornerProgressDialog.java │ │ │ ├── VKBaseAdapterDark.java │ │ │ ├── VKBaseAdapterWhite.java │ │ │ ├── VKeyboardWidget.java │ │ │ └── vkeyboard │ │ │ ├── VKey.java │ │ │ ├── VKeyboard.java │ │ │ ├── VKeyboardBody.java │ │ │ ├── VKeyboardListener.java │ │ │ └── VRow.java │ └── res │ │ ├── drawable-xxhdpi │ │ ├── pic_dart_lang.png │ │ ├── pic_my_little_hero.jpg │ │ ├── wallpaper_2018_04_14.jpg │ │ ├── wallpaper_2018_04_16.jpg │ │ ├── wallpaper_2018_04_19.jpg │ │ └── wallpaper_2018_04_25.jpg │ │ ├── drawable │ │ ├── algo_main_bg.xml │ │ ├── custom_progressbar_1.xml │ │ ├── custom_progressbar_2.xml │ │ ├── custom_progressbar_3.xml │ │ ├── custom_progressbar_4.xml │ │ ├── custom_progressbar_5.xml │ │ ├── ic_4_cube_gray.xml │ │ ├── ic_4_cube_pink.xml │ │ ├── ic_apps_white_24dp.xml │ │ ├── ic_back_white.xml │ │ ├── ic_backspace_white_24dp.xml │ │ ├── ic_cube_blue.png │ │ ├── ic_handler.xml │ │ ├── ic_media_next.xml │ │ ├── ic_media_play.xml │ │ ├── ic_media_previous.xml │ │ ├── ic_pause1.xml │ │ ├── ic_star_gray.xml │ │ ├── ic_tick_in_cube.xml │ │ ├── ic_view.xml │ │ ├── layer_progress.xml │ │ ├── littleboygreen_x128.png │ │ ├── pic_cover_blue_white.jpg │ │ ├── shape_icon_circle.xml │ │ ├── shape_round_corner_bottom.xml │ │ ├── shape_round_top_white.xml │ │ ├── shape_tv.xml │ │ ├── vk_se_tv_1.xml │ │ ├── vk_se_tv_dark_1.xml │ │ ├── vk_tv_bg_dark_def.xml │ │ ├── vk_tv_bg_dark_pressed.xml │ │ ├── vk_tv_bg_green.xml │ │ └── vk_tv_bg_grey.xml │ │ ├── layout │ │ ├── act_algo_chart.xml │ │ ├── act_bulb_view.xml │ │ ├── act_color_lines.xml │ │ ├── act_common_container.xml │ │ ├── act_dashboard.xml │ │ ├── act_dialog_demo.xml │ │ ├── act_drag.xml │ │ ├── act_fan.xml │ │ ├── act_frame_container.xml │ │ ├── act_frame_layout.xml │ │ ├── act_full_text.xml │ │ ├── act_line_chart.xml │ │ ├── act_pb1.xml │ │ ├── act_radar_1.xml │ │ ├── act_round_corner.xml │ │ ├── act_surface_view_demo.xml │ │ ├── act_v_keyboard.xml │ │ ├── activity_add_data.xml │ │ ├── activity_circle_choose.xml │ │ ├── activity_color_board.xml │ │ ├── activity_contact_database.xml │ │ ├── activity_contact_people.xml │ │ ├── activity_draw_line.xml │ │ ├── activity_image_processing.xml │ │ ├── activity_main.xml │ │ ├── color_item_view.xml │ │ ├── contacts_list_item.xml │ │ ├── data_list_item_view.xml │ │ ├── database_activity_content_main.xml │ │ ├── dialog_buttons.xml │ │ ├── dialog_confirm_delete_data.xml │ │ ├── dialog_round_corner_progress.xml │ │ ├── float_bar_layout.xml │ │ ├── frag_custom_progress_bar.xml │ │ ├── frag_joystick_style_1.xml │ │ ├── frag_joystick_style_2.xml │ │ ├── frag_multi_item_lv.xml │ │ ├── frag_progress.xml │ │ ├── frag_progress_content.xml │ │ ├── frag_shadow_line_chart.xml │ │ ├── fragment_data_list_view.xml │ │ ├── item_banner.xml │ │ ├── item_one_line.xml │ │ ├── item_one_pic.xml │ │ ├── item_pic_one_line.xml │ │ ├── item_progress.xml │ │ ├── my_day_dream.xml │ │ └── page_item_view.xml │ │ ├── menu │ │ └── menu_main.xml │ │ ├── mipmap-hdpi │ │ ├── ic_arrow_back_24dp.png │ │ └── ic_person_add_24dp.png │ │ ├── mipmap-mdpi │ │ ├── ic_arrow_back_24dp.png │ │ └── ic_person_add_24dp.png │ │ ├── mipmap-xhdpi │ │ ├── ic_arrow_back_24dp.png │ │ ├── ic_person_add_24dp.png │ │ └── launcher_text.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_arrow_back_24dp.png │ │ └── ic_person_add_24dp.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_person_add_24dp.png │ │ ├── values-v21 │ │ └── styles.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── attr.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── rust │ └── aboutview │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── pics ├── ColorBoard.gif ├── dashboard.png ├── fan_01.gif ├── lines_chart.png ├── pie_and_line.png ├── rx_android_demo_01.gif ├── rx_android_demo_02.gif └── vk-1.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | /.idea/gradle.xml 9 | /.idea/misc.xml 10 | /.idea/modules.xml 11 | /.idea 12 | AboutView.iml 13 | app/app.iml 14 | 15 | *.iml -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "uijoystick"] 2 | path = uijoystick 3 | url = https://github.com/RustFisher/uijoystick.git 4 | -------------------------------------------------------------------------------- /FisherView/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | 3 | *.iml -------------------------------------------------------------------------------- /FisherView/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | apply plugin: 'com.jfrog.bintray' 4 | 5 | android { 6 | compileSdkVersion 28 7 | 8 | defaultConfig { 9 | minSdkVersion 17 10 | targetSdkVersion 28 11 | versionCode 16 12 | versionName "0.1.6" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | lintOptions { 21 | abortOnError false 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(include: ['*.jar'], dir: 'libs') 27 | testImplementation 'junit:junit:4.12' 28 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' 29 | implementation 'androidx.appcompat:appcompat:1.0.0' 30 | } 31 | 32 | version = "0.1.6" 33 | 34 | def siteUrl = 'https://github.com/RustFisher/aboutView' 35 | def gitUrl = 'git@github.com:RustFisher/aboutView.git' 36 | group = "com.rustfisher" 37 | 38 | 39 | install { 40 | repositories.mavenInstaller { 41 | pom { 42 | project { 43 | packaging 'aar' 44 | name 'Android Custom View' 45 | description 'Android Custom View' 46 | url siteUrl 47 | 48 | licenses { 49 | license { 50 | name 'MIT License' 51 | url 'https://raw.githubusercontent.com/RustFisher/aboutView/master/License' 52 | } 53 | } 54 | 55 | developers { 56 | developer { 57 | id 'rustfisher' 58 | name 'Rust Fisher' 59 | email 'rustfisher@foxmail.com' 60 | } 61 | } 62 | 63 | scm { 64 | connection gitUrl 65 | developerConnection gitUrl 66 | url siteUrl 67 | } 68 | } 69 | } 70 | } 71 | } 72 | task sourcesJar(type: Jar) { 73 | from android.sourceSets.main.java.srcDirs 74 | classifier = 'sources' 75 | } 76 | task javadoc(type: Javadoc) { 77 | source = android.sourceSets.main.java.srcDirs 78 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 79 | failOnError false 80 | } 81 | task javadocJar(type: Jar, dependsOn: javadoc) { 82 | classifier = 'javadoc' 83 | from javadoc.destinationDir 84 | } 85 | artifacts { 86 | archives javadocJar 87 | archives sourcesJar 88 | } 89 | javadoc { 90 | options{ 91 | encoding "UTF-8" 92 | charSet 'UTF-8' 93 | } 94 | } 95 | 96 | Properties properties = new Properties() 97 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) 98 | bintray { 99 | user = properties.getProperty("bintray.user") 100 | key = properties.getProperty("bintray.apikey") 101 | 102 | configurations = ['archives'] 103 | pkg { 104 | repo = "maven" 105 | name = "FisherView" 106 | userOrg = 'rustfisher' 107 | websiteUrl = siteUrl 108 | vcsUrl = gitUrl 109 | licenses = ["MIT"] 110 | publish = true 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /FisherView/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 G:\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 | -------------------------------------------------------------------------------- /FisherView/src/androidTest/java/com/rustfisher/view/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.rustfisher.view; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /FisherView/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /FisherView/src/main/java/com/rustfisher/view/FSUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) [2017] [Rust Fisher] 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.rustfisher.view; 26 | 27 | import android.util.TypedValue; 28 | import android.view.View; 29 | 30 | /** 31 | * Fisher view utils 32 | */ 33 | public class FSUtils { 34 | public static float dp2px(float dp, View view) { 35 | return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, view.getResources().getDisplayMetrics()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /FisherView/src/main/java/com/rustfisher/view/Info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) [2017] [Rust Fisher] 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.rustfisher.view; 26 | 27 | public final class Info { 28 | public static String getInfo() { 29 | return "RustFisher Android Chart"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /FisherView/src/main/java/com/rustfisher/view/RoundCornerImageView.java: -------------------------------------------------------------------------------- 1 | package com.rustfisher.view; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.graphics.Canvas; 6 | import android.graphics.Path; 7 | import android.graphics.RectF; 8 | import android.util.AttributeSet; 9 | import android.util.TypedValue; 10 | 11 | /** 12 | * 圆角图形 13 | */ 14 | public class RoundCornerImageView extends androidx.appcompat.widget.AppCompatImageView { 15 | private float mRadius = 18; 16 | private Path mClipPath = new Path(); 17 | private RectF mRect = new RectF(); 18 | 19 | public RoundCornerImageView(Context context) { 20 | super(context); 21 | } 22 | 23 | public RoundCornerImageView(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | } 26 | 27 | public RoundCornerImageView(Context context, AttributeSet attrs, int defStyle) { 28 | super(context, attrs, defStyle); 29 | } 30 | 31 | public void setRadiusDp(float dp) { 32 | mRadius = dp2px(dp, getResources()); 33 | postInvalidate(); 34 | } 35 | 36 | public void setRadiusPx(int px) { 37 | mRadius = px; 38 | postInvalidate(); 39 | } 40 | 41 | @Override 42 | protected void onDraw(Canvas canvas) { 43 | mRect.set(0, 0, this.getWidth(), this.getHeight()); 44 | mClipPath.reset(); // remember to reset path 45 | mClipPath.addRoundRect(mRect, mRadius, mRadius, Path.Direction.CW); 46 | canvas.clipPath(mClipPath); 47 | super.onDraw(canvas); 48 | } 49 | 50 | private float dp2px(float value, Resources resources) { 51 | return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, resources.getDisplayMetrics()); 52 | } 53 | } -------------------------------------------------------------------------------- /FisherView/src/main/java/com/rustfisher/view/SelectRectView.java: -------------------------------------------------------------------------------- 1 | package com.rustfisher.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import androidx.annotation.Nullable; 8 | import android.util.AttributeSet; 9 | import android.view.MotionEvent; 10 | import android.view.View; 11 | 12 | /** 13 | * 手指从左上滑到右下 画出矩形 14 | * Created by Rust on 2018/5/8. 15 | */ 16 | public class SelectRectView extends View { 17 | private static final String TAG = "SelectRectView"; 18 | 19 | private float aDownX; // action down 按下时的x值 20 | private float aDownY; 21 | private float draggingX; // 拖动过程中的x值 22 | private float draggingY; 23 | private boolean userDragging = false; 24 | private int rectColor = Color.BLUE; 25 | private Paint paint = new Paint(); 26 | private OnSelectedListener onSelectedListener; 27 | private boolean working = false; 28 | 29 | public void setRectColor(int rectColor) { 30 | this.rectColor = rectColor; 31 | } 32 | 33 | public boolean isWorking() { 34 | return working; 35 | } 36 | 37 | public void setWorking(boolean working) { 38 | this.working = working; 39 | } 40 | 41 | public SelectRectView(Context context) { 42 | super(context); 43 | } 44 | 45 | public SelectRectView(Context context, @Nullable AttributeSet attrs) { 46 | super(context, attrs); 47 | } 48 | 49 | public SelectRectView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 50 | super(context, attrs, defStyleAttr); 51 | } 52 | 53 | public void setOnSelectedListener(OnSelectedListener listener) { 54 | this.onSelectedListener = listener; 55 | } 56 | 57 | @Override 58 | protected void onDraw(Canvas canvas) { 59 | if (userDragging) { 60 | paint.setColor(rectColor); 61 | paint.setStrokeWidth(8); 62 | paint.setStyle(Paint.Style.STROKE); 63 | canvas.drawRect(aDownX, aDownY, draggingX, draggingY, paint); 64 | } 65 | } 66 | 67 | /** 68 | * @param event 拦截并处理触摸事件 69 | */ 70 | @Override 71 | public boolean onTouchEvent(MotionEvent event) { 72 | if (!working) { 73 | userDragging = false; 74 | return false; // 如果没有激活 不处理触摸事件 75 | } 76 | switch (event.getActionMasked()) { 77 | case MotionEvent.ACTION_DOWN: 78 | aDownX = event.getX(); 79 | aDownY = event.getY(); 80 | userDragging = false; 81 | invalidate(); 82 | break; 83 | case MotionEvent.ACTION_MOVE: 84 | draggingX = event.getX(); 85 | draggingY = event.getY(); 86 | userDragging = true; 87 | invalidate(); 88 | break; 89 | case MotionEvent.ACTION_UP: 90 | draggingX = event.getX(); 91 | draggingY = event.getY(); 92 | userDragging = false; 93 | invalidate(); 94 | notifySelected(); 95 | break; 96 | } 97 | return true; // 拦截掉触摸事件 98 | } 99 | 100 | private void notifySelected() { 101 | if (null != onSelectedListener) { 102 | onSelectedListener.onSelectedRect((draggingX > aDownX && draggingY > aDownY), aDownX, aDownY, draggingX, draggingY, getWidth(), getHeight()); 103 | } 104 | } 105 | 106 | public interface OnSelectedListener { 107 | void onSelectedRect(boolean validSelected, float startX, float startY, float endX, float endY, int viewWid, int viewHeight); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /FisherView/src/main/res/values/attr_bulb_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /FisherView/src/main/res/values/attr_dashboard_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /FisherView/src/main/res/values/attr_fan_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FisherView/src/main/res/values/attr_polygons_tv.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /FisherView/src/main/res/values/attr_shadow_line_chart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /FisherView/src/main/res/values/pie_view_attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /FisherView/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FisherView 3 | 4 | -------------------------------------------------------------------------------- /FisherView/src/test/java/com/rustfisher/view/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.rustfisher.view; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Rust Fisher 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android AboutView 2 | 3 | 推荐下载源代码并`Import Module...` 4 | 5 | `app` 模块存放着一些示例代码 6 | 7 | `FisherView` 模块中存放着一些自定义View 8 | 9 | 10 | ## 分支说明 11 | 12 | * 主分支 `master` 13 | * 开发分支以 `dev` 开头 14 | 15 | 16 | ## 虚拟键盘 17 | VKeyboard - Virtual keyboard 18 | 19 | 将「按键」装配到键盘上。采用适配器模式,将View添加到ViewGroup中。 20 | 21 | VKey代表按键,VKeyboardBody代表键盘,VRow代表键盘上的一行,VKeyboardListener是监听器。 22 | VKeyboard继承Framelayout,创建适配器VKeyboard.Adapter,将「按键」装配到键盘上。 23 | 24 | ![vk demo](pics/vk-1.png) 25 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | 6 | defaultConfig { 7 | applicationId "com.rust.aboutview" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 10000 11 | versionName "20210202.1" 12 | 13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 14 | 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | lintOptions { 23 | abortOnError false 24 | } 25 | } 26 | 27 | dependencies { 28 | implementation fileTree(include: ['*.jar'], dir: 'libs') 29 | testImplementation 'junit:junit:4.12' 30 | androidTestImplementation 'androidx.test:runner:1.1.0' 31 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' 32 | androidTestImplementation 'androidx.test:rules:1.1.0' 33 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' 34 | implementation 'androidx.appcompat:appcompat:1.0.0' 35 | implementation 'androidx.recyclerview:recyclerview:1.0.0' 36 | implementation 'com.google.android.material:material:1.0.0' 37 | implementation 'org.greenrobot:eventbus:3.1.1' 38 | implementation project(':FisherView') 39 | implementation project(':uijoystick') 40 | } 41 | -------------------------------------------------------------------------------- /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 /home/liuyu/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/androidTest/java/com/rust/aboutview/UITest1.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview; 2 | 3 | import androidx.test.filters.LargeTest; 4 | import androidx.test.rule.ActivityTestRule; 5 | import androidx.test.runner.AndroidJUnit4; 6 | import android.util.Log; 7 | import android.view.View; 8 | 9 | import com.rust.aboutview.contactview.AddDataActivity; 10 | 11 | import org.hamcrest.Matcher; 12 | import org.junit.Before; 13 | import org.junit.Rule; 14 | import org.junit.Test; 15 | import org.junit.runner.RunWith; 16 | 17 | import static androidx.test.espresso.Espresso.onView; 18 | import static androidx.test.espresso.action.ViewActions.click; 19 | import static androidx.test.espresso.action.ViewActions.replaceText; 20 | import static androidx.test.espresso.assertion.ViewAssertions.matches; 21 | import static androidx.test.espresso.matcher.ViewMatchers.isClickable; 22 | import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; 23 | import static androidx.test.espresso.matcher.ViewMatchers.isEnabled; 24 | import static androidx.test.espresso.matcher.ViewMatchers.withId; 25 | import static androidx.test.espresso.matcher.ViewMatchers.withText; 26 | import static org.hamcrest.Matchers.not; 27 | 28 | @RunWith(AndroidJUnit4.class) 29 | @LargeTest 30 | public class UITest1 { 31 | private static final String TAG = "rustAppUnitTest"; 32 | 33 | @Rule 34 | public ActivityTestRule mAddData = new ActivityTestRule<>(AddDataActivity.class); // 必须是public 35 | 36 | @Before 37 | public void prepareData() { 38 | System.out.println("做一些准备工作,比如预装数据"); 39 | Log.d(TAG, "prepareData."); 40 | } 41 | 42 | /// 检查初始状态 43 | @Test 44 | public void checkDefStatus() { 45 | onView(withText("Add Data")).check(matches(isDisplayed())); 46 | 47 | onView(withId(R.id.done_add_data_button)).check(matches(not(isEnabled()))); 48 | onView(withId(R.id.done_add_data_button)).check(matches((isClickable()))); 49 | } 50 | 51 | @Test 52 | public void addPersonData() { 53 | Log.d(TAG, "addPersonData test starts."); 54 | Matcher confirmBtn = withId(R.id.done_add_data_button); 55 | Matcher nameEt = withId(R.id.add_name); 56 | Matcher phoneEt = withId(R.id.add_phone); 57 | Matcher emailEt = withId(R.id.add_email); 58 | 59 | onView(nameEt).perform(replaceText("Test Name " + System.currentTimeMillis())); 60 | onView(confirmBtn).check(matches(isEnabled())); // 输入用户名后的状态 61 | onView(phoneEt).perform(replaceText("13312345678")); 62 | onView(emailEt).perform(replaceText("xx@yy.com")); 63 | onView(confirmBtn).perform(click()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/aidl/com/rust/aidl/IMyService.aidl: -------------------------------------------------------------------------------- 1 | // IMyService.aidl 2 | package com.rust.aidl; 3 | 4 | // Declare any non-default types here with import statements 5 | 6 | interface IMyService { 7 | /** 8 | * Demonstrates some basic types that you can use as parameters 9 | * and return values in AIDL. 10 | */ 11 | void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, 12 | double aDouble, String aString); 13 | String helloAndroidAIDL(String name); 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/AboutViewConfig.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview; 2 | 3 | /** 4 | * Define some names 5 | * Create : 2016-2-22 6 | */ 7 | public class AboutViewConfig { 8 | public static final String APP_CONFIG = "AboutView_config"; 9 | public static final String SHOW_FLOAT_BAR = "Show_floating_bar"; 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/MyApplication.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | public class MyApplication extends Application { 7 | private static Context context; 8 | 9 | public static Context getMyContext() { 10 | return context; 11 | } 12 | 13 | @Override 14 | public void onCreate() { 15 | super.onCreate(); 16 | context = getApplicationContext(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/BulbViewActivity.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | import com.rust.aboutview.R; 7 | import com.rustfisher.view.BulbView; 8 | 9 | public class BulbViewActivity extends Activity { 10 | 11 | private BulbView bulbView1; 12 | private BulbView bulbView2; 13 | BulbView bulbView3; 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.act_bulb_view); 19 | 20 | bulbView1 = (BulbView) findViewById(R.id.bulb_view_1); 21 | bulbView2 = (BulbView) findViewById(R.id.bulb_view_2); 22 | bulbView3 = (BulbView) findViewById(R.id.bulb_view_3); 23 | 24 | bulbView2.setWholeSizeRatio(1.6f); 25 | bulbView3.setWholeSizeRatio(1.3f); 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/ColorLinesAct.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Color; 5 | import android.os.Bundle; 6 | import androidx.annotation.Nullable; 7 | 8 | import com.rust.aboutview.R; 9 | import com.rust.aboutview.view.ColorLinesView; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.Random; 14 | 15 | /** 16 | * Created on 2019-8-14 17 | */ 18 | public class ColorLinesAct extends Activity { 19 | 20 | private ColorLinesView mC1; 21 | 22 | @Override 23 | protected void onCreate(@Nullable Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.act_color_lines); 26 | mC1 = findViewById(R.id.c1); 27 | 28 | mC1.setHorAxisEndText("End"); 29 | mC1.setMarkList(150, 220, 300); 30 | mC1.setCompare2(true); 31 | mC1.setData(new ColorLinesView.LineData(1, Color.parseColor("#ff8f22"), Color.parseColor("#66ff8f22"), genData())); 32 | mC1.setData(new ColorLinesView.LineData(2, Color.parseColor("#ff5722"), Color.parseColor("#66ff5722"), genData())); 33 | } 34 | 35 | private List genData() { 36 | final int count = 100; 37 | Random random = new Random(); 38 | List d1 = new ArrayList<>(); 39 | for (int i = 0; i < count; i++) { 40 | d1.add(random.nextFloat() * 300); 41 | } 42 | return d1; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/DialogDemoActivity.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | import androidx.annotation.Nullable; 7 | 8 | import android.view.View; 9 | 10 | import com.rust.aboutview.R; 11 | import com.rust.aboutview.widget.PopUpButtonsDialog; 12 | 13 | 14 | public class DialogDemoActivity extends Activity implements View.OnClickListener { 15 | 16 | @Override 17 | protected void onCreate(@Nullable Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.act_dialog_demo); 20 | findViewById(R.id.pop_animate_dialog_btn).setOnClickListener(this); 21 | } 22 | 23 | @Override 24 | public void onClick(View view) { 25 | switch (view.getId()) { 26 | case R.id.pop_animate_dialog_btn: 27 | new PopUpButtonsDialog(DialogDemoActivity.this).show(); 28 | break; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/DrawLineActivity.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.animation.ObjectAnimator; 4 | import android.app.Activity; 5 | import android.os.Bundle; 6 | import android.os.Handler; 7 | import android.os.Message; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.widget.TextView; 11 | 12 | import com.rust.aboutview.R; 13 | import com.rust.aboutview.view.MarkView; 14 | 15 | public class DrawLineActivity extends Activity { 16 | 17 | TextView markText; 18 | TextView coordinateText; 19 | MarkView markView; 20 | MarkHandler handler = new MarkHandler(this); 21 | static float x; 22 | static float y; 23 | 24 | static class MarkHandler extends Handler { 25 | DrawLineActivity a; 26 | 27 | MarkHandler(DrawLineActivity drawLineActivity) { 28 | a = drawLineActivity; 29 | } 30 | 31 | @Override 32 | public void handleMessage(Message msg) { 33 | switch (msg.what) { 34 | case 1000: { 35 | a.markView.setTouchX(x); 36 | a.markView.setTouchY(y); 37 | a.markView.invalidate(); 38 | } 39 | default: 40 | break; 41 | } 42 | } 43 | } 44 | 45 | @Override 46 | protected void onCreate(Bundle savedInstanceState) { 47 | super.onCreate(savedInstanceState); 48 | setContentView(R.layout.activity_draw_line); 49 | markView = (MarkView) findViewById(R.id.draw_line); 50 | coordinateText = (TextView) findViewById(R.id.coordinate); 51 | markText = (TextView) findViewById(R.id.animation_tv); 52 | markText.setOnClickListener(new View.OnClickListener() { 53 | @Override 54 | public void onClick(View v) { 55 | ObjectAnimator oa = ObjectAnimator.ofFloat(markText, "alpha", 0f, 1f); 56 | oa.setDuration(3000); 57 | oa.start(); 58 | } 59 | }); 60 | 61 | } 62 | 63 | @Override 64 | public boolean onTouchEvent(MotionEvent event) { 65 | int[] markLocations = {0, 0}; 66 | markView.getLocationOnScreen(markLocations); 67 | x = event.getX() - markLocations[0]; 68 | y = event.getY() - markLocations[1]; 69 | coordinateText.setText(String.format("x: %s, y:%s", x, y)); 70 | handler.sendEmptyMessage(1000); 71 | return false; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/FanActivity.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.os.Handler; 6 | import androidx.annotation.Nullable; 7 | 8 | import com.rust.aboutview.R; 9 | import com.rustfisher.view.fan.FanView; 10 | 11 | 12 | /** 13 | * Fan demo 14 | * Created by Rust Fisher on 2017/7/20. 15 | */ 16 | public class FanActivity extends Activity { 17 | 18 | private Handler mHandler = new Handler(); 19 | 20 | private FanView mFan1; 21 | private FanView mFan2; 22 | private FanView mFan3; 23 | private FanView mFan4; 24 | private FanView mFan5; 25 | 26 | @Override 27 | protected void onCreate(@Nullable Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | setContentView(R.layout.act_fan); 30 | mFan1 = (FanView) findViewById(R.id.fanView1); 31 | mFan2 = (FanView) findViewById(R.id.fanView2); 32 | mFan3 = (FanView) findViewById(R.id.fanView3); 33 | mFan4 = (FanView) findViewById(R.id.fanView4); 34 | mFan5 = (FanView) findViewById(R.id.fanView5); 35 | mFanThread.start(); 36 | } 37 | 38 | @Override 39 | protected void onDestroy() { 40 | super.onDestroy(); 41 | mFanThread.interrupt(); 42 | mFanThread = null; 43 | mHandler.removeCallbacksAndMessages(null); 44 | } 45 | 46 | private int mFanDegree = 0; 47 | private int mFanDegree1 = 360; 48 | 49 | private Thread mFanThread = new Thread() { 50 | @Override 51 | public void run() { 52 | super.run(); 53 | while (!isInterrupted()) { 54 | try { 55 | Thread.sleep(20); 56 | mFanDegree--; 57 | mFanDegree1 -= 4; 58 | if (mFanDegree < 0) { 59 | mFanDegree = 360; 60 | } 61 | if (mFanDegree1 < 0) { 62 | mFanDegree1 = 360; 63 | } 64 | runOnUiThread(new Runnable() { 65 | @Override 66 | public void run() { 67 | mFan1.setFanDegreeNow(mFanDegree); 68 | mFan2.setFanDegreeNow(mFanDegree); 69 | mFan3.setFanDegreeNow(mFanDegree1); 70 | mFan4.setFanDegreeNow(mFanDegree1); 71 | mFan5.setFanDegreeNow(mFanDegree - 100); 72 | } 73 | }); 74 | } catch (InterruptedException e) { 75 | e.printStackTrace(); 76 | } 77 | } 78 | } 79 | }; 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/FragContainerActivity.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import androidx.annotation.Nullable; 7 | import androidx.appcompat.app.AppCompatActivity; 8 | import android.util.Log; 9 | import android.view.View; 10 | 11 | import com.rust.aboutview.R; 12 | import com.rust.aboutview.fragment.CustomProgressBarFrag; 13 | import com.rust.aboutview.fragment.DataProgressFragment; 14 | import com.rust.aboutview.fragment.MultiItemListViewFragment; 15 | 16 | /** 17 | * Show fragment 18 | * Created by Rust on 2018/5/25. 19 | */ 20 | public class FragContainerActivity extends AppCompatActivity implements View.OnClickListener { 21 | private static final String TAG = "rustAppFrag"; 22 | private static final String K_PAGE_TYPE = "key_page_type"; 23 | private static final int PAGE_CUSTOM_PB = 1; 24 | private DataProgressFragment mDataProgressFragment; 25 | private MultiItemListViewFragment mMultiItemListViewFragment; 26 | private CustomProgressBarFrag mCustomProgressBarFrag; 27 | 28 | public static void goCustomPbPage(Activity activity) { 29 | Intent intent = new Intent(activity, FragContainerActivity.class); 30 | intent.putExtra(K_PAGE_TYPE, PAGE_CUSTOM_PB); 31 | activity.startActivity(intent); 32 | } 33 | 34 | @Override 35 | protected void onCreate(@Nullable Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | setContentView(R.layout.act_frame_container); 38 | initUI(); 39 | Intent ii = getIntent(); 40 | if (null != ii) { 41 | int pageType = ii.getIntExtra(K_PAGE_TYPE, 0); 42 | switch (pageType) { 43 | case PAGE_CUSTOM_PB: 44 | getSupportFragmentManager().beginTransaction().replace(R.id.container, mCustomProgressBarFrag).commit(); 45 | break; 46 | default: 47 | break; 48 | } 49 | } 50 | } 51 | 52 | private void initUI() { 53 | mDataProgressFragment = new DataProgressFragment(); 54 | mMultiItemListViewFragment = new MultiItemListViewFragment(); 55 | mCustomProgressBarFrag = new CustomProgressBarFrag(); 56 | findViewById(R.id.show_progress_data_btn).setOnClickListener(this); 57 | findViewById(R.id.multi_item_lv_btn).setOnClickListener(this); 58 | } 59 | 60 | @Override 61 | public void onClick(View v) { 62 | switch (v.getId()) { 63 | case R.id.show_progress_data_btn: 64 | Log.d(TAG, "show DataProgressFragment"); 65 | getSupportFragmentManager().beginTransaction().replace(R.id.container, mDataProgressFragment).commit(); 66 | break; 67 | case R.id.multi_item_lv_btn: 68 | Log.d(TAG, "show: mMultiItemListViewFragment"); 69 | getSupportFragmentManager().beginTransaction().replace(R.id.container, mMultiItemListViewFragment).commit(); 70 | break; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/FragHolderActivity.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import androidx.annotation.Nullable; 7 | import androidx.fragment.app.FragmentManager; 8 | import androidx.appcompat.app.AppCompatActivity; 9 | 10 | import com.rust.aboutview.R; 11 | import com.rust.aboutview.fragment.ShadowLineChartFragment; 12 | 13 | /** 14 | * 显示Fragment 15 | * Created by Rust on 2018/6/8. 16 | */ 17 | public class FragHolderActivity extends AppCompatActivity { 18 | private static final String K_SHOW_TYPE = "key_show_type"; 19 | private static final int SHOW_TYPE_SHADOW_LINE_CHART = 1; 20 | 21 | public static void showShadowLineChart(Activity activity) { 22 | Intent intent = new Intent(activity.getApplicationContext(), FragHolderActivity.class); 23 | intent.putExtra(K_SHOW_TYPE, SHOW_TYPE_SHADOW_LINE_CHART); 24 | activity.startActivity(intent); 25 | } 26 | 27 | @Override 28 | protected void onCreate(@Nullable Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | setContentView(R.layout.act_frame_layout); 31 | Intent inIntent = getIntent(); 32 | if (null != inIntent) { 33 | int sType = inIntent.getIntExtra(K_SHOW_TYPE, SHOW_TYPE_SHADOW_LINE_CHART); 34 | FragmentManager fragmentManager = getSupportFragmentManager(); 35 | switch (sType) { 36 | case SHOW_TYPE_SHADOW_LINE_CHART: 37 | fragmentManager.beginTransaction().add(R.id.container, new ShadowLineChartFragment()).commit(); 38 | break; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/FullTextAct.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import androidx.annotation.Nullable; 7 | import android.util.DisplayMetrics; 8 | import android.util.Log; 9 | import android.util.TypedValue; 10 | import android.widget.TextView; 11 | 12 | import com.rust.aboutview.R; 13 | 14 | /** 15 | * 文字全屏 16 | * Created on 2019-7-10 17 | */ 18 | public class FullTextAct extends Activity { 19 | private static final String TAG = "rustAppFullText"; 20 | TextView mFullTextTv; 21 | 22 | @Override 23 | protected void onCreate(@Nullable Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.act_full_text); 26 | mFullTextTv = findViewById(R.id.full_text_tv); 27 | 28 | DisplayMetrics displayMetrics = new DisplayMetrics(); 29 | getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); 30 | int height = displayMetrics.heightPixels; 31 | int width = displayMetrics.widthPixels; 32 | Log.d(TAG, "onCreate: window[" + width + ", " + height + "]"); 33 | mFullTextTv.setTextSize(TypedValue.COMPLEX_UNIT_SP, pxToSp(height, this) * 0.8f); 34 | mFullTextTv.setSelected(true); 35 | } 36 | 37 | public float convertPxToDp(Context context, float px) { 38 | return px / context.getResources().getDisplayMetrics().density; 39 | } 40 | 41 | public static int spToPx(float sp, Context context) { 42 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, context.getResources().getDisplayMetrics()); 43 | } 44 | 45 | public static float pxToSp(int px, Context context) { 46 | return px / context.getResources().getDisplayMetrics().scaledDensity; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/JoystickActivity.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.os.Bundle; 4 | import androidx.appcompat.app.AppCompatActivity; 5 | 6 | import com.rust.aboutview.R; 7 | import com.rust.aboutview.fragment.JoystickStyleOneFragment; 8 | import com.rust.aboutview.fragment.JoystickStyleTwoFragment; 9 | 10 | 11 | public class JoystickActivity extends AppCompatActivity { 12 | 13 | JoystickStyleOneFragment mJoystickStyleOneFragment; 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.act_common_container); 19 | mJoystickStyleOneFragment = new JoystickStyleOneFragment(); 20 | getSupportFragmentManager().beginTransaction() 21 | .add(R.id.container, new JoystickStyleTwoFragment()) 22 | .add(R.id.container, mJoystickStyleOneFragment) 23 | .commit(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/Pb1Act.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Color; 5 | import android.os.Bundle; 6 | import androidx.annotation.Nullable; 7 | 8 | import com.rust.aboutview.R; 9 | import com.rust.aboutview.view.TrapezoidalPb; 10 | import com.rustfisher.view.GridsProgressView; 11 | import com.rustfisher.view.RoundHorBatteryView; 12 | 13 | import java.util.Timer; 14 | import java.util.TimerTask; 15 | 16 | public class Pb1Act extends Activity { 17 | 18 | private TrapezoidalPb pb1; 19 | private RoundHorBatteryView bat1; 20 | private GridsProgressView gp2; 21 | 22 | private Timer timer = new Timer(); 23 | 24 | @Override 25 | protected void onCreate(@Nullable Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | setContentView(R.layout.act_pb1); 28 | pb1 = findViewById(R.id.pb1); 29 | bat1 = findViewById(R.id.bat_1); 30 | gp2 = findViewById(R.id.bat_2); 31 | bat1.setPower(0); 32 | bat1.enableMode(); 33 | 34 | timer.schedule(new TimerTask() { 35 | int progress = 0; 36 | 37 | @Override 38 | public void run() { 39 | runOnUiThread(new Runnable() { 40 | @Override 41 | public void run() { 42 | if (progress < 20) { 43 | progress += 5; 44 | } else if (progress < 80) { 45 | progress += 9; 46 | } else { 47 | progress++; 48 | } 49 | if (progress > 100) { 50 | progress = 0; 51 | } 52 | pb1.setProgress(progress); 53 | bat1.setValueAndColor(progress, progress < 20 ? Color.RED : Color.GREEN); 54 | gp2.setCubeCount((44 + progress) / 12); 55 | } 56 | }); 57 | } 58 | }, 1, 200); 59 | } 60 | 61 | @Override 62 | protected void onDestroy() { 63 | super.onDestroy(); 64 | timer.cancel(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/RadarChart1Act.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import androidx.annotation.Nullable; 6 | import android.util.Log; 7 | import android.view.View; 8 | import android.widget.TextView; 9 | 10 | import com.rust.aboutview.R; 11 | import com.rust.aboutview.view.RadarUxChartView; 12 | 13 | /** 14 | * 雷达图示例 15 | * Created on 2019-3-26 16 | */ 17 | public class RadarChart1Act extends Activity { 18 | private static final String TAG = "RadarChart"; 19 | 20 | private RadarUxChartView radar1; 21 | private TextView tv1; 22 | 23 | @Override 24 | protected void onCreate(@Nullable Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.act_radar_1); 27 | radar1 = findViewById(R.id.r1); 28 | radar1.setListener(new RadarUxChartView.UxListener() { 29 | @Override 30 | public void onDateSelected(float mData, float lData, float rData) { 31 | Log.d(TAG, "onDateSelected: " + mData + ", " + lData + ", " + rData); 32 | } 33 | }); 34 | 35 | tv1 = findViewById(R.id.s_tv); 36 | tv1.setOnClickListener(new View.OnClickListener() { 37 | @Override 38 | public void onClick(View v) { 39 | radar1.setAbleDrag(!radar1.isAbleDrag()); 40 | updateTv(); 41 | } 42 | }); 43 | } 44 | 45 | @Override 46 | protected void onResume() { 47 | super.onResume(); 48 | updateTv(); 49 | } 50 | 51 | private void updateTv() { 52 | tv1.setText(radar1.isAbleDrag() ? "可拖动" : "已锁定"); 53 | } 54 | 55 | @Override 56 | protected void onDestroy() { 57 | super.onDestroy(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/SelectRectActivity.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import android.widget.TextView; 7 | 8 | import com.rust.aboutview.R; 9 | import com.rustfisher.view.SelectRectView; 10 | 11 | import java.util.Locale; 12 | 13 | /** 14 | * 框选 15 | * Created by Rust on 2018/5/23. 16 | */ 17 | public class SelectRectActivity extends AppCompatActivity { 18 | 19 | @Override 20 | protected void onCreate(@Nullable Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.act_drag); 23 | final TextView textView = findViewById(R.id.p_tv); 24 | final SelectRectView selectRectView = findViewById(R.id.se_view); 25 | selectRectView.setWorking(true); 26 | selectRectView.setOnSelectedListener(new SelectRectView.OnSelectedListener() { 27 | @Override 28 | public void onSelectedRect(boolean validSelected, float startX, float startY, float endX, float endY, int viewWid, int viewHeight) { 29 | textView.setText(String.format(Locale.CHINA, 30 | "working:%b\nview size [%4d, %4d]\nstart [%4.2f, %4.2f]\nend [%4.2f, %4.2f]", 31 | validSelected, viewWid, viewHeight, startX, startY, endX, endY)); 32 | } 33 | }); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/SurfaceViewDemoActivity.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | 7 | import com.rust.aboutview.R; 8 | import com.rustfisher.view.MultiLinesChartSView; 9 | 10 | /** 11 | * 使用SurfaceView事例 12 | */ 13 | public class SurfaceViewDemoActivity extends Activity implements View.OnClickListener { 14 | 15 | private MultiLinesChartSView mLinesChart; 16 | private float mScaleX = 1.0f; 17 | 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.act_surface_view_demo); 22 | mLinesChart = (MultiLinesChartSView) findViewById(R.id.multiLinesChart); 23 | findViewById(R.id.drawAlphaBtn).setOnClickListener(this); 24 | findViewById(R.id.drawBetaBtn).setOnClickListener(this); 25 | findViewById(R.id.drawThetaBtn).setOnClickListener(this); 26 | findViewById(R.id.drawDeltaBtn).setOnClickListener(this); 27 | findViewById(R.id.scaleXBtn1).setOnClickListener(this); 28 | findViewById(R.id.scaleXBtn2).setOnClickListener(this); 29 | new Thread(new Runnable() { 30 | @Override 31 | public void run() { 32 | int dataLen = 4006; 33 | float[] alpha = new float[dataLen]; 34 | float[] beta = new float[dataLen]; 35 | float[] theta = new float[dataLen]; 36 | float[] delta = new float[dataLen]; 37 | 38 | for (int i = 0; i < alpha.length; i++) { 39 | alpha[i] = (float) (8.5f * Math.cos(Math.PI * i / 90)) + 16; 40 | beta[i] = (float) (10.0f * Math.sin(Math.PI * i / 180)) + 3; 41 | theta[i] = (float) (3.5f * Math.cos(Math.PI * i / 60)) + 21; 42 | delta[i] = 9 + (float) Math.random() * 10f; 43 | } 44 | 45 | mLinesChart.input4DataArr(alpha, beta, theta, delta); 46 | 47 | } 48 | }).start(); 49 | } 50 | 51 | 52 | @Override 53 | public void onClick(View v) { 54 | switch (v.getId()) { 55 | case R.id.drawAlphaBtn: 56 | mLinesChart.setShowAlpha(!mLinesChart.isShowAlpha()); 57 | break; 58 | case R.id.drawBetaBtn: 59 | mLinesChart.setShowBeta(!mLinesChart.isShowBeta()); 60 | break; 61 | case R.id.drawThetaBtn: 62 | mLinesChart.setShowTheta(!mLinesChart.isShowTheta()); 63 | break; 64 | case R.id.drawDeltaBtn: 65 | mLinesChart.setShowDelta(!mLinesChart.isShowDelta()); 66 | break; 67 | case R.id.scaleXBtn1: 68 | mScaleX *= 2.0f; 69 | mLinesChart.setScaleRatioX(mScaleX); 70 | break; 71 | case R.id.scaleXBtn2: 72 | mScaleX /= 2.0f; 73 | mLinesChart.setScaleRatioX(mScaleX); 74 | break; 75 | 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/activity/VKeyboardAct.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.activity; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.text.Editable; 6 | import android.util.Log; 7 | import android.widget.TextView; 8 | import android.widget.Toast; 9 | 10 | import androidx.annotation.Nullable; 11 | 12 | import com.rust.aboutview.R; 13 | import com.rust.aboutview.widget.VKBaseAdapterDark; 14 | import com.rust.aboutview.widget.VKBaseAdapterWhite; 15 | import com.rust.aboutview.widget.vkeyboard.VKey; 16 | import com.rust.aboutview.widget.vkeyboard.VKeyboard; 17 | import com.rust.aboutview.widget.vkeyboard.VKeyboardListener; 18 | 19 | /** 20 | * 虚拟键盘页面 21 | * Created on 2019-8-22 22 | */ 23 | public class VKeyboardAct extends Activity { 24 | private static final String TAG = "rustAppVKeyboardAct"; 25 | public static int screenWidth = 1080; 26 | private TextView mTv1; 27 | private TextView mTv2; 28 | private Editable mEditable1; 29 | private Editable mEditable2; 30 | 31 | @Override 32 | protected void onCreate(@Nullable Bundle savedInstanceState) { 33 | super.onCreate(savedInstanceState); 34 | setContentView(R.layout.act_v_keyboard); 35 | Log.d(TAG, "onCreate: 1"); 36 | 37 | mTv1 = findViewById(R.id.vk_page_tv1); 38 | mTv2 = findViewById(R.id.vk_page_tv2); 39 | mEditable1 = new Editable.Factory().newEditable(""); 40 | mEditable2 = new Editable.Factory().newEditable(""); 41 | VKeyboard vKeyboard1 = findViewById(R.id.vk_1); 42 | vKeyboard1.setAdapter(new VKBaseAdapterWhite(screenWidth)); 43 | vKeyboard1.setKeyboardListener(new VKeyboardListener() { 44 | @Override 45 | public void onKeyClick(VKey key) { 46 | Log.d(TAG, "onKeyClick: " + key); 47 | inputKey(key, mEditable1); 48 | updateTv1(); 49 | } 50 | }); 51 | 52 | VKeyboard vk2 = findViewById(R.id.vk_2); 53 | vk2.setAdapter(new VKBaseAdapterDark(screenWidth)); 54 | vk2.setKeyboardListener(new VKeyboardListener() { 55 | @Override 56 | public void onKeyClick(VKey key) { 57 | inputKey(key, mEditable2); 58 | updateTv2(); 59 | } 60 | }); 61 | Log.d(TAG, "onCreate: end"); 62 | } 63 | 64 | private void inputKey(VKey key, Editable editable) { 65 | if (key.isBackSpace()) { 66 | if (editable.length() > 0) { 67 | editable.delete(editable.length() - 1, editable.length()); 68 | } 69 | } else if (key.isOk()) { 70 | Toast.makeText(this, "OK", Toast.LENGTH_SHORT).show(); 71 | } else if (key.isSpace()) { 72 | editable.append(" "); 73 | } else { 74 | editable.append(key.getKeyText()); 75 | } 76 | } 77 | 78 | @Override 79 | protected void onResume() { 80 | super.onResume(); 81 | Log.d(TAG, "onResume"); 82 | } 83 | 84 | @Override 85 | public void onWindowFocusChanged(boolean hasFocus) { 86 | super.onWindowFocusChanged(hasFocus); 87 | Log.d(TAG, "onWindowFocusChanged: hasFocus: " + hasFocus); 88 | } 89 | 90 | private void updateTv1() { 91 | mTv1.setText(mEditable1.toString()); 92 | } 93 | 94 | private void updateTv2() { 95 | mTv2.setText(mEditable2.toString()); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/adapter/ImagePagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.adapter; 2 | 3 | import android.content.Context; 4 | import androidx.annotation.NonNull; 5 | import androidx.viewpager.widget.PagerAdapter; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * Show image 15 | * Created by Rust on 2018/6/2. 16 | */ 17 | public class ImagePagerAdapter extends PagerAdapter { 18 | 19 | private Context mContext; 20 | private List mResIdList; 21 | 22 | public ImagePagerAdapter(Context context, List resIdList) { 23 | mContext = context; 24 | mResIdList = new ArrayList<>(resIdList); 25 | } 26 | 27 | @Override 28 | public int getCount() { 29 | if (null != mResIdList) { 30 | return mResIdList.size(); 31 | } 32 | return 0; 33 | } 34 | 35 | @Override 36 | public int getItemPosition(@NonNull Object object) { 37 | if (null != mResIdList) { 38 | Integer resId = (Integer) ((ImageView) object).getTag(); 39 | if (null != resId) { 40 | for (Integer i : mResIdList) { 41 | if (resId.equals(i)) { 42 | return i; 43 | } 44 | } 45 | } 46 | } 47 | return super.getItemPosition(object); 48 | } 49 | 50 | @NonNull 51 | @Override 52 | public Object instantiateItem(@NonNull ViewGroup container, int position) { 53 | if (mResIdList != null && position < mResIdList.size()) { 54 | Integer resId = mResIdList.get(position); 55 | if (resId != null) { 56 | ImageView itemView = new ImageView(mContext); 57 | itemView.setScaleType(ImageView.ScaleType.FIT_XY); 58 | itemView.setPadding(10, 0, 10, 0); 59 | itemView.setImageResource(resId); 60 | 61 | // 此处假设所有的照片都不同,用resId唯一标识一个itemView;也可用其它Object来标识,只要保证唯一即可 62 | itemView.setTag(resId); 63 | container.addView(itemView); 64 | return itemView; 65 | } 66 | } 67 | return null; 68 | } 69 | 70 | @Override 71 | public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { 72 | // 注意:此处position是ViewPager中所有要显示的页面的position,与Adapter mDrawableResIdList并不是一一对应的。 73 | // 因为mDrawableResIdList有可能被修改删除某一个item,在调用notifyDataSetChanged()的时候,ViewPager中的页面 74 | // 数量并没有改变,只有当ViewPager遍历完自己所有的页面,并将不存在的页面删除后,二者才能对应起来 75 | int count = container.getChildCount(); 76 | for (int i = 0; i < count; i++) { 77 | View childView = container.getChildAt(i); 78 | if (childView == object) { 79 | container.removeView(childView); 80 | break; 81 | } 82 | } 83 | } 84 | 85 | @Override 86 | public boolean isViewFromObject(@NonNull View view, @NonNull Object object) { 87 | return view == object; 88 | } 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/adapter/holder/BannerVH.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.adapter.holder; 2 | 3 | import android.content.Context; 4 | import androidx.viewpager.widget.ViewPager; 5 | import android.util.Log; 6 | import android.view.View; 7 | 8 | import com.rust.aboutview.R; 9 | import com.rust.aboutview.adapter.ImagePagerAdapter; 10 | import com.rust.aboutview.multiitemlv.MultiItemAdapter; 11 | 12 | /** 13 | * Banner view holder 14 | * 轮播 15 | * Created by Rust on 2018/5/31. 16 | */ 17 | public class BannerVH { 18 | private static final String TAG = "rustAppBannerVH"; 19 | private Context mContext; 20 | private ViewPager mViewPager; 21 | private ImagePagerAdapter mImagePagerAdapter; 22 | 23 | public BannerVH(Context context, View convertedView) { 24 | mContext = context; 25 | if (null != convertedView) { 26 | mViewPager = convertedView.findViewById(R.id.vp); 27 | } 28 | } 29 | 30 | public void setDataBean(MultiItemAdapter.DataBean dataBean) { 31 | if (null == mImagePagerAdapter) { 32 | mImagePagerAdapter = new ImagePagerAdapter(mContext, dataBean.picResIdList); 33 | mViewPager.setAdapter(mImagePagerAdapter); 34 | mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { 35 | @Override 36 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 37 | // Log.d(TAG, "onPageScrolled"); 38 | } 39 | 40 | @Override 41 | public void onPageSelected(int position) { 42 | Log.d(TAG, "onPageSelected -> " + position); 43 | } 44 | 45 | @Override 46 | public void onPageScrollStateChanged(int state) { 47 | Log.d(TAG, "onPageScrollStateChanged: " + state); 48 | } 49 | }); 50 | 51 | } 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/algochart/AlgoChart.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.algochart; 2 | 3 | import com.rust.aboutview.algochart.algo.AlgoStepSlice; 4 | 5 | 6 | public interface AlgoChart { 7 | 8 | /** 9 | * 一般在主线程使用 10 | * 11 | * @param data 要显示的数据 12 | */ 13 | void showData(AlgoStepSlice data); 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/algochart/AlgoChartActivity.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.algochart; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import androidx.annotation.Nullable; 6 | import androidx.appcompat.widget.Toolbar; 7 | import android.view.View; 8 | import android.widget.ImageView; 9 | 10 | import com.rust.aboutview.R; 11 | import com.rust.aboutview.algochart.algo.AlgoStepSlice; 12 | import com.rust.aboutview.algochart.algo.sort.SelectionSort; 13 | import com.rustfisher.view.DotBarChart; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * 显示算法图表 19 | */ 20 | public class AlgoChartActivity extends Activity { 21 | private static final String TAG = "rustApp"; 22 | private DotBarChart mDbc1; 23 | private AlgoPlayer mAlgoPlayer; 24 | 25 | private ImageView mPlayIv; 26 | private Toolbar mToolbar; 27 | private int[] mArray1 = ArraySource.genIntArray(); 28 | 29 | @Override 30 | protected void onCreate(@Nullable Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | setContentView(R.layout.act_algo_chart); 33 | initUI(); 34 | 35 | List algoStepEntities = SelectionSort.selectSort(mArray1); 36 | mAlgoPlayer = new AlgoPlayer(); 37 | mAlgoPlayer.setDataList(algoStepEntities); 38 | mAlgoPlayer.setAlgoChart(mAlgoChart); 39 | mAlgoPlayer.setListener(aListener); 40 | } 41 | 42 | private void initUI() { 43 | mToolbar = findViewById(R.id.toolbar); 44 | mPlayIv = findViewById(R.id.play_iv); 45 | mDbc1 = findViewById(R.id.dbc1); 46 | mPlayIv.setOnClickListener(mOnClickListener); 47 | findViewById(R.id.next_iv).setOnClickListener(mOnClickListener); 48 | findViewById(R.id.pre_iv).setOnClickListener(mOnClickListener); 49 | mDbc1.setData(mArray1, null); 50 | 51 | mToolbar.setNavigationIcon(R.drawable.ic_back_white); 52 | mToolbar.setNavigationOnClickListener(new View.OnClickListener() { 53 | @Override 54 | public void onClick(View v) { 55 | mAlgoPlayer.exit(); 56 | finish(); 57 | } 58 | }); 59 | } 60 | 61 | private AlgoChart mAlgoChart = new AlgoChart() { 62 | @Override 63 | public void showData(AlgoStepSlice entity) { 64 | mDbc1.setData(entity.dataArray, entity.indexColorMap); 65 | } 66 | }; 67 | 68 | private View.OnClickListener mOnClickListener = new View.OnClickListener() { 69 | @Override 70 | public void onClick(View v) { 71 | switch (v.getId()) { 72 | case R.id.play_iv: 73 | mAlgoPlayer.togglePlay(); 74 | break; 75 | case R.id.pre_iv: 76 | mAlgoPlayer.pressPrevious(); 77 | break; 78 | case R.id.next_iv: 79 | mAlgoPlayer.pressNext(); 80 | break; 81 | } 82 | } 83 | }; 84 | 85 | private AlgoPlayer.AListener aListener = new AlgoPlayer.AListener() { 86 | @Override 87 | public void onStateChanged(AlgoPlayer.STATE state) { 88 | switch (state) { 89 | case NONE: 90 | case PAUSE: 91 | mPlayIv.setImageDrawable(getResources().getDrawable(R.drawable.ic_media_play)); 92 | break; 93 | case PLAYING: 94 | mPlayIv.setImageDrawable(getResources().getDrawable(R.drawable.ic_pause1)); 95 | break; 96 | } 97 | } 98 | }; 99 | 100 | } 101 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/algochart/ArraySource.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.algochart; 2 | 3 | import java.util.Random; 4 | 5 | public class ArraySource { 6 | 7 | private static final int DEF_ARR_SIZE = 15; 8 | 9 | public static int[] genIntArray() { 10 | return genIntArray(DEF_ARR_SIZE); 11 | } 12 | 13 | public static int[] genIntArray(int size) { 14 | int[] arr = new int[size]; 15 | for (int i = 0; i < size; i++) { 16 | arr[i] = i; 17 | } 18 | randomMix(arr); 19 | return arr; 20 | } 21 | 22 | private static void randomMix(int[] arr) { 23 | Random random = new Random(); 24 | int len = arr.length; 25 | for (int i = 1; i < len; i++) { 26 | int targetIndex = random.nextInt(len); 27 | int tmp = arr[i]; 28 | arr[i] = arr[targetIndex]; 29 | arr[targetIndex] = tmp; 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/algochart/algo/AlgoStepSlice.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.algochart.algo; 2 | 3 | import android.util.SparseIntArray; 4 | 5 | /** 6 | * 算法步骤 7 | */ 8 | public class AlgoStepSlice { 9 | public int[] dataArray; 10 | public SparseIntArray indexColorMap = new SparseIntArray(); 11 | 12 | public AlgoStepSlice(int[] data) { 13 | dataArray = data; 14 | } 15 | 16 | public void addMarkData(int index, int colorInt) { 17 | indexColorMap.put(index, colorInt); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/algochart/algo/BaseSort.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.algochart.algo; 2 | 3 | 4 | public class BaseSort { 5 | 6 | public static void exch(int a[], int i, int j) { 7 | int t = a[i]; 8 | a[i] = a[j]; 9 | a[j] = t; 10 | } 11 | 12 | /** 13 | * v < w 返回 true 14 | */ 15 | public static boolean less(Comparable v, Comparable w) { 16 | return v.compareTo(w) < 0; //v < w 返回 -1 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/algochart/algo/sort/SelectionSort.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.algochart.algo.sort; 2 | 3 | import android.graphics.Color; 4 | 5 | import com.rust.aboutview.algochart.algo.AlgoStepSlice; 6 | import com.rust.aboutview.algochart.algo.BaseSort; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | public class SelectionSort extends BaseSort { 12 | 13 | public static List selectSort(int a[]) { 14 | List stepEntities = new ArrayList<>(); 15 | int N = a.length; 16 | stepEntities.add(new AlgoStepSlice(a.clone())); 17 | for (int i = 0; i < N; i++) { 18 | int min = i; 19 | for (int j = i + 1; j < N; j++) { 20 | if (less(a[j], a[min])) min = j; 21 | } 22 | markDot(a, stepEntities, i, min); 23 | exch(a, i, min); 24 | markDot(a, stepEntities, i, min); 25 | 26 | } 27 | return stepEntities; 28 | } 29 | 30 | private static void markDot(int[] a, List stepEntities, int i, int min) { 31 | AlgoStepSlice algoStepSlice = new AlgoStepSlice(a.clone()); 32 | algoStepSlice.addMarkData(i, Color.RED); 33 | algoStepSlice.addMarkData(min, Color.YELLOW); 34 | stepEntities.add(algoStepSlice); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/database/RustDatabaseHelper.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.database; 2 | 3 | import android.content.Context; 4 | import android.database.sqlite.SQLiteDatabase; 5 | import android.database.sqlite.SQLiteOpenHelper; 6 | 7 | public class RustDatabaseHelper extends SQLiteOpenHelper { 8 | 9 | public static final int DATABASE_VERSION = 1; 10 | public static final String DATABASE_NAME = "data.db"; 11 | 12 | public interface Tables { 13 | String CONTACT_TABLE = "contact"; 14 | } 15 | 16 | public interface Contact { 17 | String _ID = "contact_id"; 18 | String NAME = "name"; 19 | String PHONE = "phone"; 20 | String EMAIL = "email"; 21 | } 22 | 23 | public RustDatabaseHelper(Context context, String name, 24 | SQLiteDatabase.CursorFactory factory, int version) { 25 | super(context, name, factory, version); 26 | } 27 | 28 | @Override 29 | public void onCreate(SQLiteDatabase db) { 30 | String cmd = "CREATE TABLE IF NOT EXISTS " + Tables.CONTACT_TABLE + "(" 31 | + Contact._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " 32 | + Contact.NAME + " VARCHAR, " 33 | + Contact.PHONE + " VARCHAR, " 34 | + Contact.EMAIL + " VARCHAR);"; 35 | db.execSQL(cmd); 36 | } 37 | 38 | @Override 39 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/fragment/CustomProgressBarFrag.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.os.Handler; 5 | import android.os.Looper; 6 | import androidx.annotation.NonNull; 7 | import androidx.annotation.Nullable; 8 | import androidx.fragment.app.Fragment; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.ProgressBar; 13 | 14 | import com.rust.aboutview.R; 15 | 16 | import java.util.Timer; 17 | import java.util.TimerTask; 18 | 19 | /** 20 | * 自定义progress bar 21 | * 各种样式的进度条 22 | * Created by Rust on 2018/7/19. 23 | */ 24 | public class CustomProgressBarFrag extends Fragment { 25 | 26 | ProgressBar mPb1; 27 | ProgressBar mPb2; 28 | ProgressBar mPb3; 29 | ProgressBar mPb4; 30 | ProgressBar mPb5; 31 | private Handler mHandler = new Handler(Looper.getMainLooper()); 32 | private Timer mTimer = new Timer("CPB"); 33 | 34 | @Nullable 35 | @Override 36 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 37 | return inflater.inflate(R.layout.frag_custom_progress_bar, container, false); 38 | } 39 | 40 | @Override 41 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { 42 | super.onViewCreated(view, savedInstanceState); 43 | mPb1 = view.findViewById(R.id.pb1); 44 | mPb2 = view.findViewById(R.id.pb2); 45 | mPb3 = view.findViewById(R.id.pb3); 46 | mPb4 = view.findViewById(R.id.pb4); 47 | mPb5 = view.findViewById(R.id.pb5); 48 | setupPb(mPb1, 200); 49 | setupPb(mPb4, 1000); 50 | setupPb(mPb5, 1000); 51 | mTimer.schedule(mTask, 0, 16); 52 | } 53 | 54 | @Override 55 | public void onDestroy() { 56 | mTimer.cancel(); 57 | super.onDestroy(); 58 | } 59 | 60 | private TimerTask mTask = new TimerTask() { 61 | private int period = 0; 62 | 63 | @Override 64 | public void run() { 65 | period++; 66 | 67 | mHandler.post(new Runnable() { 68 | @Override 69 | public void run() { 70 | increasePb(mPb1); 71 | if (period % 2 == 0) { 72 | increasePb(mPb2); 73 | } 74 | if (period % 3 == 0) { 75 | increasePb(mPb3); 76 | } 77 | increasePb(mPb4); 78 | increasePb(mPb5); 79 | } 80 | }); 81 | } 82 | }; 83 | 84 | private void increasePb(ProgressBar pb) { 85 | if (pb.getProgress() == pb.getMax()) { 86 | pb.setProgress(0); 87 | } else { 88 | pb.setProgress(pb.getProgress() + 1); 89 | } 90 | } 91 | 92 | private void setupPb(ProgressBar pb, int max) { 93 | pb.setMax(max); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/fragment/JoystickStyleTwoFragment.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.fragment; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.fragment.app.Fragment; 6 | import android.util.Log; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.RelativeLayout; 11 | 12 | import com.rust.aboutview.R; 13 | import com.rustfisher.uijoystick.controller.DefaultController; 14 | import com.rustfisher.uijoystick.listener.JoystickTouchViewListener; 15 | import com.rustfisher.uijoystick.model.PadStyle; 16 | 17 | public class JoystickStyleTwoFragment extends Fragment { 18 | 19 | private static final String TAG = "rustAppFrag2"; 20 | 21 | @Nullable 22 | @Override 23 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 24 | View root = inflater.inflate(R.layout.frag_joystick_style_2, container, false); 25 | initJoystick(root); 26 | return root; 27 | } 28 | 29 | private void initJoystick(View root) { 30 | DefaultController defaultController = 31 | new DefaultController(getContext(), 32 | (RelativeLayout) root.findViewById(R.id.joystick_container), PadStyle.FLOATING); 33 | defaultController.createViews(); 34 | defaultController.showViews(false); 35 | defaultController.setLeftTouchViewListener(new JoystickTouchViewListener() { 36 | @Override 37 | public void onTouch(float horizontalPercent, float verticalPercent) { 38 | Log.d(TAG, "onTouch left: " + horizontalPercent + ", " + verticalPercent); 39 | } 40 | 41 | @Override 42 | public void onReset() { 43 | Log.d(TAG, "onReset: left pad"); 44 | } 45 | 46 | @Override 47 | public void onActionDown() { 48 | Log.d(TAG, "onActionDown: left pad"); 49 | } 50 | 51 | @Override 52 | public void onActionUp() { 53 | Log.d(TAG, "onActionUp: left pad"); 54 | } 55 | }); 56 | defaultController.setRightTouchViewListener(new JoystickTouchViewListener() { 57 | @Override 58 | public void onTouch(float horizontalPercent, float verticalPercent) { 59 | Log.d(TAG, "onTouch right: " + horizontalPercent + ", " + verticalPercent); 60 | } 61 | 62 | @Override 63 | public void onReset() { 64 | Log.d(TAG, "onReset: right pad"); 65 | } 66 | 67 | @Override 68 | public void onActionDown() { 69 | Log.d(TAG, "onActionDown: right pad"); 70 | } 71 | 72 | @Override 73 | public void onActionUp() { 74 | Log.d(TAG, "onActionUp: right pad"); 75 | } 76 | }); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/msgonbus/AudioPlayEventOnBus.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.msgonbus; 2 | 3 | public class AudioPlayEventOnBus { 4 | public enum AudioType { 5 | DO, RE, MI, FA, SOL, LA, SI, H_DO, H_RE, H_MI, H_FA, H_SOL, H_LA, H_SI, 6 | GAI_ZI, WATER 7 | } 8 | 9 | private AudioType type = AudioType.DO; 10 | 11 | public AudioPlayEventOnBus() { 12 | 13 | } 14 | 15 | public AudioPlayEventOnBus(AudioType type) { 16 | this.type = type; 17 | } 18 | 19 | public AudioType getType() { 20 | return this.type; 21 | } 22 | 23 | public void setType(AudioType type) { 24 | this.type = type; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/multiitemlv/MuType.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.multiitemlv; 2 | 3 | /** 4 | * multi type 5 | * Created by Rust on 2018/5/31. 6 | */ 7 | public enum MuType { 8 | ONE_LINE(0), 9 | PIC_AND_ONE_LINE(1), 10 | ONE_PIC(2), 11 | BANNER(3); 12 | 13 | int code; 14 | 15 | MuType(int c) { 16 | code = c; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/service/MyDayDream.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.service; 2 | 3 | import android.service.dreams.DreamService; 4 | 5 | import com.rust.aboutview.R; 6 | 7 | public class MyDayDream extends DreamService { 8 | 9 | @Override 10 | public void onAttachedToWindow() { 11 | super.onAttachedToWindow(); 12 | // Exit dream upon user touch 13 | setInteractive(false); 14 | // Hide system UI 15 | setFullscreen(true); 16 | // Set the dream layout 17 | setContentView(R.layout.my_day_dream); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/service/MyService.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.service; 2 | 3 | import android.app.Service; 4 | import android.content.Intent; 5 | import android.os.IBinder; 6 | import android.os.RemoteException; 7 | import androidx.annotation.Nullable; 8 | import android.util.Log; 9 | 10 | import com.rust.aidl.IMyService; 11 | 12 | public class MyService extends Service { 13 | 14 | public class MyServiceImpl extends IMyService.Stub { 15 | @Override 16 | public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, 17 | double aDouble, String aString) throws RemoteException { 18 | 19 | } 20 | 21 | public String helloAndroidAIDL(String name) throws RemoteException { 22 | Log.d("aidl", "helloAndroidAIDL heard from : " + name); 23 | return "Rust: Service01 return value successfully!"; 24 | } 25 | } 26 | 27 | @Nullable 28 | @Override 29 | public IBinder onBind(Intent intent) { 30 | return new MyServiceImpl(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/view/CircleImageView.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.view; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.content.res.TypedArray; 6 | import android.graphics.Canvas; 7 | import android.graphics.Color; 8 | import android.graphics.Paint; 9 | import android.util.AttributeSet; 10 | import android.util.TypedValue; 11 | import android.widget.ImageView; 12 | 13 | import com.rust.aboutview.R; 14 | 15 | /** 16 | * A little circle who can add a background color. 17 | */ 18 | public class CircleImageView extends ImageView { 19 | 20 | private int mRadius; 21 | private boolean mSelected = false; 22 | int mColor = Color.BLACK; 23 | Paint mPaint = new Paint(); 24 | 25 | public CircleImageView(Context context) { 26 | this(context, null); 27 | } 28 | 29 | public CircleImageView(Context context, AttributeSet attrs) { 30 | this(context, attrs, 0); 31 | } 32 | 33 | public CircleImageView(Context context, AttributeSet attrs, int defStyleAttr) { 34 | super(context, attrs, defStyleAttr); 35 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyleAttr, 0); 36 | mRadius = a.getDimensionPixelSize(R.styleable.CircleImageView_CIVCircleRadius, dpToPx(12, getResources())); 37 | a.recycle(); 38 | } 39 | 40 | public void setColor(int color) { 41 | this.mColor = color; 42 | invalidate(); 43 | } 44 | 45 | @Override 46 | protected void onDraw(Canvas canvas) { 47 | super.onDraw(canvas); 48 | mPaint.setAntiAlias(true); 49 | mPaint.setStyle(Paint.Style.FILL); 50 | mPaint.setStrokeWidth(1.5f); 51 | if (mSelected) { 52 | mPaint.setColor(Color.WHITE); 53 | canvas.drawCircle(getWidth() / 2, getHeight() / 2, mRadius, mPaint); 54 | } 55 | mPaint.setColor(mColor); 56 | canvas.drawCircle(getWidth() / 2, getHeight() / 2, mRadius - 10, mPaint); 57 | } 58 | 59 | @Override 60 | public void setSelected(boolean selected) { 61 | mSelected = selected; 62 | super.setSelected(selected); 63 | invalidate(); 64 | } 65 | 66 | public static int dpToPx(int dp, Resources resources) { 67 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics()); 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/view/ColorBoardListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.view; 2 | 3 | import androidx.recyclerview.widget.RecyclerView; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | 8 | import com.rust.aboutview.R; 9 | 10 | import java.util.ArrayList; 11 | 12 | /** 13 | * Adapter for showing color list 14 | */ 15 | public class ColorBoardListAdapter extends RecyclerView.Adapter { 16 | 17 | private ArrayList mDataList; 18 | private int mSelectedPosition = -1; 19 | 20 | public interface OnItemClickListener { 21 | void onItemClick(View view, int position); 22 | 23 | void onItemLongClick(View view, int position); 24 | } 25 | 26 | private OnItemClickListener mOnItemClickListener;// Set this listener to item view 27 | 28 | public void setOnItemClickListener(OnItemClickListener l) { 29 | this.mOnItemClickListener = l; 30 | } 31 | 32 | public void setSelectedPosition(int position) { 33 | this.mSelectedPosition = position; 34 | notifyDataSetChanged(); 35 | notifyItemChanged(position); 36 | } 37 | 38 | // Provide a reference to the views for each data item 39 | // Complex data items may need more than one view per item, and 40 | // you provide access to all the views for a data item in a view holder 41 | public static class ViewHolder extends RecyclerView.ViewHolder { 42 | public CircleImageView mImageView; 43 | 44 | public ViewHolder(View view) { 45 | super(view); 46 | } 47 | } 48 | 49 | public static class ColorItemViewEntity { 50 | public int color; 51 | public int id; 52 | 53 | public ColorItemViewEntity(int ID, int color) { 54 | this.id = ID; 55 | this.color = color; 56 | } 57 | } 58 | 59 | // Provide a suitable constructor (depends on the kind of data set) 60 | public ColorBoardListAdapter(ArrayList deviceItemViewEntities) { 61 | mDataList = deviceItemViewEntities; 62 | } 63 | 64 | // Create new views (invoked by the layout manager) 65 | @Override 66 | public ColorBoardListAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 67 | // create a new view 68 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.color_item_view, parent, false); 69 | ViewHolder vh = new ViewHolder(v); 70 | vh.mImageView = (CircleImageView) v.findViewById(R.id.color_item_image_view); 71 | return vh; 72 | } 73 | 74 | // Replace the contents of a view (invoked by the layout manager) 75 | @Override 76 | public void onBindViewHolder(ViewHolder holder, final int position) { 77 | holder.mImageView.setColor(mDataList.get(position).color); 78 | holder.mImageView.setSelected(mSelectedPosition == position); 79 | if (mOnItemClickListener != null) { 80 | holder.mImageView.setOnClickListener(new View.OnClickListener() { 81 | @Override 82 | public void onClick(View v) { 83 | mOnItemClickListener.onItemClick(v, position); 84 | } 85 | }); 86 | holder.mImageView.setOnLongClickListener(new View.OnLongClickListener() { 87 | @Override 88 | public boolean onLongClick(View v) { 89 | mOnItemClickListener.onItemLongClick(v, position); 90 | return true; 91 | } 92 | }); 93 | } 94 | } 95 | 96 | // Return the size of your data set (invoked by the layout manager) 97 | @Override 98 | public int getItemCount() { 99 | return mDataList.size(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/view/MarkView.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import android.util.AttributeSet; 8 | import android.widget.ImageView; 9 | 10 | public class MarkView extends ImageView { 11 | 12 | public static final double PI = Math.PI; 13 | public static final double PI_DIVER_100 = PI / 100.0; 14 | private final Paint paint; 15 | float touchX = 0; 16 | float touchY = 0; 17 | 18 | public void setTouchX(float touchX) { 19 | this.touchX = touchX; 20 | } 21 | 22 | public void setTouchY(float touchY) { 23 | this.touchY = touchY; 24 | } 25 | 26 | public MarkView(Context context) { 27 | this(context, null); 28 | } 29 | 30 | public MarkView(Context context, AttributeSet attr) { 31 | super(context, attr); 32 | this.paint = new Paint(); 33 | } 34 | 35 | 36 | @Override 37 | protected void onDraw(Canvas canvas) { 38 | 39 | paint.setAlpha(180); 40 | paint.setColor(Color.GRAY); 41 | canvas.drawLine(touchX - 100, touchY, touchX + 100, touchY, paint);// draw horizon line 42 | canvas.drawLine(touchX, touchY - 100, touchX, touchY + 100, paint);// draw vertical line 43 | 44 | paint.setColor(Color.argb(255, 255, 0, 0)); 45 | paint.setStrokeWidth(2); 46 | // for (float x = 0; x < 500; x += PI_DIVER_100) { 47 | // canvas.drawPoint(x, (float) -(100 * Math.sin(x / 20.0)) + 200, paint); 48 | // } 49 | 50 | super.onDraw(canvas); 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/widget/ConfirmDialog.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.widget; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import androidx.appcompat.app.AlertDialog; 6 | import android.text.TextUtils; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.widget.TextView; 10 | 11 | import com.rust.aboutview.R; 12 | 13 | /** 14 | * Extend from AlertDialog not Dialog 15 | * In API 19, extend from Dialog would have a blank frame on the top 16 | * API 23 is OK with Dialog 17 | */ 18 | public class ConfirmDialog extends AlertDialog { 19 | 20 | private Context context; 21 | private String title; 22 | private String confirmButtonText; 23 | private String cancelButtonText; 24 | private OnClickListenerInterface onClickListenerInterface; 25 | 26 | public ConfirmDialog(Context context) { 27 | super(context); 28 | this.context = context; 29 | this.title = context.getResources().getString(R.string.delete_message); 30 | this.confirmButtonText = context.getResources().getString(R.string.yes); 31 | this.cancelButtonText = context.getResources().getString(R.string.cancel); 32 | } 33 | 34 | public void setContext(Context context) { 35 | this.context = context; 36 | } 37 | 38 | public void setTitle(String title) { 39 | this.title = title; 40 | } 41 | 42 | public void setConfirmButtonText(String confirmButtonText) { 43 | this.confirmButtonText = confirmButtonText; 44 | } 45 | 46 | public void setCancelButtonText(String cancelButtonText) { 47 | this.cancelButtonText = cancelButtonText; 48 | } 49 | 50 | public interface OnClickListenerInterface { 51 | 52 | void doConfirm(); 53 | 54 | void doCancel(); 55 | } 56 | 57 | @Override 58 | protected void onCreate(Bundle savedInstanceState) { 59 | super.onCreate(savedInstanceState); 60 | LayoutInflater layoutInflater = (LayoutInflater) context 61 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 62 | View view = layoutInflater.inflate(R.layout.dialog_confirm_delete_data, null); 63 | setContentView(view); 64 | 65 | TextView titleView = (TextView) view.findViewById(R.id.dialog_message); 66 | TextView confirmButton = (TextView) view.findViewById(R.id.confirm_delete_btn); 67 | TextView cancelButton = (TextView) view.findViewById(R.id.cancel_delete_btn); 68 | 69 | if (TextUtils.isEmpty(title)) { 70 | titleView.setText(title); 71 | } 72 | if (TextUtils.isEmpty(confirmButtonText)) { 73 | confirmButton.setText(confirmButtonText); 74 | } 75 | if (TextUtils.isEmpty(cancelButtonText)) { 76 | cancelButton.setText(cancelButtonText); 77 | } 78 | confirmButton.setOnClickListener(new clickListener()); 79 | cancelButton.setOnClickListener(new clickListener()); 80 | } 81 | 82 | public void setClickListener(OnClickListenerInterface clickListenerInterface) { 83 | this.onClickListenerInterface = clickListenerInterface; 84 | } 85 | 86 | private class clickListener implements View.OnClickListener { 87 | 88 | @Override 89 | public void onClick(View v) { 90 | int id = v.getId(); 91 | switch (id) { 92 | case R.id.confirm_delete_btn: { 93 | onClickListenerInterface.doConfirm(); 94 | break; 95 | } 96 | case R.id.cancel_delete_btn: { 97 | onClickListenerInterface.doCancel(); 98 | break; 99 | } 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/widget/DividerLine.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.widget; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Paint; 5 | 6 | import androidx.recyclerview.widget.RecyclerView; 7 | import android.view.View; 8 | 9 | public class DividerLine extends RecyclerView.ItemDecoration { 10 | /** 11 | * 水平方向 12 | */ 13 | public static final int HORIZONTAL = 0; 14 | 15 | /** 16 | * 垂直方向 17 | */ 18 | public static final int VERTICAL = 1; 19 | 20 | /** 21 | * 方框 22 | */ 23 | public static final int TYPE_RECT = 2; 24 | 25 | // 画笔 26 | private Paint paint; 27 | 28 | // 布局方向 29 | private int orientation; 30 | // 分割线颜色 31 | private int color; 32 | // 分割线尺寸 33 | private int size; 34 | 35 | public DividerLine() { 36 | this(VERTICAL); 37 | } 38 | 39 | public DividerLine(int orientation) { 40 | this.orientation = orientation; 41 | 42 | paint = new Paint(); 43 | } 44 | 45 | @Override 46 | public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) { 47 | super.onDrawOver(c, parent, state); 48 | 49 | if (orientation == VERTICAL) { 50 | drawHorizontal(c, parent); 51 | } else if (orientation == HORIZONTAL) { 52 | drawVertical(c, parent); 53 | } else if (orientation == TYPE_RECT) { 54 | drawHorizontal(c, parent); 55 | drawVertical(c, parent); 56 | } 57 | } 58 | 59 | /** 60 | * 设置分割线颜色 61 | * 62 | * @param color 颜色 63 | */ 64 | public void setColor(int color) { 65 | this.color = color; 66 | paint.setColor(color); 67 | } 68 | 69 | /** 70 | * 设置分割线尺寸 71 | * 72 | * @param size 尺寸 73 | */ 74 | public void setSize(int size) { 75 | this.size = size; 76 | } 77 | 78 | // 绘制垂直分割线 79 | private void drawVertical(Canvas c, RecyclerView parent) { 80 | final int top = parent.getPaddingTop(); 81 | final int bottom = parent.getHeight() - parent.getPaddingBottom(); 82 | 83 | final int childCount = parent.getChildCount(); 84 | for (int i = 0; i < childCount; i++) { 85 | final View child = parent.getChildAt(i); 86 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams(); 87 | final int left = child.getRight() + params.rightMargin; 88 | final int right = left + size; 89 | 90 | c.drawRect(left, top, right, bottom, paint); 91 | } 92 | } 93 | 94 | // 绘制水平分割线 95 | private void drawHorizontal(Canvas c, RecyclerView parent) { 96 | final int left = parent.getPaddingLeft(); 97 | final int right = parent.getWidth() - parent.getPaddingRight(); 98 | 99 | final int childCount = parent.getChildCount(); 100 | for (int i = 0; i < childCount; i++) { 101 | final View child = parent.getChildAt(i); 102 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams(); 103 | final int top = child.getBottom() + params.bottomMargin; 104 | final int bottom = top + size; 105 | 106 | c.drawRect(left, top, right, bottom, paint); 107 | } 108 | } 109 | } -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/widget/RoundCornerProgressDialog.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.widget; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.fragment.app.DialogFragment; 6 | import android.util.DisplayMetrics; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.view.Window; 11 | import android.view.WindowManager; 12 | import android.widget.ImageView; 13 | import android.widget.RelativeLayout; 14 | import android.widget.TextView; 15 | 16 | import com.rust.aboutview.R; 17 | import com.rustfisher.view.RoundCornerImageView; 18 | 19 | import java.util.Locale; 20 | 21 | 22 | /** 23 | * 进度条 24 | * Created by Rust on 2018/5/22. 25 | */ 26 | public class RoundCornerProgressDialog extends DialogFragment { 27 | private static final String TAG = "rustApp"; 28 | public static final String F_TAG = "f_tag_ChangeUserProgressDialog"; 29 | private int mDialogWid = -1; 30 | private int mDialogHeight = -1; 31 | int mPercent = 0; // 百分比 32 | private TextView mPercentTv; 33 | private RoundCornerImageView mProgressIv; 34 | private ImageView mBotIv; 35 | 36 | @Nullable 37 | @Override 38 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 39 | return inflater.inflate(R.layout.dialog_round_corner_progress, container, false); 40 | } 41 | 42 | @Override 43 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 44 | super.onViewCreated(view, savedInstanceState); 45 | mPercentTv = view.findViewById(R.id.percent_tv); 46 | mProgressIv = view.findViewById(R.id.p_cover_iv); 47 | mBotIv = view.findViewById(R.id.p_bot_iv); 48 | mProgressIv.setRadiusDp(5); 49 | } 50 | 51 | 52 | @Override 53 | public void onStart() { 54 | super.onStart(); 55 | Window window = getDialog().getWindow(); 56 | if (null != window) { 57 | WindowManager.LayoutParams windowParams = window.getAttributes(); 58 | windowParams.dimAmount = 0.0f; 59 | window.setAttributes(windowParams); 60 | DisplayMetrics dm = new DisplayMetrics(); 61 | getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm); 62 | if (mDialogWid < 0) { 63 | mDialogHeight = (int) (dm.heightPixels * 0.4); 64 | mDialogWid = (int) (dm.widthPixels * 0.86); 65 | } 66 | window.setLayout(mDialogWid, mDialogHeight); 67 | } 68 | } // 调整dialog的宽高 69 | 70 | public void updatePercent(int percent) { 71 | mPercent = percent; 72 | mPercentTv.setText(String.format(Locale.CHINA, "%2d%%", mPercent)); 73 | float percentFloat = mPercent / 100.0f; 74 | final int ivWidth = mBotIv.getWidth(); 75 | RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) mProgressIv.getLayoutParams(); 76 | int marginEnd = (int) ((1 - percentFloat) * ivWidth); 77 | lp.width = ivWidth - marginEnd; 78 | mProgressIv.setLayoutParams(lp); 79 | mProgressIv.postInvalidate(); 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/widget/VKBaseAdapterDark.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.widget; 2 | 3 | import android.graphics.Color; 4 | import android.util.Log; 5 | 6 | import com.rust.aboutview.R; 7 | import com.rust.aboutview.widget.vkeyboard.VKey; 8 | import com.rust.aboutview.widget.vkeyboard.VKeyboard; 9 | import com.rust.aboutview.widget.vkeyboard.VKeyboardBody; 10 | import com.rust.aboutview.widget.vkeyboard.VRow; 11 | 12 | import java.util.ArrayList; 13 | import java.util.Arrays; 14 | import java.util.List; 15 | 16 | /** 17 | * Sample adapter. Dark theme. 18 | * Created on 2019-8-25 19 | */ 20 | public class VKBaseAdapterDark extends VKeyboard.Adapter { 21 | private static final String TAG = "rustApp"; 22 | private static final int DEF_SCREEN_WID = 1080; 23 | private List rows; 24 | 25 | private VKeyboardBody vKeyboardBody = new VKeyboardBody(Color.parseColor("#1b1a1e")); 26 | 27 | public VKBaseAdapterDark() { 28 | initKeys(DEF_SCREEN_WID); 29 | } 30 | 31 | public VKBaseAdapterDark(int screenWidth) { 32 | initKeys(screenWidth); 33 | } 34 | 35 | private void initKeys(int screenWid) { 36 | Log.d(TAG, "initKeys: screen width: " + screenWid); 37 | List line1Keys = Arrays.asList( 38 | VKey.normal("q", 'q'), VKey.normal("w", 'w'), VKey.normal("e", 'e'), 39 | VKey.normal("r", 'r'), VKey.normal("t", 't'), VKey.normal("y", 'y'), 40 | VKey.normal("u", 'u'), VKey.normal("i", 'i'), VKey.normal("o", 'o'), 41 | VKey.normal("p", 'p'), VKey.backspace() 42 | ); 43 | List line2Keys = Arrays.asList( 44 | VKey.normal("a", 'a'), VKey.normal("s", 's'), VKey.normal("d", 'd'), 45 | VKey.normal("f", 'f'), VKey.normal("g", 'g'), VKey.normal("h", 'h'), 46 | VKey.normal("j", 'j'), VKey.normal("k", 'k'), VKey.normal("l", 'l'), 47 | VKey.ok() 48 | ); 49 | List line3Keys = Arrays.asList( 50 | VKey.normal("z", 'z'), VKey.normal("x", 'x'), VKey.normal("c", 'c'), 51 | VKey.normal("v", 'v'), VKey.normal("b", 'b'), VKey.normal("n", 'n'), 52 | VKey.normal("m", 'm'), VKey.space() 53 | ); 54 | 55 | int line1Count = line1Keys.size(); 56 | final float keyWidDp = px2Dp((screenWid * 1f) / line1Count) - 8; 57 | Log.d(TAG, "initKeys: key width(dp): " + keyWidDp); 58 | rows = new ArrayList<>(); 59 | VRow row1 = new VRow(line1Keys); 60 | VRow row2 = new VRow(line2Keys); 61 | VRow row3 = new VRow(line3Keys); 62 | row1.setPaddingTop(5); 63 | row2.setPaddingTop(5); 64 | row3.setPaddingTop(5); 65 | row3.setPaddingBottom(5); 66 | rows.add(row1); 67 | rows.add(row2); 68 | rows.add(row3); 69 | 70 | for (VRow row : rows) { 71 | for (VKey key : row.getKeys()) { 72 | key.setTextColor(Color.WHITE); 73 | key.setKeyViewWidthDp(keyWidDp); 74 | key.setBackgroundResId(R.drawable.vk_se_tv_dark_1); 75 | key.setUseBgRes(true); 76 | if (key.isOk()) { 77 | key.setKeyViewWidthDp((int) (keyWidDp * 2f)); 78 | } else if (key.isBackSpace()) { 79 | key.setTextSizeSp(11); 80 | } else if (key.isSpace()) { 81 | key.setKeyViewWidthDp((int) (keyWidDp * 1.5f)); 82 | } 83 | } 84 | } 85 | 86 | } 87 | 88 | @Override 89 | public List getRows() { 90 | return rows; 91 | } 92 | 93 | @Override 94 | public VKeyboardBody getKeyboardBody() { 95 | return vKeyboardBody; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/widget/VKBaseAdapterWhite.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.widget; 2 | 3 | import android.graphics.Color; 4 | import android.util.Log; 5 | 6 | import com.rust.aboutview.R; 7 | import com.rust.aboutview.widget.vkeyboard.VKey; 8 | import com.rust.aboutview.widget.vkeyboard.VKeyboard; 9 | import com.rust.aboutview.widget.vkeyboard.VKeyboardBody; 10 | import com.rust.aboutview.widget.vkeyboard.VRow; 11 | 12 | import java.util.ArrayList; 13 | import java.util.Arrays; 14 | import java.util.List; 15 | 16 | /** 17 | * Sample adapter. White theme. 18 | * Created on 2019-8-25 19 | */ 20 | public class VKBaseAdapterWhite extends VKeyboard.Adapter { 21 | private static final String TAG = "rustAppVKeyboard"; 22 | private static final int DEF_SCREEN_WID = 1080; 23 | private List rows; 24 | 25 | private VKeyboardBody vKeyboardBody = new VKeyboardBody(Color.parseColor("#66eaeaea")); 26 | 27 | public VKBaseAdapterWhite() { 28 | initKeys(DEF_SCREEN_WID); 29 | } 30 | 31 | public VKBaseAdapterWhite(int screenWidth) { 32 | initKeys(screenWidth); 33 | } 34 | 35 | private void initKeys(int screenWid) { 36 | Log.d(TAG, "initKeys: screen width: " + screenWid); 37 | List line1Keys = Arrays.asList( 38 | VKey.normal("q", 'q'), VKey.normal("w", 'w'), VKey.normal("e", 'e'), 39 | VKey.normal("r", 'r'), VKey.normal("t", 't'), VKey.normal("y", 'y'), 40 | VKey.normal("u", 'u'), VKey.normal("i", 'i'), VKey.normal("o", 'o'), VKey.normal("p", 'p') 41 | ); 42 | List line2Keys = Arrays.asList( 43 | VKey.normal("a", 'a'), VKey.normal("s", 's'), VKey.normal("d", 'd'), 44 | VKey.normal("f", 'f'), VKey.normal("g", 'g'), VKey.normal("h", 'h'), 45 | VKey.normal("j", 'j'), VKey.normal("k", 'k'), VKey.normal("l", 'l'), 46 | VKey.backspace() 47 | ); 48 | List line3Keys = Arrays.asList( 49 | VKey.emptyNormal(), VKey.normal("z", 'z'), VKey.normal("x", 'x'), VKey.normal("c", 'c'), 50 | VKey.normal("v", 'v'), VKey.normal("b", 'b'), VKey.normal("n", 'n'), 51 | VKey.normal("m", 'm'), VKey.ok() 52 | ); 53 | 54 | int line1Count = line1Keys.size(); 55 | final float keyWidDp = px2Dp((screenWid * 1f) / line1Count) - 8; 56 | Log.d(TAG, "initKeys: key width(dp): " + keyWidDp); 57 | rows = new ArrayList<>(); 58 | VRow row1 = new VRow(line1Keys); 59 | VRow row2 = new VRow(line2Keys); 60 | VRow row3 = new VRow(line3Keys); 61 | row1.setPaddingTop(5); 62 | row2.setPaddingTop(5); 63 | row3.setPaddingTop(5); 64 | row3.setPaddingBottom(5); 65 | rows.add(row1); 66 | rows.add(row2); 67 | rows.add(row3); 68 | for (VRow row : rows) { 69 | for (VKey key : row.getKeys()) { 70 | key.setTextColor(Color.BLACK); 71 | key.setKeyViewWidthDp(keyWidDp); 72 | key.setUseBgRes(true); 73 | key.setBackgroundResId(R.drawable.vk_se_tv_1); 74 | if (key.isOk()) { 75 | key.setKeyViewWidthDp(keyWidDp); 76 | key.setKeyViewWidthDp((int) (keyWidDp * 2f)); 77 | } else if (key.isBackSpace()) { 78 | key.setTextSizeSp(11); 79 | } 80 | } 81 | } 82 | 83 | } 84 | 85 | @Override 86 | public List getRows() { 87 | return rows; 88 | } 89 | 90 | @Override 91 | public VKeyboardBody getKeyboardBody() { 92 | return vKeyboardBody; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/widget/vkeyboard/VKeyboardBody.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.widget.vkeyboard; 2 | 3 | /** 4 | * 键盘的背景 5 | * Created on 2019-8-24 6 | */ 7 | public class VKeyboardBody { 8 | 9 | private int bgColor; 10 | private int bgResId; 11 | private boolean bgUseRes = false; 12 | 13 | public VKeyboardBody(int bgColor) { 14 | this.bgColor = bgColor; 15 | } 16 | 17 | public VKeyboardBody(int bgResId, boolean bgUseRes) { 18 | this.bgResId = bgResId; 19 | this.bgUseRes = bgUseRes; 20 | } 21 | 22 | public int getBgColor() { 23 | return bgColor; 24 | } 25 | 26 | public void setBgColor(int bgColor) { 27 | this.bgColor = bgColor; 28 | } 29 | 30 | public int getBgResId() { 31 | return bgResId; 32 | } 33 | 34 | public void setBgResId(int bgResId) { 35 | this.bgResId = bgResId; 36 | } 37 | 38 | public boolean isBgUseRes() { 39 | return bgUseRes; 40 | } 41 | 42 | public void setBgUseRes(boolean bgUseRes) { 43 | this.bgUseRes = bgUseRes; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/widget/vkeyboard/VKeyboardListener.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.widget.vkeyboard; 2 | 3 | 4 | public abstract class VKeyboardListener { 5 | 6 | public void onKeyClick(VKey key){} 7 | 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/rust/aboutview/widget/vkeyboard/VRow.java: -------------------------------------------------------------------------------- 1 | package com.rust.aboutview.widget.vkeyboard; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Contains keys 7 | * Created on 2019-8-25 8 | */ 9 | public class VRow { 10 | 11 | private int paddingLeft; // dp 12 | private int paddingTop; 13 | private int paddingRight; 14 | private int paddingBottom; 15 | private int marginLeft; 16 | private int marginTop; 17 | private int marginRight; 18 | private int marginBottom; 19 | 20 | private List keys; 21 | 22 | public VRow(List keys) { 23 | this.keys = keys; 24 | } 25 | 26 | public List getKeys() { 27 | return keys; 28 | } 29 | 30 | public void setKeys(List keys) { 31 | this.keys = keys; 32 | } 33 | 34 | public int getPaddingLeft() { 35 | return paddingLeft; 36 | } 37 | 38 | public void setPaddingLeft(int paddingLeft) { 39 | this.paddingLeft = paddingLeft; 40 | } 41 | 42 | public int getPaddingTop() { 43 | return paddingTop; 44 | } 45 | 46 | public void setPaddingTop(int paddingTop) { 47 | this.paddingTop = paddingTop; 48 | } 49 | 50 | public int getPaddingRight() { 51 | return paddingRight; 52 | } 53 | 54 | public void setPaddingRight(int paddingRight) { 55 | this.paddingRight = paddingRight; 56 | } 57 | 58 | public int getPaddingBottom() { 59 | return paddingBottom; 60 | } 61 | 62 | public void setPaddingBottom(int paddingBottom) { 63 | this.paddingBottom = paddingBottom; 64 | } 65 | 66 | public int getMarginLeft() { 67 | return marginLeft; 68 | } 69 | 70 | public void setMarginLeft(int marginLeft) { 71 | this.marginLeft = marginLeft; 72 | } 73 | 74 | public int getMarginTop() { 75 | return marginTop; 76 | } 77 | 78 | public void setMarginTop(int marginTop) { 79 | this.marginTop = marginTop; 80 | } 81 | 82 | public int getMarginRight() { 83 | return marginRight; 84 | } 85 | 86 | public void setMarginRight(int marginRight) { 87 | this.marginRight = marginRight; 88 | } 89 | 90 | public int getMarginBottom() { 91 | return marginBottom; 92 | } 93 | 94 | public void setMarginBottom(int marginBottom) { 95 | this.marginBottom = marginBottom; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/pic_dart_lang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustFisher/aboutView/a2fe0bc5ffee5e5f320b2413542b8495bab2243b/app/src/main/res/drawable-xxhdpi/pic_dart_lang.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/pic_my_little_hero.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustFisher/aboutView/a2fe0bc5ffee5e5f320b2413542b8495bab2243b/app/src/main/res/drawable-xxhdpi/pic_my_little_hero.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/wallpaper_2018_04_14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustFisher/aboutView/a2fe0bc5ffee5e5f320b2413542b8495bab2243b/app/src/main/res/drawable-xxhdpi/wallpaper_2018_04_14.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/wallpaper_2018_04_16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustFisher/aboutView/a2fe0bc5ffee5e5f320b2413542b8495bab2243b/app/src/main/res/drawable-xxhdpi/wallpaper_2018_04_16.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/wallpaper_2018_04_19.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustFisher/aboutView/a2fe0bc5ffee5e5f320b2413542b8495bab2243b/app/src/main/res/drawable-xxhdpi/wallpaper_2018_04_19.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/wallpaper_2018_04_25.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustFisher/aboutView/a2fe0bc5ffee5e5f320b2413542b8495bab2243b/app/src/main/res/drawable-xxhdpi/wallpaper_2018_04_25.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/algo_main_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/custom_progressbar_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/custom_progressbar_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/custom_progressbar_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/custom_progressbar_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/custom_progressbar_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_4_cube_gray.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_4_cube_pink.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_apps_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_back_white.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_backspace_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_cube_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustFisher/aboutView/a2fe0bc5ffee5e5f320b2413542b8495bab2243b/app/src/main/res/drawable/ic_cube_blue.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_handler.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_media_next.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_media_play.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_media_previous.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_pause1.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_star_gray.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_tick_in_cube.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_view.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/layer_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/littleboygreen_x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustFisher/aboutView/a2fe0bc5ffee5e5f320b2413542b8495bab2243b/app/src/main/res/drawable/littleboygreen_x128.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/pic_cover_blue_white.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RustFisher/aboutView/a2fe0bc5ffee5e5f320b2413542b8495bab2243b/app/src/main/res/drawable/pic_cover_blue_white.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_icon_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 12 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_round_corner_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_round_top_white.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_tv.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/vk_se_tv_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/vk_se_tv_dark_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/vk_tv_bg_dark_def.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/vk_tv_bg_dark_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/vk_tv_bg_green.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/vk_tv_bg_grey.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/act_algo_chart.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 19 | 20 | 25 | 26 | 30 | 31 | 38 | 39 | 44 | 45 | 51 | 52 | 53 | 54 | 55 | 56 | 65 | 66 | 73 | 74 | 83 | 84 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /app/src/main/res/layout/act_bulb_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 21 | 22 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/act_color_lines.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/act_common_container.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/act_dashboard.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 26 | 27 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/act_dialog_demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |