Skip to content

Commit

Permalink
[Labs] Hide code editor if it's disabled in settings
Browse files Browse the repository at this point in the history
Signed-off-by: Muntashir Al-Islam <muntashirakon@riseup.net>
  • Loading branch information
MuntashirAkon committed Jul 9, 2024
1 parent d475e07 commit ce2dcec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ protected void onAuthenticated(@Nullable Bundle savedInstanceState) {
startActivity(intent);
});
}
addAction(this, flowLayout, R.string.title_code_editor, R.drawable.ic_code)
.setOnClickListener(v -> {
Intent intent = new Intent(this, CodeEditorActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
});
if (FeatureController.isCodeEditorEnabled()) {
addAction(this, flowLayout, R.string.title_code_editor, R.drawable.ic_code)
.setOnClickListener(v -> {
Intent intent = new Intent(this, CodeEditorActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
});
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ public static boolean isVirusTotalEnabled() {
return getInstance().isEnabled(FEAT_VIRUS_TOTAL);
}

public static boolean isCodeEditorEnabled() {
return getInstance().isEnabled(FEAT_CODE_EDITOR);
}

private boolean isEnabled(@FeatureFlags int key) {
ComponentName cn;
switch (key) {
Expand Down

0 comments on commit ce2dcec

Please sign in to comment.