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
private void add() | |
{ | |
AlarmManager am = (AlarmManager) getApplicationContext().getSystemService( Context.ALARM_SERVICE ); | |
Intent intent = new Intent( getApplicationContext(), AlarmReceiver.class ); | |
intent.setAction( "com.actions.alarms" ); | |
intent.putExtra( "id", suppID ); | |
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 class ContentAdapter extends RecyclerView.Adapter<ContentAdapter.ViewHolder> { | |
public interface OnItemClickListener { | |
void onItemClick(ContentItem item); | |
} | |
private final List<ContentItem> items; | |
private final OnItemClickListener listener; | |
public ContentAdapter(List<ContentItem> items, OnItemClickListener listener) { |
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 class ListAdapter extends ArrayAdapter<Item> { | |
public ListAdapter(Context context, int textViewResourceId) { | |
super(context, textViewResourceId); | |
} | |
public ListAdapter(Context context, int resource, List<Item> items) { | |
super(context, resource, items); | |
} |
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
private Handler mHandler = new Handler(); | |
//Make sure you update Seekbar on UI thread | |
MainActivity.this.runOnUiThread(new Runnable() { | |
@Override | |
public void run() { | |
if(mMediaPlayer != null){ | |
int mCurrentPosition = mMediaPlayer.getCurrentPosition() / 1000; | |
mSeekBar.setProgress(mCurrentPosition); | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.example.mediaplayer"> | |
<uses-permission android:name="android.permission.INTERNET"/> | |
<permission android:name="android.permission.MEDIA_CONTENT_CONTROL"/> | |
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
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
https://medium.com/google-developers/mediabrowserservicecompat-and-the-modern-media-playback-app-7959a5196d90 | |
https://developer.android.com/reference/android/media/MediaPlayer.html |
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 class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
FusedLocationProviderClient client = | |
LocationServices.getFusedLocationProviderClient(this); | |
client.requestLocationUpdates(LocationRequest.create(), pendingIntent) |
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
/* | |
* Copyright (C) 2010 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 class FlipViewAnimation{ | |
public static void flip( View firstView, View secondView, float duration) | |
{ | |
firstView.animate().rotationX(90).setDuration(duration).setListener(new AnimatorListenerAdapter() { | |
@Override | |
public void onAnimationEnd(Animator animation) { | |
firstView.setVisibility(View.GONE); | |
secondView.setRotationX(-90); |
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 class ExpandableListAdapter extends BaseExpandableListAdapter | |
{ | |
private Context _context; | |
private List<String> _listDataHeader; // header titles | |
// child data in format of header title, child title | |
private HashMap<String, List<String>> _listDataChild; | |
public ExpandableListAdapter(Context context, List<String> listDataHeader, | |
HashMap<String, List<String>> listChildData) { |