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
@Override | |
public void onAddAttachments() { | |
boolean shouldShowReqPermission = !ActivityCompat.shouldShowRequestPermissionRationale( | |
__GlobalApp.getActivity(), | |
Manifest.permission.READ_EXTERNAL_STORAGE); | |
boolean isNeedPermission = ActivityCompat.checkSelfPermission(getActivity(), | |
Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED; | |
// dialog request permission | |
if (isNeedPermission) { |
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
/** | |
* @param dialog | |
*/ | |
protected void setupDialogBehavior(Dialog dialog) { | |
dialog.setOnShowListener(dialog1 -> { | |
BottomSheetDialog d = (BottomSheetDialog) dialog; | |
View v = d.findViewById(android.support.design.R.id.design_bottom_sheet); | |
if (v != 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
package ***; | |
import android.Manifest; | |
import android.annotation.SuppressLint; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.pm.ActivityInfo; | |
import android.content.pm.PackageManager; | |
import android.content.res.Configuration; | |
import android.databinding.DataBindingUtil; |
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
private int getCurrentOrientation() { | |
int rotation = getWindowManager().getDefaultDisplay().getRotation(); | |
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { | |
switch (rotation) { | |
case Surface.ROTATION_0: | |
case Surface.ROTATION_90: | |
return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; | |
default: | |
return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; | |
} |
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
/** | |
* | |
*/ | |
void initAppCenter() { | |
// setup app center for crashlytics | |
Distribute.setListener(new __UpdateListener()); | |
AppCenter.start(this, APPCENTER_SECRET_KEY, Analytics.class, Crashes.class, Distribute.class); | |
AppCenter.setEnabled(!BuildConfig.DEBUG); | |
SharedPreferencesManager.initialize(this); |
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
interface __IReportService { | |
@GET("ticket/list") | |
fun getReports(@QueryMap(encoded = true) queries: ReportQuery): Call<__ResponseDTO<Array<__ReportDTO>>> | |
@POST("ticket/create") | |
fun postReport(@Body body: __ReportDTO): Call<__ResponseDTO<__ReportDTO>> | |
@POST("ticket/{ticketId}/update") | |
fun postUpdateReport(@Path("ticketId") ticketiId: String, @Body body: __ReportDTO): Call<__ResponseDTO<__ReportDTO>> |
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
////TODO: change to generic T model | |
public class __ResponseDTO<T>{ | |
public T data; | |
public String ContinuationToken; | |
public Boolean status; | |
public String msg; | |
} |
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
protected void setupWebview() { | |
webChromeClient = new WebChromeClient() { | |
@Override | |
public void onProgressChanged(WebView view, int newProgress) { | |
super.onProgressChanged(view, newProgress); | |
boolean onGoing = newProgress != 100; | |
vBinding.setOnGoing(onGoing); | |
vBinding.action.setImageResource(onGoing ? R.drawable.ic_cancel : R.drawable.ic_refresh); | |
vBinding.setCanBack(view.canGoBack()); | |
vBinding.setCanForward(view.canGoForward()); |
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 StringDeserializer implements JsonDeserializer<String> { | |
@Override | |
public String deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | |
if (json.isJsonObject()) { | |
return json.toString(); | |
} else { | |
return json.getAsString(); | |
} | |
} | |
} |
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 ***.__data; | |
import android.os.Handler; | |
import android.os.Looper; | |
import com.google.gson.GsonBuilder; | |
import ***.R; | |
import ***.utils.Contents; | |
import ***.utils.__ConnectionEvent; | |
import ***.utils.__GlobalApp; |