use of android.widget.RelativeLayout in project iterable-android-sdk by Iterable.
the class IterableWebViewClient method onStart.
/**
* Sets up the webview and the dialog layout
*/
@Override
protected void onStart() {
super.onStart();
this.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
webView = new IterableWebView(context);
webView.createWithHtml(this, htmlString);
webView.addJavascriptInterface(this, JAVASCRIPT_INTERFACE);
if (orientationListener == null) {
orientationListener = new OrientationEventListener(context, SensorManager.SENSOR_DELAY_NORMAL) {
public void onOrientationChanged(int orientation) {
// Resize the webview on device rotation
if (loaded) {
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
webView.loadUrl(IterableWebViewClient.resizeScript);
}
}, 1000);
}
}
};
}
orientationListener.enable();
RelativeLayout relativeLayout = new RelativeLayout(this.getContext());
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
relativeLayout.addView(webView, layoutParams);
setContentView(relativeLayout, layoutParams);
IterableApi.sharedInstance.trackInAppOpen(messageId);
}
use of android.widget.RelativeLayout in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method updateDownloadStatus.
public void updateDownloadStatus(final Message message) {
if (this.getActivity() == null) {
return;
}
this.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
try {
int index = messageList.indexOf(message);
if (index != -1) {
Message smListItem = messageList.get(index);
smListItem.setKeyString(message.getKeyString());
smListItem.setFileMetaKeyStrings(message.getFileMetaKeyStrings());
if (messageList.get(index) != null) {
messageList.get(index).setKeyString(message.getKeyString());
messageList.get(index).setFileMetaKeyStrings(message.getFileMetaKeyStrings());
}
View view = recyclerView.getChildAt(index - linearLayoutManager.findFirstVisibleItemPosition());
if (view != null) {
final RelativeLayout attachmentDownloadProgressLayout = (RelativeLayout) view.findViewById(R.id.attachment_download_progress_layout);
final AttachmentView attachmentView = (AttachmentView) view.findViewById(R.id.main_attachment_view);
final ImageView preview = (ImageView) view.findViewById(R.id.preview);
TextView audioDurationTextView = (TextView) view.findViewById(R.id.audio_duration_textView);
final ImageView videoIcon = (ImageView) view.findViewById(R.id.video_icon);
String audioDuration;
if (message.getFileMetas() != null && message.getFileMetas().getContentType().contains("image")) {
attachmentView.setVisibility(VISIBLE);
preview.setVisibility(View.GONE);
attachmentView.setMessage(smListItem);
attachmentDownloadProgressLayout.setVisibility(View.GONE);
} else if (message.getFileMetas() != null && message.getFileMetas().getContentType().contains("video")) {
FileClientService fileClientService = new FileClientService(getContext());
attachedFile.setVisibility(View.GONE);
preview.setVisibility(VISIBLE);
videoIcon.setVisibility(VISIBLE);
preview.setImageBitmap(fileClientService.createAndSaveVideoThumbnail(message.getFilePaths().get(0)));
} else if (message.getFileMetas() != null) {
// Hide Attachment View...
RelativeLayout applozicDocRelativeLayout = (RelativeLayout) view.findViewById(R.id.applozic_doc_downloaded);
ImageView imageViewDoc = (ImageView) applozicDocRelativeLayout.findViewById(R.id.doc_icon);
if (message.getFileMetas() != null && message.getFilePaths() == null) {
if (message.getFileMetas().getContentType().contains("audio")) {
imageViewDoc.setImageResource(R.drawable.ic_play_circle_outline);
} else {
imageViewDoc.setImageResource(R.drawable.ic_documentreceive);
}
applozicDocRelativeLayout.setVisibility(VISIBLE);
} else if (message.getFilePaths() != null) {
String filePath = message.getFilePaths().get(0);
final String mimeType = FileUtils.getMimeType(filePath);
if (mimeType.contains("audio")) {
if (message.isAttachmentDownloaded()) {
audioDuration = ApplozicAudioManager.getInstance(getContext()).refreshAudioDuration(filePath);
audioDurationTextView.setVisibility(View.VISIBLE);
audioDurationTextView.setText(audioDuration);
} else {
audioDurationTextView.setVisibility(View.VISIBLE);
audioDurationTextView.setText("00:00");
}
imageViewDoc.setImageResource(R.drawable.ic_play_circle_outline);
} else {
imageViewDoc.setImageResource(R.drawable.ic_documentreceive);
}
applozicDocRelativeLayout.setVisibility(VISIBLE);
}
view.findViewById(R.id.applozic_doc_download_progress_rl).setVisibility(View.GONE);
}
}
}
} catch (Exception ex) {
Utils.printLog(getContext(), TAG, "Exception while updating download status: " + ex.getMessage());
}
}
});
}
use of android.widget.RelativeLayout in project Applozic-Android-SDK by AppLozic.
the class ProfileFragment method setupDeviderView.
private void setupDeviderView(View view, int parentLayout, int childVerticalLineLayout) {
final RelativeLayout layout = (RelativeLayout) view.findViewById(parentLayout);
final RelativeLayout childLayout = (RelativeLayout) view.findViewById(childVerticalLineLayout);
ViewTreeObserver viewTreeObserver = layout.getViewTreeObserver();
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
layout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
int height = layout.getMeasuredHeight();
float marginPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, LEFT_MARGIN, getActivity().getResources().getDisplayMetrics());
float liineWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, LINE_WIDTH, getActivity().getResources().getDisplayMetrics());
RelativeLayout.LayoutParams layoutPrams = new RelativeLayout.LayoutParams((int) liineWidth, height);
layoutPrams.setMargins((int) marginPx, 0, 0, 0);
childLayout.setLayoutParams(layoutPrams);
}
});
}
use of android.widget.RelativeLayout in project Applozic-Android-SDK by AppLozic.
the class MessageInfoFragment method onCreateView.
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
init();
View view = inflater.inflate(R.layout.applozic_message_info, container, false);
Bundle bundle = getArguments();
String messageJson = bundle.getString(MESSAGE_ARGUMENT_KEY);
message = (Message) GsonUtils.getObjectFromJson(messageJson, Message.class);
attachmentView = (AttachmentView) view.findViewById(R.id.applozic_message_info_attachmentview);
ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.applozic_message_info_progress_bar);
attachmentView.setProressBar(progressBar);
attachmentView.setVisibility(message.hasAttachment() ? View.VISIBLE : View.GONE);
RelativeLayout defaultRelativeLayout = (RelativeLayout) view.findViewById(R.id.applozic_message_info_default_layout);
TextView textView = (TextView) view.findViewById(R.id.applozic_message_info_message_text);
readListView = (RecyclerView) view.findViewById(R.id.applozic_message_info_read_list);
deliveredListView = (RecyclerView) view.findViewById(R.id.applozic_message_info_delivered_list_view);
readListView.setHasFixedSize(true);
deliveredListView.setHasFixedSize(true);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
RecyclerView.LayoutManager mLayoutManagerForDev = new LinearLayoutManager(getActivity());
readListView.setLayoutManager(mLayoutManager);
readListView.setClickable(true);
deliveredListView.setLayoutManager(mLayoutManagerForDev);
deliveredListView.setClickable(true);
ImageView locationImageView = (ImageView) view.findViewById(R.id.static_mapview);
final LinearLayout mainContactShareLayout = (LinearLayout) view.findViewById(R.id.contact_share_layout);
RelativeLayout chatLocation = (RelativeLayout) view.findViewById(R.id.chat_location);
if (message.hasAttachment() && !message.isContactMessage() && !message.isLocationMessage()) {
textView.setVisibility(View.GONE);
attachmentView.setMessage(message);
chatLocation.setVisibility(View.GONE);
defaultRelativeLayout.setVisibility(View.GONE);
defaultRelativeLayout.setVisibility(View.VISIBLE);
setupAttachmentView(message, defaultRelativeLayout);
} else {
defaultRelativeLayout.setVisibility(View.GONE);
textView.setVisibility(View.VISIBLE);
textView.setText(message.getMessage());
}
if (message.isLocationMessage()) {
defaultRelativeLayout.setVisibility(View.GONE);
chatLocation.setVisibility(View.VISIBLE);
locationImageLoader.setImageFadeIn(false);
locationImageLoader.setLoadingImage(R.drawable.applozic_map_offline_thumbnail);
locationImageLoader.loadImage(LocationUtils.loadStaticMap(message.getMessage()), locationImageView);
textView.setVisibility(View.GONE);
} else {
chatLocation.setVisibility(View.GONE);
}
if (message.isContactMessage()) {
chatLocation.setVisibility(View.GONE);
defaultRelativeLayout.setVisibility(View.GONE);
setupContactShareView(message, mainContactShareLayout);
textView.setVisibility(View.GONE);
} else {
mainContactShareLayout.setVisibility(View.GONE);
}
messageInfoAsyncTask = new MessageInfoAsyncTask(message.getKeyString(), getActivity());
messageInfoAsyncTask.execute();
return view;
}
use of android.widget.RelativeLayout in project android_packages_apps_Settings by omnirom.
the class DashboardAdapterTest method setupSuggestions.
private void setupSuggestions(List<Tile> suggestions) {
mDashboardAdapter.setCategoriesAndSuggestions(null, /* category */
suggestions);
final Context context = RuntimeEnvironment.application;
mSuggestionHolder = new DashboardAdapter.SuggestionAndConditionHeaderHolder(LayoutInflater.from(context).inflate(R.layout.suggestion_condition_header, new RelativeLayout(context), true));
}
Aggregations