List of usage examples for android.widget LinearLayout setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.hyphenate.chatuidemo.ui.SettingsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false)) return;/*from www . java 2s.co m*/ rl_switch_notification = (RelativeLayout) getView().findViewById(R.id.rl_switch_notification); rl_switch_sound = (RelativeLayout) getView().findViewById(R.id.rl_switch_sound); rl_switch_vibrate = (RelativeLayout) getView().findViewById(R.id.rl_switch_vibrate); rl_switch_speaker = (RelativeLayout) getView().findViewById(R.id.rl_switch_speaker); rl_switch_chatroom_leave = (RelativeLayout) getView().findViewById(R.id.rl_switch_chatroom_owner_leave); rl_switch_delete_msg_when_exit_group = (RelativeLayout) getView() .findViewById(R.id.rl_switch_delete_msg_when_exit_group); rl_switch_auto_accept_group_invitation = (RelativeLayout) getView() .findViewById(R.id.rl_switch_auto_accept_group_invitation); rl_switch_adaptive_video_encode = (RelativeLayout) getView() .findViewById(R.id.rl_switch_adaptive_video_encode); rl_custom_appkey = (RelativeLayout) getView().findViewById(R.id.rl_custom_appkey); rl_custom_server = (RelativeLayout) getView().findViewById(R.id.rl_custom_server); rl_switch_offline_call_push = (RelativeLayout) getView().findViewById(R.id.rl_switch_offline_call_push); notifySwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_notification); soundSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_sound); vibrateSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_vibrate); speakerSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_speaker); ownerLeaveSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_owner_leave); switch_delete_msg_when_exit_group = (EaseSwitchButton) getView() .findViewById(R.id.switch_delete_msg_when_exit_group); switch_auto_accept_group_invitation = (EaseSwitchButton) getView() .findViewById(R.id.switch_auto_accept_group_invitation); switch_adaptive_video_encode = (EaseSwitchButton) getView().findViewById(R.id.switch_adaptive_video_encode); switch_offline_call_push = (EaseSwitchButton) getView().findViewById(R.id.switch_offline_call_push); LinearLayout llChange = (LinearLayout) getView().findViewById(R.id.ll_change); logoutBtn = (Button) getView().findViewById(R.id.btn_logout); if (!TextUtils.isEmpty(EMClient.getInstance().getCurrentUser())) { logoutBtn.setText( getString(R.string.button_logout) + "(" + EMClient.getInstance().getCurrentUser() + ")"); } customServerSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_custom_server); customAppkeySwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_custom_appkey); textview1 = (TextView) getView().findViewById(R.id.textview1); textview2 = (TextView) getView().findViewById(R.id.textview2); blacklistContainer = (LinearLayout) getView().findViewById(R.id.ll_black_list); userProfileContainer = (LinearLayout) getView().findViewById(R.id.ll_user_profile); llDiagnose = (LinearLayout) getView().findViewById(R.id.ll_diagnose); pushNick = (LinearLayout) getView().findViewById(R.id.ll_set_push_nick); edit_custom_appkey = (EditText) getView().findViewById(R.id.edit_custom_appkey); settingsModel = DemoHelper.getInstance().getModel(); chatOptions = EMClient.getInstance().getOptions(); blacklistContainer.setOnClickListener(this); userProfileContainer.setOnClickListener(this); rl_switch_notification.setOnClickListener(this); rl_switch_sound.setOnClickListener(this); rl_switch_vibrate.setOnClickListener(this); rl_switch_speaker.setOnClickListener(this); customAppkeySwitch.setOnClickListener(this); customServerSwitch.setOnClickListener(this); rl_custom_server.setOnClickListener(this); logoutBtn.setOnClickListener(this); llDiagnose.setOnClickListener(this); pushNick.setOnClickListener(this); rl_switch_chatroom_leave.setOnClickListener(this); rl_switch_delete_msg_when_exit_group.setOnClickListener(this); rl_switch_auto_accept_group_invitation.setOnClickListener(this); rl_switch_adaptive_video_encode.setOnClickListener(this); rl_switch_offline_call_push.setOnClickListener(this); llChange.setOnClickListener(this); // the vibrate and sound notification are allowed or not? if (settingsModel.getSettingMsgNotification()) { notifySwitch.openSwitch(); } else { notifySwitch.closeSwitch(); } // sound notification is switched on or not? if (settingsModel.getSettingMsgSound()) { soundSwitch.openSwitch(); } else { soundSwitch.closeSwitch(); } // vibrate notification is switched on or not? if (settingsModel.getSettingMsgVibrate()) { vibrateSwitch.openSwitch(); } else { vibrateSwitch.closeSwitch(); } // the speaker is switched on or not? if (settingsModel.getSettingMsgSpeaker()) { speakerSwitch.openSwitch(); } else { speakerSwitch.closeSwitch(); } // if allow owner leave if (settingsModel.isChatroomOwnerLeaveAllowed()) { ownerLeaveSwitch.openSwitch(); } else { ownerLeaveSwitch.closeSwitch(); } // delete messages when exit group? if (settingsModel.isDeleteMessagesAsExitGroup()) { switch_delete_msg_when_exit_group.openSwitch(); } else { switch_delete_msg_when_exit_group.closeSwitch(); } if (settingsModel.isAutoAcceptGroupInvitation()) { switch_auto_accept_group_invitation.openSwitch(); } else { switch_auto_accept_group_invitation.closeSwitch(); } if (settingsModel.isAdaptiveVideoEncode()) { switch_adaptive_video_encode.openSwitch(); EMClient.getInstance().callManager().getVideoCallHelper().setAdaptiveVideoFlag(true); } else { switch_adaptive_video_encode.closeSwitch(); EMClient.getInstance().callManager().getVideoCallHelper().setAdaptiveVideoFlag(false); } if (settingsModel.isCustomServerEnable()) { customServerSwitch.openSwitch(); } else { customServerSwitch.closeSwitch(); } if (settingsModel.isPushCall()) { switch_offline_call_push.openSwitch(); EMClient.getInstance().callManager().getCallOptions().setIsSendPushIfOffline(true); } else { switch_offline_call_push.closeSwitch(); EMClient.getInstance().callManager().getCallOptions().setIsSendPushIfOffline(false); } if (settingsModel.isCustomAppkeyEnabled()) { customAppkeySwitch.openSwitch(); } else { customAppkeySwitch.closeSwitch(); } edit_custom_appkey.setEnabled(settingsModel.isCustomAppkeyEnabled()); edit_custom_appkey.setText(settingsModel.getCutomAppkey()); edit_custom_appkey.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { PreferenceManager.getInstance().setCustomAppkey(s.toString()); } }); }
From source file:com.jiandanbaoxian.fragment.DialogFragmentCreater.java
/** * Dialog ???//from w w w. j a v a 2 s. com * @param mContext * @return */ private Dialog showLicenseChoiceDialog(final Context mContext) { View convertView = LayoutInflater.from(mContext).inflate(R.layout.dialog_license_choice, null); final Dialog dialog = new Dialog(mContext, R.style.mystyle); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.layout_rule: if (isAgree) { isAgree = false; ImageView imageView = (ImageView) v.findViewById(R.id.iv_choose); // TextView textView = (TextView)v.findViewById(R.id.tv_rule); imageView.setImageResource(R.drawable.icon_choose); // textView.setBackgroundColor(getResources().getColor(R.color.bg_gray_color_level_0)); // textView.setTextColor(getResources().getColor(R.color.tv_gray_color_level_3)); } else { isAgree = true; ImageView imageView = (ImageView) v.findViewById(R.id.iv_choose); // TextView textView = (TextView)v.findViewById(R.id.tv_rule); imageView.setImageResource(R.drawable.icon_choose_selected); // textView.setBackgroundResource(R.drawable.btn_select_base_shape_0); // textView.setTextColor(getResources().getColor(R.color.white_color)); } break; } if (onLicenseDialogClickListener != null) { onLicenseDialogClickListener.onClick(v, isAgree); } } }; TitleBar titleBar; SwipeRefreshLayout swipeLayout; final WebView webView; ProgressBar progressBar; LinearLayout layoutRule; LinearLayout layoutConfirm; titleBar = (TitleBar) convertView.findViewById(R.id.title_bar); swipeLayout = (SwipeRefreshLayout) convertView.findViewById(R.id.swipe_layout); webView = (WebView) convertView.findViewById(R.id.webView); progressBar = (ProgressBar) convertView.findViewById(R.id.progress_bar); layoutRule = (LinearLayout) convertView.findViewById(R.id.layout_rule); layoutConfirm = (LinearLayout) convertView.findViewById(R.id.layout_confirm); WebChromeClient client = new AppChromeWebClient(titleBar, progressBar, swipeLayout); webView.setWebChromeClient(client); webView.setWebViewClient(new AppWebClient()); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl(webViewURL); webView.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { if (keyCode == KeyEvent.KEYCODE_BACK && webView.canGoBack()) { webView.goBack(); //? return true; //? } } return false; } }); titleBar.initTitleBarInfo("", R.drawable.arrow_left, -1, "", ""); titleBar.setOnTitleBarClickListener(new TitleBar.OnTitleBarClickListener() { @Override public void onLeftButtonClick(View v) { if (webView.canGoBack()) { webView.goBack(); //? return; //? } if (onLicenseDialogClickListener != null) { onLicenseDialogClickListener.onClick(v, isAgree); dismiss(); } } @Override public void onRightButtonClick(View v) { } }); UIUtils.initSwipeRefreshLayout(swipeLayout); swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { webView.reload(); } }); layoutConfirm.setOnClickListener(listener); layoutRule.setOnClickListener(listener); dialog.setContentView(convertView); dialog.getWindow().setWindowAnimations(R.style.dialog_right_control_style); return dialog; }
From source file:com.kevin.cattalk.ui.SettingsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false)) return;//from w w w .ja va 2 s . co m rl_switch_notification = (RelativeLayout) getView().findViewById(R.id.rl_switch_notification); rl_switch_sound = (RelativeLayout) getView().findViewById(R.id.rl_switch_sound); rl_switch_vibrate = (RelativeLayout) getView().findViewById(R.id.rl_switch_vibrate); rl_switch_speaker = (RelativeLayout) getView().findViewById(R.id.rl_switch_speaker); rl_switch_chatroom_leave = (RelativeLayout) getView().findViewById(R.id.rl_switch_chatroom_owner_leave); rl_switch_delete_msg_when_exit_group = (RelativeLayout) getView() .findViewById(R.id.rl_switch_delete_msg_when_exit_group); rl_switch_auto_accept_group_invitation = (RelativeLayout) getView() .findViewById(R.id.rl_switch_auto_accept_group_invitation); rl_switch_adaptive_video_encode = (RelativeLayout) getView() .findViewById(R.id.rl_switch_adaptive_video_encode); rl_custom_appkey = (RelativeLayout) getView().findViewById(R.id.rl_custom_appkey); rl_custom_server = (RelativeLayout) getView().findViewById(R.id.rl_custom_server); rl_push_settings = (RelativeLayout) getView().findViewById(R.id.rl_push_settings); ll_call_option = (LinearLayout) getView().findViewById(R.id.ll_call_option); rl_mail_log = (RelativeLayout) getView().findViewById(R.id.rl_mail_log); notifySwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_notification); soundSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_sound); vibrateSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_vibrate); speakerSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_speaker); ownerLeaveSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_owner_leave); switch_delete_msg_when_exit_group = (EaseSwitchButton) getView() .findViewById(R.id.switch_delete_msg_when_exit_group); switch_auto_accept_group_invitation = (EaseSwitchButton) getView() .findViewById(R.id.switch_auto_accept_group_invitation); switch_adaptive_video_encode = (EaseSwitchButton) getView().findViewById(R.id.switch_adaptive_video_encode); LinearLayout llChange = (LinearLayout) getView().findViewById(R.id.ll_change); logoutBtn = (Button) getView().findViewById(R.id.btn_logout); if (!TextUtils.isEmpty(EMClient.getInstance().getCurrentUser())) { logoutBtn.setText( getString(R.string.button_logout) + "(" + EMClient.getInstance().getCurrentUser() + ")"); } customServerSwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_custom_server); customAppkeySwitch = (EaseSwitchButton) getView().findViewById(R.id.switch_custom_appkey); textview1 = (TextView) getView().findViewById(R.id.textview1); textview2 = (TextView) getView().findViewById(R.id.textview2); blacklistContainer = (LinearLayout) getView().findViewById(R.id.ll_black_list); userProfileContainer = (LinearLayout) getView().findViewById(R.id.ll_user_profile); llDiagnose = (LinearLayout) getView().findViewById(R.id.ll_diagnose); pushNick = (LinearLayout) getView().findViewById(R.id.ll_set_push_nick); edit_custom_appkey = (EditText) getView().findViewById(R.id.edit_custom_appkey); settingsModel = DemoHelper.getInstance().getModel(); chatOptions = EMClient.getInstance().getOptions(); blacklistContainer.setOnClickListener(this); userProfileContainer.setOnClickListener(this); rl_switch_notification.setOnClickListener(this); rl_switch_sound.setOnClickListener(this); rl_switch_vibrate.setOnClickListener(this); rl_switch_speaker.setOnClickListener(this); customAppkeySwitch.setOnClickListener(this); customServerSwitch.setOnClickListener(this); rl_custom_server.setOnClickListener(this); logoutBtn.setOnClickListener(this); llDiagnose.setOnClickListener(this); pushNick.setOnClickListener(this); rl_switch_chatroom_leave.setOnClickListener(this); rl_switch_delete_msg_when_exit_group.setOnClickListener(this); rl_switch_auto_accept_group_invitation.setOnClickListener(this); rl_switch_adaptive_video_encode.setOnClickListener(this); rl_push_settings.setOnClickListener(this); ll_call_option.setOnClickListener(this); llChange.setOnClickListener(this); rl_mail_log.setOnClickListener(this); // the vibrate and sound notification are allowed or not? if (settingsModel.getSettingMsgNotification()) { notifySwitch.openSwitch(); } else { notifySwitch.closeSwitch(); } // sound notification is switched on or not? if (settingsModel.getSettingMsgSound()) { soundSwitch.openSwitch(); } else { soundSwitch.closeSwitch(); } // vibrate notification is switched on or not? if (settingsModel.getSettingMsgVibrate()) { vibrateSwitch.openSwitch(); } else { vibrateSwitch.closeSwitch(); } // the speaker is switched on or not? if (settingsModel.getSettingMsgSpeaker()) { speakerSwitch.openSwitch(); } else { speakerSwitch.closeSwitch(); } // if allow owner leave if (settingsModel.isChatroomOwnerLeaveAllowed()) { ownerLeaveSwitch.openSwitch(); } else { ownerLeaveSwitch.closeSwitch(); } // delete messages when exit group? if (settingsModel.isDeleteMessagesAsExitGroup()) { switch_delete_msg_when_exit_group.openSwitch(); } else { switch_delete_msg_when_exit_group.closeSwitch(); } if (settingsModel.isAutoAcceptGroupInvitation()) { switch_auto_accept_group_invitation.openSwitch(); } else { switch_auto_accept_group_invitation.closeSwitch(); } if (settingsModel.isAdaptiveVideoEncode()) { switch_adaptive_video_encode.openSwitch(); EMClient.getInstance().callManager().getCallOptions().enableFixedVideoResolution(false); } else { switch_adaptive_video_encode.closeSwitch(); EMClient.getInstance().callManager().getCallOptions().enableFixedVideoResolution(true); } if (settingsModel.isCustomServerEnable()) { customServerSwitch.openSwitch(); } else { customServerSwitch.closeSwitch(); } if (settingsModel.isCustomAppkeyEnabled()) { customAppkeySwitch.openSwitch(); } else { customAppkeySwitch.closeSwitch(); } edit_custom_appkey.setEnabled(settingsModel.isCustomAppkeyEnabled()); edit_custom_appkey.setText(settingsModel.getCutomAppkey()); edit_custom_appkey.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { PreferenceManager.getInstance().setCustomAppkey(s.toString()); } }); }
From source file:com.popdeem.sdk.uikit.activity.PDUIClaimActivity.java
private void addRewardDetailsToUI() { // Logo//from www. j av a 2 s . c o m final ImageView logoImageView = (ImageView) findViewById(R.id.pd_reward_star_image_view); final String imageUrl = mReward.getCoverImage(); if (imageUrl == null || imageUrl.isEmpty() || imageUrl.contains("default")) { Glide.with(this).load(R.drawable.pd_ui_star_icon).error(R.drawable.pd_ui_star_icon).dontAnimate() .placeholder(R.drawable.pd_ui_star_icon).into(logoImageView); } else { Glide.with(this).load(imageUrl).error(R.drawable.pd_ui_star_icon).dontAnimate() .placeholder(R.drawable.pd_ui_star_icon).into(logoImageView); } // Reward Description TextView textView = (TextView) findViewById(R.id.pd_reward_offer_text_view); textView.setText(mReward.getDescription()); // Rules textView = (TextView) findViewById(R.id.pd_reward_item_rules_text_view); textView.setText(mReward.getRules()); if (mReward.getRules() == null || mReward.getRules().isEmpty()) { textView.setVisibility(View.GONE); } StringBuilder actionStringBuilder = new StringBuilder(""); // Action final boolean TWITTER_ACTION_REQUIRED = twitterShareForced(); if (mReward.getAction().equalsIgnoreCase(PDReward.PD_REWARD_ACTION_PHOTO)) { actionStringBuilder.append(getString(TWITTER_ACTION_REQUIRED ? R.string.pd_claim_action_tweet_photo : R.string.pd_claim_action_photo_camera)); } else if (mReward.getAction().equalsIgnoreCase(PDReward.PD_REWARD_ACTION_CHECKIN)) { actionStringBuilder.append(getString(TWITTER_ACTION_REQUIRED ? R.string.pd_claim_action_tweet_checkin : R.string.pd_claim_action_checkin)); } else { actionStringBuilder.append(getString(R.string.pd_claim_action_none)); } // End date long timeInSecs = PDNumberUtils.toLong(mReward.getAvailableUntilInSeconds(), -1); String convertedTimeString = PDUIUtils.convertTimeToDayAndMonth(timeInSecs); if (!convertedTimeString.isEmpty()) { actionStringBuilder.append(String.format(Locale.getDefault(), " | Exp %1s", convertedTimeString)); } textView = (TextView) findViewById(R.id.pd_reward_request_text_view); textView.setText(actionStringBuilder.toString()); textView.setVisibility(View.GONE); //add photo addPhotoView = findViewById(R.id.pd_share_view_icon_holder); addedPhotoView = findViewById(R.id.pd_share_view_taken_holder); TextView infoView = findViewById(R.id.pd_claim_info_text); //already shared button LinearLayout alreadySharedButton = findViewById(R.id.pd_claim_already_shared_view); TextView alreadySharedText = findViewById(R.id.pd_claim_already_shared_button); if (mReward.getAction().equalsIgnoreCase(PDReward.PD_REWARD_ACTION_PHOTO)) { alreadySharedText.setText(getResources().getString(R.string.pd_claim_scan_for_already_shared_text)); infoView.setText(String.format(getResources().getString(R.string.pd_claim_info_photo), mReward.getGlobalHashtag())); } else { alreadySharedText .setText(getResources().getString(R.string.pd_claim_scan_for_already_shared_activity_text)); infoView.setText(String.format(getResources().getString(R.string.pd_claim_info_check_in), mReward.getGlobalHashtag())); } alreadySharedButton.setOnClickListener(this); if (mReward.getGlobalHashtag() != null && !mReward.getGlobalHashtag().equalsIgnoreCase("")) { // alreadySharedButton.setText(String.format(getString(R.string.pd_claim_get_already_shared_text), mReward.getGlobalHashtag())); } else { // alreadySharedButton.setText(R.string.pd_claim_already_shared_default); } infoIcon.setVisibility(View.VISIBLE); infoIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { final Dialog dialog = new Dialog(PDUIClaimActivity.this); PDUIDialogUtils.setMargins(dialog, 25, 100, 25, 100); dialog.setContentView(R.layout.claim_alert_dialog); Button claim = (Button) dialog.findViewById(R.id.button_claim); Button cancel = (Button) dialog.findViewById(R.id.button_cancel); ImageView icon = (ImageView) dialog.findViewById(R.id.icon); String imageUrl = mReward.getCoverImage(); if (imageUrl == null || imageUrl.isEmpty() || imageUrl.contains("default")) { Glide.with(PDUIClaimActivity.this).load(R.drawable.pd_ui_star_icon).dontAnimate() .error(R.drawable.pd_ui_star_icon).dontAnimate().placeholder(R.drawable.pd_ui_star_icon) .into(icon); } else { Glide.with(PDUIClaimActivity.this).load(imageUrl).dontAnimate() .error(R.drawable.pd_ui_star_icon).dontAnimate().placeholder(R.drawable.pd_ui_star_icon) .into(icon); } claim.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); claim.setText("Close"); cancel.setVisibility(View.GONE); TextView tvTitle = dialog.findViewById(R.id.alertTitle); tvTitle.setText(mReward.getDescription()); TextView message = dialog.findViewById(R.id.message); message.setText(mReward.getRules()); TextView detailsActionText = (TextView) dialog.findViewById(R.id.pd_action_text); setActionString(detailsActionText); dialog.show(); } }); }
From source file:dev.datvt.cloudtracks.sound_cloud.LocalTracksFragment.java
public void setUpListPlaylist() { menus = new ArrayList<>(); mm.removeAllViews();//from ww w . j a va 2 s .co m LayoutInflater lf = LayoutInflater.from(ctx); if (true) { LinearLayout con; con = (LinearLayout) lf.inflate(R.layout.fragment_local_main, null); ImageView art = (ImageView) con.findViewById(R.id.artM); ImageView shuf = (ImageView) con.findViewById(R.id.shuffleM); ImageView del = (ImageView) con.findViewById(R.id.delM); TextView mn = (TextView) con.findViewById(R.id.nameM); TextView sn = (TextView) con.findViewById(R.id.noM); con.setGravity(Gravity.CENTER); art.setImageResource(R.drawable.icon_add_press); mn.setText(getString(R.string.create_new)); art.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showChangeLangDialog(); } }); mm.addView(con); } final ArrayList<String> names = ToolsHelper.getListPlaylist(); if (names.size() > 0) { for (int i = 0; i < ToolsHelper.getListPlaylist().size(); i++) { View con; con = lf.inflate(R.layout.fragment_local_main, null); ImageView art = (ImageView) con.findViewById(R.id.artM); ImageView shuf = (ImageView) con.findViewById(R.id.shuffleM); ImageView del = (ImageView) con.findViewById(R.id.delM); TextView mn = (TextView) con.findViewById(R.id.nameM); TextView sn = (TextView) con.findViewById(R.id.noM); Menu m; art.setImageResource(R.drawable.default_nhaccuatui); shuf.setImageResource(R.drawable.ic_shuffle); shuf.setVisibility(View.VISIBLE); del.setImageResource(R.drawable.ic_delete); del.setVisibility(View.VISIBLE); mn.setText(names.get(i).replace(".lst", "")); sn.setText( "" + ToolsHelper.getPlayList(ctx, names.get(i)).size() + " " + getString(R.string.songs)); sn.setVisibility(View.VISIBLE); final String playlistname = names.get(i); con.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mm.setVisibility(View.GONE); lnBack.setVisibility(View.VISIBLE); ref.setVisibility(View.VISIBLE); ExecuterU ex = new ExecuterU(ctx, getString(R.string.scanning)) { @Override public void doIt() { baseLocal = ToolsHelper.getPlayList(ctx, playlistname); } @Override public void doNe() { setUpList(baseLocal); } }; ex.execute(); } }); del.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { File f = new File(MainActivity.folder + "/Playlist/" + playlistname); f.delete(); setUpListPlaylist(); } }); shuf.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ExecuterU ex = new ExecuterU(ctx, getString(R.string.scanning)) { @Override public void doIt() { ArrayList<Track> tracks = ToolsHelper.getPlayList(ctx, playlistname); localTracks = tracks; } @Override public void doNe() { ArrayList<Track> tracks = localTracks; Collections.shuffle(tracks); if (tracks.size() > 0) { if (tracks.get(0).bpm == ToolsHelper.IS_LOCAL) mListener.onListFragmentInteraction(tracks, tracks.get(0), 0, ToolsHelper.IS_LOCAL); else { mListener.onListFragmentInteraction(tracks, tracks.get(0), 0, ToolsHelper.DOWNLOAD_CODE); } } else { ToolsHelper.toast(ctx, getString(R.string.empty_playlist)); } } }; ex.execute(); } }); m = new Menu(con, art, mn, sn); menus.add(m); mm.addView(con); } } }
From source file:com.ehret.mixit.fragment.PeopleDetailFragment.java
private void addPeopleSession(Member membre) { //On recupere aussi la liste des sessions de l'utilisateur List<Talk> conferences = ConferenceFacade.getInstance().getSessionMembre(membre, getActivity()); //On vide les lments sessionLayout.removeAllViews();// w ww . j ava 2s. c o m //On affiche les liens que si on a recuperer des choses if (conferences != null && !conferences.isEmpty()) { //On ajoute un table layout TableLayout.LayoutParams tableParams = new TableLayout.LayoutParams( TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT); TableLayout tableLayout = new TableLayout(getActivity().getBaseContext()); tableLayout.setLayoutParams(tableParams); if (mInflater != null) { for (final Talk conf : conferences) { LinearLayout row = (LinearLayout) mInflater.inflate(R.layout.item_talk, tableLayout, false); row.setBackgroundResource(R.drawable.row_transparent_background); //Dans lequel nous allons ajouter le contenu que nous faisons mapp dans TextView horaire = (TextView) row.findViewById(R.id.talk_horaire); TextView talkImageText = (TextView) row.findViewById(R.id.talkImageText); TextView talkSalle = (TextView) row.findViewById(R.id.talk_salle); ImageView imageFavorite = (ImageView) row.findViewById(R.id.talk_image_favorite); ImageView langImage = (ImageView) row.findViewById(R.id.talk_image_language); ((TextView) row.findViewById(R.id.talk_name)).setText(conf.getTitle()); ((TextView) row.findViewById(R.id.talk_shortdesciptif)).setText(conf.getSummary().trim()); SimpleDateFormat sdf = new SimpleDateFormat("EEE"); if (conf.getStart() != null && conf.getEnd() != null) { horaire.setText(String.format(getResources().getString(R.string.periode), sdf.format(conf.getStart()), DateFormat.getTimeInstance(DateFormat.SHORT).format(conf.getStart()), DateFormat.getTimeInstance(DateFormat.SHORT).format(conf.getEnd()))); } else { horaire.setText(getResources().getString(R.string.pasdate)); } if (conf.getLang() != null && "ENGLISH".equals(conf.getLang())) { langImage.setImageDrawable(getResources().getDrawable(R.drawable.en)); } else { langImage.setImageDrawable(getResources().getDrawable(R.drawable.fr)); } Salle salle = Salle.INCONNU; if (conf instanceof Talk && Salle.INCONNU != Salle.getSalle(conf.getRoom())) { salle = Salle.getSalle(conf.getRoom()); } talkSalle.setText(String.format(getResources().getString(R.string.Salle), salle.getNom())); talkSalle.setBackgroundColor(getResources().getColor(salle.getColor())); if (conf instanceof Talk) { if ("Workshop".equals(((Talk) conf).getFormat())) { talkImageText.setText("Atelier"); } else { talkImageText.setText("Talk"); } } else { talkImageText.setText("L.Talk"); } row.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TypeFile typeFile; int page = 6; if (conf instanceof Talk) { if ("Workshop".equals(((Talk) conf).getFormat())) { typeFile = TypeFile.workshops; page = 4; } else { typeFile = TypeFile.talks; page = 3; } } else { typeFile = TypeFile.lightningtalks; } ((HomeActivity) getActivity()).changeCurrentFragment(SessionDetailFragment.newInstance( typeFile.toString(), conf.getIdSession(), page), typeFile.toString()); } }); //On regarde si la conf fait partie des favoris SharedPreferences settings = getActivity().getSharedPreferences(UIUtils.PREFS_FAVORITES_NAME, 0); boolean trouve = false; for (String key : settings.getAll().keySet()) { if (key.equals(String.valueOf(conf.getIdSession()))) { trouve = true; imageFavorite.setImageDrawable( getActivity().getResources().getDrawable(R.drawable.ic_action_important)); break; } } if (!trouve) { imageFavorite.setImageDrawable( getActivity().getResources().getDrawable(R.drawable.ic_action_not_important)); } tableLayout.addView(row); } } sessionLayout.addView(tableLayout); } else { titleSessions.getLayoutParams().height = 0; } }
From source file:de.grobox.liberario.TripsActivity.java
private void addTrips(final TableLayout main, List<Trip> trip_list, boolean append) { if (trip_list != null) { // reverse order of trips if they should be prepended if (!append) { ArrayList<Trip> tempResults = new ArrayList<Trip>(trip_list); Collections.reverse(tempResults); trip_list = tempResults;/*from w w w . j a va 2 s. c o m*/ } for (final Trip trip : trip_list) { final LinearLayout trip_layout = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.trip, null); TableRow row = (TableRow) trip_layout.findViewById(R.id.tripTableRow); // Locations TextView fromView = (TextView) row.findViewById(R.id.fromView); fromView.setText(trip.from.uniqueShortName()); TextView toView = ((TextView) row.findViewById(R.id.toView)); toView.setText(trip.to.uniqueShortName()); // Departure Time and Delay TextView departureTimeView = (TextView) row.findViewById(R.id.departureTimeView); TextView departureDelayView = (TextView) row.findViewById(R.id.departureDelayView); if (trip.getFirstPublicLeg() != null) { LiberarioUtils.setDepartureTimes(this, departureTimeView, departureDelayView, trip.getFirstPublicLeg().departureStop); } else { departureTimeView.setText(DateUtils.getTime(this, trip.getFirstDepartureTime())); } // Arrival Time and Delay TextView arrivalTimeView = (TextView) row.findViewById(R.id.arrivalTimeView); TextView arrivalDelayView = (TextView) row.findViewById(R.id.arrivalDelayView); if (trip.getLastPublicLeg() != null) { LiberarioUtils.setArrivalTimes(this, arrivalTimeView, arrivalDelayView, trip.getLastPublicLeg().arrivalStop); } else { arrivalTimeView.setText(DateUtils.getTime(this, trip.getLastArrivalTime())); } // Duration TextView durationView = (TextView) trip_layout.findViewById(R.id.durationView); durationView .setText(DateUtils.getDuration(trip.getFirstDepartureTime(), trip.getLastArrivalTime())); // Transports FlowLayout lineLayout = (FlowLayout) trip_layout.findViewById(R.id.lineLayout); // for each leg for (final Leg leg : trip.legs) { if (leg instanceof Trip.Public) { LiberarioUtils.addLineBox(this, lineLayout, ((Public) leg).line); } else if (leg instanceof Trip.Individual) { LiberarioUtils.addWalkingBox(this, lineLayout); } } // remember trip in view for onClick event trip_layout.setTag(trip); // make trip details fold out and in on click trip_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { View v = main.getChildAt(main.indexOfChild(view) + 1); if (v != null) { if (v.getVisibility() == View.GONE) { v.setVisibility(View.VISIBLE); } else if (v.getVisibility() == View.VISIBLE) { v.setVisibility(View.GONE); } } } }); trip_layout.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { selectTrip(view, trip_layout); return true; } }); // show more button for trip details final ImageView showMoreView = (ImageView) trip_layout.findViewById(R.id.showMoreView); showMoreView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { selectTrip(view, trip_layout); } }); // Create container for trip details fragment FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(mContainerId); fragmentContainer.setVisibility(View.GONE); // Create a new Fragment to be placed in the activity layout TripDetailFragment tripDetailFragment = new TripDetailFragment(); // In case this activity was started with special instructions from an // Intent, pass the Intent's extras to the fragment as arguments Bundle bundle = new Bundle(); bundle.putSerializable("de.schildbach.pte.dto.Trip", trip); bundle.putSerializable("de.schildbach.pte.dto.Trip.from", from); bundle.putSerializable("de.schildbach.pte.dto.Trip.to", to); tripDetailFragment.setArguments(bundle); // Add the fragment to the 'fragment_container' FrameLayout getSupportFragmentManager().beginTransaction().add(mContainerId, tripDetailFragment).commit(); mContainerId++; if (append) { trip_layout.addView(LiberarioUtils.getDivider(this)); main.addView(trip_layout); main.addView(fragmentContainer); } else { trip_layout.addView(LiberarioUtils.getDivider(this), 0); main.addView(trip_layout, 0); main.addView(fragmentContainer, 1); } } // end foreach trip } else { // TODO offer option to query again for trips } }
From source file:org.onebusaway.android.report.ui.SimpleArrivalListFragment.java
private void loadArrivalList(ObaArrivalInfo[] info, final ObaReferences refs, long currentTime) { LinearLayout contentLayout = (LinearLayout) getActivity().findViewById(R.id.simple_arrival_content); contentLayout.removeAllViews();//from ww w . j a v a2s. c o m ArrayList<ArrivalInfo> arrivalInfos = ArrivalInfoUtils.convertObaArrivalInfo(getActivity(), info, new ArrayList<String>(), currentTime, false); for (ArrivalInfo stopInfo : arrivalInfos) { final ObaArrivalInfo arrivalInfo = stopInfo.getInfo(); LayoutInflater inflater = LayoutInflater.from(getActivity()); LinearLayout view = (LinearLayout) inflater.inflate(R.layout.arrivals_list_item, null, false); view.setBackgroundColor(getResources().getColor(R.color.material_background)); TextView route = (TextView) view.findViewById(R.id.route); TextView destination = (TextView) view.findViewById(R.id.destination); TextView time = (TextView) view.findViewById(R.id.time); TextView status = (TextView) view.findViewById(R.id.status); TextView etaView = (TextView) view.findViewById(R.id.eta); TextView minView = (TextView) view.findViewById(R.id.eta_min); ViewGroup realtimeView = (ViewGroup) view.findViewById(R.id.eta_realtime_indicator); view.findViewById(R.id.more_horizontal).setVisibility(View.INVISIBLE); view.findViewById(R.id.route_favorite).setVisibility(View.INVISIBLE); String routeShortName = arrivalInfo.getShortName(); route.setText(routeShortName); UIUtils.maybeShrinkRouteName(getActivity(), route, routeShortName); destination.setText(UIUtils.formatDisplayText(arrivalInfo.getHeadsign())); status.setText(stopInfo.getStatusText()); long eta = stopInfo.getEta(); if (eta == 0) { etaView.setText(R.string.stop_info_eta_now); minView.setVisibility(View.GONE); } else { etaView.setText(String.valueOf(eta)); minView.setVisibility(View.VISIBLE); } status.setBackgroundResource(R.drawable.round_corners_style_b_status); GradientDrawable d = (GradientDrawable) status.getBackground(); Integer colorCode = stopInfo.getColor(); int color = getActivity().getResources().getColor(colorCode); if (stopInfo.getPredicted()) { // Show real-time indicator UIUtils.setRealtimeIndicatorColorByResourceCode(realtimeView, colorCode, android.R.color.transparent); realtimeView.setVisibility(View.VISIBLE); } else { realtimeView.setVisibility(View.INVISIBLE); } etaView.setTextColor(color); minView.setTextColor(color); d.setColor(color); // Set padding on status view int pSides = UIUtils.dpToPixels(getActivity(), 5); int pTopBottom = UIUtils.dpToPixels(getActivity(), 2); status.setPadding(pSides, pTopBottom, pSides, pTopBottom); time.setText(DateUtils.formatDateTime(getActivity(), stopInfo.getDisplayTime(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NO_NOON | DateUtils.FORMAT_NO_MIDNIGHT)); View reminder = view.findViewById(R.id.reminder); reminder.setVisibility(View.GONE); contentLayout.addView(view); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String agencyName = findAgencyNameByRouteId(refs, arrivalInfo.getRouteId()); mCallback.onArrivalItemClicked(arrivalInfo, agencyName); } }); } }
From source file:com.michal.animalvision.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { // Should we show an explanation? if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) { Toast.makeText(this, "Camera access is required.", Toast.LENGTH_SHORT).show(); } else {/* w ww . j a v a2 s . co m*/ ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA }, REQUEST_CAMERA_PERMISSION); } } LinearLayout blackandWhiteBtn = (LinearLayout) findViewById(R.id.blackandWhiteBtn); LinearLayout dogVisionBtn = (LinearLayout) findViewById(R.id.dogVisionBtn); LinearLayout fishVisionBtn = (LinearLayout) findViewById(R.id.fishVisionBtn); LinearLayout hsvtorgbBtn = (LinearLayout) findViewById(R.id.hsvtorgbBtn); LinearLayout invertVisionBtn = (LinearLayout) findViewById(R.id.invertVisionBtn); LinearLayout originalVisionBtn = (LinearLayout) findViewById(R.id.originalBtn); LinearLayout thermalVisionBtn = (LinearLayout) findViewById(R.id.thermalVisionBtn); LinearLayout sepiaBtn = (LinearLayout) findViewById(R.id.sepiaBtn); LinearLayout polaroidBtn = (LinearLayout) findViewById(R.id.PolaroidBtn); LinearLayout hueShiftBtn = (LinearLayout) findViewById(R.id.HueShiftBtn); LinearLayout snailBtn = (LinearLayout) findViewById(R.id.snailVisionBtn); LinearLayout sharkVisionBtn = (LinearLayout) findViewById(R.id.sharkVisionBtn); LinearLayout catVisionBtn = (LinearLayout) findViewById(R.id.catVisionBtn); LinearLayout birdVisionBtn = (LinearLayout) findViewById(R.id.birdVisionBtn); LinearLayout beeVisionBtn = (LinearLayout) findViewById(R.id.beeVisionBtn); LinearLayout clamVisionBtn = (LinearLayout) findViewById(R.id.clamVisionBtn); LinearLayout geckoVisionBtn = (LinearLayout) findViewById(R.id.geckoVisionBtn); LinearLayout cuttlefishVisionBtn = (LinearLayout) findViewById(R.id.cuttlefishVisionBtn); LinearLayout jumpingSpiderVisionBtn = (LinearLayout) findViewById(R.id.jumpingSpiderVisionBtn); LinearLayout bearVisionBtn = (LinearLayout) findViewById(R.id.bearVisionBtn); LinearLayout dragonflyVisionBtn = (LinearLayout) findViewById(R.id.dragonflyVisionBtn); LinearLayout horseVisionBtn = (LinearLayout) findViewById(R.id.horseVisionBtn); LinearLayout octopusVisionBtn = (LinearLayout) findViewById(R.id.octopusVisionBtn); LinearLayout dolphinVisionBtn = (LinearLayout) findViewById(R.id.dolphinVisionBtn); LinearLayout deuteranopiaBtn = (LinearLayout) findViewById(R.id.deuteranopiaBtn); LinearLayout deuteranomalyBtn = (LinearLayout) findViewById(R.id.deuteranomalyBtm); LinearLayout protanopiaBtn = (LinearLayout) findViewById(R.id.protanopiaBtn); LinearLayout protanomalyBtn = (LinearLayout) findViewById(R.id.protanomalyBtn); LinearLayout tritanopiaBtn = (LinearLayout) findViewById(R.id.tritanopiaBtn); LinearLayout tritanomalyBtn = (LinearLayout) findViewById(R.id.tritanomalyBtn); LinearLayout achromatosopiaBtn = (LinearLayout) findViewById(R.id.achromatosopiaBtn); LinearLayout achromatomalyBtn = (LinearLayout) findViewById(R.id.achromatomalyBtn); dogVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.DOG_VISION); } }); blackandWhiteBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.BLACK_AND_WHITE); } }); fishVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.FISH_VISION); } }); hsvtorgbBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.HSV_TO_RGB); } }); invertVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.INVERT_VISION); } }); originalVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.ORIGINAL_VISION); } }); thermalVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.THERMAL_VISION); } }); snailBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.SNAIL_VISION); } }); sharkVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.SHARK_VISION); } }); catVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.CAT_VISION); } }); birdVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.BIRD_VISION); } }); beeVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.BEE_VISION); } }); clamVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.CLAM_VISION); } }); geckoVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.GECKO_VISION); } }); cuttlefishVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.CUTTLEFISH_VISION); } }); jumpingSpiderVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.JUMPINGSPIDER_VISION); } }); bearVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.BEAR_VISION); } }); dragonflyVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.DRAGONFLY_VISION); } }); horseVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.HORSE_VISION); } }); octopusVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.OCTOPUS_VISION); } }); dolphinVisionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.DOLPHIN_VISION); } }); deuteranopiaBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.DEUTERANOPIA); } }); deuteranomalyBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.DEUTERANOMALY); } }); protanopiaBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.PROTANOPIA); } }); protanomalyBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.PROTANOMALY); } }); tritanopiaBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.TRITANOPIA); } }); tritanomalyBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.TRITANOMALY); } }); achromatosopiaBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.ACHROMATOSOPIA); } }); achromatomalyBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.ACHROMATOMALY); } }); polaroidBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.POLAROID); } }); sepiaBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.SEPIA); } }); hueShiftBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadVisionActivity(MainActivity.HUESHIFT); } }); }
From source file:org.xingjitong.InCallActivity.java
private void displayCall(Resources resources, LinphoneCall call, int index) { String sipUri = call.getRemoteAddress().asStringUriOnly(); LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); // Control Row LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.active_call_control_row, container, false); setContactPhone(callView, lAddress, sipUri, resources); //yyppcallingfun del //displayCallStatusIconAndReturnCallPaused(callView, call); setRowBackground(callView, index);// ww w .j a va2 s . c om registerCallDurationTimer(callView, call); callsList.addView(callView); // Image Row LinearLayout imageView = (LinearLayout) inflater.inflate(R.layout.active_call_image_row, container, false); Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, imageView.getContext().getContentResolver()); final TextView name = (TextView) imageView.findViewById(R.id.call_name); //yyppcalling //yyppcallingui add //callhint = (TextView) imageView.findViewById(R.id.incall_callhint); phone = sipUri.substring(sipUri.indexOf(":") + 1, sipUri.indexOf("@")); if (phone.startsWith("01") && !phone.startsWith("010")) { phone = phone.substring(1); } else if (phone.startsWith("51201")) { phone = phone.substring(4); } else if (phone.startsWith("512")) { phone = phone.substring(3); } if (!phone.startsWith("1") && !phone.startsWith("0")) { phone = "0" + phone; } handler.post(new Runnable() { @Override public void run() { String n = ContactDB.Instance().getName(phone); if (!n.equals(phone) && n != null) { name.invalidate(); name.setText(n); } } }); displayOrHideContactPicture(imageView, pictureUri, false); callsList.addView(imageView); callView.setTag(imageView); callView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (v.getTag() != null) { View imageView = (View) v.getTag(); if (imageView.getVisibility() == View.VISIBLE) imageView.setVisibility(View.GONE); else imageView.setVisibility(View.VISIBLE); callsList.invalidate(); } } }); }