Update to viewBinding

This commit is contained in:
Arne 2023-12-04 23:12:56 +01:00
parent 59106db23f
commit c125651d9f
22 changed files with 24 additions and 23 deletions

View file

@ -263,6 +263,7 @@ android {
}
buildFeatures {
buildConfig true
viewBinding true
}
android.applicationVariants.all { variant ->
variant.outputs.each { output ->

View file

@ -94,7 +94,7 @@ public abstract class AbstractSearchableListItemActivity extends XmppActivity im
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_choose_contact);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
this.binding.chooseContactList.setFastScrollEnabled(true);
mListItemsAdapter = new ListItemAdapter(this, listItems);

View file

@ -96,7 +96,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_channel_discovery);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar(), true);
binding.list.setAdapter(this.adapter);
this.adapter.setOnChannelSearchResultSelectedListener(this);

View file

@ -46,7 +46,7 @@ public class ConferenceContactDetailsActivity extends XmppActivity {
}
}
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_contact_details);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
}

View file

@ -255,7 +255,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
this.binding.destroy.setOnClickListener(destroyListener);
this.binding.leaveMuc.setVisibility(View.GONE);
this.binding.addContactButton.setVisibility(View.GONE);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
this.binding.editNickButton.setOnClickListener(v -> {
try {

View file

@ -299,7 +299,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
}
this.messageFingerprint = getIntent().getStringExtra("fingerprint");
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_contact_details);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
binding.showInactiveDevices.setOnClickListener(v -> {
showInactiveOmemo = !showInactiveOmemo;

View file

@ -697,7 +697,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
ConversationMenuConfigurator.reloadFeatures(this);
OmemoSetting.load(this);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_conversations);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
this.getFragmentManager().addOnBackStackChangedListener(this::invalidateActionBarTitle);
this.getFragmentManager().addOnBackStackChangedListener(this::showDialogsIfMainIsOverview);
@ -1157,7 +1157,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
findViewById(R.id.toolbar_avatar_square).setVisibility(View.VISIBLE);
}
ActionBarUtil.setCustomActionBarOnClickListener(
binding.toolbar,
binding.toolbar.getRoot(),
(v) -> openConversationDetails(conversation)
);
return;
@ -1171,7 +1171,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
actionBar.setDisplayShowCustomEnabled(false);
actionBar.setTitle(app_title);
actionBar.setDisplayHomeAsUpEnabled(false);
ActionBarUtil.resetCustomActionBarOnClickListeners(binding.toolbar);
ActionBarUtil.resetCustomActionBarOnClickListeners(binding.toolbar.getRoot());
}
private void openConversationDetails(final Conversation conversation) {

View file

@ -35,7 +35,7 @@ public class EasyOnboardingInviteActivity extends XmppActivity implements EasyOn
public void onCreate(final Bundle bundle) {
super.onCreate(bundle);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_easy_invite);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar(), true);
if (bundle != null && bundle.containsKey("invite")) {
this.easyOnboardingInvite = bundle.getParcelable("invite");

View file

@ -687,7 +687,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.mSavedInstanceInit = savedInstanceState.getBoolean("initMode", false);
}
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_edit_account);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
this.binding.accountJid.addTextChangedListener(this.mTextWatcher);
this.binding.accountJid.setOnFocusChangeListener(this.mEditTextFocusListener);

View file

@ -26,7 +26,7 @@ public class EnterNameActivity extends XmppActivity implements XmppConnectionSer
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_enter_name);
setSupportActionBar((Toolbar) this.binding.toolbar);
setSupportActionBar((Toolbar) this.binding.toolbar.getRoot());
this.binding.next.setOnClickListener(this::next);
this.binding.skip.setOnClickListener(this::skip);
updateNextButton();

View file

@ -55,7 +55,7 @@ public class ImportBackupActivity extends XmppActivity implements ServiceConnect
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_import_backup);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
setLoadingState(savedInstanceState != null && savedInstanceState.getBoolean("loading_state", false));
this.backupFileAdapter = new BackupFileAdapter();
this.binding.list.setAdapter(this.backupFileAdapter);

View file

@ -109,7 +109,7 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher, Ad
binding.server.setSelection(defaultServer);
binding.server.setOnItemSelectedListener(this);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
setSupportActionBar((Toolbar) this.binding.toolbar);
setSupportActionBar((Toolbar) this.binding.toolbar.getRoot());
configureActionBar(getSupportActionBar(), this.domain == null);
if (username != null && domain != null) {
binding.title.setText(R.string.your_server_invitation);

View file

@ -69,7 +69,7 @@ public class MediaBrowserActivity extends XmppActivity implements OnMediaLoaded
this.mSavedInstanceJid = savedInstanceState.getString("jid");
}
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_media_browser);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
mMediaAdapter = new MediaAdapter(this, R.dimen.media_size);
this.binding.media.setAdapter(mMediaAdapter);

View file

@ -104,7 +104,7 @@ public class MucUsersActivity extends XmppActivity implements XmppConnectionServ
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityMucUsersBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_users);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar(), true);
this.userAdapter = new UserAdapter(getPreferences().getBoolean("advanced_muc_mode", false));
binding.list.setAdapter(this.userAdapter);

View file

@ -101,7 +101,7 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_publish_profile_picture);
setSupportActionBar((Toolbar) this.binding.toolbar);
setSupportActionBar((Toolbar) this.binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
this.binding.cancelButton.setOnClickListener((v) -> this.finish());
this.binding.secondaryHint.setVisibility(View.GONE);

View file

@ -98,7 +98,7 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc
}
super.onCreate(bundle);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_search);
setSupportActionBar((Toolbar) this.binding.toolbar);
setSupportActionBar((Toolbar) this.binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
this.messageListAdapter = new MessageAdapter(this, this.messages, uuid == null);
this.messageListAdapter.setOnContactPictureClicked(this);

View file

@ -59,7 +59,7 @@ public class SetSettingsActivity extends XmppActivity implements XmppConnectionS
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_set_settings);
setSupportActionBar((Toolbar) this.binding.toolbar);
setSupportActionBar((Toolbar) this.binding.toolbar.getRoot());
this.binding.next.setOnClickListener(this::next);
createInfoMenu();
getDefaults();

View file

@ -75,7 +75,7 @@ public class ShareLocationActivity extends LocationActivity implements LocationL
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_share_locaction);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
setupMapView(binding.map, LocationProvider.getGeoPoint(this));

View file

@ -53,7 +53,7 @@ public class ShowLocationActivity extends LocationActivity implements LocationLi
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_show_location);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
setupMapView(this.binding.map, this.loc);

View file

@ -305,7 +305,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_start_conversation);
Toolbar toolbar = (Toolbar) binding.toolbar;
Toolbar toolbar = (Toolbar) binding.toolbar.getRoot();
setSupportActionBar(toolbar);
configureActionBar(getSupportActionBar());

View file

@ -83,7 +83,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
binding.cancelButton.setOnClickListener(mCancelButtonListener);
binding.saveButton.setOnClickListener(mSaveButtonListener);
setSupportActionBar((Toolbar) binding.toolbar);
setSupportActionBar((Toolbar) binding.toolbar.getRoot());
configureActionBar(getSupportActionBar());
if (savedInstanceState != null) {

View file

@ -26,7 +26,7 @@ public class EnterNameActivity extends XmppActivity implements XmppConnectionSer
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_enter_name);
setSupportActionBar((Toolbar) this.binding.toolbar);
setSupportActionBar((Toolbar) this.binding.toolbar.getRoot());
this.binding.next.setOnClickListener(this::next);
this.setNick.set(savedInstanceState != null && savedInstanceState.getBoolean("set_nick",false));
}