Refactor calls to find views in ShareFileFragment

This commit is contained in:
Juan Carlos González Cabrero 2016-03-14 14:02:45 +01:00
parent 02eade8029
commit ceffd197a9

View file

@ -252,7 +252,7 @@ public class ShareFileFragment extends Fragment
*/
private void initShareViaLinkListener(View shareView) {
mOnShareViaLinkSwitchCheckedChangeListener = new OnShareViaLinkListener();
Switch shareViaLinkSwitch = (Switch) shareView.findViewById(R.id.shareViaLinkSectionSwitch);
Switch shareViaLinkSwitch = getShareViaLinkSwitch();
shareViaLinkSwitch.setOnCheckedChangeListener(mOnShareViaLinkSwitchCheckedChangeListener);
}
@ -314,13 +314,13 @@ public class ShareFileFragment extends Fragment
private void initExpirationListener(View shareView) {
mOnExpirationDateInteractionListener = new OnExpirationDateInteractionListener();
((Switch) shareView.findViewById(R.id.shareViaLinkExpirationSwitch)).
getExpirationDateSwitch().
setOnCheckedChangeListener(mOnExpirationDateInteractionListener);
shareView.findViewById(R.id.shareViaLinkExpirationLabel).
setOnClickListener(mOnExpirationDateInteractionListener);
shareView.findViewById(R.id.shareViaLinkExpirationValue).
getExpirationDateValue().
setOnClickListener(mOnExpirationDateInteractionListener);
}
@ -398,13 +398,13 @@ public class ShareFileFragment extends Fragment
private void initPasswordListener(View shareView) {
mOnPasswordInteractionListener = new OnPasswordInteractionListener();
((Switch) shareView.findViewById(R.id.shareViaLinkPasswordSwitch)).
getPasswordSwitch().
setOnCheckedChangeListener(mOnPasswordInteractionListener);
shareView.findViewById(R.id.shareViaLinkPasswordLabel).
setOnClickListener(mOnPasswordInteractionListener);
shareView.findViewById(R.id.shareViaLinkPasswordValue).
getPasswordValue().
setOnClickListener(mOnPasswordInteractionListener);
}
@ -466,7 +466,7 @@ public class ShareFileFragment extends Fragment
private void initEditPermissionListener(View shareView) {
mOnEditPermissionInteractionListener = new OnEditPermissionInteractionListener();
((Switch) shareView.findViewById(R.id.shareViaLinkEditPermissionSwitch)).
getEditPermissionSwitch().
setOnCheckedChangeListener(mOnEditPermissionInteractionListener);
}
@ -742,7 +742,7 @@ public class ShareFileFragment extends Fragment
/// update state of the edit permission switch
Switch editPermissionSwitch = getEditPermissionSwitch();
if(getEditPermissionSection().getVisibility() == View.VISIBLE) {
if (getEditPermissionSection().getVisibility() == View.VISIBLE) {
// set null listener before setChecked() to prevent infinite loop of calls
editPermissionSwitch.setOnCheckedChangeListener(null);
if (mPublicShare.getPermissions() > OCShare.READ_PERMISSION_FLAG) {