Fix onAttach deprecation
This commit is contained in:
parent
c23139a3fe
commit
2e6d0fb05c
|
@ -18,6 +18,7 @@
|
|||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -80,8 +81,8 @@ public class CreateKeyNameFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
mCreateKeyActivity = (CreateKeyActivity) getActivity();
|
||||
}
|
||||
|
||||
|
|
|
@ -164,8 +164,8 @@ public class CreateKeyPassphraseFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
mCreateKeyActivity = (CreateKeyActivity) getActivity();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -130,8 +131,8 @@ public class CreateKeyStartFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
mCreateKeyActivity = (CreateKeyActivity) getActivity();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -75,8 +76,8 @@ public class CreateSecurityTokenBlankFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
mCreateKeyActivity = (CreateKeyActivity) getActivity();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.ui;
|
|||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -195,8 +196,8 @@ public class CreateSecurityTokenImportResetFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
mCreateKeyActivity = (CreateKeyActivity) getActivity();
|
||||
}
|
||||
|
||||
|
|
|
@ -167,8 +167,8 @@ public class CreateSecurityTokenPinFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
mCreateKeyActivity = (CreateKeyActivity) getActivity();
|
||||
}
|
||||
|
||||
|
|
|
@ -125,10 +125,11 @@ public class EncryptFilesFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
if ( ! (activity instanceof EncryptActivity) ) {
|
||||
throw new AssertionError(activity + " must inherit from EncryptionActivity");
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
if ( ! (context instanceof EncryptActivity) ) {
|
||||
throw new AssertionError(context + " must inherit from EncryptionActivity");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,10 +82,11 @@ public class EncryptTextFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
if ( ! (activity instanceof EncryptActivity) ) {
|
||||
throw new AssertionError(activity + " must inherit from EncryptionActivity");
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
if ( ! (context instanceof EncryptActivity) ) {
|
||||
throw new AssertionError(context + " must inherit from EncryptionActivity");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,17 +107,17 @@ public class ImportKeysCloudFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
|
||||
mActivity = activity;
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
mCallback = (ImportKeysListener) activity;
|
||||
mCallback = (ImportKeysListener) context;
|
||||
} catch (ClassCastException e) {
|
||||
throw new ClassCastException(activity.toString()
|
||||
throw new ClassCastException(context.toString()
|
||||
+ " must implement ImportKeysListener");
|
||||
}
|
||||
|
||||
mActivity = (Activity) context;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
@ -72,17 +73,17 @@ public class ImportKeysFileFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
|
||||
mActivity = activity;
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
mCallback = (ImportKeysListener) activity;
|
||||
mCallback = (ImportKeysListener) context;
|
||||
} catch (ClassCastException e) {
|
||||
throw new ClassCastException(activity.toString()
|
||||
throw new ClassCastException(context.toString()
|
||||
+ " must implement ImportKeysListener");
|
||||
}
|
||||
|
||||
mActivity = (Activity) context;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.ui;
|
|||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
@ -157,8 +158,7 @@ public class ImportKeysListFragment extends Fragment implements
|
|||
if (dataUri != null || bytes != null) {
|
||||
loadState(new BytesLoaderState(bytes, dataUri));
|
||||
} else if (query != null) {
|
||||
CloudSearchPrefs cloudSearchPrefs
|
||||
= args.getParcelable(ARG_CLOUD_SEARCH_PREFS);
|
||||
CloudSearchPrefs cloudSearchPrefs = args.getParcelable(ARG_CLOUD_SEARCH_PREFS);
|
||||
if (cloudSearchPrefs == null) {
|
||||
cloudSearchPrefs = Preferences.getPreferences(mActivity).getCloudSearchPrefs();
|
||||
}
|
||||
|
@ -183,13 +183,13 @@ public class ImportKeysListFragment extends Fragment implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
mListener = (ImportKeysListener) activity;
|
||||
mListener = (ImportKeysListener) context;
|
||||
} catch (ClassCastException e) {
|
||||
throw new ClassCastException(activity.toString()
|
||||
throw new ClassCastException(context.toString()
|
||||
+ " must implement ImportKeysListener");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue