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
<string name="text_link_resource"><span>Some example text <a href="https://gist.github.com/">link text</a></span></string> |
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
/** | |
* The view model class | |
*/ | |
public class TestViewModel extends AndroidViewModel { | |
private final StocksLiveData stocksLiveData; | |
public TestViewModel(Application application) { | |
super(application); | |
stocksLiveData = new StocksLiveData(application); |
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
private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
Log.d("TAG", intent.getAction()); | |
} | |
}; | |
@Override | |
protected void onResume() { | |
super.onResume(); |
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
public List<File> getExternalDirectoryRoots(Context context) { | |
File[] externalFilesDirs = ContextCompat.getExternalFilesDirs(context, null); | |
List<File> externalDirectories = new ArrayList<>(); | |
Set<String> stringSet = new HashSet<>(); | |
for (File file : externalFilesDirs) { | |
String[] split = file.getAbsolutePath().split("/"); | |
if (split.length > 1) { |
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
// Took forever because of crappy tutorials, for example https://developer.android.com/guide/topics/media-apps/audio-app/building-a-mediabrowserservice.html | |
// Key information was in COMMENTS in MediaButtonReceiver.java | |
// The key is to have a receiver with filter android.intent.action.MEDIA_BUTTON AND in the service | |
// register pending intent to the button in notification | |
builder.addAction(new NotificationCompat.Action( | |
R.drawable.ic_skip_next_black_24dp, getString(R.string.skip_next), | |
MediaButtonReceiver.buildMediaButtonPendingIntent(this, PlaybackStateCompat.ACTION_SKIP_TO_NEXT))); | |
// manifest changes |
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
private final ExoPlayer exoPlayer; | |
public PlayerExoPlayer(ExoPlayer exoPlayer) { | |
this.exoPlayer = exoPlayer; | |
} | |
public void prepareMp3(Context context, Uri uri) { | |
DefaultBandwidthMeter defaultBandwidthMeter = new DefaultBandwidthMeter(); | |
String userAgent = System.getProperty("http.agent"); |
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
@SuppressWarnings("deprecation") | |
public static Spanned fromHtml(String source) { | |
if (source == null) { | |
return null; | |
} | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | |
return Html.fromHtml(source, Html.FROM_HTML_MODE_LEGACY); | |
} |
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
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { | |
@Override | |
public void onScrolled(RecyclerView recyclerView, int dx, int dy) { | |
super.onScrolled(recyclerView, dx, dy); | |
if (dy > 0) { | |
if (!recyclerView.canScrollVertically(1)) { | |
} | |
} |
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
exports.onPropertyCommitted = function (args) { | |
if (args.propertyName == "height") { | |
var ageEntityProperty = dataForm.getPropertyByName("age"); | |
if (ageEntityProperty) { | |
if (args.entityProperty.originalValue == 2) { | |
ageEntityProperty.hidden = true; | |
} else { | |
ageEntityProperty.hidden = false; | |
} |
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
final String gifUrl = "http://i.imgur.com/LU208u2.gif"; | |
final RequestOptions requestOptions = new RequestOptions() | |
.fitCenter(this); | |
Glide.with(LoginActivity.this).asBitmap().load(gifUrl).apply(requestOptions).into(imageViewPreview); | |
final View.OnClickListener onClickListener = new OnClickListener() { | |
@Override | |
public void onClick(View v) { |
NewerOlder