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
File f = new File( | |
"/data/data/your_application_package/shared_prefs/Name_of_your_preference.xml"); | |
if (f.exists()) | |
Log.d("TAG", "SharedPreferences Name_of_your_preference : exist"); | |
else | |
Log.d("TAG", "Setup default preferences"); |
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
// image = findviewbyid, etc | |
Bundle b = ActivityOptions.makeSceneTransitionAnimation( | |
this, | |
image, | |
image.getTransitionName() | |
).toBundle(); | |
// start the activity with the bundle | |
Intent i = new Intent(this, detailActivity.class); | |
startActivity(i, b); |
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 static void disableTouchTheft(View view) { | |
view.setOnTouchListener(new View.OnTouchListener() { | |
@Override | |
public boolean onTouch(View view, MotionEvent motionEvent) { | |
view.getParent().requestDisallowInterceptTouchEvent(true); // <--- | |
switch (motionEvent.getAction() & MotionEvent.ACTION_MASK) { | |
case MotionEvent.ACTION_UP: | |
view.getParent().requestDisallowInterceptTouchEvent(false); | |
break; | |
} |
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
long TRANS_DURATION = 300; | |
Log.d(TAG, "Ready to reveal mode picker"); | |
ModeSelectorActivityFragment f = new ModeSelectorActivityFragment(); | |
fragmentContainer.setVisibility(View.INVISIBLE); | |
getChildFragmentManager() | |
.beginTransaction() | |
.add(R.id.mode_list_fragment_container, f) |
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
d = (TransitionDrawable) myLittleButton.getDrawable(); | |
d.startTransition(DURATION); |
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
<application | |
android:theme="@style/Theme.Wearable.Launcher" > |
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
if(((ImageView) view).getDrawable() instanceof StateListDrawable){ | |
Log.d(TAG, "It totally is a statelister"); | |
} else { | |
Log.d(TAG, "It's not a statelist"); | |
} |
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
void animateDrawer(){ | |
// Animate to header state | |
//Log.d("test", scrollStateHeader.toString()); | |
ObjectAnimator drawerAnimator = ObjectAnimator.ofInt(appView, "scrollY", 0, scrollStateHeader).setDuration(1200); | |
drawerAnimator.setInterpolator(new AnticipateInterpolator(2)); | |
drawerAnimator.setStartDelay(1000); | |
drawerAnimator.start(); | |
} |
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 Note { | |
String to; | |
String from; | |
String heading; | |
String body; | |
} |
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 Date getNewestDateTime(){ | |
String stringDate = getLatestEpisode().getPubDate(); | |
Log.d(TAG, "stringdate is "+stringDate); | |
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.ENGLISH); | |
try{ | |
Date date = format.parse(stringDate); | |
Log.d(TAG, "parsed date: "+date); |