public Support(Context context) { this.SUPPORT_PHONE_NUMBER = Utils.getMetaDataValue(context.getApplicationContext(), SUPPORT_PHONE_NUMBER_METADATA); }
public static boolean isDeviceInIdleState(Context context) { if (hasMarshmallow()) { PowerManager pm = context.getSystemService(PowerManager.class); if (pm != null && pm.isDeviceIdleMode()) { return true; } } return false; }
public void showDownloadInProgress() { Utils.printLog(context, TAG, "showDownloadInProgress :: "); mainLayout.setVisibility(View.VISIBLE); downloadInProgressLayout.setVisibility(View.VISIBLE); previewLayout.setVisibility(GONE); downloadedLayout.setVisibility(GONE); retryLayout.setVisibility(GONE); }
public synchronized void syncMessageMetadataUpdate(String key, boolean isFromFcm) { if (!TextUtils.isEmpty(key) && mobiComMessageService.isMessagePresent(key)) { if (Utils.isDeviceInIdleState(context)) { new ConversationRunnables(context, null, false, false, true); } else { Utils.printLog(context, TAG, "Syncing updated message metadata from " + (isFromFcm ? "FCM" : "MQTT") + " for message key : " + key); Intent intent = new Intent(context, ConversationIntentService.class); intent.putExtra(ConversationIntentService.MESSAGE_METADATA_UPDATE, true); ConversationIntentService.enqueueWork(context, intent); } } }
public void reconnectMQTT() { try { if (((MobiComKitActivityInterface) fragmentActivity).getRetryCount() <= 3) { if (Utils.isInternetAvailable(fragmentActivity)) { Utils.printLog(fragmentActivity, TAG, "Reconnecting to mqtt."); ((MobiComKitActivityInterface) fragmentActivity).retry(); Intent intent = new Intent(fragmentActivity, ApplozicMqttIntentService.class); intent.putExtra(ApplozicMqttIntentService.SUBSCRIBE, true); ApplozicMqttIntentService.enqueueWork(fragmentActivity, intent); } } } catch (Exception e) { e.printStackTrace(); } }
private void populateAutoComplete() { if (Utils.isBetweenGingerBreadAndKitKat()) { // Use AccountManager (API 8+) new SetupEmailAutoCompleteTask().execute(null, null); } else if (Utils.hasMarshmallow()) { showRunTimePermission(); } }
@Override public void onClick(View v) { try { if (message.isAttachmentDownloaded()) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); Uri outputUri; if (Utils.hasNougat()) { outputUri = FileProvider.getUriForFile(context, Utils.getMetaDataValue(context, MobiComKitConstants.PACKAGE_NAME) + ".provider", new File(message.getFilePaths().get(0))); } else { outputUri = Uri.fromFile(new File(message.getFilePaths().get(0))); } intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); if (intent.resolveActivity(context.getPackageManager()) != null) { intent.setDataAndType(outputUri, mimeType); context.startActivity(intent); } else { Toast.makeText(context, R.string.info_app_not_found_to_open_file, Toast.LENGTH_LONG).show(); } } } catch (Exception e) { Utils.printLog(context, TAG, "No application found to open this file"); } }
@Override public void onFailure(RegisteredUsersApiResponse registeredUsersApiResponse, String[] userIdArray, Exception exception) { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } String error = fragmentActivity.getString(Utils.isInternetAvailable(fragmentActivity) ? R.string.applozic_server_error : R.string.you_need_network_access_for_block_or_unblock); Toast toast = Toast.makeText(fragmentActivity, error, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); }
public static void processLocationAction(final Activity activity, LinearLayout layout) { String geoApiKey = Utils.getMetaDataValue(activity.getApplicationContext(), GOOGLE_API_KEY_META_DATA); if (Utils.hasMarshmallow() && PermissionsUtils.checkSelfPermissionForLocation(activity)) { new ApplozicPermissions(activity, layout).requestLocationPermissions(); } else {
if (Utils.hasMarshmallow() && !PermissionsUtils.checkPermissionForCameraAndMicrophone(this)) { applozicPermission.checkRuntimePermissionForCameraAndAudioRecording(); return; if (Utils.hasMarshmallow() && PermissionsUtils.checkSelfForCallPermission(this)) { applozicPermission.requestCallPermission(); } else if (PermissionsUtils.isCallPermissionGranted(this)) { Utils.printLog(this, "ConversationActivity", "Call permission is not added in androidManifest");
public boolean onTouch(View v, MotionEvent event) { Utils.toggleSoftKeyBoard(LoginActivity.this, true); return false; } });
public void playAudio() { final String mimeType = FileUtils.getMimeType(message.getFileMetas().getName()); if (Utils.hasNougat()) { uri = FileProvider.getUriForFile(context, Utils.getMetaDataValue(context, MobiComKitConstants.PACKAGE_NAME) + ".provider", new File(message.getFilePaths().get(0))); } else { uri = Uri.fromFile(new File(message.getFilePaths().get(0))); Log.i(TAG, uri.toString()); } if (mimeType != null && mimeType.contains("audio")) { /* if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions((Activity) context, new String[]{Manifest.permission.READ_PHONE_STATE}, 10); } else { }*/ ApplozicAudioManager.getInstance(context).play(uri, ApplozicDocumentView.this); setAudioIcons(); updateApplozicSeekBar(); } else { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(uri, mimeType); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); if (intent.resolveActivity(context.getPackageManager()) != null) { context.startActivity(intent); } else { Toast.makeText(context, R.string.info_app_not_found_to_open_file, Toast.LENGTH_LONG).show(); } } }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_contact, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setQueryHint(getResources().getString(R.string.search_hint)); if (Utils.hasICS()) { searchItem.collapseActionView(); } searchView.setOnQueryTextListener(this); searchView.setSubmitButtonEnabled(true); searchView.setIconified(true); return super.onCreateOptionsMenu(menu); }
public static void enableStrictMode() { if (Utils.hasGingerbread()) { if (Utils.hasHoneycomb()) {
Uri thumbUri; if (Utils.hasHoneycomb()) { thumbUri = Uri.parse(photoData); } else {
public static Spannable getSmiledText(Context context, CharSequence text, EmojiconHandler emojiHandler) { Spannable spannable = spannableFactory.newSpannable(text); if (emojiHandler != null) { emojiHandler.addEmojis(context, spannable, Utils.dpToPx(28)); } return spannable; } }
public static void sendNotificationBroadcast(Context context, Message message, int index) { if (message != null) { if (message.getMetadata() != null && message.getMetadata().containsKey("NO_ALERT") && "true".equals(message.getMetadata().get("NO_ALERT"))) { return; } int notificationId = Utils.getLauncherIcon(context.getApplicationContext()); final NotificationService notificationService = new NotificationService(notificationId, context, 0, 0, 0); if (MobiComUserPreference.getInstance(context).isLoggedIn()) { Channel channel = ChannelService.getInstance(context).getChannelInfo(message.getGroupId()); Contact contact = null; if (message.getConversationId() != null) { ConversationService.getInstance(context).getConversation(message.getConversationId()); } if (message.getGroupId() == null) { contact = new AppContactService(context).getContactById(message.getContactIds()); } if (ApplozicClient.getInstance(context).isNotificationStacking()) { notificationService.notifyUser(contact, channel, message, index); } else { notificationService.notifyUserForNormalMessage(contact, channel, message, index); } } } }
intentVideo.setAction(Intent.ACTION_VIEW); Uri outputUri; if (Utils.hasNougat()) { outputUri = FileProvider.getUriForFile(context, Utils.getMetaDataValue(context, MobiComKitConstants.PACKAGE_NAME) + ".provider", new File(smListItem.getFilePaths().get(0))); } else { outputUri = Uri.fromFile(new File(smListItem.getFilePaths().get(0))); Utils.printLog(context, TAG, "No application found to open this file");
@Override public void onFailure(RegisteredUsersApiResponse registeredUsersApiResponse, String[] userIdArray, Exception exception) { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } String error = getString(Utils.isInternetAvailable(ChannelInfoActivity.this) ? R.string.applozic_server_error : R.string.you_need_network_access_for_block_or_unblock); Toast toast = Toast.makeText(ChannelInfoActivity.this, error, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); }
String action = intent.getAction(); LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent(action)); Utils.printLog(context, TAG, action); if (!Utils.isInternetAvailable(context)) { firstConnect = true; return;