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 connectToRoom(String roomName) { | |
configureAudio(true); | |
ConnectOptions.Builder connectOptionsBuilder = new ConnectOptions.Builder(accessToken) | |
.roomName(roomName); | |
/* | |
* Add local audio track to connect options to share with participants. | |
*/ | |
if (localAudioTrack != null) { | |
connectOptionsBuilder |
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
// rxjava-challenge-solution | |
// this example use RxJava 1.0 | |
// Province class => data class Province(val id: Int ,val name:String, var cities:List<City>? = null) | |
class DataManager { | |
// solution | |
fun getProvincesAndCities(): Observable<List<Province>> { | |
return getProvinces() | |
.subscribeOn(Schedulers.io()) |
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
void drawCustomMethod(Canvas canvas) { | |
int startLine = getTouchedLine(startX, startY); | |
int startCharPos = getCharPositionByTouch(startX, startY, startLine); | |
int currentLine = getTouchedLine(currentX, currentY); | |
int currentCharPos = getCharPositionByTouch(currentX, currentY, currentLine); | |
if(startLine == currentLine) { | |
drawSelection(canvas,startCharPos,currentCharPos,startLine); | |
return; |
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
void drawSelection(Canvas canvas, int startChar, int endChar, int line) { | |
Rect rect = getTextRect(line); | |
float startX = layout.getPrimaryHorizontal(startChar ); | |
float endX = 0; | |
int maxPosLine = layout.getLineEnd(line); |
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
int getTouchedLine(float y) { | |
int line = 0; | |
for (int i = 0; i < layout.getLineCount(); i++) { | |
if (y > layout.getLineTop(i) && y < layout.getLineBottom(i)) { | |
line = i; | |
break; | |
} | |
} | |
return line; | |
} |
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 boolean onTouchEvent(MotionEvent event) { | |
int action = event.getActionMasked(); | |
float x = event.getX(); | |
float y = event.getY(); | |
switch (action) { | |
case MotionEvent.ACTION_DOWN: | |
startX = x; | |
startY = y; |
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
if (boring == null && isUndefined(desiredWidth) && desiredWidth <= width) { | |
// Is used when the width is not known and the text is not boring, ie. if it contains | |
// unicode characters. | |
layout = new StaticLayout(); | |
} else if (boring != null && boring.width <= width) { | |
// Is used for single-line, boring text when the width is either unknown or bigger | |
// than the width of the text. | |
layout = new BoringLayout(); | |
} else { | |
// Is used for multiline, boring text and the width is known. |
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 VerticalTimelineDecoration extends RecyclerView.ItemDecoration { | |
Paint paintFill = null; | |
Paint paintStrokeFill = null; | |
Paint paintStroke = null; | |
Paint paintDotLine = null; | |
Paint paintText=null; | |
Paint paintTextBold=null; |
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 consumeDownloadPurchase(Purchase purchase) { | |
mHelper.consumeAsync(purchase, new IabHelper.OnConsumeFinishedListener() { | |
@Override | |
public void onConsumeFinished(Purchase purchase, IabResult result) { | |
if (result.isFailure()) { | |
Toast.makeText(DetailActivity.this, R.string.purchasing_error, Toast.LENGTH_SHORT).show(); | |
return; | |
} | |
startDownloading(); | |
} |
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 SKU_DOWNLOAD = "DOWNLOAD"; | |
private static final String SKU_STREAMING = "STREAMING"; | |
private static final String SKU_FULL_VERSION = "FULLVERSION"; |
NewerOlder