forked from TeamNewPipe/NewPipe
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BraveNewPipe: check for app updates from within the drawer
- Loading branch information
1 parent
31197ab
commit 3df7120
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
app/src/main/java/org/schabi/newpipe/BraveMainActivityHelper.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.schabi.newpipe; | ||
|
||
import android.content.Context; | ||
import android.view.MenuItem; | ||
import android.widget.Toast; | ||
|
||
import org.schabi.newpipe.databinding.DrawerLayoutBinding; | ||
|
||
public final class BraveMainActivityHelper { | ||
|
||
private BraveMainActivityHelper() { | ||
} | ||
|
||
// make sure it won't collide with any ITEM_ID_... in MainActivity | ||
static final int BRAVE_ITEM_ID_UPDATE = 100; | ||
|
||
public static void addBraveDrawers( | ||
final DrawerLayoutBinding drawerLayoutBinding, | ||
final int order) { | ||
drawerLayoutBinding.navigation.getMenu() | ||
.add(R.id.menu_options_about_group, BraveMainActivityHelper.BRAVE_ITEM_ID_UPDATE, | ||
order, R.string.settings_category_updates_title) | ||
.setIcon(R.drawable.ic_newpipe_update); | ||
} | ||
|
||
public static void onSelectedItemInDrawer( | ||
final Context context, | ||
final MenuItem item) { | ||
|
||
if (item.getItemId() == BRAVE_ITEM_ID_UPDATE) { | ||
Toast.makeText(context, R.string.checking_updates_toast, Toast.LENGTH_SHORT).show(); | ||
NewVersionWorker.enqueueNewVersionCheckingWork(context, true); | ||
} | ||
} | ||
} |
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