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 string_resource = getResources().getString(R.string.number_of_results_text); | |
String formattedString = String.format(string_resource, randomList.size()); | |
searchResultTopText.setText(formattedString); |
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
// Part of this code is taken from http://stackoverflow.com/a/4618030/2288146 | |
// Thanks to http://stackoverflow.com/users/540908/nininho | |
private static BitmapDrawable loadBitmapFromView(View view, Context context) { | |
view.setDrawingCacheEnabled(true); | |
// this is the important code :) | |
// Without it the view will have a dimension of 0,0 and the bitmap will be null | |
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), | |
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); | |
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); |
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
getFragmentManager().beginTransaction() | |
.setCustomAnimations(R.animator.right_in, R.animator.right_out) | |
.remove(yourFragment) | |
.commit(); | |
getFragmentManager().beginTransaction() | |
.setCustomAnimations(R.animator.right_in, R.animator.right_out) | |
.add(R.id.fragmentContainer, yourFragment, "yourFragment") | |
.commit(); |
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 startActivity(Intent intent) { | |
super.startActivity(intent); | |
overridePendingTransition( | |
R.anim.slide_in_right, R.anim.slide_out_left); | |
// as mentioned in q http://stackoverflow.com/a/13578979/2288146 | |
// The first argument determines the transition animation used by the | |
// second activity. Also the two animations can be more properly named | |
// as slide_out_to_right and slide_in_from_left, since in fact they |
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 onResume() { | |
super.onResume(); | |
searchEditText.requestFocus(); | |
showKeyboard(); | |
} | |
private void showKeyboard() { | |
searchEditText.postDelayed(new Runnable() { | |
@Override |
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
{ | |
"name": "test-project", | |
"version": "1.0.0", | |
"description": "just a quick test project to show package.json structure", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC" |
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 TestActivity extends AppCompatActivity { | |
@Arg String arg1; | |
@Arg String arg2; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
ActivityStarter.fill(this); |