{"id":13645274,"url":"https://github.com/SwiftyWang/android-drag-square","last_synced_at":"2025-04-21T13:32:35.471Z","repository":{"id":189857762,"uuid":"75053667","full_name":"SwiftyWang/android-drag-square","owner":"SwiftyWang","description":"edit personal information which enables users to drag and rank image order","archived":false,"fork":true,"pushed_at":"2019-03-26T15:24:36.000Z","size":12283,"stargazers_count":264,"open_issues_count":0,"forks_count":20,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-09T18:41:56.132Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"xmuSistone/DragRankSquare","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwiftyWang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-11-29T07:10:44.000Z","updated_at":"2024-06-27T09:34:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/SwiftyWang/android-drag-square","commit_stats":null,"previous_names":["swiftywang/android-drag-square"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyWang%2Fandroid-drag-square","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyWang%2Fandroid-drag-square/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyWang%2Fandroid-drag-square/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyWang%2Fandroid-drag-square/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwiftyWang","download_url":"https://codeload.github.com/SwiftyWang/android-drag-square/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250064835,"owners_count":21368977,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:02:32.711Z","updated_at":"2025-04-21T13:32:32.994Z","avatar_url":"https://github.com/SwiftyWang.png","language":"Java","funding_links":[],"categories":["Sort\u0026Drag"],"sub_categories":[],"readme":"# Modified by Swifty\n## refactor the repository, easy to use with gradle import.\n[![](https://jitpack.io/v/SwiftyWang/android-drag-square.svg)](https://jitpack.io/#SwiftyWang/android-drag-square)\n\n## How to use\nAdd it in your root build.gradle at the end of repositories:\n\n```gradle\n\tallprojects {\n\t\trepositories {\n\t\t\t...\n\t\t\tmaven { url 'https://jitpack.io' }\n\t\t}\n\t}\n```\n\nAdd the dependency\n```gradle\n\tdependencies {\n\t        compile 'com.github.SwiftyWang.android-drag-square:dragsquareimage:1.2.3'\n\t}\n```\n\nget DraggablePresenter\n```java\n        DraggableSquareView dragSquare = (DraggableSquareView) findViewById(R.id.drag_square);\n        contentText = (TextView) findViewById(R.id.contentText);\n        draggablePresent = new DraggablePresentImpl(fragment, dragSquare);\n        draggablePresent = new DraggablePresentImpl(activity, dragSquare);\n```\n\nneed pass activity callback to DraggablePresentImpl\n```java\n    @Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent result) {\n        draggablePresent.onActivityResult(requestCode, resultCode, result);\n    }\n```\n\nSet customer dialog, Customer dialog must extends ActionDialog.class\n```java\n    draggablePresent.setCustomActionDialog(new MyActionDialog(Context));\n```\n\nlisten image changes\n```java\n    dragSquare.setImageChangesListener(imageChangesListener);\n\n    public interface ImageChangesListener {\n        void onImageAdded(String uri, int index);\n\n        void onImageEdited(String uri, int index);\n\n        void onImageDeleted(String uri, int index);\n    }\n```\nAll public apis\n```java\n    SparseArray\u003cString\u003e getImageUrls();\n\n    void setImages(String... imageUrls);\n\n    void setCustomActionDialog(ActionDialog actionDialog);\n```\n\n\n# android-drag-square\nedit personal data which enables users to drag and rank image order\n\n编辑个人资料，图片可拖拽排序。有点像可拖拽的gridView，但是会更流畅。\u003cbr\u003e\n这个demo是探探的个人资料编辑页面，受网上一位朋友的委托，该库模仿了其拖动效果。\u003cbr\u003e\n探探的安卓工程师，应该特别牛逼吧。因为最初时，这种拖拽效果真的无从下手。反编译探探的源代码，发现它做了很严肃的混淆处理。然后用Hierarchy Viewer看了View的层级，这才有了一点点的思路。\u003cbr\u003e\n在代码撰写的过程中，我也踩了不少坑。细看代码深处，或许你会有一丝丝的收获吧。\u003cbr\u003e\n当然，在最初的最初，我搜了不少的draggable gridview的仓库，可惜用起来的时候发现不够流畅、不够灵活。\n\n### 截图\n\u003ctd\u003e\n\t \u003cimg src=\"capture1.gif\" width=\"290\" height=\"485\" /\u003e\n\t \u003cimg src=\"capture2.gif\" width=\"290\" height=\"485\" /\u003e\n\t \u003cimg src=\"capture3.gif\" width=\"290\" height=\"485\" /\u003e\n\u003c/td\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwiftyWang%2Fandroid-drag-square","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSwiftyWang%2Fandroid-drag-square","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwiftyWang%2Fandroid-drag-square/lists"}