@Override public View getView(final int position, View convertView, ViewGroup arg2) { ViewHolder holder = null; if (convertView == null) { convertView = this.layoutInflater.inflate(R.layout.favourite_item, null); holder = new ViewHolder(); holder.avatar = (ImageView) convertView.findViewById(R.id.phone_avatar); convertView.setTag(holder); } else holder = (ViewHolder) convertView.getTag(); final FavouriteItem favouriteItem = mFavouriteItems.get(position); Uri photoUri = null; if (StringUtility.isEmpty(favouriteItem.phoneNo)) { holder.avatar.setImageResource(R.drawable.ic_contact_picture_holo_light); } else photoUri = Utils.getPhotoUriFromPhoneNumber(mContext.getContentResolver(), favouriteItem.phoneNo); if (photoUri != null) { holder.avatar.setImageURI(photoUri); } else { holder.avatar.setImageResource(R.drawable.ic_contact_picture_holo_light); } holder.avatar.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { String phone = favouriteItem.phoneNo; Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:" + phone)); mContext.startActivity(intent); } }); return convertView; }
@Override public void onAnimationEnd(Animation animation) { Handler handler = new Handler(); handler.postDelayed(run, 1000); Log.d("KieuThang", "mFadeOutAnime"); mBottomLayout.setVisibility(View.GONE); if (!isAccept) { ProgramHelper helper = new ProgramHelper(); helper.removeNewestSession(mFileName); } else { // save the call to the db try { ProgramHelper.writeToList( NotificationActivity.this, mFileName, phoneNo, mCreatedDate, mCallState, mDurationTime); } catch (Exception e) { e.printStackTrace(); } Uri phoneUri = Utils.getContactUriTypeFromPhoneNumber(getContentResolver(), phoneNo, 1); String phoneName = ""; if (phoneUri == null || StringUtility.isEmpty(phoneUri.toString())) phoneName = phoneNo; else phoneName = phoneUri.toString(); boolean isShowNotication = MyCallRecorderApplication.getInstance() .getMyCallRecorderSharePref(NotificationActivity.this) .getBooleanValue(MyCallRecorderConstant.KEY_SHOW_NOTIFICATION); if (isShowNotication) Utils.showNotificationAfterCalling( NotificationActivity.this, phoneName, phoneNo, mCreatedDate); // After call recording, we need to update view if activity is still alive requestToRefreshActivityView(mDurationTime); } finish(); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_notification); MyCallRecorderSharePrefs myCallRecorderSharePrefs = MyCallRecorderSharePrefs.getInstance(this); int which = myCallRecorderSharePrefs.getIntValue(MyCallRecorderConstant.KEY_THEME); mThemeColor = Utils.getThemeColor(this, which); mBottomLayout = (LinearLayout) findViewById(R.id.welcome_intro_bottom_layout); Log.d("KieuThang", "mThemeColor:" + mThemeColor); // mLayoutWelcome = (LinearLayout) findViewById(R.id.welcome_intro_content); // mLayoutWelcome.setBackgroundColor(mThemeColor); mBottomLayout.setBackgroundColor(mThemeColor); mBottomLayout.setVisibility(View.GONE); mNextBtnLayout = (RelativeLayout) findViewById(R.id.intro_next_layout); mContentUpAnime = AnimationUtils.loadAnimation(this, R.anim.layout_content_down); mFadeInAnime = AnimationUtils.loadAnimation(this, R.anim.welcome_image_fade_in); if (mFadeInAnime != null) { mFadeInAnime.setAnimationListener(fadeInAniListener); } Bundle bundle = getIntent().getExtras(); if (bundle == null) { finish(); return; } phoneNo = bundle.getString(MyCallRecorderConstant.EXTRA_PHONE_NO); mCreatedDate = bundle.getString(MyCallRecorderConstant.EXTRA_CREATED_DATE); mFileName = bundle.getString(MyCallRecorderConstant.EXTRA_FILE_NAME); mCallState = bundle.getInt(MyCallRecorderConstant.EXTRA_CALL_STATE); mDurationTime = bundle.getString(MyCallRecorderConstant.EXTRA_DURATION); if (StringUtility.isEmpty(mCreatedDate)) { AIOLog.e(MyCallRecorderConstant.TAG, "created date time is null"); finish(); } mBottomLayout.setVisibility(View.VISIBLE); mBottomLayout.setBackgroundColor(mThemeColor); mBottomLayout.startAnimation(mContentUpAnime); }
private void requestToRefreshActivityView(String duration) { if (MyCallRecorderApplication.getInstance().getActivity() != null) { String phoneName = ""; Uri phoneNameUri = Utils.getContactUriTypeFromPhoneNumber(getContentResolver(), phoneNo, 1); if (phoneNameUri == null || StringUtility.isEmpty(phoneNameUri.toString())) { phoneName = ""; } else phoneName = phoneNameUri.toString(); int isFavorite = Utils.isCheckFavouriteContactByPhoneNo(this, phoneNo); RecordingSession session = new RecordingSession( phoneNo, MyCallRecorderConstant.STATE_INCOMING, mFileName, phoneName, isFavorite, mCreatedDate, duration); Utils.requestRefreshViewToAddNewRecord( MyCallRecorderApplication.getInstance().getActivity(), ActivityHome.FRAGMENT_ALL_RECORDING, session); } }