This file contains hidden or 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.app.Activity; | |
| import android.content.Intent; | |
| import android.os.Bundle; | |
| import java.util.concurrent.TimeUnit; | |
| import rx.Observable; | |
| import rx.Observer; | |
| import rx.Subscription; |
This file contains hidden or 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.app.AlertDialog; | |
| import android.content.Context; | |
| import android.content.DialogInterface; | |
| /** | |
| * Dialog helper class | |
| */ | |
| public class DestructiveDialog { | |
| public DestructiveDialog(Context context, String title, String message, String positive, String negative, final DialogListener dialogListener) { |
This file contains hidden or 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 LocationHelper{ | |
| public static boolean isLocationEnabled(Context context) { | |
| LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); | |
| // Check GPS status | |
| boolean isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); | |
| // Check network status | |
| boolean isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); | |
| if (!isGPSEnabled && !isNetworkEnabled) { | |
| return false; | |
| } |
This file contains hidden or 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 NetworkUtils{ | |
| public static boolean isNetworkConnected(Context context) { | |
| ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
| NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); | |
| return (networkInfo != null && networkInfo.isConnectedOrConnecting()); | |
| } | |
| } |
This file contains hidden or 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 FragmentHelper { | |
| public static boolean isFragmentVisible(WeakReference<Fragment> fragment) { | |
| if (fragment!=null && fragment.get() != null && fragment.get().getActivity() != null && | |
| fragment.get() | |
| .isVisible() | |
| && !fragment.get().isRemoving()) { | |
| return true; | |
| } | |
| return false; | |
| } |
This file contains hidden or 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
| package <Package Name>; | |
| import android.content.Context; | |
| import android.graphics.Typeface; | |
| import android.text.TextUtils; | |
| public class FontUtils { | |
| /** | |
| * Loads the desired font. | |
| * |
This file contains hidden or 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
| package <Package Name>; | |
| import android.content.Context; | |
| import android.content.SharedPreferences; | |
| import android.preference.PreferenceManager; | |
| import java.util.Map; | |
| import java.util.Set; | |
| public class PreferenceHelper { |
This file contains hidden or 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
| Observable.merge(Observable.from(getRawSelfPosts()), Observable.from(getRawFriendPosts()), Observable.from(getRawNearbyPosts(activity))) | |
| .distinct((post) -> post.getObjectId()) | |
| .subscribeOn(Schedulers.io()); | |
| getRawPostsObs(activity).map((post) -> postToCardModel(post)); | |
| new RxList(getRawPostsObs(activity)); | |
| getPostsObs(activity).toList().toBlocking().single(); |
This file contains hidden or 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
| Observable.just("") | |
| .subscribeOn(Schedulers.immediate()).observeOn(Schedulers.io()).doOnSubscribe(() -> { | |
| //tv1.setText("fe"); | |
| }) | |
| .map(x -> { | |
| InitVo initVo = qrHttp.init(); | |
| return initVo; | |
| }) | |
| .map(initVo -> { |