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 reveal a previously invisible view using this effect: | |
void enterReveal() { | |
// previously invisible view | |
final View myView = findViewById(R.id.my_view); | |
// get the center for the clipping circle | |
int cx = myView.getMeasuredWidth() / 2; | |
int cy = myView.getMeasuredHeight() / 2; |
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
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |
android:color="?android:colorControlHighlight"> | |
<item> | |
<shape android:shape="rectangle"> | |
<solid android:color="?android:colorAccent"/> | |
</shape> | |
</item> | |
</ripple> |
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"?> | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:state_enabled="true" android:state_pressed="true"> | |
<objectAnimator | |
android:duration="@android:integer/config_shortAnimTime" | |
android:propertyName="translationZ" | |
android:valueTo="8dp" | |
android:valueType="floatType" | |
/> | |
</item> |
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"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/activity_main" | |
android:clipToPadding="false" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:gravity="center" |
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 FreeTheWakelockActivity extends ActionBarActivity { | |
public static final String LOG_TAG = "FreeTheWakelockActivity"; | |
TextView mWakeLockMsg; | |
ComponentName mServiceComponent; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_wakelock); |
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
// It is very easy to subscribe to changes to the battery state, but you can get the current | |
// state by simply passing null in as your receiver. Nifty, isn't that? | |
IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); | |
Intent batteryStatus = this.registerReceiver(null, filter); | |
int chargePlug = batteryStatus.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1); | |
boolean acCharge = (chargePlug == BatteryManager.BATTERY_PLUGGED_AC); | |
if (acCharge) { | |
Log.v(LOG_TAG,“The phone is charging!”); | |
} |
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.testbed.projects.stackoverflow"> | |
<application | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" | |
android:supportsRtl="true" | |
android:theme="@style/AppTheme"> |
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
Uri.parse("android.resource://" + getPackageName() | |
+ "/drawable/"+nameOfFile); |
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 android.app.Notification; | |
import android.app.NotificationManager; | |
import android.app.PendingIntent; | |
import android.app.Service; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.media.MediaPlayer; | |
import android.media.Rating; | |
import android.media.session.MediaController; | |
import android.media.session.MediaSession; |
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
Handler handler = new Handler(); | |
// run a thread after 2 seconds to start the home screen | |
handler.postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
//code written here will execute after 2000ms(2 seconds) | |