is a starting blank template for Android Projects
- AppCompat
- Support Design
- Timber: https://github.com/JakeWharton/timber
- Butterknife: http://jakewharton.github.io/butterknife
- Picasso: https://github.com/square/picasso
- Dagger: http://google.github.io/dagger/
- Retrofit: http://square.github.io/retrofit
- GSON: https://github.com/google/gson
- RXJava https://github.com/ReactiveX/RxJava
- okHTTP http://square.github.io/okhttp
- Facebook SDK https://developers.facebook.com/docs/android
- Twitter SDK hhttps://docs.fabric.io/android/twitter/twitter.html
- Google SDK https://developers.google.com/api-client-library/java/google-api-java-client/oauth2
- EasyForm https://github.com/emmasuzuki/EasyForm
- Sweet Alert Dialog https://github.com/pedant/sweet-alert-dialog
- Sugar ORM https://github.com/satyan/sugar
- Java JWT https://github.com/jwtk/jjwt
- Particle https://github.com/JeasonWong/Particle
- CircleImageView https://github.com/hdodenhof/CircleImageView
- Material DateTime Picker - Select a time/date in style https://github.com/wdullaer/MaterialDateTimePicker
- RippleEffect https://github.com/traex/RippleEffect
- Picasso http://square.github.io/picasso
- Socket.IO-client Java https://github.com/socketio/socket.io-client-java
- Firebase Cloud Messaging https://firebase.google.com/docs/cloud-messaging
- PayPal Android SDK https://github.com/paypal/PayPal-Android-SDK
- PhotoView https://github.com/chrisbanes/PhotoView
MainThreadImp.getInstance().post(new Runnable() {
@Override
public void run() {
}
});
@Inject
Launcher launcher;
int REQUEST_IMAGE_CAPTURE = launcher.REQUEST_IMAGE_CAPTURE;
launcher.takePicture();
// on activity result
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
if (imageBitmap != null) {
// location: imageBitmap.toString()
}
}
}
@Inject
Launcher launcher;
int REQUEST_VIDEO_CAPTURE = launcher.REQUEST_VIDEO_CAPTURE;
launcher.takeVideo();
// on activity result
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_VIDEO_CAPTURE && resultCode == RESULT_OK) {
// video file: launcher.videoFile(data);
}
}
@Inject
AccelListener accelListener;
// accelerometer
accelListener.listener(new SensorEventListener() {
public void onSensorChanged(SensorEvent event) {
// only look at accelerometer events
if (event.sensor.getType() != Sensor.TYPE_ACCELEROMETER) {
return;
}
// X: event.values[0]
// Y: event.values[1]
// Z: event.values[2]
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
});
// start
try {
accelListener.start();
} catch (Exception e) {
e.printStackTrace();
}
// stop
accelListener.stop();
@Inject
GPS gps;
// gps
gps.run(new LocationListener() {
@Override
public void onLocationChanged(Location location) {
// LAT: location.getLatitude()
// LNG: location.getLongitude()
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
});
@Inject
ScreenOrientation orientation;
// screen orientation
TYPES:
UNSPECIFIED, LANDSCAPE_PRIMARY, PORTRAIT_PRIMARY, LANDSCAPE, PORTRAIT, LANDSCAPE_SECONDARY, PORTRAIT_SECONDARY
try {
orientation.apply(TYPES);
} catch (Exception e) {
e.printStackTrace();
}
@Inject
Vibrate vibrate;
long[] patterns = {100, 200, 300, 400, 500};
vibrate.pattern(patterns, 1);
@Inject
AudioHandler audioHandler;
// play audio
audioHandler.play("android.resource://" + getApplicationContext().getPackageName() + "/" + R.raw.audio);
@Inject
VideoHandler videoHandler;
videoHandler.play("https://www.youtube.com/path-to-video");
videoHandler.play("http://your-domain-name/video.mp4");
videoHandler.play("file:///your-path/demo.mp4");
videoHandler.play("file:///android_asset/your-path/demo.mp4");
// error dialog
DialogFactory.error(ctx, "Title", "Message!",
new DialogInterfaceFactory().OnClick(new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})).show();
@Inject
WBAlerts wbAlerts;
wbAlerts.error("Error Name", "Error Message").show();
// Call API
YourAdapter yourAdapter = new YourAdapter();
Call<YOURMODELNAME> call = yourAdapter.getUser("username");
call.enqueue(new Callback<YOURMODELNAME>() {
@Override
public void onResponse(Call<YOURMODELNAME> call, Response<YOURMODELNAME> response) {
final Response<YOURMODELNAME> res = response;
// sample response model
// res.body().getEmail()
}
@Override
public void onFailure(Call<YOURMODELNAME> call, Throwable t) {
}
});
@Inject
SMTP smtp;
smtp.username = "[email protected]";
smtp.password = "your-password";
smtp.host = "smtp.gmail.com";
// single email
smtp.email = "[email protected]";
// multiple email
smtp.emailMultiple = "[email protected],[email protected]";
smtp.subject = "JavaMail Demo";
smtp.message = "Content of the demo";
smtp.attachment = new File(Environment.getExternalStorageDirectory() +
File.separator + "DCIM" + File.separator + "Camera" + File.separator + "your-image.png").toString();
// send the email
smtp.execute();
@Inject
IMAP imap;
private class FetchEmail extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... voids) {
imap.username = "[email protected]";
imap.password = "your-email-password";
imap.host = "imap.your-provider.com";
IMAP.ContentMessages[] messages = imap.fetch();
for (IMAP.ContentMessages message : messages) {
// message.getReceivedDate().toString()
}
// close the connection
imap.close();
return null;
}
}
// execute the task
new FetchEmail().execute();
@Inject
Network network;
// type
network.connectionInfo().getString("type");
// info
network.connectionInfo().getString("info");
@Inject
SocketIOConnector socketIOConnector;
socketIOConnector.setUp();
// response
Emitter.Listener onNewMessage = args -> mActivity.runOnUiThread(() -> {
String response = (String) args[0];
Log.i(TAG, "Response: " + response);
});
socketIOConnector.listen("recieved_message", onNewMessage);
// connect
socketIOConnector.connect();
// sent data, message or what ever you
socketIOConnector.sendString("send_message", "We will sent data here!");
Replace the google-service.json under app folder with your own.
// start SIP Service
startService(new Intent(getBaseContext(), SIPService.class));
// stop SIP Service
stopService(new Intent(getBaseContext(), SIPService.class));
// start a call
new SIPService().initiateCall(mActivity, "sip:name_to_call@domain");
File helpers
FileWBFile.getBmpUri(Context context, Bitmap inImage);
String WBFile.getRealPathFromURI(Activity activity, Uri uri);
File WBFile.bmpToFile(Activity activity, Bitmap bitmap);
Form helpers
Spinner WBForm.defaultSpinner(Context context, int spinnerArray, Spinner spinner, AdapterView.OnItemSelectedListener onItemSelectedListener);
HTTP helpers
void WBHttp.imgURLLoad(Context context, String source, CircleImageView imageView);
Security helpers
String WBSecurity.MD5(String toHash);
String WBSecurity.encodeBase64(String toConvert);
String WBSecurity.decodeBase64(String converted);
Encryption helpers
String JWT.generateToken();
Time helpers
long WBTime.unix();
long WBTime.unixTimeStamp();
long WBTime.addMinuteUnix(int minute);
Date WBTime.currentDate();
Date WBTime.addMinuteDate(int minute);
Date WBTime.minusMinuteDate(int minute);
String WBTime.getMonthForInt(int num);
Using OAuth 2.0 with the Google API Client Library for Java
Android Clean Architecture Boilerplate is licensed under the Apache License (ASL) license. For more information, see the LICENSE file in this repository.