-
-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6034 from Bnyro/master
feat: download popup that can be displayed over other apps
- Loading branch information
Showing
12 changed files
with
165 additions
and
70 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
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
44 changes: 44 additions & 0 deletions
44
app/src/main/java/com/github/libretube/ui/activities/DownloadActivity.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,44 @@ | ||
package com.github.libretube.ui.activities | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.net.toUri | ||
import androidx.core.os.bundleOf | ||
import com.github.libretube.constants.IntentData | ||
import com.github.libretube.enums.PlaylistType | ||
import com.github.libretube.helpers.IntentHelper | ||
import com.github.libretube.helpers.ThemeHelper | ||
import com.github.libretube.ui.base.BaseActivity | ||
import com.github.libretube.ui.dialogs.DownloadDialog | ||
import com.github.libretube.ui.dialogs.DownloadPlaylistDialog | ||
|
||
class DownloadActivity: BaseActivity() { | ||
override val isDialogActivity: Boolean = true | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
val intentData = intent.getStringExtra(Intent.EXTRA_TEXT)?.let { | ||
IntentHelper.resolveType(Intent(), it.toUri()) | ||
} | ||
|
||
val videoId = intentData?.getStringExtra(IntentData.videoId) | ||
val playlistId = intentData?.getStringExtra(IntentData.playlistId) | ||
if (videoId != null) { | ||
DownloadDialog().apply { | ||
arguments = bundleOf(IntentData.videoId to videoId) | ||
}.show(supportFragmentManager, null) | ||
} else if (playlistId != null) { | ||
DownloadPlaylistDialog().apply { | ||
arguments = bundleOf( | ||
IntentData.playlistId to playlistId, | ||
IntentData.playlistType to PlaylistType.PUBLIC, | ||
IntentData.playlistName to intent.getStringExtra(Intent.EXTRA_TITLE) | ||
) | ||
}.show(supportFragmentManager, null) | ||
} else { | ||
finishAndRemoveTask() | ||
} | ||
} | ||
} |
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
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.