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
TextFragment textFragment = TextFragment.newInstance("Hello there!"); |
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 class TextFragment extends Fragment { | |
private static final String ARG_TEXT = "arg_text"; | |
public static TextFragment newInstance(String text) { | |
TextFragment textFragment = new TextFragment(); | |
Bundle bundle = new Bundle(); | |
bundle.putString(ARG_TEXT, text); | |
textFragment.setArguments(bundle); |
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
TextFragment textFragment = new TextFragment(); | |
Bundle bundle = new Bundle(); | |
bundle.putString("myText", "Hey ya!"); | |
textFragment.setArguments(bundle); |
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
Toast toast = Toast.makeText(context, text, duration); | |
toast.show(); |
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
Effective Java | |
============== | |
[Creating and Destroying Objects] | |
/ Consider static factory methods instead of constructors | |
+ they have names | |
+ they are not required to create a new object each time they’re invoked | |
+ they can return an object of any subtype of their return type | |
- classes without public or protected constructors cannot be subclassed |
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
import android.support.test.rule.ActivityTestRule; | |
import android.support.test.runner.AndroidJUnit4; | |
import android.test.suitebuilder.annotation.LargeTest; | |
import org.junit.Rule; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import static android.support.test.espresso.Espresso.onView; | |
import static android.support.test.espresso.action.ViewActions.click; |
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
@Override | |
public void onAnimationEnd(Animation animation) { | |
Animation fadeIn = new AlphaAnimation(0, 1); | |
fadeIn.setInterpolator(new DecelerateInterpolator()); | |
fadeIn.setDuration(3000); | |
Animation fadeOut = new AlphaAnimation(1, 0); | |
fadeOut.setInterpolator(new AccelerateInterpolator()); | |
fadeOut.setStartOffset(3000); |
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 class MainActivity extends Activity implements Animation.AnimationListener{ | |
@Override | |
public void onAnimationStart(Animation animation) { | |
} | |
@Override | |
public void onAnimationEnd(Animation animation) { |
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 void fallDownWordAnimation() { | |
// define animation to be used | |
Animation animator = AnimationUtils.loadAnimation( | |
getActivity().getApplicationContext(), R.anim.fall_down); | |
// set animation listener | |
animator.setAnimationListener(this); | |
// start the animation |
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
<?xml version="1.0" encoding="utf-8"?> | |
<set | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:interpolator="@android:anim/linear_interpolator" | |
android:fillAfter="true"> | |
<translate | |
android:fromYDelta="0%p" | |
android:toYDelta="50%p" | |
android:duration="4000" /> |