-
-
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.
添加DownloadReceiver, 由于hilt编译问题, 暂时注释. 恢复检查更新功能 Signed-off-by: 子斗子 <[email protected]>
- Loading branch information
Showing
17 changed files
with
135 additions
and
78 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
2 changes: 1 addition & 1 deletion
2
app/src/main/java/zdz/imageURL/ui/MainNav.kt → ...ava/zdz/imageURL/activity/main/MainNav.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
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
27 changes: 27 additions & 0 deletions
27
app/src/main/java/zdz/imageURL/receive/DownloadReceiver.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,27 @@ | ||
package zdz.imageURL.receive | ||
|
||
/* | ||
@AndroidEntryPoint | ||
class DownloadReceiver @Inject constructor( | ||
private val downloader: DownloadManager, | ||
private val pf: Prefer, | ||
) : BroadcastReceiver() { | ||
override fun onReceive(context: Context, intent: Intent) { | ||
if (intent.action != DownloadManager.ACTION_DOWNLOAD_COMPLETE) return | ||
val id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1) | ||
if (id == -1L) return | ||
val cursor = downloader.query(DownloadManager.Query().setFilterById(id)) | ||
val status = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) | ||
if (status != DownloadManager.STATUS_SUCCESSFUL) return | ||
val uri = cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)) | ||
context.viewContent( | ||
Uri.parse(uri), | ||
mimeType = "application/vnd.android.package-archive", | ||
choose = pf.installerChooser.value | ||
) | ||
cursor.close() | ||
} | ||
}*/ | ||
// TODO: cannot compile |
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
Oops, something went wrong.