-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* setup the style and manifest file to make activity transparent and single instance
- Loading branch information
1 parent
6b6ec74
commit cc6c8af
Showing
8 changed files
with
105 additions
and
1 deletion.
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
45 changes: 45 additions & 0 deletions
45
AnkiDroid/src/main/java/com/ichi2/anki/instantnoteeditor/InstantNoteEditorActivity.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,45 @@ | ||
/* | ||
* Copyright (c) 2024 Ashish Yadav <[email protected]> | ||
* | ||
* This program 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. | ||
* | ||
* This program 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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.ichi2.anki.instantnoteeditor | ||
|
||
import android.os.Bundle | ||
import androidx.activity.enableEdgeToEdge | ||
import com.ichi2.anki.AnkiActivity | ||
import com.ichi2.anki.R | ||
import com.ichi2.themes.setTransparentBackground | ||
|
||
/** | ||
* Single instance Activity for instantly editing and adding cloze card/s without actually opening the app, | ||
* uses a custom dialog layout and a transparent activity theme to achieve the functionality. | ||
**/ | ||
class InstantNoteEditorActivity : AnkiActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
if (showedActivityFailedScreen(savedInstanceState)) { | ||
return | ||
} | ||
super.onCreate(savedInstanceState) | ||
if (!ensureStoragePermissions()) { | ||
return | ||
} | ||
setTransparentBackground() | ||
enableEdgeToEdge() | ||
setContentView(R.layout.activity_instant_note_editor) | ||
onDestroy() | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
AnkiDroid/src/main/res/layout/activity_instant_note_editor.xml
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,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
~ Copyright (c) 2024 Ashish Yadav <[email protected]> | ||
~ | ||
~ This program 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. | ||
~ | ||
~ This program 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 <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:id="@+id/root_layout" | ||
android:layout_height="match_parent" > | ||
|
||
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
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