This file contains hidden or 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
@Composable | |
fun MainScreen(viewModel: ViewModel) { | |
val cameraIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) | |
var bitmap by remember { mutableStateOf<Bitmap?>(null) } | |
val textResponse by viewModel.textGenerated.observeAsState() | |
val isGenerating by viewModel.isGenerating.observeAsState(false) | |
// Get your image | |
val resultLauncher = | |
rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult -> |
This file contains hidden or 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
adb shell settings put global sysui_demo_allowed 1 |
This file contains hidden or 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
#!/bin/sh | |
set -e | |
# Get the current branch name. | |
branch=`git rev-parse --abbrev-ref HEAD` | |
# Determine the commit at which the current branch diverged. | |
ancestor=`git merge-base master HEAD` | |
# Stash any uncommited, changed files. | |
git stash --all | |
# Revert the branch back to the ancestor SHA. |
This file contains hidden or 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
<permission | |
android:name="your.package.name.permission.BLA" | |
tools:node="remove"/> |
This file contains hidden or 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
Failure [INSTALL_FAILED_DUPLICATE_PERMISSION perm=your.package.name.permission.BLA pkg=your.package.name] |
This file contains hidden or 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
adb shell screenrecord /sdcard/video.mp4 | |
adb pull /sdcard/video.mp4 |
This file contains hidden or 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
// To instantiate a RippleDrawable: | |
// new RippleDrawable(null, null), the default constructor isn't public. | |
// Unfortunately, this has no colors set, so the app will crash, here's another way | |
int[] attrs = new int[] { android.R.attr.selectableItemBackground}; | |
TypedArray array = getContext().obtainStyledAttributes(attrs); | |
Drawable drawableFromTheme = array.getDrawable(0); | |
array.recycle(); | |
setBackground(drawableFromTheme); |
This file contains hidden or 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
public boolean isTwitterSignedIn(){ | |
AccountManager manager = AccountManager.get(this); | |
Account[] account = manager.getAccountsByType("com.twitter.android.auth.login"); | |
if (account.length > 0) { | |
Log.d("MainActivity", "Authenticated on twitter!"); | |
return true; | |
} else { | |
return false; | |
} | |
} |
This file contains hidden or 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
MainActivity.this.runOnUiThread(new Runnable() { | |
@Override | |
public void run() { | |
// Code to run on UI | |
} | |
}); |
This file contains hidden or 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
import org.apache.commons.lang3.StringUtils | |
... | |
StringUtils.isBlank(myString) |
NewerOlder