Skip to content

Commit b9858e5

Browse files
committed
feat: improve prompt - no spoilers, richer context annotations
1 parent e7313f3 commit b9858e5

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

app/src/main/java/com/example/epubspoon/service/FloatingService.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,19 @@ class FloatingService : Service() {
111111
floatingView = LayoutInflater.from(this).inflate(R.layout.layout_floating_button, null)
112112
updateProgressText()
113113

114+
// 获取屏幕宽度,默认放右上角
115+
val displayMetrics = resources.displayMetrics
116+
val screenWidth = displayMetrics.widthPixels
117+
114118
val params = WindowManager.LayoutParams(
115119
WindowManager.LayoutParams.WRAP_CONTENT,
116120
WindowManager.LayoutParams.WRAP_CONTENT,
117121
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
118122
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
119123
PixelFormat.TRANSLUCENT
120124
).apply {
121-
gravity = Gravity.TOP or Gravity.END
122-
x = 16
125+
gravity = Gravity.TOP or Gravity.START
126+
x = screenWidth - (72 * displayMetrics.density + 16 * displayMetrics.density).toInt()
123127
y = 300
124128
}
125129

@@ -143,7 +147,7 @@ class FloatingService : Service() {
143147
MotionEvent.ACTION_MOVE -> {
144148
val dx = event.rawX - initialTouchX
145149
val dy = event.rawY - initialTouchY
146-
if (dx * dx + dy * dy > 100) { // 移动超过 10px 判定为拖拽
150+
if (dx * dx + dy * dy > 100) {
147151
isDragging = true
148152
}
149153
params.x = initialX + dx.toInt()

app/src/main/java/com/example/epubspoon/ui/MainActivity.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,21 @@ class MainActivity : AppCompatActivity() {
4444
private var floatingServiceRunning = false
4545

4646
private val defaultInstruction = """
47-
You are my English reading assistant and cultural guide. I will send you passages from an English book one at a time.
47+
You are my English reading assistant and cultural guide. I will send you passages from an English book one at a time. I am reading this book for the first time.
48+
49+
⚠️ **Critical rules:**
50+
- **NEVER spoil future plot, character fates, twists, or outcomes** — even indirectly. Do not hint at what will happen later.
51+
- **NEVER say things like** "this will be important later", "foreshadowing", "ironic given what happens next", or anything that reveals future events.
52+
- Only explain what is **in this passage and before it**. Treat every passage as if you don't know what comes after.
53+
- Your goal is to **enhance my reading experience** — help me fully understand what the author is expressing **right now**, without ruining the joy of discovery.
4854
4955
For each passage, please go through it **sentence by sentence** in order. For each sentence, provide:
5056
5157
1. **English original** — the sentence as-is.
5258
2. **Chinese translation** — natural, fluent Chinese translation.
5359
3. **Inline notes** — right after the translation, annotate as needed:
5460
- **word/phrase** — Chinese meaning;usage note or nuance if helpful.
55-
- If a sentence involves **cultural references, historical allusions, religious/mythological context, social customs, literary devices, or implied meanings** that a Chinese reader might not immediately grasp, add a 💡 note explaining the cultural/contextual background in Chinese.
61+
- If a sentence involves **cultural references, historical allusions, religious/mythological context, social customs, literary devices, or implied meanings** that a Chinese reader might not immediately grasp, add a 💡 note explaining the cultural/contextual background in Chinese. Focus on enriching understanding — explain what the author is conveying, the emotional undertone, rhetorical techniques, or real-world context that helps me appreciate the writing.
5662
- Not every sentence needs a 💡 note — only add when there's genuine cultural or contextual depth worth explaining.
5763
5864
After all sentences are done, add:

0 commit comments

Comments
 (0)