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 HTTPConnectionService { | |
public final static int GET = 1; | |
public final static int POST = 2; | |
HttpURLConnection urlConnection = null; | |
InputStream in = null; | |
// private View view; | |
StringBuilder response = null; | |
// private static final String LINE_FEED = "\r\n"; | |
int resCode = -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
// ********************************************* SHOW SNACKBAR METHOD ******************************************************** | |
public static void showSnackbar(String msg, View v, boolean isError) { | |
Snackbar snackbar = Snackbar.make(v, "" + msg | |
, Snackbar.LENGTH_LONG); | |
if (isError) { | |
View sbView = snackbar.getView(); | |
TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); |
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 TaskController { | |
ApiInterface apiService = null; | |
OnWebAPIResponseListener mRepsonseListener; | |
Context context; | |
public TaskController(OnWebAPIResponseListener mRepsonseListener, Context context) { | |
this.context = context; | |
this.mRepsonseListener = mRepsonseListener; | |
} |
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
/** | |
* Created by vishal.halani on 23-Jun-17. | |
*/ | |
public class APIError { | |
@Expose | |
@SerializedName("odata.error") | |
private ErrorBody error; |
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
/** | |
* Created by vishal.halani on 23-Jun-17. | |
*/ | |
public class ErrorUtil { | |
public static APIError parseError(Response<?> response) { | |
Converter<ResponseBody, APIError> converter = |
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
/** | |
* Created by vishal.halani on 31-Aug-17. | |
*/ | |
public interface OnWebAPIResponseListener<T> { | |
void onCallComplete(T object, int requestCode); |
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 LoginActivity extends AppCompatActivity implements OnWebAPIResponseListener, View.OnClickListener { | |
private final String TAG = LoginActivity.class.getSimpleName(); | |
private final int ACCESS_TOKEN_REQUEST_CODE = 1; | |
private static final int RC_LOGIN = 2; | |
private SharedPreferences pref; | |
private String username, password; | |
private LoginController controller; |
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
/** | |
* Created by vishal.halani on 11-May-18. | |
*/ | |
public class TaskAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |
private final int VIEW_ITEM = 1; | |
private final int VIEW_PROG = 0; | |
// The minimum amount of items to have below your current scroll position | |
// before loading more. |
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
/** | |
* Created by vishal.halani on 10-May-18. | |
*/ | |
public class TaskFragment extends Fragment implements OnWebAPIResponseListener { | |
private static final int RC_EMP = 111; | |
private static final int RC_GET_TASK = 222; |
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 BaseActivity extends AppCompatActivity { | |
public ProgressDialog progressDialog; | |
public ActionBar actionBar; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
actionBar = getSupportActionBar(); |
OlderNewer