Messaging: Let there be lambdas
Change-Id: Iee1fc46c92ea9159abb10d92d34baee937bdee0c
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,11 +26,9 @@ import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnLayoutChangeListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ExpandableListAdapter;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.ExpandableListView.OnChildClickListener;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.DataModel;
|
||||
@@ -73,34 +72,27 @@ public class VCardDetailFragment extends Fragment implements PersonItemDataListe
|
||||
Assert.notNull(mVCardUri);
|
||||
final View view = inflater.inflate(R.layout.vcard_detail_fragment, container, false);
|
||||
mListView = (ExpandableListView) view.findViewById(R.id.list);
|
||||
mListView.addOnLayoutChangeListener(new OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(final View v, final int left, final int top, final int right,
|
||||
final int bottom, final int oldLeft, final int oldTop, final int oldRight,
|
||||
final int oldBottom) {
|
||||
mListView.setIndicatorBounds(mListView.getWidth() - getResources()
|
||||
.getDimensionPixelSize(R.dimen.vcard_detail_group_indicator_width),
|
||||
mListView.getWidth());
|
||||
}
|
||||
mListView.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight,
|
||||
oldBottom) -> {
|
||||
mListView.setIndicatorBounds(mListView.getWidth() - getResources().
|
||||
getDimensionPixelSize(R.dimen.vcard_detail_group_indicator_width),
|
||||
mListView.getWidth());
|
||||
});
|
||||
mListView.setOnChildClickListener(new OnChildClickListener() {
|
||||
@Override
|
||||
public boolean onChildClick(ExpandableListView expandableListView, View clickedView,
|
||||
int groupPosition, int childPosition, long childId) {
|
||||
if (!(clickedView instanceof PersonItemView)) {
|
||||
return false;
|
||||
}
|
||||
final Intent intent = ((PersonItemView) clickedView).getClickIntent();
|
||||
if (intent != null) {
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
mListView.setOnChildClickListener((expandableListView, clickedView, groupPosition,
|
||||
childPosition, childId) -> {
|
||||
if (!(clickedView instanceof PersonItemView)) {
|
||||
return false;
|
||||
}
|
||||
final Intent intent = ((PersonItemView) clickedView).getClickIntent();
|
||||
if (intent != null) {
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
mBinding.bind(DataModel.get().createVCardContactItemData(getActivity(), mVCardUri));
|
||||
mBinding.getData().setListener(this);
|
||||
|
||||
Reference in New Issue
Block a user