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
function pdfmerge () { | |
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=$1 ${@:2} | |
} |
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 | |
protected void replaceText(CharSequence text) { | |
// Do nothing | |
} | |
@Override | |
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { | |
... | |
Object data = getDataForSuggestion(adapter, position); | |
CharSequence text = getFilter().convertResultToString(adapter.getItem(position)); |
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 afterTextChanged(Editable message) { | |
if(mIgnoreTextChangedEvents) { | |
return; | |
} | |
// Avoid triggering text changed events from changes we make in this method | |
mIgnoreTextChangedEvents = true; | |
// Perform text changes |
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
private void updatePadding() { | |
boolean chipsArePresent = !getAllChips().isEmpty(); | |
if (!chipsArePresent && mUsingDefaultPadding) { | |
mUsingDefaultPadding = false; | |
Paint paint = getPaint(); | |
Paint.FontMetricsInt fm = paint.getFontMetricsInt(); | |
int textHeight = fm.descent - fm.ascent; | |
// Calculate how tall the view should be if there were chips | |
int newTextHeight = mChipHeight + (mChipVerticalSpacing != -1 ? mChipVerticalSpacing : 0); | |
// We need to add half our missing height above and below the text by increasing top and bottom padding |
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
private void adjustFontMetrics(FontMetricsInt fm) { | |
paint.getFontMetricsInt(fm); | |
int textHeight = fm.descent - fm.ascent; | |
// Break up the vertical spacing in half because half will go above the chip, half will go below the chip | |
int halfSpacing = mChipVerticalSpacing / 2; | |
// Given that the text is centered vertically within the chip, the amount of space above or below the text (inbetween the text and chip) | |
// is half their difference in height: | |
int spaceBetweenChipAndText = (mChipHeight - textHeight) / 2; |
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 draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { | |
// Shift everything mLeftMarginPx to the left to create an empty space on the left (creating the margin) | |
x += mLeftMarginPx; | |
if (mChipHeight != -1) { | |
// If we set a chip height, adjust to vertically center chip in the line | |
// Adding (bottom - top) / 2 shifts the chip down so the top of it will be centered vertically | |
// Subtracting (mChipHeight / 2) shifts the chip back up so that the center of it will be centered vertically (as desired) | |
top += ((bottom - top) / 2) - (mChipHeight / 2); | |
bottom = top + mChipHeight; |
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 NetworkRequestFragment extends Fragment { | |
// Declare some sort of interface that your AsyncTask will use to communicate with the Activity | |
public interface NetworkRequestListener { | |
void onRequestStarted(); | |
void onRequestProgressUpdate(int progress); | |
void onRequestFinished(SomeObject result); | |
} | |
private NetworkTask mTask; |
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
private Subscription mDoSomethingSubscription; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(...); | |
// Setup views | |
... |
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
private static final String STATE_TASK_RUNNING = "taskRunning"; | |
private MyTask mTask; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(...); | |
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
private static final String TAG_MY_FRAGMENT = "myFragment"; | |
private MyFragment mFragment; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_adding_fragments); | |
NewerOlder