-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
CullyCross
committed
Nov 6, 2015
1 parent
217e5a5
commit 81ab948
Showing
9 changed files
with
195 additions
and
36 deletions.
There are no files selected for viewing
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
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
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
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
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
28 changes: 28 additions & 0 deletions
28
app/src/main/java/me/cullycross/test4tabs/utils/ColorUtils.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package me.cullycross.test4tabs.utils; | ||
|
||
import android.content.Context; | ||
import android.os.Build; | ||
import android.support.annotation.ColorRes; | ||
|
||
/** | ||
* Created by: Anton Shkurenko (cullycross) | ||
* Project: Test4tabs | ||
* Date: 11/6/15 | ||
* Code style: SquareAndroid (https://github.com/square/java-code-styles) | ||
* Follow me: @tonyshkurenko | ||
*/ | ||
public class ColorUtils { | ||
|
||
private ColorUtils() { | ||
|
||
} | ||
|
||
public static int getColor(Context ctx, @ColorRes int color) { | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||
return ctx.getColor(color); | ||
} else { | ||
//noinspection deprecation | ||
return ctx.getResources().getColor(color); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
app/src/main/java/me/cullycross/test4tabs/utils/RxHelper.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package me.cullycross.test4tabs.utils; | ||
|
||
import android.util.Log; | ||
import java.util.concurrent.Callable; | ||
import rx.Observable; | ||
import rx.Subscriber; | ||
|
||
/** | ||
* Created by: Anton Shkurenko (cullycross) | ||
* Project: Test4tabs | ||
* Date: 11/6/15 | ||
* Code style: SquareAndroid (https://github.com/square/java-code-styles) | ||
* Follow me: @tonyshkurenko | ||
*/ | ||
public class RxHelper { | ||
|
||
private static final String TAG = RxHelper.class.getSimpleName(); | ||
|
||
public static <T> Observable<T> makeColdObservable(final Callable<T> func) { | ||
return Observable.create( | ||
new Observable.OnSubscribe<T>() { | ||
@Override | ||
public void call(Subscriber<? super T> subscriber) { | ||
try { | ||
subscriber.onNext(func.call()); | ||
} catch(Exception e) { | ||
Log.e(TAG, "Something wrong happened", e); | ||
} | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.