├── .github
└── workflows
│ └── codeql-analysis.yml
├── .gitignore
├── .idea
└── copyright
│ ├── fei_android_gpl.xml
│ └── profiles_settings.xml
├── LICENSE
├── README.md
├── aboutconfig
└── libraries
│ └── lib_opencc_android.json
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-playstore.png
│ ├── java
│ └── com
│ │ └── iatfei
│ │ └── tsconverter
│ │ ├── AboutActivity.java
│ │ ├── ChineseTypes.kt
│ │ ├── Constant.java
│ │ ├── ConvTileService.java
│ │ ├── ConvertPopupActivity.java
│ │ ├── ConvertUtils.java
│ │ ├── FirstStartupActivity.kt
│ │ ├── MainActivity.java
│ │ ├── OpenSourceActivity.kt
│ │ ├── SettingsActivity.java
│ │ └── SimpleConvert.kt
│ └── res
│ ├── drawable-hdpi
│ ├── tutorial_textselection_1.webp
│ ├── tutorial_textselection_2.webp
│ └── tutorial_textselection_3.webp
│ ├── drawable-mdpi
│ ├── tutorial_textselection_1.webp
│ ├── tutorial_textselection_2.webp
│ └── tutorial_textselection_3.webp
│ ├── drawable-xhdpi
│ ├── tutorial_textselection_1.webp
│ ├── tutorial_textselection_2.webp
│ └── tutorial_textselection_3.webp
│ ├── drawable-xxhdpi
│ ├── tutorial_textselection_1.webp
│ ├── tutorial_textselection_2.webp
│ └── tutorial_textselection_3.webp
│ ├── drawable-xxxhdpi
│ ├── tutorial_textselection_1.webp
│ ├── tutorial_textselection_2.webp
│ └── tutorial_textselection_3.webp
│ ├── drawable
│ ├── ic_applogo_intro.xml
│ ├── ic_baseline_info_24.xml
│ ├── ic_baseline_refresh_24.xml
│ ├── ic_launcher_background.xml
│ └── ic_launcher_foreground.xml
│ ├── layout-land
│ ├── activity_main.xml
│ └── content_main.xml
│ ├── layout
│ ├── activity_about.xml
│ ├── activity_convert.xml
│ ├── activity_convert_empty.xml
│ ├── activity_convert_simp.xml
│ ├── activity_convert_simple.xml
│ ├── activity_convert_trad.xml
│ ├── activity_main.xml
│ ├── activity_open_source.xml
│ ├── activity_settings.xml
│ ├── content_main.xml
│ └── view_preference_switch.xml
│ ├── menu
│ └── menu_main.xml
│ ├── mipmap-anydpi-v26
│ └── ic_launcher.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── raw
│ └── charmap.bin
│ ├── resources.properties
│ ├── values-en-rUS
│ └── strings.xml
│ ├── values-night
│ ├── color.xml
│ └── styles.xml
│ ├── values-v28
│ └── styles.xml
│ ├── values-zh-rCN
│ └── strings.xml
│ ├── values
│ ├── arrays.xml
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
│ └── xml
│ ├── about.xml
│ ├── backup_descriptor.xml
│ └── settings.xml
├── banner.xcf
├── build.gradle
├── fastlane
└── metadata
│ └── android
│ ├── en-US
│ ├── changelogs
│ │ ├── 15.txt
│ │ └── 18.txt
│ ├── full_description.txt
│ ├── images
│ │ ├── featureGraphic.png
│ │ ├── icon.png
│ │ └── phoneScreenshots
│ │ │ ├── 1.png
│ │ │ ├── 2.png
│ │ │ ├── 4.png
│ │ │ └── 5.png
│ ├── short_description.txt
│ └── title.txt
│ ├── zh-CN
│ ├── changelogs
│ │ ├── 15.txt
│ │ └── 18.txt
│ ├── full_description.txt
│ ├── images
│ │ ├── featureGraphic.png
│ │ ├── icon.png
│ │ └── phoneScreenshots
│ │ │ ├── 1.png
│ │ │ ├── 2.png
│ │ │ ├── 3.png
│ │ │ └── 4.png
│ ├── short_description.txt
│ └── title.txt
│ └── zh-TW
│ ├── changelogs
│ ├── 15.txt
│ └── 18.txt
│ ├── full_description.txt
│ ├── images
│ ├── featureGraphic.png
│ ├── icon.png
│ └── phoneScreenshots
│ │ ├── 1.png
│ │ ├── 2.png
│ │ ├── 3.png
│ │ └── 4.png
│ ├── short_description.txt
│ └── title.txt
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
├── tsconverter-icon.svg
└── util
├── ChineseTypes.kt
└── dict-gen.kt
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | name: "CodeQL"
2 |
3 | on:
4 | push:
5 | branches: [master, ]
6 | pull_request:
7 | # The branches below must be a subset of the branches above
8 | branches: [master]
9 | schedule:
10 | - cron: '0 2 * * 3'
11 |
12 | jobs:
13 | analyse:
14 | name: Analyse
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - name: Checkout repository
19 | uses: actions/checkout@v2
20 | with:
21 | # We must fetch at least the immediate parents so that if this is
22 | # a pull request then we can checkout the head.
23 | fetch-depth: 2
24 |
25 | # If this run was triggered by a pull request event, then checkout
26 | # the head of the pull request instead of the merge commit.
27 | - run: git checkout HEAD^2
28 | if: ${{ github.event_name == 'pull_request' }}
29 |
30 | # Initializes the CodeQL tools for scanning.
31 | - name: Initialize CodeQL
32 | uses: github/codeql-action/init@v1
33 | # Override language selection by uncommenting this and choosing your languages
34 | # with:
35 | # languages: go, javascript, csharp, python, cpp, java
36 |
37 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
38 | # If this step fails, then you should remove it and run the build manually (see below)
39 | - name: Autobuild
40 | uses: github/codeql-action/autobuild@v1
41 |
42 | # ℹ️ Command-line programs to run using the OS shell.
43 | # 📚 https://git.io/JvXDl
44 |
45 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
46 | # and modify them (or add more) to build your code if your project
47 | # uses a compiled language
48 |
49 | #- run: |
50 | # make bootstrap
51 | # make release
52 |
53 | - name: Perform CodeQL Analysis
54 | uses: github/codeql-action/analyze@v1
55 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Gradle files
2 | .gradle/
3 | build/
4 |
5 | # Local configuration files
6 | local.properties
7 |
8 | # Android Studio and IntelliJ IDEA files
9 | .idea/*
10 | *.iml
11 | *.iws
12 | *.ipr
13 |
14 | # unignore copyright files
15 | !.idea/copyright/
16 |
17 | # Android Studio cache
18 | #.idea/caches/
19 | #.idea/libraries/
20 | #.idea/modules.xml
21 | #.idea/workspace.xml
22 | #.idea/gradle.xml
23 | #.idea/usage.statistics.xml
24 | #.idea/dictionaries/
25 | #.idea/httpRequests/
26 |
27 | # Keystore files
28 | *.jks
29 | *.keystore
30 |
31 | # Log files
32 | *.log
33 |
34 | # OS-specific files
35 | .DS_Store
36 | Thumbs.db
37 |
38 | # Build directories
39 | app/build/
40 | */build/
41 |
42 | # Proguard configuration files
43 | # not necessary for open-source app?
44 | # proguard-rules.pro
45 |
46 | # Miscellaneous
47 | *.apk
48 | *.ap_
49 | *.dex
50 | *.class
51 |
52 | # Android NDK
53 | ndkBuild/
54 | local.properties
--------------------------------------------------------------------------------
/.idea/copyright/fei_android_gpl.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android OpenCC (Android 開放中文轉換)
2 | An implementation of OpenCC for Android for the conversion between different variants of Chinese, with auto detection & conversion.
3 |
4 | 爲 Android 使用者開發的 OpenCC 中文轉換器。支援自動轉換。
5 |
6 | My third project! Developed during the COVID-19 pandemic.
7 |
8 | Special thanks to BYVoid for the [OpenCC project](https://github.com/BYVoid/OpenCC), and qichuan for the [Android OpenCC Library](https://github.com/qichuan/android-opencc).
9 | Special thanks to Renn for code contribution.
10 |
11 | My app can be downloaded in the following three sources. Thanks to [Reproducible Builds](https://f-droid.org/docs/Reproducible_Builds/), apk from all sources are signed with my own keys, allowing cross-updates.
12 |
13 |
14 |
17 |
18 |
19 |
20 |
22 |
23 |
24 | GitHub Releases: https://github.com/fei0316/OpenCC-android-app/releases
25 |
26 | ## Features
27 |
28 | - Automatically detect Traditional or Simplified Chinese to convert automatically (Easy Mode)
29 | - 10 conversion modes (see below for details)
30 | - Convert directly by selecting text in text field, selecting the option in menu, and replaces with converted text automatically.
31 |
32 | ## Conversion Modes
33 |
34 | ### Conversion Modes chart
35 |
36 | | ID | From | To | Chinese Variant (異體) | Word Use (用詞) |
37 | |:--:|:------------------:|:---------------------:|:---------------------------------------------------:|:--------------------------------------------:|
38 | | 1 | Simplified | Traditional | OpenCC standard (OpenCC 標準) | ❌ (no conversion) |
39 | | 2 | Simplified | Traditional | Convert to Taiwan variant (臺灣正體標準) | ❌ |
40 | | 3 | Simplified | Traditional | Convert to Hong Kong variant (香港繁體標準/香港小學學習字詞表標準) | ❌ |
41 | | 4 | Simplified | Traditional | Convert to Taiwan variant (臺灣正體標準) | Convert to Taiwan phrases (臺灣常用詞彙) |
42 | | 5 | Traditional | Simplified | ❌ | ❌ |
43 | | 6 | Traditional | Simplified | Convert from Taiwan variant (臺灣正體標準) | ❌ |
44 | | 7 | Traditional | Simplified | Convert from Hong Kong variant (香港繁體標準/香港小學學習字詞表標準) | ❌ |
45 | | 8 | Traditional | Simplified | Convert from Taiwan variant (臺灣正體標準) | Convert to Mainland China phrases (中國大陸常用詞彙) |
46 | | 9 | OpenCC Traditional | Taiwan Traditional | Convert to Taiwan variant (臺灣正體標準) | ❌ |
47 | | 10 | OpenCC Traditional | Hong Kong Traditional | Convert to Hong Kong variant (香港繁體標準/香港小學學習字詞表標準) | ❌ |
48 |
49 |
50 | ### Notes on OpenCC standard
51 |
52 | **Note:** "no conversion" for Chinese variants converts inputs into the OpenCC standard, and no particular governmental standards are followed. It is based the contributors' research, and aims to avoid situations where one character in a variant can be multiple characters in another variant by splitting up as much as possible.
53 |
54 | For example, the character 「臺」 is used for 「臺灣」 while 「台」 is used for 「天台」 in Taiwan standard, but in Hong Kong standard 「台」 is used for both. In this case, the OpenCC standard adopts the Taiwanese convention when translating from Simplified Chinese where 「台」 is always used for both.
55 |
56 | **注意:**「OpenCC 標準」的異體選項代表使用 OpenCC 標準而不依照任何政府標準。OpenCC 標準由貢獻者參照各領域的漢字異體用法得出,依照「能分則不合」的原則,避免一對多的問題。
57 |
58 | 以「台/臺」舉例:
59 |
60 | | 標準 | Taiwan | Rooftop |
61 | | -------------- | -------- | -------- |
62 | | 臺灣標準 | 臺灣 | 天台 |
63 | | 香港標準 | 台灣 | 天台 |
64 | | **OpenCC標準** | **臺灣** | **天台** |
65 |
66 | ### Example
67 |
68 | #### Simplified to Traditional
69 |
70 | ##### Original
71 |
72 | ```
73 | 这个用户应该使用鼠标点击这里来查看东涌的涌浪的图片
74 | ```
75 |
76 | ##### OpenCC Traditional
77 |
78 | ```
79 | 這個用戶應該使用鼠標點擊這裏來查看東涌的涌浪的圖片
80 | ```
81 |
82 | ##### Taiwan Traditional
83 |
84 | ```
85 | 這個用戶應該使用鼠標點擊這裡來查看東湧的湧浪的圖片
86 | ```
87 |
88 | ##### Hong Kong Traditional
89 |
90 | ```
91 | 這個用户應該使用鼠標點擊這裏來查看東涌的湧浪的圖片
92 | ```
93 |
94 | ##### Taiwan Traditional with Taiwan phrases
95 |
96 | ```
97 | 這個使用者應該使用滑鼠點選這裡來檢視東湧的湧浪的圖片
98 | ```
99 |
100 | **Note:** 「涌/湧」 is an exception to the OpenCC's aim to separating as much as possible, as the contributors based their research on old literary and dictionaries and ignored the special use case in Cantonese-speaking region.
101 |
102 | **註:**「涌/湧」是 OpenCC 「能分則不合」的例外,請見 https://zhuanlan.zhihu.com/p/104314323
103 |
104 | #### Traditional to Simplified
105 |
106 | ##### Correct Simplified Chinese Result
107 |
108 | ```
109 | 我同学手中拿着一本有关自行车的名著
110 | ```
111 |
112 | | Original Traditional Chinese | From OpenCC standard | From Taiwanese | From HK | From Taiwanese (CN phrase) |
113 | | ------------------------------------------------------ | -------------------------------------------------- | ------------------------------------------ | -------------------------------------------------- | ------------------------------------------ |
114 | | 我同學手中拿**着**一本有關腳踏車的名**著** (HK style) | 我同学手中拿**着**一本有关脚踏车的名**著** | 我同学手中拿**着**一本有关脚踏车的名**著** | 我同学手中拿**着**一本有关脚踏车的名**著** | 我同学手中拿**着**一本有关自行车的名**著** |
115 | | 我同學手中拿**著**一本有關腳踏車的名**著** (TW style) | 我同学手中拿**著**一本有关脚踏车的名**著** (wrong) | 我同学手中拿**着**一本有关脚踏车的名**著** | 我同学手中拿**著**一本有关脚踏车的名**著** (wrong) | 我同学手中拿**着**一本有关自行车的名**著** |
116 |
117 | Therefore, please always choose the origin text to the best of your knowledge and double check the result. Most discrepancies are small however, as demonstrated.
118 |
119 | #### Traditional Variant Conversion
120 |
121 | ##### Original (OpenCC standard)
122 |
123 | ```
124 | 我拿着有關臺灣的名著
125 | ```
126 |
127 | ##### Hong Kong Standard
128 |
129 | ```
130 | 我拿着有關台灣的名著
131 | ```
132 |
133 | ##### Taiwan Standard
134 |
135 | ```
136 | 我拿著有關臺灣的名著
137 | ```
138 |
139 | ## Todo
140 |
141 | - Wait for qichuan to update the library for the new Hong Kong variant updates no longer based on 香港小學學習字詞表 (OpenCC pull request #418)
142 | - Japanese New Kanji support?
143 |
144 | ## How to build
145 | Just clone the repository and open it in Android Studio. It *should* work...
146 | ### Notes on Easy Mode autodetection
147 | The charmap.bin in res/raw is generated with code in util. It takes in data from OpenCC's GitHub page and compile a Serialized HashMap. Use Kotlin compiler to compile these two files and then run it to get the bin file. Change package name as needed.
148 | This part of the code is not as clean as I wanted it to be, so pull requests are welcome!
149 | ```
150 | ./kotlinc ../dict-gen.kt ./ChineseTypes.class -include-runtime -d dict-gen.jar
151 | java -jar ./dict-gen.jar
152 | ```
153 |
154 | ## Any issues?
155 |
156 | For problems related to conversion database, please open an issue in OpenCC's [GitHub page](https://github.com/BYVoid/OpenCC).
157 |
158 | Otherwise, please open an issue here.
159 |
160 | This app's version numbers follows Romantic, [Sentimental Versioning](https://github.com/dominictarr/sentimental-versioning).
161 | In the version number `x.y.z`, `x` will be updated when significant changes are made, `y` be updated when small changes are made, and `z` is reserved for minor bugfixes.
162 | So, don't ask about SemVer, it doesn't really make sense for an app like this anyway.
163 |
164 | ## Licenses
165 | ```
166 | Copyright (c) 2020-2025 Fei Kuan.
167 |
168 | This program is free software: you can redistribute it and/or modify
169 | it under the terms of the GNU General Public License as published by
170 | the Free Software Foundation, either version 3 of the License, or
171 | (at your option) any later version.
172 |
173 | This program is distributed in the hope that it will be useful,
174 | but WITHOUT ANY WARRANTY; without even the implied warranty of
175 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
176 | GNU General Public License for more details.
177 |
178 | You should have received a copy of the GNU General Public License
179 | along with this program. If not, see .
180 |
181 | ```
182 |
--------------------------------------------------------------------------------
/aboutconfig/libraries/lib_opencc_android.json:
--------------------------------------------------------------------------------
1 | {
2 | "uniqueId": "com.github.qichuan:android-opencc",
3 | "developers": [
4 | {
5 | "name": "Zhang Qichuan",
6 | "organisationUrl": "https://zhangqichuan.com/"
7 | }
8 | ],
9 | "artifactVersion": "1.2.0",
10 | "licenses": [
11 | "MIT"
12 | ],
13 | "description": "An Android library project for conversion between Traditional and Simplified Chinese ",
14 | "name": "lib-opencc-android",
15 | "website": "https://github.com/qichuan/android-opencc"
16 | }
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | //apply plugin: 'kotlin-android-extensions'
4 | apply plugin: 'com.mikepenz.aboutlibraries.plugin'
5 |
6 | android {
7 | compileSdk 35
8 | defaultConfig {
9 | manifestPlaceholders
10 | applicationId "com.iatfei.tsconverter"
11 | minSdkVersion 23
12 | targetSdkVersion 35
13 | versionCode 19
14 | versionName "3.1.1"
15 | resourceConfigurations += ['en-rUS', 'zh-rCN', 'zh-rHK', 'zh-rTW']
16 | manifestPlaceholders.appName = "@string/app_name"
17 | }
18 | buildTypes {
19 | debug {
20 | manifestPlaceholders.appName = "DEBUG-Chinese Converter"
21 | versionNameSuffix "-debug"
22 | applicationIdSuffix ".debug"
23 | }
24 | release {
25 | signingConfig null
26 | minifyEnabled true
27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
28 | }
29 | }
30 | compileOptions {
31 | sourceCompatibility JavaVersion.VERSION_17
32 | targetCompatibility JavaVersion.VERSION_17
33 | }
34 | buildFeatures {
35 | viewBinding true
36 | buildConfig true
37 | }
38 | androidResources {
39 | generateLocaleConfig true
40 | }
41 | aaptOptions {
42 | cruncherEnabled = false
43 | }
44 | namespace 'com.iatfei.tsconverter'
45 | }
46 |
47 | dependencies {
48 | implementation fileTree(dir: 'libs', include: ['*.jar'])
49 | implementation 'androidx.appcompat:appcompat:1.7.0'
50 | implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
51 | implementation 'com.google.android.material:material:1.12.0'
52 | implementation 'com.github.qichuan:android-opencc:1.2.0'
53 | implementation 'androidx.preference:preference-ktx:1.2.1'
54 | implementation "com.mikepenz:aboutlibraries:11.6.3"
55 | implementation "androidx.core:core-ktx:1.15.0"
56 | implementation "com.github.AppIntro:AppIntro:6.3.1"
57 | implementation 'androidx.preference:preference-ktx:1.2.1'
58 | implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.7'
59 | implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7'
60 | implementation 'commons-io:commons-io:2.18.0'
61 | // coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.0'
62 | constraints {
63 | implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") {
64 | because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
65 | }
66 | implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
67 | because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
68 | }
69 | }
70 | }
71 |
72 | aboutLibraries {
73 | configPath = "aboutconfig"
74 | }
75 | java {
76 | toolchain {
77 | languageVersion = JavaLanguageVersion.of(17)
78 | }
79 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | -keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | -renamesourcefileattribute SourceFile
22 |
23 | -keep class com.iatfei.tsconverter.ChineseTypes
24 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
46 |
52 |
56 |
57 |
58 |
59 |
60 |
61 |
64 |
69 |
74 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
102 |
103 |
104 |
105 |
106 |
110 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/java/com/iatfei/tsconverter/AboutActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Fei Kuan.
3 | *
4 | * This file is part of Chinese Converter
5 | * (see ).
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | package com.iatfei.tsconverter;
22 |
23 | import android.content.Intent;
24 | import android.content.pm.PackageManager;
25 | import android.net.Uri;
26 | import android.os.Bundle;
27 |
28 | import androidx.appcompat.app.ActionBar;
29 | import androidx.appcompat.app.AppCompatActivity;
30 | import com.google.android.material.appbar.MaterialToolbar;
31 | import androidx.preference.Preference;
32 | import androidx.preference.PreferenceFragmentCompat;
33 |
34 | public class AboutActivity extends AppCompatActivity {
35 |
36 | @Override
37 | protected void onCreate(Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 | setContentView(R.layout.activity_about);
40 |
41 | getSupportFragmentManager()
42 | .beginTransaction()
43 | .replace(R.id.about, new SettingsFragment())
44 | .commit();
45 |
46 | MaterialToolbar toolbar = findViewById(R.id.toolbar_about);
47 | setSupportActionBar(toolbar);
48 | ActionBar actionBar = getSupportActionBar();
49 | if (actionBar != null) {
50 | actionBar.setDisplayHomeAsUpEnabled(true);
51 | }
52 | }
53 |
54 | public static class SettingsFragment extends PreferenceFragmentCompat {
55 | @Override
56 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
57 | addPreferencesFromResource(R.xml.about);
58 |
59 | String version = BuildConfig.VERSION_NAME +
60 | //"-" + BuildConfig.FLAVOR +
61 | " v" + BuildConfig.VERSION_CODE;
62 | Preference ver = findPreference("edit_text_preference_2");
63 | if (ver != null) {
64 | ver.setSummary(version);
65 | }
66 | Preference license = findPreference("edit_text_preference_6");
67 | if (license != null) {
68 | license.setIntent(new Intent(getActivity(),OpenSourceActivity.class));
69 | }
70 |
71 | Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
72 | emailIntent.setData(Uri.parse("mailto:"));
73 | PackageManager packageManager = requireActivity().getPackageManager();
74 | if(emailIntent.resolveActivity(packageManager) == null){
75 | Preference mail = findPreference("edit_text_preference_8");
76 | if (mail != null) {
77 | mail.setIntent(null);
78 | }
79 | }
80 |
81 | Intent webpageIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.example.com"));
82 | if(webpageIntent.resolveActivity(packageManager) == null) {
83 | Preference web = findPreference("edit_text_preference_4");
84 | Preference github = findPreference("edit_text_preference_3");
85 | if (web != null) {
86 | web.setIntent(null);
87 | }
88 | if (github != null) {
89 | github.setIntent(null);
90 | }
91 | }
92 | }
93 | }
94 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/iatfei/tsconverter/ChineseTypes.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Fei Kuan.
3 | *
4 | * This file is part of Chinese Converter
5 | * (see ).
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | /*
22 | * Special thanks to Renn on GitHub who contributed to this piece of code.
23 | * Copyright (c) 2021 Renn. Released under GNU GPL v3+.
24 | */
25 |
26 | package com.iatfei.tsconverter
27 |
28 | enum class ChineseTypes {
29 | SIMPLIFIED_CHINESE,
30 | TRADITIONAL_CHINESE,
31 | JAPANESE,
32 | NONE
33 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/iatfei/tsconverter/Constant.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Fei Kuan.
3 | *
4 | * This file is part of Chinese Converter
5 | * (see ).
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | package com.iatfei.tsconverter;
22 |
23 | public class Constant {
24 | public static final int APPINTRO_LAST_UPDATE_VERSIONCODE = 18;
25 | public static final String PREF_MAIN_EASY_MODE = "main_simplemode";
26 | public static final String PREF_PREVIOUS_STARTED_VERSION = "previous_started_ver";
27 | public static final String PREF_SETTINGS_EASY_MODE = "switch_preference_1";
28 | public static final String PREF_SETTINGS_AUTODETECT_MODE = "switch_preference_2";
29 | public static final String PREF_SETTINGS_TRAD_MODE = "list_preference_1";
30 | public static final String PREF_SETTINGS_SIMP_MODE = "list_preference_2";
31 | public static final String PREF_SETTINGS_TTS_LANGUAGE = "list_preference_tts_lang";
32 | public static final String PREF_SETTINGS_UI_LANGUAGE = "list_preference_ui_lang";
33 | public static final String PREF_SETTINGS_TEXT_PROCESSING = "settings_text_processing_master_switch";
34 | public static final String PREF_SETTINGS_DELETE_TEXT = "multi_select_list_preference_1";
35 |
36 | public static final String TILE_CONVERT_INTENT_EXTRA = "fromTile";
37 |
38 | public static final String CLIPBOARD_LABEL = "ConvertedChinese";
39 |
40 | public static final String TTS_UTTERANCE_ID = "com.iatfei.tsconvert:MainActivity.editText_convert";
41 |
42 | public static final int S2T = 1;
43 | public static final int S2TW = 2;
44 | public static final int S2HK = 3;
45 | public static final int S2TWP = 4;
46 | public static final int T2S = 5;
47 | public static final int TW2S = 6;
48 | public static final int HK2S = 7;
49 | public static final int TW2SP = 8;
50 | public static final int T2TW = 9;
51 | public static final int T2HK = 10;
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/iatfei/tsconverter/ConvTileService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Fei Kuan.
3 | *
4 | * This file is part of Chinese Converter
5 | * (see ).
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | package com.iatfei.tsconverter;
22 |
23 | import android.annotation.SuppressLint;
24 | import android.app.PendingIntent;
25 | import android.content.Intent;
26 | import android.os.Build;
27 | import android.service.quicksettings.Tile;
28 | import android.service.quicksettings.TileService;
29 |
30 | import androidx.annotation.RequiresApi;
31 |
32 | @RequiresApi(api = Build.VERSION_CODES.N)
33 |
34 | public class ConvTileService extends TileService {
35 |
36 | public ConvTileService() {
37 |
38 | }
39 |
40 | @Override
41 | public void onStartListening() {
42 | Tile tile = getQsTile();
43 | if (tile != null) {
44 | tile.setState(Tile.STATE_INACTIVE);
45 | tile.updateTile();
46 | }
47 | super.onStartListening();
48 | }
49 |
50 | @SuppressLint("StartActivityAndCollapseDeprecated")
51 | @Override
52 | public void onClick() {
53 | Intent intent = new Intent(this, ConvertPopupActivity.class);
54 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
55 | intent.putExtra(Constant.TILE_CONVERT_INTENT_EXTRA, true);
56 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
57 | startActivityAndCollapse(
58 | PendingIntent.getActivity(
59 | this,
60 | 0,
61 | intent,
62 | PendingIntent.FLAG_IMMUTABLE
63 | )
64 | );
65 | } else {
66 | startActivityAndCollapse(intent);
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/iatfei/tsconverter/ConvertPopupActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Fei Kuan.
3 | *
4 | * This file is part of Chinese Converter
5 | * (see ).
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | package com.iatfei.tsconverter;
22 |
23 | import androidx.appcompat.app.AppCompatActivity;
24 | import androidx.preference.PreferenceManager;
25 |
26 | import android.content.ClipData;
27 | import android.content.ClipboardManager;
28 | import android.content.Context;
29 | import android.content.Intent;
30 | import android.content.SharedPreferences;
31 | import android.os.Bundle;
32 | import android.widget.Button;
33 | import android.widget.RadioGroup;
34 | import android.widget.Toast;
35 |
36 | import java.util.Objects;
37 |
38 | public class ConvertPopupActivity extends AppCompatActivity {
39 |
40 | boolean tileClipboardAccessRequested = false;
41 |
42 | @Override
43 | protected void onCreate(Bundle savedInstanceState) {
44 | super.onCreate(savedInstanceState);
45 |
46 | Intent intent = getIntent();
47 | String action = intent.getAction();
48 | String intentType = intent.getType();
49 |
50 | if (Intent.ACTION_SEND.equals(action) && intentType != null) {
51 | // reached here through share action
52 | CharSequence textTemp = "";
53 | if ("text/plain".equals(intentType)) {
54 | String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
55 | if (sharedText != null) {
56 | textTemp = sharedText;
57 | }
58 | }
59 | convHelper(true, false, textTemp);
60 | } else if (intent.getBooleanExtra(Constant.TILE_CONVERT_INTENT_EXTRA, false)) {
61 | // reached here through tile
62 | // open empty activity to trigger onWindowFocusChanged
63 | tileClipboardAccessRequested = true;
64 | setContentView(R.layout.activity_convert_empty);
65 | } else {
66 | // reached here through text selection menu
67 | convHelper(getIntent().getBooleanExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, false),
68 | false, getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT));
69 | }
70 | }
71 |
72 | public void onWindowFocusChanged(boolean hasFocus) {
73 | super.onWindowFocusChanged(hasFocus);
74 | // get clipboard data once in activity, then call convHelper like others
75 | if (hasFocus) {
76 | if (tileClipboardAccessRequested) {
77 | tileClipboardAccessRequested = false;
78 | ClipboardManager clipBoard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE);
79 | ClipData clipData = clipBoard.getPrimaryClip();
80 | if (clipData == null) {
81 | return;
82 | }
83 | CharSequence cs = clipData.getItemAt(0).getText();
84 | if (cs == null) {
85 | return;
86 | }
87 | String clipboardText = cs.toString();
88 | convHelper(true, true, clipboardText);
89 | }
90 | }
91 | }
92 |
93 | private void convHelper (boolean readonly, boolean quitAfterConv, CharSequence text) {
94 | SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
95 | boolean easyMode = pref.getBoolean(Constant.PREF_SETTINGS_EASY_MODE, true);
96 | boolean autodetect = pref.getBoolean(Constant.PREF_SETTINGS_AUTODETECT_MODE, true);
97 | int tradMode = Integer.parseInt(pref.getString(Constant.PREF_SETTINGS_TRAD_MODE, "0"));
98 | int simpMode = Integer.parseInt(pref.getString(Constant.PREF_SETTINGS_SIMP_MODE, "0"));
99 |
100 | if (text == null) {
101 | Toast toast = Toast.makeText(getApplicationContext(), R.string.menu_toast_unknown_error, Toast.LENGTH_SHORT);
102 | toast.show();
103 | } else {
104 | if (easyMode) {
105 | // easy mode: if detected trad/simp, convert with OpenCC; if not, ask for trad/simp then convert with OpenCC
106 | ChineseTypes type = SimpleConvert.checkString(text.toString(), getApplicationContext());
107 | if (type == ChineseTypes.TRADITIONAL_CHINESE) {
108 | convAndSet(Constant.T2S, text, readonly, quitAfterConv);
109 | } else if (type == ChineseTypes.SIMPLIFIED_CHINESE) {
110 | convAndSet(Constant.S2T, text, readonly, quitAfterConv);
111 | } else {
112 | tradSimpPopup(Constant.T2S, Constant.S2T, text, readonly, quitAfterConv);
113 | }
114 | } else if (autodetect) {
115 | // auto detect mode: if detected trad/simp, convert directly if conversion preference chosen,
116 | // otherwise present all trad or all simp options
117 | // if not detected, ask if text is simp or trad if conversion preference chosen,
118 | // otherwise present every possible options
119 | ChineseTypes type = SimpleConvert.checkString(text.toString(), getApplicationContext());
120 | if (type == ChineseTypes.TRADITIONAL_CHINESE) {
121 | if (tradMode == 0) {
122 | tradPopup(text, readonly, quitAfterConv);
123 | } else {
124 | convAndSet(tradMode, text, readonly, quitAfterConv);
125 | }
126 | } else if (type == ChineseTypes.SIMPLIFIED_CHINESE) {
127 | if (simpMode == 0) {
128 | simpPopup(text, readonly, quitAfterConv);
129 | } else {
130 | convAndSet(simpMode, text, readonly, quitAfterConv);
131 | }
132 | } else {
133 | if (tradMode == 0 || simpMode == 0) {
134 | allOptionsPopup(text, readonly, quitAfterConv);
135 | } else {
136 | tradSimpPopup(tradMode, simpMode, text, readonly, quitAfterConv);
137 | }
138 | }
139 | }
140 | else {
141 | // fully manual mode: show all options
142 | allOptionsPopup(text, readonly, quitAfterConv);
143 | }
144 | }
145 | }
146 |
147 | private void tradSimpPopup (int tradType, int simpType, CharSequence text, boolean readonly, boolean quitAfterConv) {
148 | // popup when user selection of traditional or simplified text is required
149 | setContentView(R.layout.activity_convert_simple);
150 | popupSetCancelListener(quitAfterConv);
151 |
152 | Button conv_button = findViewById(R.id.button4);
153 | conv_button.setOnClickListener(v -> {
154 | RadioGroup rgPopup = findViewById(R.id.radioGroup);
155 | int id = rgPopup.getCheckedRadioButtonId();
156 | int sel;
157 | if (id == R.id.popupRadioType1) {
158 | sel = tradType; // traditional
159 | } else if (id == R.id.popupRadioType2) {
160 | sel = simpType; // simplified
161 | } else {
162 | sel = 0;
163 | }
164 | convAndSet(sel, text, readonly, quitAfterConv);
165 | });
166 | }
167 |
168 | private void tradPopup (CharSequence text, boolean readonly, boolean quitAfterConv) {
169 | // popup with only traditional options
170 | setContentView(R.layout.activity_convert_trad);
171 | popupSetCancelListener(quitAfterConv);
172 |
173 | Button conv_button = findViewById(R.id.button4);
174 | conv_button.setOnClickListener(v -> {
175 | RadioGroup rgPopup = findViewById(R.id.radioGroup);
176 | int id = rgPopup.getCheckedRadioButtonId();
177 | int sel;
178 | if (id == R.id.popupRadioType5) {
179 | sel = Constant.T2S;
180 | } else if (id == R.id.popupRadioType6) {
181 | sel = Constant.TW2S;
182 | } else if (id == R.id.popupRadioType7) {
183 | sel = Constant.HK2S;
184 | } else if (id == R.id.popupRadioType8) {
185 | sel = Constant.TW2SP;
186 | } else if (id == R.id.popupRadioType9) {
187 | sel = Constant.T2TW;
188 | } else if (id == R.id.popupRadioType10) {
189 | sel = Constant.T2HK;
190 | } else {
191 | sel = 0;
192 | }
193 | convAndSet(sel, text, readonly, quitAfterConv);
194 | });
195 | }
196 |
197 | private void simpPopup (CharSequence text, boolean readonly, boolean quitAfterConv) {
198 | // popup with only simplified options
199 | setContentView(R.layout.activity_convert_simp);
200 | popupSetCancelListener(quitAfterConv);
201 |
202 | Button conv_button = findViewById(R.id.button4);
203 | conv_button.setOnClickListener(v -> {
204 | RadioGroup rgPopup = findViewById(R.id.radioGroup);
205 | int id = rgPopup.getCheckedRadioButtonId();
206 | int sel;
207 | if (id == R.id.popupRadioType1) {
208 | sel = Constant.S2T;
209 | } else if (id == R.id.popupRadioType2) {
210 | sel = Constant.S2TW;
211 | } else if (id == R.id.popupRadioType3) {
212 | sel = Constant.S2HK;
213 | } else if (id == R.id.popupRadioType4) {
214 | sel = Constant.S2TWP;
215 | } else {
216 | sel = 0;
217 | }
218 | convAndSet(sel, text, readonly, quitAfterConv);
219 | });
220 | }
221 |
222 | private void allOptionsPopup (CharSequence text, boolean readonly, boolean quitAfterConv) {
223 | // popup with every single possible options
224 | setContentView(R.layout.activity_convert);
225 | popupSetCancelListener(quitAfterConv);
226 |
227 | Button conv_button = findViewById(R.id.button4);
228 | conv_button.setOnClickListener(v -> {
229 | int sel;
230 | RadioGroup rgPopup = findViewById(R.id.radioGroup);
231 | int id = rgPopup.getCheckedRadioButtonId();
232 | if (id == R.id.popupRadioType1) {
233 | sel = Constant.S2T;
234 | } else if (id == R.id.popupRadioType2) {
235 | sel = Constant.S2TW;
236 | } else if (id == R.id.popupRadioType3) {
237 | sel = Constant.S2HK;
238 | } else if (id == R.id.popupRadioType4) {
239 | sel = Constant.S2TWP;
240 | } else if (id == R.id.popupRadioType5) {
241 | sel = Constant.T2S;
242 | } else if (id == R.id.popupRadioType6) {
243 | sel = Constant.TW2S;
244 | } else if (id == R.id.popupRadioType7) {
245 | sel = Constant.HK2S;
246 | } else if (id == R.id.popupRadioType8) {
247 | sel = Constant.TW2SP;
248 | } else if (id == R.id.popupRadioType9) {
249 | sel = Constant.T2TW;
250 | } else if (id == R.id.popupRadioType10) {
251 | sel = Constant.T2HK;
252 | } else {
253 | sel = 0;
254 | }
255 | convAndSet(sel, text, readonly, quitAfterConv);
256 | });
257 | }
258 |
259 | private void showConversionError () {
260 | Toast toast = Toast.makeText(getApplicationContext(), getString(R.string.menu_autonotdetected), Toast.LENGTH_SHORT);
261 | toast.show();
262 | }
263 |
264 | private void popupSetCancelListener (boolean quitAfterConv) {
265 | Button cancel_button = findViewById(R.id.button5);
266 | cancel_button.setOnClickListener(v -> {
267 | finish();
268 | if (quitAfterConv) {
269 | moveTaskToBack(true);
270 | }
271 | });
272 | }
273 |
274 | private void convAndSet(int sel, CharSequence text, boolean readonly, boolean quitAfterConv) {
275 | if (sel != 0) {
276 | String fromText = Objects.requireNonNull(text).toString();
277 | String resultText = ConvertUtils.openCCConv(fromText, sel, getApplicationContext());
278 |
279 | if (readonly) {
280 | // copy converted to clipboard
281 | ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
282 | ClipData clip = ClipData.newPlainText(Constant.CLIPBOARD_LABEL, resultText);
283 | clipboard.setPrimaryClip(clip);
284 | Toast toast = Toast.makeText(getApplicationContext(), R.string.menu_readonly, Toast.LENGTH_SHORT);
285 | toast.show();
286 | } else {
287 | // replace text directly
288 | Intent intent = new Intent();
289 | intent.putExtra(Intent.EXTRA_PROCESS_TEXT, resultText);
290 | setResult(RESULT_OK, intent);
291 | }
292 | } else {
293 | showConversionError();
294 | }
295 | finish();
296 | if (quitAfterConv) {
297 | moveTaskToBack(true);
298 | }
299 | }
300 | }
301 |
--------------------------------------------------------------------------------
/app/src/main/java/com/iatfei/tsconverter/ConvertUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Fei Kuan.
3 | *
4 | * This file is part of Chinese Converter
5 | * (see ).
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | package com.iatfei.tsconverter;
22 |
23 | import android.content.Context;
24 | import android.content.SharedPreferences;
25 |
26 | import com.zqc.opencc.android.lib.ChineseConverter;
27 | import com.zqc.opencc.android.lib.ConversionType;
28 |
29 | import static com.zqc.opencc.android.lib.ConversionType.*;
30 |
31 | import androidx.preference.PreferenceManager;
32 |
33 | import java.util.HashSet;
34 | import java.util.Set;
35 |
36 | class ConvertUtils {
37 |
38 | static String openCCConv(String from, int type, Context context) {
39 | ConversionType convType = findType (type);
40 | if (convType == null) {
41 | return from;
42 | }
43 | SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
44 | if (pref.getBoolean(Constant.PREF_SETTINGS_TEXT_PROCESSING, false)) {
45 | Set delSel = pref.getStringSet(Constant.PREF_SETTINGS_DELETE_TEXT, new HashSet<>());
46 | from = textProcessing(from, delSel);
47 | }
48 | return ChineseConverter.convert(from, convType, context);
49 | }
50 |
51 | private static String textProcessing(String from, Set del) {
52 | if (del.contains("space")) {
53 | from = from.replaceAll("\\p{Z}+", "");
54 | }
55 | if (del.contains("numbers")) {
56 | from = from.replaceAll("\\d", "");
57 | }
58 | if (del.contains("latin")) {
59 | from = from.replaceAll("\\p{Script=Latin}+", "");
60 | }
61 | if (del.contains("specialChar")) {
62 | from = from.replaceAll("\\p{S}", "");
63 | }
64 | if (del.contains("emptyLine")) {
65 | from = from.replaceAll("(\\r?\\n){2,}", "\n");
66 | }
67 | if (del.contains("hangul")) {
68 | from = from.replaceAll("\\p{Script=Hangul}+", "");
69 | }
70 | if (del.contains("hirakata")) {
71 | from = from.replaceAll("[\\p{IsKatakana}\\p{IsHiragana}]+", "");
72 | }
73 | if (del.contains("bopomofo")) {
74 | from = from.replaceAll("\\p{Script=Bopomofo}+", "");
75 | }
76 | if (del.contains("punctuation")) {
77 | from = from.replaceAll("\\p{P}+", "");
78 | }
79 | return from;
80 | }
81 |
82 | private static ConversionType findType(int type){
83 | return switch (type) {
84 | case Constant.S2T -> S2T;
85 | case Constant.S2TW -> S2TW;
86 | case Constant.S2HK -> S2HK;
87 | case Constant.S2TWP -> S2TWP;
88 | case Constant.T2S -> T2S;
89 | case Constant.TW2S -> TW2S;
90 | case Constant.HK2S -> HK2S;
91 | case Constant.TW2SP -> TW2SP;
92 | case Constant.T2TW -> T2TW;
93 | case Constant.T2HK -> T2HK;
94 | default -> null;
95 | };
96 | }
97 |
98 | static int radioToType (boolean t1, boolean t2, boolean t3, boolean v1, boolean v2, boolean v3, boolean v4, boolean v5, boolean i1, boolean i2, boolean i3){
99 | if (i1 && v1 && t1)
100 | return Constant.S2T;
101 | if (i1 && v2 && t1)
102 | return Constant.S2TW;
103 | if (i1 && v3 && t1)
104 | return Constant.S2HK;
105 | if (i2 && v2 && t1)
106 | return Constant.S2TWP;
107 | if (i1 && v1 && t2)
108 | return Constant.T2S;
109 | if (i1 && v4 && t2)
110 | return Constant.TW2S;
111 | if (i1 && v5 && t2)
112 | return Constant.HK2S;
113 | if (i3 && v4 && t2)
114 | return Constant.TW2SP;
115 | if (i1 && v2 && t3)
116 | return Constant.T2TW;
117 | if (i1 && v3 && t3)
118 | return Constant.T2HK;
119 | return -1;
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/app/src/main/java/com/iatfei/tsconverter/FirstStartupActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Fei Kuan.
3 | *
4 | * This file is part of Chinese Converter
5 | * (see ).
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | package com.iatfei.tsconverter
22 |
23 | import android.os.Bundle
24 | import androidx.fragment.app.Fragment
25 | import com.github.appintro.AppIntro
26 | import com.github.appintro.AppIntroFragment
27 | import androidx.core.content.edit
28 |
29 | class FirstStartupActivity : AppIntro() {
30 | override fun onCreate(savedInstanceState: Bundle?) {
31 | super.onCreate(savedInstanceState)
32 | isColorTransitionsEnabled = true
33 | setImmersiveMode()
34 |
35 | addSlide(AppIntroFragment.createInstance(
36 | title = getString(R.string.appintro_title_1),
37 | description = getString(R.string.appintro_content_1),
38 | imageDrawable = R.drawable.ic_applogo_intro,
39 | backgroundColorRes = R.color.appIntroOne
40 | ))
41 | addSlide(AppIntroFragment.createInstance(
42 | title = getString(R.string.appintro_title_2),
43 | description = getString(R.string.appintro_content_2),
44 | imageDrawable = R.drawable.ic_baseline_info_24,
45 | backgroundColorRes = R.color.appIntroTwo
46 | ))
47 | addSlide(AppIntroFragment.createInstance(
48 | title = getString(R.string.appintro_title_3_1),
49 | description = getString(R.string.appintro_content_3_1),
50 | imageDrawable = R.drawable.tutorial_textselection_1,
51 | backgroundColorRes = R.color.appIntroFour
52 | ))
53 | addSlide(AppIntroFragment.createInstance(
54 | title = getString(R.string.appintro_title_3_2),
55 | description = getString(R.string.appintro_content_3_2),
56 | imageDrawable = R.drawable.tutorial_textselection_2,
57 | backgroundColorRes = R.color.appIntroFour
58 | ))
59 | addSlide(AppIntroFragment.createInstance(
60 | title = getString(R.string.appintro_title_3_3),
61 | description = getString(R.string.appintro_content_3_3),
62 | imageDrawable = R.drawable.tutorial_textselection_3,
63 | backgroundColorRes = R.color.appIntroFour
64 | ))
65 | addSlide(AppIntroFragment.createInstance(
66 | title = getString(R.string.appintro_title_4),
67 | description = getString(R.string.appintro_content_4),
68 | imageDrawable = R.drawable.ic_applogo_intro,
69 | backgroundColorRes = R.color.appIntroThree
70 | ))
71 | }
72 |
73 | override fun onSkipPressed(currentFragment: Fragment?) {
74 | super.onSkipPressed(currentFragment)
75 |
76 | val prefs = androidx.preference.PreferenceManager.getDefaultSharedPreferences(baseContext)
77 | prefs.edit {
78 | putInt(Constant.PREF_PREVIOUS_STARTED_VERSION, BuildConfig.VERSION_CODE)
79 | }
80 | finish()
81 | }
82 |
83 | override fun onDonePressed(currentFragment: Fragment?) {
84 | super.onDonePressed(currentFragment)
85 |
86 | val prefs = androidx.preference.PreferenceManager.getDefaultSharedPreferences(baseContext)
87 | prefs.edit {
88 | putInt(Constant.PREF_PREVIOUS_STARTED_VERSION, BuildConfig.VERSION_CODE)
89 | }
90 | finish()
91 | }
92 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/iatfei/tsconverter/OpenSourceActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Fei Kuan.
3 | *
4 | * This file is part of Chinese Converter
5 | * (see ).
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | package com.iatfei.tsconverter
22 |
23 | import android.os.Bundle
24 | import androidx.appcompat.app.AppCompatActivity
25 | import com.google.android.material.appbar.MaterialToolbar
26 | import com.mikepenz.aboutlibraries.LibsBuilder
27 |
28 | class OpenSourceActivity : AppCompatActivity() {
29 |
30 | override fun onCreate(savedInstanceState: Bundle?) {
31 | super.onCreate(savedInstanceState)
32 | setContentView(R.layout.activity_open_source)
33 |
34 | val toolbar = findViewById(R.id.toolbar_opensource)
35 | setSupportActionBar(toolbar)
36 | val actionBar = supportActionBar
37 | actionBar?.setDisplayHomeAsUpEnabled(true)
38 |
39 | val fragment = LibsBuilder()
40 | .withAboutIconShown(true)
41 | .withAboutVersionShown(true)
42 | .withLicenseShown(true)
43 | .withAboutAppName(getString(R.string.app_name))
44 | .withAboutDescription("I can't believe you clicked on this! Thank you for using my app!
Special thanks to BYVoid for developing OpenCC.
願世界和平。")
45 | .supportFragment()
46 |
47 | supportFragmentManager.beginTransaction()
48 | .replace(R.id.container, fragment)
49 | .commit()
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/iatfei/tsconverter/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Fei Kuan.
3 | *
4 | * This file is part of Chinese Converter
5 | * (see ).
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | package com.iatfei.tsconverter;
22 |
23 | import android.content.SharedPreferences;
24 | import android.os.Bundle;
25 |
26 | import androidx.appcompat.app.ActionBar;
27 | import androidx.appcompat.app.AppCompatActivity;
28 | import com.google.android.material.appbar.MaterialToolbar;
29 |
30 | import androidx.appcompat.app.AppCompatDelegate;
31 | import androidx.core.os.LocaleListCompat;
32 | import androidx.preference.ListPreference;
33 | import androidx.preference.MultiSelectListPreference;
34 | import androidx.preference.PreferenceFragmentCompat;
35 | import androidx.preference.PreferenceManager;
36 | import androidx.preference.SwitchPreferenceCompat;
37 |
38 | import java.util.Arrays;
39 | import java.util.List;
40 | import java.util.Locale;
41 |
42 | public class SettingsActivity extends AppCompatActivity {
43 |
44 | @Override
45 | protected void onCreate(Bundle savedInstanceState) {
46 | super.onCreate(savedInstanceState);
47 | setContentView(R.layout.activity_settings);
48 | if (savedInstanceState == null) {
49 | getSupportFragmentManager()
50 | .beginTransaction()
51 | .replace(R.id.settings, new SettingsFragment())
52 | .commit();
53 | }
54 | MaterialToolbar toolbar = findViewById(R.id.toolbar_settings);
55 | setSupportActionBar(toolbar);
56 | ActionBar actionBar = getSupportActionBar();
57 | if (actionBar != null) {
58 | actionBar.setDisplayHomeAsUpEnabled(true);
59 | }
60 | }
61 |
62 | public static class SettingsFragment extends PreferenceFragmentCompat {
63 | @Override
64 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
65 | // todo make popups material 3
66 | addPreferencesFromResource(R.xml.settings);
67 |
68 | // finding preferences and setting initial values
69 | final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(requireContext());
70 | final SwitchPreferenceCompat simpleSwitch = findPreference(Constant.PREF_SETTINGS_EASY_MODE);
71 | final SwitchPreferenceCompat autodetectSwitch = findPreference(Constant.PREF_SETTINGS_AUTODETECT_MODE);
72 | final SwitchPreferenceCompat textProcessingSwitch = findPreference("settings_text_processing_master_switch");
73 | final ListPreference lpTraditional = findPreference(Constant.PREF_SETTINGS_TRAD_MODE);
74 | final ListPreference lpSimplified = findPreference(Constant.PREF_SETTINGS_SIMP_MODE);
75 | final MultiSelectListPreference deleteTextPref = findPreference("multi_select_list_preference_1");
76 |
77 | if (autodetectSwitch != null && lpTraditional != null && lpSimplified != null
78 | && simpleSwitch != null && textProcessingSwitch != null && deleteTextPref != null) {
79 | boolean easyMode = pref.getBoolean(Constant.PREF_SETTINGS_EASY_MODE, true);
80 | boolean autoDetect = pref.getBoolean(Constant.PREF_SETTINGS_AUTODETECT_MODE, true);
81 | boolean textProcessing = pref.getBoolean(Constant.PREF_SETTINGS_TEXT_PROCESSING, false);
82 | autodetectSwitch.setEnabled(!easyMode);
83 | lpTraditional.setEnabled(!easyMode && autoDetect);
84 | lpSimplified.setEnabled(!easyMode && autoDetect);
85 | deleteTextPref.setEnabled(textProcessing);
86 | simpleSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
87 | boolean autoDetect2 = pref.getBoolean(Constant.PREF_SETTINGS_AUTODETECT_MODE, true);
88 | boolean newValEasy = (Boolean) newValue;
89 | autodetectSwitch.setEnabled(!newValEasy);
90 | lpTraditional.setEnabled(!newValEasy && autoDetect2);
91 | lpSimplified.setEnabled(!newValEasy && autoDetect2);
92 | return true;
93 | });
94 | autodetectSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
95 | boolean newVal = (Boolean) newValue;
96 | lpTraditional.setEnabled(newVal);
97 | lpSimplified.setEnabled(newVal);
98 | return true;
99 | });
100 | textProcessingSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
101 | boolean newVal = (Boolean) newValue;
102 | deleteTextPref.setEnabled(newVal);
103 | return true;
104 | });
105 | }
106 | ListPreference langSelectorPref = findPreference(Constant.PREF_SETTINGS_UI_LANGUAGE);
107 | LocaleListCompat selectedLocaleList = AppCompatDelegate.getApplicationLocales();
108 | List supportedLocaleIDs = Arrays.asList(getResources().getStringArray(R.array.ui_lang_settings_languages_vals));
109 | List supportedLocale = Arrays.asList(getResources().getStringArray(R.array.ui_lang_settings_languages));
110 | if (langSelectorPref != null ) {
111 | if (selectedLocaleList.isEmpty()) {
112 | // no language override selected
113 | langSelectorPref.setSummary(supportedLocale.get(0));
114 | langSelectorPref.setValueIndex(0);
115 | } else {
116 | Locale selectedLocale = selectedLocaleList.get(0);
117 | String selectedLocaleString = selectedLocale != null ? selectedLocale.toLanguageTag() : "";
118 | if (selectedLocaleString.equals("und")) {
119 | // no language override selected, happens on Android 6?
120 | langSelectorPref.setSummary(supportedLocale.get(0));
121 | langSelectorPref.setValueIndex(0);
122 | } else if (supportedLocaleIDs.contains(selectedLocaleString)) {
123 | // language override selected. matches an item in the preference language list
124 | langSelectorPref.setValue(selectedLocaleString);
125 | langSelectorPref.setSummary(getResources()
126 | .getStringArray(R.array.ui_lang_settings_languages)
127 | [supportedLocaleIDs.indexOf(selectedLocaleString)]);
128 | } else {
129 | // language override selected. does not match an item in our list (probably selected from system settings)
130 | langSelectorPref.setValue(null);
131 | langSelectorPref.setSummary(selectedLocaleString);
132 | }
133 | }
134 | langSelectorPref.setOnPreferenceChangeListener((preference, newValue) -> {
135 | LocaleListCompat newLocale = LocaleListCompat.forLanguageTags(newValue.toString());
136 | AppCompatDelegate.setApplicationLocales(newLocale);
137 | return true;
138 | });
139 | }
140 | }
141 | }
142 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/iatfei/tsconverter/SimpleConvert.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Fei Kuan.
3 | *
4 | * This file is part of Chinese Converter
5 | * (see ).
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | /*
22 | * Special thanks to Renn on GitHub who contributed to this piece of code.
23 | * Copyright (c) 2021 Renn. Released under GNU GPL v3+.
24 | */
25 |
26 | package com.iatfei.tsconverter
27 |
28 | import android.content.Context
29 | import android.os.Build
30 | import java.io.ObjectInputStream
31 |
32 | object SimpleConvert {
33 | private var charMap = HashMap()
34 |
35 | private fun loadMap(c: Context) {
36 | val objectInput = ObjectInputStream(c.resources.openRawResource(R.raw.charmap))
37 | val readFile = objectInput.readObject()
38 | charMap = readFile as HashMap
39 | objectInput.close()
40 | }
41 |
42 | @JvmStatic
43 | fun checkString(str: String, c: Context): ChineseTypes {
44 | // Idea: find the first unique Simplified/Traditional character (i.e. that character only exists in Traditional/Simplified)
45 | // Approach: The HashMap contains all Unicode code points of unique Trad/Simp characters and whether it's Trad or Simp,
46 | // just search through the map.
47 | if (charMap.size < 2) {
48 | // if charMap is empty, load it
49 | loadMap(c)
50 | }
51 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
52 | val codePoints = StringBuilder(str).codePoints()
53 | for (codePoint in codePoints) {
54 | val tempResult = charMap[codePoint]
55 | if (tempResult != null) {
56 | return tempResult
57 | }
58 | }
59 | } else {
60 | // old approach which does not support surrogates (beyond BMP)
61 | for (i in str.indices) {
62 | val tempCodePoint = Character.codePointAt(str, i)
63 | if (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF) {
64 | val tempResult = charMap[tempCodePoint]
65 | if (tempResult != null) {
66 | return tempResult
67 | }
68 | }
69 | }
70 | }
71 | return ChineseTypes.NONE
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/tutorial_textselection_1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-hdpi/tutorial_textselection_1.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/tutorial_textselection_2.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-hdpi/tutorial_textselection_2.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/tutorial_textselection_3.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-hdpi/tutorial_textselection_3.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/tutorial_textselection_1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-mdpi/tutorial_textselection_1.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/tutorial_textselection_2.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-mdpi/tutorial_textselection_2.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/tutorial_textselection_3.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-mdpi/tutorial_textselection_3.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/tutorial_textselection_1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-xhdpi/tutorial_textselection_1.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/tutorial_textselection_2.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-xhdpi/tutorial_textselection_2.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/tutorial_textselection_3.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-xhdpi/tutorial_textselection_3.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/tutorial_textselection_1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-xxhdpi/tutorial_textselection_1.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/tutorial_textselection_2.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-xxhdpi/tutorial_textselection_2.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/tutorial_textselection_3.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-xxhdpi/tutorial_textselection_3.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/tutorial_textselection_1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-xxxhdpi/tutorial_textselection_1.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/tutorial_textselection_2.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-xxxhdpi/tutorial_textselection_2.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/tutorial_textselection_3.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/drawable-xxxhdpi/tutorial_textselection_3.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_applogo_intro.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
26 |
30 |
32 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_info_24.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_refresh_24.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
26 |
30 |
32 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout-land/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
26 |
27 |
31 |
32 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_about.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
25 |
26 |
30 |
31 |
36 |
37 |
38 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_convert.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
30 |
31 |
35 |
36 |
39 |
40 |
50 |
51 |
56 |
57 |
63 |
64 |
69 |
70 |
75 |
76 |
81 |
82 |
88 |
89 |
94 |
95 |
100 |
101 |
106 |
107 |
112 |
113 |
119 |
120 |
125 |
126 |
131 |
132 |
133 |
134 |
140 |
141 |
152 |
153 |
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_convert_empty.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_convert_simp.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
29 |
30 |
33 |
34 |
37 |
38 |
48 |
49 |
54 |
55 |
61 |
62 |
67 |
68 |
73 |
74 |
79 |
80 |
81 |
82 |
88 |
89 |
100 |
101 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_convert_simple.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
29 |
30 |
33 |
34 |
37 |
38 |
48 |
49 |
54 |
55 |
61 |
62 |
67 |
68 |
69 |
70 |
76 |
77 |
88 |
89 |
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_convert_trad.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
29 |
30 |
33 |
36 |
46 |
47 |
53 |
54 |
59 |
60 |
65 |
66 |
71 |
72 |
77 |
78 |
84 |
85 |
90 |
91 |
96 |
97 |
98 |
104 |
105 |
116 |
117 |
128 |
129 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
26 |
27 |
31 |
32 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_open_source.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
26 |
27 |
31 |
32 |
37 |
38 |
39 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
25 |
26 |
30 |
31 |
36 |
37 |
38 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_preference_switch.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/raw/charmap.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/app/src/main/res/raw/charmap.bin
--------------------------------------------------------------------------------
/app/src/main/res/resources.properties:
--------------------------------------------------------------------------------
1 | unqualifiedResLocale=zh-Hant-HK
--------------------------------------------------------------------------------
/app/src/main/res/values-en-rUS/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 | Chinese Converter
24 | Enter text here…
25 | Chinese Convert
26 | Converted text has been copied to the clipboard
27 | Convert
28 | Clear
29 | Simp. to Trad.
30 | Trad. to Simp.
31 | Convert between Trad. variants
32 | From Taiwan
33 | From Hong Kong
34 | To Taiwan
35 | To Hong Kong
36 | No conversion
37 | Taiwan
38 | Variant Characters
39 | Vocabulary
40 | Type
41 | Mainland Chinese
42 | About
43 | Select conversion type…
44 | Ask every time
45 | Simp. to OpenCC Trad. (default)
46 | Simp. to Trad. (TW variant)
47 | Simp. to Trad. (HK variant)
48 | Simp. to Trad. (TW variant and phrases)
49 | OpenCC Trad. to Simp. (default)
50 | Trad. (TW variant) to Simp.
51 | Trad. (HK variant) to Simp.
52 | Trad. (TW variant) to Simp. (CN phrases)
53 | OpenCC Trad. to Trad. (TW variant)
54 | OpenCC Trad. to Trad. (HK variant)
55 | Simplified Chinese to Traditional Chinese
56 | Traditional to Simplified Chinese
57 | Hong Kong-Taiwan variants conversion
58 | OpenCC (recommended)
59 |
60 | An unknown error occurred.
61 | No file manager found!
62 | File I/O error!
63 |
64 | Cancel
65 | About
66 |
67 | File
68 | Save File
69 |
70 | OpenCC Simplified-Traditional Chinese converter for Android
71 | Version
72 | Development
73 | Fei Kuan on Android Studio, during COVID-19 pandemic in May 2020.
74 | Developed by
75 | Visit my site
76 | Contact me
77 | This application is licensed under the GNU General Public License Version 3 or later. This license allows you to freely redistribute and/or modify this application under certain conditions. Click to visit my GitHub page for source code and license details.
78 | Source Code
79 | Open Source Licenses
80 | About this App
81 | Developed in celebration of what makes us different, yet together.
82 | Welcome!
83 | Convert between Traditional and Simplified Chinese with ease, with support for regional word use preferences!
84 | Recommendations…
85 | Thanks for using my app!
86 | This is my second app project, made possible by the amazing contributors to the OpenCC project. Due to the complicated nature of natural languages, errors can exist, and proofreading is necessary.
87 | Easy Mode is recommended if you do not have specific requirements.
88 | Convert directly in-app! (1)
89 | Convert directly in-app! (2)
90 | Convert directly in-app! (3)
91 | "Select text anywhere and choose \“Chinese Convert\” to convert in place!\n\nNOTE: Some apps such as WeChat and LINE might not support this method. "
92 | "You can also choose \“Share\” then \“Chinese Convert\”, and pasted the converted text anywhere."
93 | "You can also add a tile to your Quick Settings panel. Copy text and select the \“Chinese Convert\” tile and paste the converted text anywhere."
94 | Tutorial
95 | Contributors
96 | Easy Mode suggestion and code contribution: Renn
97 | Settings
98 | Text selection menu
99 | When converting through text selection menu, autodetect Traditional/Simplified and convert using OpenCC Standard
100 | Easy Mode
101 |
102 |
103 | - Ask every time
104 | - OpenCC Trad. to Simp. (default)
105 | - Trad. (TW variant) to Simp.
106 | - Trad. (HK variant) to Simp.
107 | - Trad. (TW variant) to Simp. (CN phrases)
108 | - OpenCC Trad. to Trad. (TW variant)
109 | - OpenCC Trad. to Trad. (HK variant)
110 |
111 |
112 | - Ask every time
113 | - Simp. to OpenCC Trad. (default)
114 | - Simp. to Trad. (TW variant)
115 | - Simp. to Trad. (HK variant)
116 | - Simp. to Trad. (TW variant and phrases)
117 |
118 | When text is Simplified
119 | When text is Traditional
120 | Autodetect Trad./Simp.
121 | When using text selection menu, autodetect Traditional/Simplified and convert with preference below
122 | Text is not Chinese or can be either Traditional or Simplified
123 | Traditional/Simplified detection failed, please choose manually:
124 |
125 | Start Reading Aloud
126 | Stop Reading Aloud
127 | Start/Stop Reading Aloud
128 | Language Settings
129 | Text-to-Speech Language
130 | Read Aloud failed. Please check device Text-to-Speech settings.
131 |
132 | - Mandarin (Taiwan)
133 | - Cantonese (Hong Kong)
134 | - Mandarin (China)
135 |
136 |
137 |
138 | - System Default
139 | - Traditional Chinese
140 | - Simplified Chinese
141 | - English
142 |
143 | Interface Language
144 |
145 |
146 | - Spaces
147 | - Numbers
148 | - Latin Alphabets
149 | - Punctuations
150 | - Empty Lines
151 | - Special Characters
152 | - Hangul
153 | - Japanese Kana
154 | - Bopomofo
155 |
156 | Delete specific characters
157 | Text Processing
158 | Perform Text Processing
159 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/color.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 | #A3C9FE
24 | #00315C
25 | #1F4876
26 | #D3E4FF
27 | #A4C9FE
28 | #00315D
29 | #204876
30 | #D3E3FF
31 | #D9BDE3
32 | #3C2947
33 | #543F5E
34 | #F5D9FF
35 | #FFB4AB
36 | #690005
37 | #93000A
38 | #FFDAD6
39 | #111318
40 | #E1E2E8
41 | #111318
42 | #E1E2E8
43 | #43474E
44 | #C3C6CF
45 | #8D9199
46 | #43474E
47 | #000000
48 | #E1E2E8
49 | #2E3035
50 | #3A608F
51 | #D3E4FF
52 | #001C38
53 | #A3C9FE
54 | #1F4876
55 | #D3E3FF
56 | #001C39
57 | #A4C9FE
58 | #204876
59 | #F5D9FF
60 | #261430
61 | #D9BDE3
62 | #543F5E
63 | #111318
64 | #37393E
65 | #0C0E13
66 | #191C20
67 | #1D2024
68 | #272A2F
69 | #32353A
70 | #AACDFF
71 | #001730
72 | #6E93C5
73 | #000000
74 | #ABCDFF
75 | #001730
76 | #6E93C5
77 | #000000
78 | #DDC1E7
79 | #210E2B
80 | #A188AB
81 | #000000
82 | #FFBAB1
83 | #370001
84 | #FF5449
85 | #000000
86 | #111318
87 | #E1E2E8
88 | #111318
89 | #FBFAFF
90 | #43474E
91 | #C7CBD3
92 | #9FA3AB
93 | #7F838B
94 | #000000
95 | #E1E2E8
96 | #272A2F
97 | #204977
98 | #D3E4FF
99 | #001227
100 | #A3C9FE
101 | #053764
102 | #D3E3FF
103 | #001127
104 | #A4C9FE
105 | #063764
106 | #F5D9FF
107 | #1B0925
108 | #D9BDE3
109 | #422F4D
110 | #111318
111 | #37393E
112 | #0C0E13
113 | #191C20
114 | #1D2024
115 | #272A2F
116 | #32353A
117 | #FBFAFF
118 | #000000
119 | #AACDFF
120 | #000000
121 | #FBFAFF
122 | #000000
123 | #ABCDFF
124 | #000000
125 | #FFF9FB
126 | #000000
127 | #DDC1E7
128 | #000000
129 | #FFF9F9
130 | #000000
131 | #FFBAB1
132 | #000000
133 | #111318
134 | #E1E2E8
135 | #111318
136 | #FFFFFF
137 | #43474E
138 | #FBFAFF
139 | #C7CBD3
140 | #C7CBD3
141 | #000000
142 | #E1E2E8
143 | #000000
144 | #002B51
145 | #DAE8FF
146 | #000000
147 | #AACDFF
148 | #001730
149 | #DBE8FF
150 | #000000
151 | #ABCDFF
152 | #001730
153 | #F7DFFF
154 | #000000
155 | #DDC1E7
156 | #210E2B
157 | #111318
158 | #37393E
159 | #0C0E13
160 | #191C20
161 | #1D2024
162 | #272A2F
163 | #32353A
164 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v28/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh-rCN/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 | 中文转换
24 | 关于
25 | 请输入需转换的文本:
26 | 转换
27 | 清除
28 | 繁简转换
29 | 已转换的文本已复制到剪贴板
30 | 简体转繁体
31 | 繁体转简体
32 | 繁体异体转换
33 | 原文是台湾标准
34 | 原文是香港标准
35 | 转换为台湾标准
36 | 转换为香港标准
37 | 不转换
38 | 台湾用词
39 | 中国大陆用词
40 | 类型
41 | 异体标准
42 | 用词
43 | 请选择转换类型:
44 | (每次询问)
45 | 简体到 OpenCC 繁体(默认)
46 | 简体到台湾正体
47 | 简体到香港繁体
48 | 简体到台湾正体(包括词汇)
49 | OpenCC 繁体到简体(默认)
50 | 台湾正体到简体
51 | 香港繁体到简体
52 | 台湾正体到简体(中国大陆词汇)
53 | OpenCC 繁体转换为台湾异体
54 | OpenCC 繁体转换为香港异体
55 | 简-繁转换
56 | 繁-简转换
57 | 港台异体转换
58 |
59 | 发生了未知错误!
60 | 找不到文件管理器!
61 | 读写文档错误!
62 |
63 | 转换文档
64 | 存档
65 |
66 | 取消
67 | 关于
68 | 使用 OpenCC 的 Android 简繁转换器
69 | 版本
70 | 开发
71 | 由 Fei 在 2019 冠状病毒病疫情期间使用 Android Studio 开发,2020 年 5 月。
72 | 开发
73 | 我的网站
74 | 联系我
75 | 本软件以 GNU 通用公共许可证条款第三版(或更新版本)发布。你可以在遵守此条款的前提下自由重新发布和修改本软件。请点击以进入本程序的 GitHub 页面获得原代码和版权信息。
76 | 原代码
77 | 开放原代码授权
78 | 关于此软件
79 | "For the peace between us. "
80 | OpenCC(推荐)
81 | 建议…
82 | 感谢使用!
83 | "我的第二个自行开发软件。本软件的成功全靠 OpenCC 项目的贡献者。\n\n因自然语言的复杂性,完美转换是不可能的,因此请务必仔细检查。"
84 | 欢迎!
85 | 轻松转换繁体与简体。同时亦可转换地区用词或异体字。
86 | 如没有指定地区异体字的需求,建议使用简易模式。
87 | 在软件中直接转换!(一)
88 | 在软件中直接转换!(二)
89 | 在软件中直接转换!(三)
90 | "在软件中选取文本并点击「繁简转换」即可转换并取代原有文本。\n\n注意:某些通讯软件(如:微信、Telegram)无法使用此方式。请参考下一页的介绍。"
91 | 选取文本后也可點擊「分享」后选择「繁简转换」,并自行贴上转换后的文本。
92 | 将本软件的快速设置图块加入到快速设置面板后,拷贝任何文本后选择「繁简转换」图块,并自行贴上转换后的文本。
93 | 教学
94 | 贡献者
95 | 简易模式提议及部分代码:Renn
96 | 设置
97 | 文本选取菜单
98 | 在文本选取菜单转换时,自动检测繁简并使用OpenCC标准转换
99 | 简易模式
100 |
101 | - (每次询问)
102 | - OpenCC 繁体到简体(默认)
103 | - 台湾正体到简体
104 | - 香港繁体到简体
105 | - 台湾正体到简体(中国大陆词汇)
106 | - OpenCC 繁体转换为台湾异体
107 | - OpenCC 繁体转换为香港异体
108 |
109 |
110 | - (每次询问)
111 | - 简体到 OpenCC 繁体(默认)
112 | - 简体到台湾正体
113 | - 简体到香港繁体
114 | - 简体到台湾正体(台湾词汇)
115 |
116 | 文字侦测为简体中文时
117 | 文字侦测为繁体中文时
118 | 自动侦测繁简
119 | 在文本选取菜单转换时,自动检测繁简并使用以下模式转换
120 | 选取的文本中没有繁/简獨有字符或不是中文
121 | 无法侦测繁简,请手动选择:
122 |
123 | 开始朗读
124 | 停止朗读
125 | 开始/停止朗读
126 | 语言设定
127 | 朗读语言
128 | 朗读失败,请检查文字转语音设定
129 |
130 | - 国语(台湾)
131 | - 粤语(香港)
132 | - 普通话(中国)
133 |
134 |
135 |
136 | - 系统默认
137 | - 正体中文
138 | - 简体中文
139 | - 英文
140 |
141 | 界面语言
142 |
143 |
144 | - 空格
145 | - 数字
146 | - 拉丁字母
147 | - 标点符号
148 | - 空行
149 | - 特殊符号
150 | - 谚文
151 | - 平假名及片假名
152 | - 注音符号
153 |
154 | 删除特定文字
155 | 文字处理
156 | 进行文字处理
157 |
158 |
--------------------------------------------------------------------------------
/app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 |
23 | - 0
24 | - 5
25 | - 6
26 | - 7
27 | - 8
28 | - 9
29 | - 10
30 |
31 |
32 | - 0
33 | - 1
34 | - 2
35 | - 3
36 | - 4
37 |
38 |
39 | - TW
40 | - HK
41 | - CN
42 |
43 |
44 | - default
45 | - zh-HK
46 | - zh-CN
47 | - en-US
48 |
49 |
50 | - space
51 | - numbers
52 | - latin
53 | - punctuation
54 | - emptyLine
55 | - specialChar
56 | - hangul
57 | - hirakata
58 | - bopomofo
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
24 | #3A608F
25 | #FFFFFF
26 | #D3E4FF
27 | #001C38
28 | #3A608F
29 | #FFFFFF
30 | #D3E3FF
31 | #001C39
32 | #6D5677
33 | #FFFFFF
34 | #F5D9FF
35 | #261430
36 | #BA1A1A
37 | #FFFFFF
38 | #FFDAD6
39 | #410002
40 | #F8F9FF
41 | #191C20
42 | #F8F9FF
43 | #191C20
44 | #DFE2EB
45 | #43474E
46 | #73777F
47 | #C3C6CF
48 | #000000
49 | #2E3035
50 | #EFF0F7
51 | #A3C9FE
52 | #D3E4FF
53 | #001C38
54 | #A3C9FE
55 | #1F4876
56 | #D3E3FF
57 | #001C39
58 | #A4C9FE
59 | #204876
60 | #F5D9FF
61 | #261430
62 | #D9BDE3
63 | #543F5E
64 | #D8DAE0
65 | #F8F9FF
66 | #FFFFFF
67 | #F2F3FA
68 | #EDEDF4
69 | #E7E8EE
70 | #E1E2E8
71 | #1A4471
72 | #FFFFFF
73 | #5176A7
74 | #FFFFFF
75 | #1B4472
76 | #FFFFFF
77 | #5276A7
78 | #FFFFFF
79 | #503B5A
80 | #FFFFFF
81 | #846C8E
82 | #FFFFFF
83 | #8C0009
84 | #FFFFFF
85 | #DA342E
86 | #FFFFFF
87 | #F8F9FF
88 | #191C20
89 | #F8F9FF
90 | #191C20
91 | #DFE2EB
92 | #3F434A
93 | #5B5F67
94 | #777B83
95 | #000000
96 | #2E3035
97 | #EFF0F7
98 | #A3C9FE
99 | #5176A7
100 | #FFFFFF
101 | #375E8C
102 | #FFFFFF
103 | #5276A7
104 | #FFFFFF
105 | #385D8D
106 | #FFFFFF
107 | #846C8E
108 | #FFFFFF
109 | #6A5474
110 | #FFFFFF
111 | #D8DAE0
112 | #F8F9FF
113 | #FFFFFF
114 | #F2F3FA
115 | #EDEDF4
116 | #E7E8EE
117 | #E1E2E8
118 | #002344
119 | #FFFFFF
120 | #1A4471
121 | #FFFFFF
122 | #002344
123 | #FFFFFF
124 | #1B4472
125 | #FFFFFF
126 | #2D1B37
127 | #FFFFFF
128 | #503B5A
129 | #FFFFFF
130 | #4E0002
131 | #FFFFFF
132 | #8C0009
133 | #FFFFFF
134 | #F8F9FF
135 | #191C20
136 | #F8F9FF
137 | #000000
138 | #DFE2EB
139 | #20242B
140 | #3F434A
141 | #3F434A
142 | #000000
143 | #2E3035
144 | #FFFFFF
145 | #E3ECFF
146 | #1A4471
147 | #FFFFFF
148 | #002E56
149 | #FFFFFF
150 | #1B4472
151 | #FFFFFF
152 | #002D56
153 | #FFFFFF
154 | #503B5A
155 | #FFFFFF
156 | #382543
157 | #FFFFFF
158 | #D8DAE0
159 | #F8F9FF
160 | #FFFFFF
161 | #F2F3FA
162 | #EDEDF4
163 | #E7E8EE
164 | #E1E2E8
165 |
166 |
167 | #ffa000
168 | #c2185b
169 | #00796b
170 | #1976d2
171 |
172 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 | 關於
23 | 請輸入需轉換的文字:
24 | 轉換
25 | 清除
26 | 繁簡轉換
27 | 已轉換的文字已複製到剪貼簿
28 | 簡體轉繁體
29 | 繁體轉簡體
30 | 繁體異體轉換
31 | 原文是臺灣標準
32 | 原文是香港標準
33 | 轉換爲臺灣標準
34 | 轉換爲香港標準
35 | 不轉換
36 | 臺灣用詞
37 | 中國大陸用詞
38 | 類型
39 | 異體標準
40 | 用詞
41 | 發生了未知錯誤!
42 | 找不到檔案管理器!
43 | 讀寫檔案錯誤!
44 | 請選擇轉換類型:
45 | (每次詢問)
46 | 簡體到 OpenCC 繁體(預設)
47 | 簡體到臺灣正體
48 | 簡體到香港繁體
49 | 簡體到臺灣正體(包括詞彙)
50 | OpenCC 繁體到簡體(預設)
51 | 臺灣正體到簡體
52 | 香港繁體到簡體
53 | 臺灣正體到簡體(中國大陸詞彙)
54 | OpenCC 繁體轉換爲臺灣異體
55 | OpenCC 繁體轉換爲香港異體
56 | 簡-繁轉換
57 | 繁-簡轉換
58 | 港臺異體轉換
59 |
60 | 檔案
61 | 儲存檔案
62 |
63 | 取消
64 | 關於
65 | 使用 OpenCC 的 Android 簡繁轉換器
66 | 版本
67 | 開發
68 | 由 Fei 在 2019 冠狀病毒病疫情期間使用 Android Studio 開發,2020 年 5 月。
69 | 開發
70 | https://iatfei.com
71 | 我的網站
72 | apps@iatfei.com
73 | 聯絡我
74 | 本軟件以 GNU 通用公共許可證條款第三版(或更新版本)發佈。此條款允許你在遵守某些條件下,無需經本人同意即可重新發佈和修改本軟件。請點選以進入本程式的 GitHub 頁面獲得原始碼和版權資訊。
75 | 開放原始碼授權
76 | RE:START
77 | Those who care will come back; those who hate are unimportant.
78 | RE:START #2
79 | Be together. Not the same.
80 | 關於此軟件
81 | 原始碼
82 | 中文轉換
83 | OpenCC(建議)
84 | 歡迎!
85 | 建議…
86 | 在軟件中直接轉換!(一)
87 | 在軟件中直接轉換!(二)
88 | 在軟件中直接轉換!(三)
89 | 感謝使用!
90 | 輕鬆轉換繁體與簡體。同時亦可轉換地區用詞或異體字。
91 | 如果只需要普通簡繁轉換,請使用簡易模式。
92 | "在任何軟件選擇文字並按「繁簡轉換」即可轉換並取代原有文字。\n\n注意:某些軟件(如:WeChat、Telegram)無法使用此方式。請參考下一頁介紹。"
93 | 選擇文字後也可按「分享」後選擇「繁簡轉換」,並自行貼上轉換後的文字。
94 | 將本軟件的圖塊加入到快速設定面板後,複製任何文字後選擇「繁簡轉換」圖塊,並自行貼上轉換後的文字。
95 | "我的第二個自行開發軟件。本軟件的成功全靠 OpenCC 項目的貢獻者。\n\n因自然語言的複雜性,完美轉換是不可能的,因此請務必仔細檢查。"
96 | 教學
97 | 貢獻者
98 | 簡易模式提議及部分源碼:Renn
99 | 設定
100 | 彈出功能表
101 | 在彈出功能表選擇轉換時,自動偵測繁簡並使用OpenCC標準轉換
102 | 簡易模式
103 |
104 |
105 | - (每次詢問)
106 | - OpenCC 繁體到簡體(預設)
107 | - 臺灣正體到簡體
108 | - 香港繁體到簡體
109 | - 臺灣正體到簡體(中國大陸詞彙)
110 | - OpenCC 繁體轉換爲臺灣異體
111 | - OpenCC 繁體轉換爲香港異體
112 |
113 |
114 | - (每次詢問)
115 | - 簡體到 OpenCC 繁體(預設)
116 | - 簡體到臺灣正體
117 | - 簡體到香港繁體
118 | - 簡體到臺灣正體(臺灣詞彙)
119 |
120 | 文字偵測為繁體中文時
121 | 文字偵測爲簡體中文時
122 | 使用彈出功能表時,自動偵測繁簡中文並按照以下模式轉換
123 | 自動偵測繁簡
124 | 選擇的文字中沒有繁/簡獨有字或者不是中文
125 | 無法偵測繁簡,請手動選擇:
126 |
127 | 開始朗讀
128 | 停止朗讀
129 | 開始/停止朗讀
130 | 語言設定
131 | 朗讀語言
132 | 朗讀失敗,請檢查文字轉語音設定
133 |
134 | - 國語(台灣)
135 | - 粵語(香港)
136 | - 普通話(中國)
137 |
138 |
139 |
140 | - 系統預設
141 | - 正體中文
142 | - 簡體中文
143 | - 英文
144 |
145 | 界面語言
146 |
147 |
148 | - 空格
149 | - 數字
150 | - 拉丁字母
151 | - 標點符號
152 | - 空行
153 | - 特殊符號
154 | - 諺文
155 | - 片假名及平假名
156 | - 注音符號
157 |
158 | 刪除特定文字
159 | 文字處理
160 | 進行文字處理
161 |
162 |
163 |
164 |
165 |
166 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/about.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
23 |
26 |
27 |
28 |
36 |
46 |
49 |
59 |
69 |
72 |
73 |
83 |
86 |
87 |
97 |
107 |
110 |
111 |
120 |
123 |
133 |
142 |
143 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_descriptor.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/settings.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 |
23 |
24 |
33 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
52 |
58 |
59 |
60 |
65 |
70 |
77 |
86 |
87 |
--------------------------------------------------------------------------------
/banner.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/banner.xcf
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | mavenCentral()
7 | maven { url "https://plugins.gradle.org/m2/" }
8 | mavenCentral()
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:8.9.0'
12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10"
13 | classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:11.6.3"
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | google()
22 | mavenCentral()
23 | maven { url "https://jitpack.io" }
24 | }
25 | }
26 |
27 | tasks.register('clean', Delete) {
28 | delete rootProject.layout.buildDirectory
29 | }
30 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/15.txt:
--------------------------------------------------------------------------------
1 | New Text-to-Speech reading out loud and text file conversion features, and interface experience updates.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/changelogs/18.txt:
--------------------------------------------------------------------------------
1 | Text-to-Speech, text file conversion, text preprocessing, and interface experience updates.
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/full_description.txt:
--------------------------------------------------------------------------------
1 | No ads! Supports conversion directly in-app automatically! Open source!
2 |
3 | My second app project! Hope you will like it!
4 |
5 | Makes use of the OpenCC database, which eliminates Simplified to Traditional conversion problems like 「后門」 or 「頭發」. It supports regional variant characters standards of Hong Kong and Taiwan, as well as word use preferences of mainland China and Taiwan.
6 |
7 | Features:
8 | - Easy Mode automatically detects Traditional/Simplified Chinese and convert to the other
9 | - Supports conversion in-place in input boxes of other apps
10 | - 10 conversion schemes (see the list below)
11 | - Text-to-Speech Feature
12 | - Converting from File
13 | - Follows latest Material 3 guidelines
14 | - Supports night mode
15 | - No ads and no tracking (app does not have internet or storage access)
16 |
17 | Conversion Schemes: (OpenCC standard recommended unless there is a special need)
18 | Simplified to Traditional
19 | 1. Simplified to OpenCC Traditional (recommended)
20 | 2. Simplified to Traditional (TW variant)
21 | 3. Simplified to Traditional (HK variant)
22 | 4. Simplified to Traditional (TW variant and phrases)
23 | Traditional to Simplified
24 | 5. OpenCC Traditional to Simplified (recommended)
25 | 6. Traditional (TW variant) to Simplified
26 | 7. Traditional (HK variant) to Simplified
27 | 8. Traditional (TW variant) to Simplified (CN phrases)
28 | HK-Taiwan variant characters conversion
29 | 9. OpenCC Traditional to Traditional (TW variant)
30 | 10. OpenCC Traditional to Traditional (HK variant)
31 |
32 | Weird issues? Send an email to apps@iatfei.com and I will fix it as soon as possible! Or send me a pull request :)
33 |
34 | This is an open source project. The source code is released under GPL version 3 or later.
35 | Source code: https://github.com/fei0316/OpenCC-android-app/
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/featureGraphic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/en-US/images/featureGraphic.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/en-US/images/icon.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/short_description.txt:
--------------------------------------------------------------------------------
1 | Converts between Simplified and Traditional with regional variants support!
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/title.txt:
--------------------------------------------------------------------------------
1 | Chinese Converter
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/changelogs/15.txt:
--------------------------------------------------------------------------------
1 | 加入语音朗读及转换文字档案功能,并进行界面更新。
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/changelogs/18.txt:
--------------------------------------------------------------------------------
1 | 加入语音朗读、转换文字档案及文字预处理功能,并进行界面更新。
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/full_description.txt:
--------------------------------------------------------------------------------
1 | 我的第二个软件作品!希望大家会喜欢!
2 |
3 | 采用 OpenCC 转换数据库,杜绝「后門」、「頭發」等转换问题,同时支持香港及台湾的异体字标准以及中国大陆及台湾的常用词汇转换。
4 |
5 | 特色功能:
6 | - 自动侦测繁简并转换,无需手动选择
7 | - 可在其他程序的输入框中直接转换并取代
8 | - 多达10种转换方式(见下列)
9 | - 文字朗读功能
10 | - 转换文字档
11 | - 遵从安卓官方最新 Material 3 设计指引,简洁易用
12 | - 支持夜间模式
13 | - 无广告无追踪(软件不能联网、不能访问设备数据)
14 |
15 | 转换方式:(如无特别需求,建议使用 OpenCC 标准)
16 | 简转繁
17 | 1. 简体到 OpenCC 繁体(建议)
18 | 2. 简体到台湾正体
19 | 3. 简体到香港繁体
20 | 4. 简体到台湾正体(包括词汇)
21 | 繁转简
22 | 5. OpenCC 繁体到简体(建议)
23 | 6. 台湾正体到简体
24 | 7. 香港繁体到简体
25 | 8. 台湾正体到简体(中国大陆词汇)
26 | 港台异体转换
27 | 9. OpenCC 繁体转换为台湾异体
28 | 10. OpenCC 繁体转换为香港异体
29 |
30 | 出现奇怪问题吗?请发送邮件到 apps@iatfei.com。
31 | 有兴趣的话还可以发送 pull request :)
32 |
33 | 此乃开源软件,原代码以 GNU 通用公共授权条款 版本3或以后 发布。
34 | 原代码:https://github.com/fei0316/OpenCC-android-app/
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/images/featureGraphic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-CN/images/featureGraphic.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-CN/images/icon.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/images/phoneScreenshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-CN/images/phoneScreenshots/1.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/images/phoneScreenshots/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-CN/images/phoneScreenshots/2.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/images/phoneScreenshots/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-CN/images/phoneScreenshots/3.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/images/phoneScreenshots/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-CN/images/phoneScreenshots/4.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/short_description.txt:
--------------------------------------------------------------------------------
1 | 无广告、无权限、开源繁简转换器。支持港台异体及常用词汇,可在其他应用程序中直接自动转换!
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-CN/title.txt:
--------------------------------------------------------------------------------
1 | 中文繁简转换
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-TW/changelogs/15.txt:
--------------------------------------------------------------------------------
1 | 加入語音朗讀及轉換文字檔案功能,並進行界面更新。
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-TW/changelogs/18.txt:
--------------------------------------------------------------------------------
1 | 加入語音朗讀、轉換文字檔案及文字預處理功能,並進行界面更新。
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-TW/full_description.txt:
--------------------------------------------------------------------------------
1 | 我的第二個軟件作品!希望大家會喜歡!
2 |
3 | 採用 OpenCC 轉換資料庫,杜絕「后門」、「頭發」等轉換問題,同時支援香港及臺灣的異體字標準以及中國大陸及臺灣的常用詞彙轉換。
4 |
5 | 特色功能:
6 | - 簡易模式可自動偵測簡繁並轉換,無需手動選擇
7 | - 可在其他程式的輸入框中直接轉換並取代
8 | - 多達10種轉換方式(見下列)
9 | - 文字朗讀功能
10 | - 轉換文字檔案
11 | - 遵從 Android 官方最新 Material 3 設計指引,簡潔易用
12 | - 支援夜間模式
13 | - 無廣告無追蹤(軟件不能聯網、不能存取裝置資料)
14 |
15 | 轉換方式:(如無特別需求,建議使用 OpenCC 標準)
16 | 簡轉繁
17 | 1. 簡體到 OpenCC 繁體(建議)
18 | 2. 簡體到臺灣正體
19 | 3. 簡體到香港繁體
20 | 4. 簡體到臺灣正體(包括詞彙)
21 | 繁轉簡
22 | 5. OpenCC 繁體到簡體(建議)
23 | 6. 臺灣正體到簡體
24 | 7. 香港繁體到簡體
25 | 8. 臺灣正體到簡體(中國大陸詞彙)
26 | 港臺異體轉換
27 | 9. OpenCC 繁體轉換爲臺灣異體
28 | 10. OpenCC 繁體轉換爲香港異體
29 |
30 | 出現奇怪問題嗎?請發送郵件到 apps@iatfei.com。
31 | 有興趣的話還可以發送 pull request :)
32 |
33 | 此乃開源軟件,原始碼以 GNU 通用公共授權條款 版本3或以後 釋出。
34 | 原始碼:https://github.com/fei0316/OpenCC-android-app/
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-TW/images/featureGraphic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-TW/images/featureGraphic.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-TW/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-TW/images/icon.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-TW/images/phoneScreenshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-TW/images/phoneScreenshots/1.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-TW/images/phoneScreenshots/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-TW/images/phoneScreenshots/2.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-TW/images/phoneScreenshots/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-TW/images/phoneScreenshots/3.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-TW/images/phoneScreenshots/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/fastlane/metadata/android/zh-TW/images/phoneScreenshots/4.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-TW/short_description.txt:
--------------------------------------------------------------------------------
1 | 無廣告、無權限、開源繁簡轉換器。支援港臺異體及常用詞彙,可在其他應用程式中直接自動轉換!
--------------------------------------------------------------------------------
/fastlane/metadata/android/zh-TW/title.txt:
--------------------------------------------------------------------------------
1 | 中文繁簡轉換
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2020-2023 Fei Kuan.
3 | #
4 | # This file is part of Chinese Converter
5 | # (see ).
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU General Public License as published by
9 | # the Free Software Foundation, either version 3 of the License, or
10 | # (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with this program. If not, see .
19 | #
20 |
21 | # Project-wide Gradle settings.
22 | # IDE (e.g. Android Studio) users:
23 | # Gradle settings configured through the IDE *will override*
24 | # any settings specified in this file.
25 | # For more details on how to configure your build environment visit
26 | # http://www.gradle.org/docs/current/userguide/build_environment.html
27 | #
28 | # Specifies the JVM arguments used for the daemon process.
29 | # The setting is particularly useful for tweaking memory settings.
30 | # Default value: -Xmx1024m -XX:MaxPermSize=256m
31 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
32 | #
33 | # When configured, Gradle will run in incubating parallel mode.
34 | # This option should only be used with decoupled projects. More details, visit
35 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
36 | # org.gradle.parallel=true
37 | #Sun Jan 09 19:17:36 PST 2022
38 | org.gradle.parallel=true
39 | org.gradle.jvmargs=-Xmx1024M -Dkotlin.daemon.jvm.options\="-Xmx1024M"
40 | android.useAndroidX=true
41 | android.nonTransitiveRClass=false
42 | android.nonFinalResIds=false
43 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fei0316/OpenCC-android-app/35e21ab684fd5a40ce8bfe907a01cc92c24acf88/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 | # SPDX-License-Identifier: Apache-2.0
19 | #
20 |
21 | ##############################################################################
22 | #
23 | # Gradle start up script for POSIX generated by Gradle.
24 | #
25 | # Important for running:
26 | #
27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28 | # noncompliant, but you have some other compliant shell such as ksh or
29 | # bash, then to run this script, type that shell name before the whole
30 | # command line, like:
31 | #
32 | # ksh Gradle
33 | #
34 | # Busybox and similar reduced shells will NOT work, because this script
35 | # requires all of these POSIX shell features:
36 | # * functions;
37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39 | # * compound commands having a testable exit status, especially «case»;
40 | # * various built-in commands including «command», «set», and «ulimit».
41 | #
42 | # Important for patching:
43 | #
44 | # (2) This script targets any POSIX shell, so it avoids extensions provided
45 | # by Bash, Ksh, etc; in particular arrays are avoided.
46 | #
47 | # The "traditional" practice of packing multiple parameters into a
48 | # space-separated string is a well documented source of bugs and security
49 | # problems, so this is (mostly) avoided, by progressively accumulating
50 | # options in "$@", and eventually passing that to Java.
51 | #
52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54 | # see the in-line comments for details.
55 | #
56 | # There are tweaks for specific operating systems such as AIX, CygWin,
57 | # Darwin, MinGW, and NonStop.
58 | #
59 | # (3) This script is generated from the Groovy template
60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61 | # within the Gradle project.
62 | #
63 | # You can find Gradle at https://github.com/gradle/gradle/.
64 | #
65 | ##############################################################################
66 |
67 | # Attempt to set APP_HOME
68 |
69 | # Resolve links: $0 may be a link
70 | app_path=$0
71 |
72 | # Need this for daisy-chained symlinks.
73 | while
74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75 | [ -h "$app_path" ]
76 | do
77 | ls=$( ls -ld "$app_path" )
78 | link=${ls#*' -> '}
79 | case $link in #(
80 | /*) app_path=$link ;; #(
81 | *) app_path=$APP_HOME$link ;;
82 | esac
83 | done
84 |
85 | # This is normally unused
86 | # shellcheck disable=SC2034
87 | APP_BASE_NAME=${0##*/}
88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90 | ' "$PWD" ) || exit
91 |
92 | # Use the maximum available, or set MAX_FD != -1 to use that value.
93 | MAX_FD=maximum
94 |
95 | warn () {
96 | echo "$*"
97 | } >&2
98 |
99 | die () {
100 | echo
101 | echo "$*"
102 | echo
103 | exit 1
104 | } >&2
105 |
106 | # OS specific support (must be 'true' or 'false').
107 | cygwin=false
108 | msys=false
109 | darwin=false
110 | nonstop=false
111 | case "$( uname )" in #(
112 | CYGWIN* ) cygwin=true ;; #(
113 | Darwin* ) darwin=true ;; #(
114 | MSYS* | MINGW* ) msys=true ;; #(
115 | NONSTOP* ) nonstop=true ;;
116 | esac
117 |
118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
119 |
120 |
121 | # Determine the Java command to use to start the JVM.
122 | if [ -n "$JAVA_HOME" ] ; then
123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
124 | # IBM's JDK on AIX uses strange locations for the executables
125 | JAVACMD=$JAVA_HOME/jre/sh/java
126 | else
127 | JAVACMD=$JAVA_HOME/bin/java
128 | fi
129 | if [ ! -x "$JAVACMD" ] ; then
130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
131 |
132 | Please set the JAVA_HOME variable in your environment to match the
133 | location of your Java installation."
134 | fi
135 | else
136 | JAVACMD=java
137 | if ! command -v java >/dev/null 2>&1
138 | then
139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
140 |
141 | Please set the JAVA_HOME variable in your environment to match the
142 | location of your Java installation."
143 | fi
144 | fi
145 |
146 | # Increase the maximum file descriptors if we can.
147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
148 | case $MAX_FD in #(
149 | max*)
150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
151 | # shellcheck disable=SC2039,SC3045
152 | MAX_FD=$( ulimit -H -n ) ||
153 | warn "Could not query maximum file descriptor limit"
154 | esac
155 | case $MAX_FD in #(
156 | '' | soft) :;; #(
157 | *)
158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
159 | # shellcheck disable=SC2039,SC3045
160 | ulimit -n "$MAX_FD" ||
161 | warn "Could not set maximum file descriptor limit to $MAX_FD"
162 | esac
163 | fi
164 |
165 | # Collect all arguments for the java command, stacking in reverse order:
166 | # * args from the command line
167 | # * the main class name
168 | # * -classpath
169 | # * -D...appname settings
170 | # * --module-path (only if needed)
171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
172 |
173 | # For Cygwin or MSYS, switch paths to Windows format before running java
174 | if "$cygwin" || "$msys" ; then
175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
177 |
178 | JAVACMD=$( cygpath --unix "$JAVACMD" )
179 |
180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
181 | for arg do
182 | if
183 | case $arg in #(
184 | -*) false ;; # don't mess with options #(
185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
186 | [ -e "$t" ] ;; #(
187 | *) false ;;
188 | esac
189 | then
190 | arg=$( cygpath --path --ignore --mixed "$arg" )
191 | fi
192 | # Roll the args list around exactly as many times as the number of
193 | # args, so each arg winds up back in the position where it started, but
194 | # possibly modified.
195 | #
196 | # NB: a `for` loop captures its iteration list before it begins, so
197 | # changing the positional parameters here affects neither the number of
198 | # iterations, nor the values presented in `arg`.
199 | shift # remove old arg
200 | set -- "$@" "$arg" # push replacement arg
201 | done
202 | fi
203 |
204 |
205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207 |
208 | # Collect all arguments for the java command:
209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210 | # and any embedded shellness will be escaped.
211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212 | # treated as '${Hostname}' itself on the command line.
213 |
214 | set -- \
215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
216 | -classpath "$CLASSPATH" \
217 | org.gradle.wrapper.GradleWrapperMain \
218 | "$@"
219 |
220 | # Stop when "xargs" is not available.
221 | if ! command -v xargs >/dev/null 2>&1
222 | then
223 | die "xargs is not available"
224 | fi
225 |
226 | # Use "xargs" to parse quoted args.
227 | #
228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
229 | #
230 | # In Bash we could simply go:
231 | #
232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
233 | # set -- "${ARGS[@]}" "$@"
234 | #
235 | # but POSIX shell has neither arrays nor command substitution, so instead we
236 | # post-process each arg (as a line of input to sed) to backslash-escape any
237 | # character that might be a shell metacharacter, then use eval to reverse
238 | # that process (while maintaining the separation between arguments), and wrap
239 | # the whole thing up as a single "set" statement.
240 | #
241 | # This will of course break if any of these variables contains a newline or
242 | # an unmatched quote.
243 | #
244 |
245 | eval "set -- $(
246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
247 | xargs -n1 |
248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
249 | tr '\n' ' '
250 | )" '"$@"'
251 |
252 | exec "$JAVACMD" "$@"
253 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
3 | }
4 | include ':app'
5 | rootProject.name='TSConverter'
6 |
--------------------------------------------------------------------------------
/util/ChineseTypes.kt:
--------------------------------------------------------------------------------
1 | package com.iatfei.tsconverter
2 |
3 | enum class ChineseTypes {
4 | SIMPLIFIED_CHINESE,
5 | TRADITIONAL_CHINESE,
6 | JAPANESE,
7 | NONE
8 | }
--------------------------------------------------------------------------------
/util/dict-gen.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2025 Fei Kuan.
3 | *
4 | * This file is part of Chinese Converter
5 | * (see ).
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | /*
22 | * Special thanks to Renn on GitHub who contributed to this piece of code.
23 | * Copyright (c) 2021 Renn. Released under GNU GPL v3+.
24 | */
25 |
26 | package com.iatfei.tsconverter
27 |
28 | import java.io.FileOutputStream;
29 | import java.io.IOException;
30 | import java.io.ObjectOutputStream;
31 | import java.util.Scanner
32 | import java.net.URL
33 | import java.util.HashMap
34 |
35 | val TS_CHAR_URL = URL("https://raw.githubusercontent.com/BYVoid/OpenCC/master/data/dictionary/TSCharacters.txt")
36 | val ST_CHAR_URL = URL("https://raw.githubusercontent.com/BYVoid/OpenCC/master/data/dictionary/STCharacters.txt")
37 |
38 | var charMap = HashMap();
39 |
40 | fun buildMap() {
41 | try {
42 | var scanner = Scanner(TS_CHAR_URL.openStream())
43 | while(scanner.hasNext()) {
44 | var chars = scanner.nextLine().trim().split('\t')
45 | if(!chars[1].contains(chars[0])) { // check if this is an uniquely Traditional character
46 | System.out.println(chars + chars[0].codePointAt(0) + "trad")
47 | charMap.put(chars[0].codePointAt(0), ChineseTypes.TRADITIONAL_CHINESE);
48 | }
49 | }
50 | } catch (e: IOException) {
51 | println("Error saving TS_CHAR_URL")
52 | }
53 |
54 | try {
55 | var scanner = Scanner(ST_CHAR_URL.openStream())
56 | while(scanner.hasNext()) {
57 | var chars = scanner.nextLine().trim().split('\t')
58 | if(!chars[1].contains(chars[0])) { // check if this is an uniquely Simplified character
59 | var codePoint = 0xFFFF
60 | codePoint = chars[0].codePointAt(0);
61 | if (codePoint != 0xFFFF) {
62 | if(charMap.get(codePoint) != null) {
63 | println("BOTH TRADITIONAL AND SIMPLIFIED???!!!!")
64 | charMap.remove(codePoint)
65 | } else {
66 | System.out.println(chars + chars[0].codePointAt(0) + "simp")
67 | charMap.put(codePoint, ChineseTypes.SIMPLIFIED_CHINESE)
68 | }
69 | }
70 | }
71 | }
72 | } catch (e: IOException) {
73 | println("Error saving ST_CHAR_URL")
74 | }
75 | }
76 |
77 | fun main(args: Array) {
78 | buildMap()
79 | var myFileOutStream = FileOutputStream("/mnt/d/Downloads/kotlin-compiler-1.8.20/kotlinc/bin/OpenCC-SimpTradMap-20230423.bin");
80 |
81 | var myObjectOutStream = ObjectOutputStream(myFileOutStream);
82 | myObjectOutStream.writeObject(charMap)
83 |
84 | myObjectOutStream.close();
85 | myFileOutStream.close();
86 | }
--------------------------------------------------------------------------------