# xuningjack/drag_click_view architecture

> Architecture diagram of the GitHub repository xuningjack/drag_click_view, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xuningjack/drag_click_view
- Repository: https://github.com/xuningjack/drag_click_view

## Overview

1. **Repository type and purpose**
   - This is a single Android application focused on a dual-GridView selection UI: users can **tap or drag** items to move them between “selected” and “unselected” states.
   - The README frames the core feature clearly: two GridViews that support click-and-drag item toggling.

2. **Top-level app structure**
   - The app is organized as a traditional Android project with `AndroidManifest.xml`, `res/`, `assets/`, `libs/`, and Java source under `src/com/example/android_pra/`.
   - There is no backend, service layer, or multi-module structure visible; the architecture is primarily **UI-driven and in-process**.

3. **Main entry point**
   - `MainActivity.java` is the application entry point and likely owns the screen layout, user interaction wiring, and data initialization.
   - The main screen is defined in `res/layout/activity_main.xml`, which probably hosts the two custom GridViews and any surrounding controls.

4. **Custom interaction widgets**
   - `SubscribeDragGridView.java` is the core custom UI component for the draggable/selected grid behavior.
   - `NoScrollGridView.java` suggests a grid implementation adapted to fit inside another scrollable container without conflicting scroll handling.
   - These custom views form the interaction boundary: they encapsulate gesture behavior and presentation mechanics separate from the activity.

5. **Adapter layer**
   - `SubScribeDragViewAdapter.java` and `UnSubScribeAdapter.java` are the data-to-view bridges for the two grid states.
   - This indicates a split between **subscribed/selected items** and **unsubscribed/unselected items**, with each grid using its own adapter or rendering path.

6. **Data model**
   - `SubScribeBean.java` is the primary item model.
   - The bean likely carries the fields needed for display and state transitions, such as label/title and selection status, and it is the unit moved between adapters when the user toggles an item.

7. **Resource-driven UI**
   - The app uses standard Android resources for layout, styles, colors, and string assets under `res/`.
   - Drawable selectors such as `btn_bg_selector.xml` and `my_item_font_color_selector.xml` indicate stateful visual feedback for pressed/selected items, which is important for the drag/click UX.
   - Multiple style directories (`values-v11`, `values-v14`) suggest compatibility handling across Android versions.

8. **Assets and bundled runtime artifacts**
   - `assets/` contains `web.html`, `classes.dex`, and `common.jar`, which is unusual for a simple source-only app.
   - This suggests the project bundles prebuilt code or a local asset-based component in addition to the Java source, possibly for demo content or embedded logic loaded at runtime.

9. **Third-party dependencies**
   - `libs/android-support-v4.jar` provides backward-compatible Android support APIs.
   - `libs/gson-2.2.4.jar` is available for JSON serialization/deserialization, though its exact use is not visible from the file tree alone.
   - These libraries indicate the app targets older Android compatibility while possibly supporting structured data handling.

10. **Build and compatibility boundaries**
   - `project.properties` and `proguard-project.txt` show a classic Eclipse/ADT-era Android build setup.
   - The `.settings/` files reinforce that this is an older Android project structure rather than a modern Gradle-based one.

11. **How the pieces fit together**
   - `MainActivity` initializes data, creates/attaches the two adapters, and connects them to the custom grid views.
   - User actions in the grids trigger item state changes, moving or reclassifying `SubScribeBean` objects between selected and unselected lists.
   - The adapters then refresh the grids to reflect the new state, with selectors/styles providing the visual feedback.

12. **Architecture diagram guidance**
   - The key boxes to draw are: **Activity**, **two custom GridViews**, **two adapters**, **item bean/model**, **Android resources**, and **bundled assets/libs**.
   - The main data flow is **user input → custom grid gesture handling → model/state update → adapter refresh → UI redraw**.

Main entry points: [`src/com/example/android_pra/MainActivity.java`](https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/MainActivity.java) (MainActivity), [`res/layout/activity_main.xml`](https://github.com/xuningjack/drag_click_view/blob/master/res/layout/activity_main.xml) (Main screen), [`src/com/example/android_pra/ui/adapter/SubScribeDragViewAdapter.java`](https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/adapter/SubScribeDragViewAdapter.java) (Selected adapter), [`src/com/example/android_pra/ui/adapter/UnSubScribeAdapter.java`](https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/adapter/UnSubScribeAdapter.java) (Unselected adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App core"]
  node_mainactivity["MainActivity<br/>[MainActivity.java]"]
  node_manifest["Manifest"]
end

subgraph group_ui["Custom UI"]
  node_subscribe_grid["Drag grid<br/>custom grid"]
  node_noscroll_grid["No-scroll grid<br/>custom grid"]
  node_sub_adapter["Selected adapter"]
  node_unsub_adapter["Unselected adapter"]
end

subgraph group_data["Data model"]
  node_bean(("Item bean<br/>model<br/>[SubScribeBean.java]"))
end

subgraph group_resources["Resources"]
  node_main_layout["Main screen<br/>layout<br/>[activity_main.xml]"]
  node_item_layout["Item view<br/>layout"]
  node_btn_selector["Button state<br/>drawable selector"]
  node_font_selector["Text state<br/>drawable selector"]
  node_strings["Strings<br/>resources<br/>[strings.xml]"]
  node_colors["Colors<br/>resources<br/>[colors.xml]"]
  node_styles["Styles<br/>resources<br/>[styles.xml]"]
  node_styles_v11["V11 styles<br/>resources<br/>[styles.xml]"]
  node_styles_v14["V14 styles<br/>resources<br/>[styles.xml]"]
end

subgraph group_bundled["Bundled assets"]
  node_web_asset["Web asset<br/>[web.html]"]
  node_dex_asset["Dex asset<br/>[classes.dex]"]
  node_common_jar["Common jar<br/>asset<br/>[common.jar]"]
  node_support_v4["Support v4"]
  node_gson["Gson<br/>[gson-2.2.4.jar]"]
end

node_mainactivity -->|"inflates"| node_main_layout
node_mainactivity -->|"configures"| node_subscribe_grid
node_mainactivity -->|"configures"| node_noscroll_grid
node_mainactivity -->|"attaches"| node_sub_adapter
node_mainactivity -->|"attaches"| node_unsub_adapter
node_sub_adapter -->|"binds"| node_bean
node_unsub_adapter -->|"binds"| node_bean
node_subscribe_grid -->|"renders"| node_sub_adapter
node_noscroll_grid -->|"renders"| node_unsub_adapter
node_subscribe_grid -->|"toggles"| node_bean
node_noscroll_grid -->|"toggles"| node_bean
node_sub_adapter -->|"inflates"| node_item_layout
node_unsub_adapter -->|"inflates"| node_item_layout
node_item_layout -->|"styles"| node_btn_selector
node_item_layout -->|"styles"| node_font_selector
node_main_layout -->|"uses"| node_styles
node_main_layout -->|"uses"| node_strings
node_main_layout -->|"uses"| node_colors
node_styles -->|"overridden by"| node_styles_v11
node_styles -->|"overridden by"| node_styles_v14
node_mainactivity -->|"declared in"| node_manifest
node_mainactivity -.->|"depends on"| node_support_v4
node_mainactivity -.->|"depends on"| node_gson
node_mainactivity -.->|"may load"| node_web_asset
node_mainactivity -.->|"bundles"| node_dex_asset
node_mainactivity -.->|"bundles"| node_common_jar

click node_mainactivity "https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/MainActivity.java"
click node_main_layout "https://github.com/xuningjack/drag_click_view/blob/master/res/layout/activity_main.xml"
click node_subscribe_grid "https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/SubscribeDragGridView.java"
click node_noscroll_grid "https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/NoScrollGridView.java"
click node_sub_adapter "https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/adapter/SubScribeDragViewAdapter.java"
click node_unsub_adapter "https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/adapter/UnSubScribeAdapter.java"
click node_bean "https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/bean/SubScribeBean.java"
click node_item_layout "https://github.com/xuningjack/drag_click_view/blob/master/res/layout/subscribe_category_item.xml"
click node_btn_selector "https://github.com/xuningjack/drag_click_view/blob/master/res/drawable/btn_bg_selector.xml"
click node_font_selector "https://github.com/xuningjack/drag_click_view/blob/master/res/drawable/my_item_font_color_selector.xml"
click node_strings "https://github.com/xuningjack/drag_click_view/blob/master/res/values/strings.xml"
click node_colors "https://github.com/xuningjack/drag_click_view/blob/master/res/values/colors.xml"
click node_styles "https://github.com/xuningjack/drag_click_view/blob/master/res/values/styles.xml"
click node_styles_v11 "https://github.com/xuningjack/drag_click_view/blob/master/res/values-v11/styles.xml"
click node_styles_v14 "https://github.com/xuningjack/drag_click_view/blob/master/res/values-v14/styles.xml"
click node_web_asset "https://github.com/xuningjack/drag_click_view/blob/master/assets/web.html"
click node_dex_asset "https://github.com/xuningjack/drag_click_view/blob/master/assets/classes.dex"
click node_common_jar "https://github.com/xuningjack/drag_click_view/blob/master/assets/common.jar"
click node_support_v4 "https://github.com/xuningjack/drag_click_view/blob/master/libs/android-support-v4.jar"
click node_gson "https://github.com/xuningjack/drag_click_view/blob/master/libs/gson-2.2.4.jar"
click node_manifest "https://github.com/xuningjack/drag_click_view/blob/master/AndroidManifest.xml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mainactivity,node_manifest toneBlue
class node_subscribe_grid,node_noscroll_grid,node_sub_adapter,node_unsub_adapter toneAmber
class node_bean toneMint
class node_main_layout,node_item_layout,node_btn_selector,node_font_selector,node_strings,node_colors,node_styles,node_styles_v11,node_styles_v14 toneRose
class node_web_asset,node_dex_asset,node_common_jar,node_support_v4,node_gson toneIndigo
```

## Components

### App core

Entry activity and primary UI flow

- [MainActivity](https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/MainActivity.java): activity · App entry point; wires layout, data, and grid interactions · `src/com/example/android_pra/MainActivity.java`
- [Manifest](https://github.com/xuningjack/drag_click_view/blob/master/AndroidManifest.xml): android manifest · Declares the application and entry activity · `AndroidManifest.xml`

### Custom UI

Grid widgets and adapters

- [Drag grid](https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/SubscribeDragGridView.java): custom grid · Custom grid that supports tap and drag selection changes · `src/com/example/android_pra/ui/SubscribeDragGridView.java`
- [No-scroll grid](https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/NoScrollGridView.java): custom grid · Grid variant adapted for nested scrolling layouts · `src/com/example/android_pra/ui/NoScrollGridView.java`
- [Selected adapter](https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/adapter/SubScribeDragViewAdapter.java): adapter · Binds subscribed items to the selected grid · `src/com/example/android_pra/ui/adapter/SubScribeDragViewAdapter.java`
- [Unselected adapter](https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/adapter/UnSubScribeAdapter.java): adapter · Binds available items to the unselected grid · `src/com/example/android_pra/ui/adapter/UnSubScribeAdapter.java`

### Data model

Item state used by the grids

- [Item bean](https://github.com/xuningjack/drag_click_view/blob/master/src/com/example/android_pra/ui/bean/SubScribeBean.java): model · Grid item state and display data · `src/com/example/android_pra/ui/bean/SubScribeBean.java`

### Resources

Layouts, drawables, and values driving presentation

- [Main screen](https://github.com/xuningjack/drag_click_view/blob/master/res/layout/activity_main.xml): layout · Hosts the dual-grid selection UI · `res/layout/activity_main.xml`
- [Item view](https://github.com/xuningjack/drag_click_view/blob/master/res/layout/subscribe_category_item.xml): layout · Row/cell layout for grid items · `res/layout/subscribe_category_item.xml`
- [Button state](https://github.com/xuningjack/drag_click_view/blob/master/res/drawable/btn_bg_selector.xml): drawable selector · Pressed/selected background styling for items · `res/drawable/btn_bg_selector.xml`
- [Text state](https://github.com/xuningjack/drag_click_view/blob/master/res/drawable/my_item_font_color_selector.xml): drawable selector · Stateful text color styling for item labels · `res/drawable/my_item_font_color_selector.xml`
- [Strings](https://github.com/xuningjack/drag_click_view/blob/master/res/values/strings.xml): resources · User-facing text constants · `res/values/strings.xml`
- [Colors](https://github.com/xuningjack/drag_click_view/blob/master/res/values/colors.xml): resources · Shared color palette · `res/values/colors.xml`
- [Styles](https://github.com/xuningjack/drag_click_view/blob/master/res/values/styles.xml): resources · Theme and widget styling across versions · `res/values/styles.xml`
- [V11 styles](https://github.com/xuningjack/drag_click_view/blob/master/res/values-v11/styles.xml): resources · API-specific style overrides · `res/values-v11/styles.xml`
- [V14 styles](https://github.com/xuningjack/drag_click_view/blob/master/res/values-v14/styles.xml): resources · API-specific style overrides · `res/values-v14/styles.xml`

### Bundled assets

Prebuilt assets and external libraries

- [Web asset](https://github.com/xuningjack/drag_click_view/blob/master/assets/web.html): asset · Bundled HTML asset included with the app · `assets/web.html`
- [Dex asset](https://github.com/xuningjack/drag_click_view/blob/master/assets/classes.dex): asset · Prebuilt dex payload bundled in assets · `assets/classes.dex`
- [Common jar](https://github.com/xuningjack/drag_click_view/blob/master/assets/common.jar): asset · Bundled precompiled jar asset · `assets/common.jar`
- [Support v4](https://github.com/xuningjack/drag_click_view/blob/master/libs/android-support-v4.jar): library · Backwards-compatible Android support library · `libs/android-support-v4.jar`
- [Gson](https://github.com/xuningjack/drag_click_view/blob/master/libs/gson-2.2.4.jar): library · JSON serialization library available to the app · `libs/gson-2.2.4.jar`

## Connections

- MainActivity → Main screen: inflates · Activity loads the main screen layout
- MainActivity → Drag grid: configures · Activity wires the draggable selected grid
- MainActivity → No-scroll grid: configures · Activity wires the companion grid
- MainActivity → Selected adapter: attaches · Selected items are rendered through the selected adapter
- MainActivity → Unselected adapter: attaches · Unselected items are rendered through the unselected adapter
- Selected adapter → Item bean: binds · Selected adapter reads item data and state
- Unselected adapter → Item bean: binds · Unselected adapter reads item data and state
- Drag grid → Selected adapter: renders · Custom grid displays the selected adapter contents
- No-scroll grid → Unselected adapter: renders · Companion grid displays the unselected adapter contents
- Drag grid → Item bean: toggles · Drag and tap interactions move or reclassify items
- No-scroll grid → Item bean: toggles · Tap interactions update item state for the other grid
- Selected adapter → Item view: inflates · Adapter uses the item cell layout
- Unselected adapter → Item view: inflates · Adapter uses the item cell layout
- Item view → Button state: styles · Cell background reacts to pressed/selected state
- Item view → Text state: styles · Cell label color reacts to state
- Main screen → Styles: uses · Main screen styling comes from shared styles
- Main screen → Strings: uses · Main screen text comes from string resources
- Main screen → Colors: uses · Main screen palette comes from color resources
- Styles → V11 styles: overridden by · Version-specific style variants extend the base theme
- Styles → V14 styles: overridden by · Version-specific style variants extend the base theme
- MainActivity → Manifest: declared in · Activity is registered as the app entry point
- MainActivity → Support v4: depends on · Activity code can use support library APIs
- MainActivity → Gson: depends on · JSON library is available for app data handling
- MainActivity → Web asset: may load · Bundled HTML asset is available at runtime
- MainActivity → Dex asset: bundles · Prebuilt dex is packaged with the app assets
- MainActivity → Common jar: bundles · Precompiled jar is packaged with the app assets
