Skip to content

Instantly share code, notes, and snippets.

Avatar
🇦🇷
https://feresr.github.io/

Fernando Raviola feresr

🇦🇷
https://feresr.github.io/
View GitHub Profile
View fragment_order_list.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="#fff"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
View OrderListFragment
package com.feresr.restapp.fragments;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
View ForecastAdapter.java
package com.feresr.rxweather.UI;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Typeface;
import android.support.v7.widget.CardView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
@feresr
feresr / Logcat.txt
Created Aug 19, 2016
Pubnub android logcat
View Logcat.txt
8-19 00:11:58.707 24889-25151/com.productify.urge.debug D/GCMService: Fer: Test 1
08-19 00:12:25.728 24889-25006/com.productify.urge.debug D/OkHttp: <-- 200 OK http://pubsub.pubnub.com/v2/subscribe/sub-c-a183106e-d9b9-11e5-9b67-0619f8945a4f/urge-0416336ce87b43779e72c7399f201ec5,urge-0416336ce87b43779e72c7399f201ec5-pnpres/0?heartbeat=300&tr=4&tt=14715799177149695&pnsdk=PubNub-Java-Unified/4.0.7&uuid=b66efd46-b87b-4a1c-8aad-3116d3b22e82 (28018ms)
08-19 00:12:25.728 24889-25006/com.productify.urge.debug D/OkHttp: Date: Fri, 19 Aug 2016 04:12:25 GMT
08-19 00:12:25.729 24889-25006/com.productify.urge.debug D/OkHttp: Content-Type: text/javascript; charset="UTF-8"
08-19 00:12:25.729 24889-25006/com.productify.urge.debug D/OkHttp: Content-Length: 392
08-19 00:12:25.729 24889-25006/com.productify.urge.debug D/OkHttp: Connection: keep-alive
08-19 00:12:25.729 24889-25006/com.productify.urge.debug D/OkHttp: Cache-Control: no-cache
08-19 00:12:25.729 24889-25006/com.productify.urge.debug D/OkHttp: Access-Control-Allow-O
View GCMService
import android.os.Bundle;
import android.util.Log;
import com.google.android.gms.gcm.GcmListenerService;
import com.productify.urge.UrgeApplication;
import com.productify.urge.UserManager;
import com.productify.urge.Utils;
import javax.inject.Inject;
View InboxUseCase
package com.productify.urge.usecase;
import android.os.Handler;
import android.util.Log;
import com.google.gson.Gson;
import com.productify.urge.common.UseCase;
import com.productify.urge.model.Message;
import com.productify.urge.model.Profile;
import com.pubnub.api.PubNub;
View InboxUseCase
/**
* Created by feresr on 8/08/16.
* This use case connects to the PubNub server and informs its listener of incoming messages.
* Usage: Simply setting a listener will start the PunNub subscription. Setting the listener to null will cancel it.
*/
public class InboxUseCase extends UseCase<InboxUseCase.InboxCallbackListener> {
private final static String TAG = InboxUseCase.class.getSimpleName();
private PubNub pubnub;
private Profile profile;
View gist:4d43b82a5dac93bd890f89bc40545c9e
11-07 12:40:39.817 14370-14370/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.productify.urge, PID: 14370
java.lang.NoSuchFieldError
at libcore.reflect.AnnotationAccess.decodeValue(AnnotationAccess.java:688)
at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:663)
at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:641)
at libcore.reflect.AnnotationAccess.getDeclaredAnnotation(AnnotationAccess.java:170)
at libcore.reflect.AnnotationAccess.getAnnotation(AnnotationAccess.java:72)
at java.lang.Class.getAnnotation(Class.java:359
View activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
View Rx subscribeOn order
return endpoints.getRecentConversations(channel, page, Constants.CONVERSATIONS_PAGE_SIZE)
.subscribeOn(Schedulers.io()) //if I put this on the bottom, everything just works
.flatMap(new CheckResponse<Conversation>())
.toMap(new Func1<Conversation, String>() {
@Override
public String call(Conversation conversation) {
String userId = profile.isMerchant() ? profile.getStore().getUid() : profile.getUid();
return utils.convertChannelNameToUid(userId.contains(conversation.getReceiverId()) ? conversation.getSenderId() : conversation.getReceiverId());
}
}).flatMap(new Func1<Map<String, Conversation>, Observable<Response<ArrayList<UserInfo>>>>() {