Skip to content

Commit 44d8e0a

Browse files
committed
refactor: add InitialKeyboard to display before deployment
1 parent 6d73bad commit 44d8e0a

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.osfans.trime.ime.keyboard
2+
3+
import android.content.Context
4+
import android.view.LayoutInflater
5+
import android.view.View
6+
import com.osfans.trime.R
7+
import com.osfans.trime.databinding.InitialKeyboardBinding
8+
9+
/**
10+
* Keyboard to be displayed before Rime is deployed completely.
11+
*
12+
* It displays a loading screen (if deploying) or error message (if cannot deploy).
13+
*
14+
* TODO: Add a help or info button to show what's problem is behind the scene.
15+
*/
16+
class InitialKeyboard(context: Context) {
17+
private var binding = InitialKeyboardBinding.inflate(LayoutInflater.from(context))
18+
19+
fun change(start: Boolean): View {
20+
if (start) {
21+
binding.progressBar.setVisibility(View.VISIBLE)
22+
binding.deploying.setText(R.string.deploy_progress)
23+
} else {
24+
binding.progressBar.setVisibility(View.INVISIBLE)
25+
binding.deploying.setText(R.string.external_storage_permission_not_available)
26+
}
27+
return binding.root
28+
}
29+
}

app/src/main/res/layout/input_loading.xml renamed to app/src/main/res/layout/initial_keyboard.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@
3131
app:layout_constraintLeft_toLeftOf="parent"
3232
app:layout_constraintRight_toRightOf="parent"
3333
/>
34+
3435
</androidx.constraintlayout.widget.ConstraintLayout>

0 commit comments

Comments
 (0)