Skip to content

Instantly share code, notes, and snippets.

View SergeyKharuk's full-sized avatar
💭
Wake me up

Sergey Kharuk SergeyKharuk

💭
Wake me up
  • Ukraine
View GitHub Profile
@SergeyKharuk
SergeyKharuk / proguard-rules.pro
Created January 21, 2021 22:00
proguard-rules.pro file of Twelve project
#1. gson
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
-keepclassmembers enum * {
@com.google.gson.annotations.SerializedName <fields>;
}
-keep,allowobfuscation interface com.google.gson.annotations.SerializedName
@SergeyKharuk
SergeyKharuk / SocketManagerImpl
Last active June 1, 2021 12:40
Class that containts all socket logic.
package com.twelve.app.data.network.repositories.impl;
import android.annotation.SuppressLint;
import android.util.Log;
import com.google.gson.internal.LinkedTreeMap;
import com.google.gson.reflect.TypeToken;
import com.microsoft.signalr.HubConnection;
import com.microsoft.signalr.HubConnectionBuilder;
import com.microsoft.signalr.HubConnectionState;
@SergeyKharuk
SergeyKharuk / gist:ccdff6edb1ec734ce25eccb9fca3d81e
Created March 12, 2018 14:28
Method which returns age of event
/**
* helpful method.
*
* Condition: '_date' must be GMT +0;
*
* Returns the time values that passed. (e.g. 4m ago, 18h ago, 5d ago...etc);
*/
public static String getAgeOfMessage(String _date){
String dateString = DateTimeConverter.getDate(_date) + " " + DateTimeConverter.getTimeWithoutOffset(_date);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
private void getTopics(){
currentPage = PAGE_START;
progressDialog.show();
Connector.getInstance(mMainActivity)
.getForumManager()
.getTopics("Bearer " + storeDataManager.getCurrentUser().token, String.valueOf(currentPage), String.valueOf(AMOUNT_TOPICS_I_GET))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(rTopics -> {
package walltreesoft.petpals.api.managers;
import java.util.Map;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
package walltreesoft.petpals.api;
import android.content.Context;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;