mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-31 06:05:12 +00:00
Fix lint warning: Avoid non-default constructors in fragments
Summary: It is common practice to use a static newInstance to create new fragment instances instead of using non-default constructors Reviewers: #kde_connect, nicolasfella Reviewed By: #kde_connect, nicolasfella Subscribers: kdeconnect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D17390
This commit is contained in:
@@ -73,11 +73,15 @@ public class DeviceFragment extends Fragment {
|
||||
public DeviceFragment() {
|
||||
}
|
||||
|
||||
public DeviceFragment(String deviceId, boolean fromDeviceList) {
|
||||
public static DeviceFragment newInstance(String deviceId, boolean fromDeviceList) {
|
||||
DeviceFragment frag = new DeviceFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_DEVICE_ID, deviceId);
|
||||
args.putBoolean(ARG_FROM_DEVICE_LIST, fromDeviceList);
|
||||
this.setArguments(args);
|
||||
frag.setArguments(args);
|
||||
|
||||
return frag;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -295,7 +295,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
} else {
|
||||
mNavigationView.setCheckedItem(mCurrentMenuEntry);
|
||||
}
|
||||
setContentFragment(new DeviceFragment(deviceId, fromDeviceList));
|
||||
setContentFragment(DeviceFragment.newInstance(deviceId, fromDeviceList));
|
||||
} else {
|
||||
mCurrentMenuEntry = MENU_ENTRY_ADD_DEVICE;
|
||||
mNavigationView.setCheckedItem(mCurrentMenuEntry);
|
||||
|
Reference in New Issue
Block a user