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
mContent = (EditText) v.findViewById(R.id.dialog_item_content_EditText); | |
mContent.setText(mContentInit); | |
mContent.setRawInputType(InputType.TYPE_CLASS_TEXT); | |
mContent.setImeActionLabel(getResources().getString(R.string.done), EditorInfo.IME_ACTION_DONE); | |
mContent.setImeOptions(EditorInfo.IME_ACTION_DONE); | |
mContent.setOnEditorActionListener(new TextView.OnEditorActionListener() { | |
@Override | |
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { | |
if (event == 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
//parsing with help of gson without storing via realm | |
UserInfo userInfo = (UserInfo)Utils.deserialize(userInfoJsonObject.toString(),new TypeToken<UserInfo>(){}.getType()); | |
//save data using realm | |
Realm realm = Realm.getDefaultInstance(); | |
realm.beginTransaction(); | |
realm.createOrUpdateObjectFromJson(UserInfo.class, userInfoJsonObject); | |
realm.commitTransaction(); | |
realm.close(); |
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 CountingFileRequestBody extends RequestBody { | |
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE | |
private final File file; | |
private final ProgressListener listener; | |
private final String contentType; | |
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) { | |
this.file = file; |
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
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
public class AspectImageView extends ImageView { | |
private static final int DEFAULT_XRATIO = 1; | |
private static final int DEFAULT_YRATIO = 1; |
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
package no.nsb.ombord; | |
import java.net.DatagramPacket; | |
import java.net.DatagramSocket; | |
import java.net.InetAddress; | |
import java.net.SocketTimeoutException; | |
import java.net.UnknownHostException; | |
import org.apache.http.util.ExceptionUtils; |
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 SplashActivity extends Activity{ | |
private static final String TAG = "SplashActivity"; | |
private Handler mHandler; | |
private Runnable mRunnable = new Runnable() { | |
@Override | |
public void run() { | |
loadHomeScreen(); |
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 PrefsManager { | |
// Shared Preferences | |
private SharedPreferences pref; | |
// Editor for Shared preferences | |
private Editor editor; | |
// Shared pref mode | |
private int PRIVATE_MODE = 0; |
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 EncryptionUtils { | |
private Cipher mCipher; | |
private SecretKeySpec mSpecSecretKey; | |
private IvParameterSpec mSpecIV; | |
/* private String iv = "4957414F6B524147";//Dummy iv (CHANGE IT!) | |
private String secret_key = "764164673344344D55624A6C486E4168";//Dummy secretKey (CHANGE IT!) | |
*/ | |
public EncryptionUtils(String secret_key,String iv) { |
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 UTILS { | |
public static boolean LOG_ENABLED = true; | |
public static class Log { | |
public static void e(String tag, String message) { | |
if (LOG_ENABLED) { | |
android.util.Log.e(tag, message); | |
} | |
} |
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 URLS { | |
public static final SERVER_CONFIGS.Server CURRENT_SERVER = SERVER_CONFIGS.Server.QA; | |
private static class SERVER_CONFIGS | |
{ | |
private static final String LIVE_URL = "http://services.joisar.com/svc/"; | |
private static final String QA_URL = "http://qaservices.joisar.com/svc/"; | |
private static enum Server { | |
LIVE(LIVE_URL), QA(QA_URL); |
NewerOlder