# huancheng65/fuckzhihublindwatermark architecture

> Architecture diagram of the GitHub repository huancheng65/fuckzhihublindwatermark, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/huancheng65/fuckzhihublindwatermark
- Repository: https://github.com/huancheng65/fuckzhihublindwatermark

## Overview

##### Project type and purpose
- This is an Android “hook” application (an Xposed/YukiHook-based module) whose purpose is to remove the blind watermark that Zhihu v8.26.0 adds to answers and ideas pages.
- It consists of two runtime roles:
a. A background hook module that runs inside the Zhihu process (via Xposed or YukihookApi).
b. A small Android UI application for user settings (MainActivity).

##### File structure
- Top‐level:
- build.gradle, settings.gradle, gradle wrapper → standard Android/Gradle build.
- app/ → the main Android module.
- app/src/main/assets/
- xposed_init & yukihookapi_init → instructs the hook framework to load this module.
- app/src/main/java/com/huanchengfly/fuck/zhihu/watermark/
- application/DefaultApplication.kt → custom Application class loaded into the Zhihu process.
- hook/HookEntry.kt → entry point that registers hook functions.
- ui/activity/MainActivity.kt → settings UI.
- utils/factory/FunctionFactory.kt → builds and registers individual hook routines (e.g., intercept image rendering).
- app/src/main/res/ → layouts, drawables, strings, themes for the UI.
- androidTest & test/ → instrumentation and unit tests.

##### README for additional insights
- “Remove Zhihu’s new blind watermark. Tested on Zhihu 8.26.0.”

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Platform
    AndroidOS["Android OS"]:::platform

    %% Target App
    ZhihuApp["Zhihu App"]:::platform

    %% Injection Framework
    Xposed["Xposed/YukiHookApi Framework"]:::injection

    %% Hook Module
    subgraph "Hook Module" 
        direction TB
        DefaultApp["DefaultApplication\n(initializes hook)"]:::hook
        HookEntryNode["HookEntry\n(registers hook functions)"]:::hook
        FuncFactory["FunctionFactory\n(defines hook routines)"]:::hook
        ExtHelpers["Ext.kt\n(extension helpers)"]:::hook
    end

    %% Assets
    subgraph "Injection Descriptors" 
        direction TB
        XposedInit["xposed_init"]:::injection
        YukiInit["yukihookapi_init"]:::injection
    end

    %% UI Module
    subgraph "Settings UI Module"
        direction TB
        MainActivityNode["MainActivity"]:::ui
        BaseActivityNode["BaseActivity"]:::ui
        MaterialSwitchNode["MaterialSwitch"]:::ui
        LayoutActivityMain["activity_main.xml"]:::ui
        SettingsXML["settings.xml"]:::ui
        subgraph "UI Resources"
            direction TB
            StringsXML["strings.xml"]:::ui
            ThemesXML["themes.xml"]:::ui
            ColorsXML["colors.xml"]:::ui
            DrawableDir["drawable/…"]:::ui
        end
    end

    %% Storage
    SharedPrefs["SharedPreferences"]:::storage

    %% Connections - Injection Flow
    AndroidOS -->|"Launches"| ZhihuApp
    ZhihuApp -->|"Injected by"| Xposed
    XposedInit -->|"Descriptor for Xposed"| Xposed
    YukiInit -->|"Descriptor for Yukihook"| Xposed
    Xposed -->|"Loads module via init"| DefaultApp
    DefaultApp -->|"calls initHooks()"| HookEntryNode
    HookEntryNode -->|"uses factory"| FuncFactory
    FuncFactory -->|"calls helpers"| ExtHelpers
    FuncFactory -->|"Override Bitmap.draw()"| ZhihuApp

    %% Connections - Configuration Flow
    MainActivityNode -->|"reads/writes"| SharedPrefs
    BaseActivityNode --> MainActivityNode
    MaterialSwitchNode --> MainActivityNode
    SharedPrefs -->|"read toggles at runtime"| HookEntryNode
    SharedPrefs -->|"read toggles at runtime"| FuncFactory

    %% Click Events
    click DefaultApp "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/java/com/huanchengfly/fuck/zhihu/watermark/application/DefaultApplication.kt"
    click HookEntryNode "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/java/com/huanchengfly/fuck/zhihu/watermark/hook/HookEntry.kt"
    click FuncFactory "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/java/com/huanchengfly/fuck/zhihu/watermark/utils/factory/FunctionFactory.kt"
    click ExtHelpers "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/java/com/huanchengfly/fuck/zhihu/watermark/Ext.kt"
    click XposedInit "https://github.com/huancheng65/fuckzhihublindwatermark/tree/main/app/src/main/assets/xposed_init"
    click YukiInit "https://github.com/huancheng65/fuckzhihublindwatermark/tree/main/app/src/main/assets/yukihookapi_init"
    click MainActivityNode "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/java/com/huanchengfly/fuck/zhihu/watermark/ui/activity/MainActivity.kt"
    click BaseActivityNode "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/java/com/huanchengfly/fuck/zhihu/watermark/ui/activity/base/BaseActivity.kt"
    click MaterialSwitchNode "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/java/com/huanchengfly/fuck/zhihu/watermark/ui/view/MaterialSwitch.kt"
    click LayoutActivityMain "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/res/layout/activity_main.xml"
    click SettingsXML "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/res/xml/settings.xml"
    click StringsXML "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/res/values/strings.xml"
    click ThemesXML "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/res/values/themes.xml"
    click ColorsXML "https://github.com/huancheng65/fuckzhihublindwatermark/blob/main/app/src/main/res/values/colors.xml"
    click DrawableDir "https://github.com/huancheng65/fuckzhihublindwatermark/tree/main/app/src/main/res/drawable/"

    %% Styles
    classDef platform fill:#cccccc,stroke:#333,stroke-width:1px
    classDef injection fill:#ffcc66,stroke:#333,stroke-width:1px
    classDef hook fill:#99cc99,stroke:#333,stroke-width:1px
    classDef ui fill:#d9b3ff,stroke:#333,stroke-width:1px
    classDef storage fill:#66ccff,stroke:#333,stroke-width:1px
```
