-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
267 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
app/src/main/java/com/acmpo6ou/myaccounts/MyAccountsBoard.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (c) 2020-2021. Bohdan Kolvakh | ||
* This file is part of MyAccounts. | ||
* | ||
* MyAccounts is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* MyAccounts is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
package com.acmpo6ou.myaccounts | ||
|
||
import android.inputmethodservice.InputMethodService | ||
import android.view.View | ||
import android.view.inputmethod.InputMethodManager | ||
import android.widget.Button | ||
import android.widget.TextView | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import javax.inject.Inject | ||
|
||
@AndroidEntryPoint | ||
class MyAccountsBoard : InputMethodService() { | ||
|
||
@Inject | ||
lateinit var app: MyApp | ||
|
||
@Inject | ||
lateinit var inputManager: InputMethodManager | ||
|
||
override fun onCreateInputView(): View { | ||
val view = layoutInflater.inflate(R.layout.myaccounts_board, null) | ||
val pasteButton = view.findViewById<Button>(R.id.pastePassword) | ||
|
||
val noPassword = view.findViewById<TextView>(R.id.noPassword) | ||
noPassword.visibility = if (app.password.isEmpty()) View.VISIBLE else View.GONE | ||
|
||
pasteButton.setOnClickListener { | ||
currentInputConnection.commitText(app.password, 1) | ||
inputManager.showInputMethodPicker() | ||
} | ||
return view | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
app/src/main/java/com/acmpo6ou/myaccounts/core/MyAccountsBoardModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2020-2021. Bohdan Kolvakh | ||
* This file is part of MyAccounts. | ||
* | ||
* MyAccounts is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* MyAccounts is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
package com.acmpo6ou.myaccounts.core | ||
|
||
import android.content.Context | ||
import android.view.inputmethod.InputMethodManager | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.ServiceComponent | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.android.scopes.ServiceScoped | ||
|
||
@Module | ||
@InstallIn(ServiceComponent::class) | ||
object MyAccountsBoardModule { | ||
@Provides | ||
@ServiceScoped | ||
fun inputMethodManager(@ApplicationContext app: Context): InputMethodManager = | ||
app.getSystemService(InputMethodManager::class.java) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
~ Copyright (c) 2020-2021. Bohdan Kolvakh | ||
~ This file is part of MyAccounts. | ||
~ | ||
~ MyAccounts is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU General Public License as published by | ||
~ the Free Software Foundation, either version 3 of the License, or | ||
~ (at your option) any later version. | ||
~ | ||
~ MyAccounts is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
~ GNU General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU General Public License | ||
~ along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
~ | ||
--> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="250dp" | ||
android:background="#333" | ||
android:minHeight="250dp"> | ||
|
||
<Button | ||
android:id="@+id/pastePassword" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:backgroundTint="#1ED760" | ||
android:text="@string/paste_password" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/noPassword" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/you_didn_t_copy_the_password" | ||
android:textColor="@color/red" | ||
android:textSize="22sp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/pastePassword" | ||
app:layout_constraintVertical_bias="0.13" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<input-method | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<subtype | ||
android:label="MyAccounts Board" | ||
android:imeSubtypeMode="keyboard"/> | ||
|
||
</input-method> |