public class SettingsFragment extends android.support.v4.app.Fragment implements InSquareProfile.InSquareProfileListener, com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener, com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks
Modifier and Type | Field and Description |
---|---|
private TextView |
appInvitesButton |
private TextView |
facebookConnectButton |
private java.lang.String |
fbAccessToken |
private com.facebook.CallbackManager |
fbCallbackManager |
private TextView |
feedbackSendButton |
private java.lang.String |
gAccessToken |
private com.google.android.gms.common.api.GoogleApiClient |
gApiClient |
private TextView |
googleConnectButton |
private com.google.android.gms.auth.api.signin.GoogleSignInOptions |
gSo |
private TextView |
inSquareDisconnectButton |
private static SettingsFragment |
instance |
private InSquareProfile |
profile |
static int |
RC_SIGN_IN |
static int |
REQUEST_INVITE |
private static java.lang.String |
TAG |
private TextView |
tutorialButton |
private de.hdodenhof.circleimageview.CircleImageView |
userAvatar |
private TextView |
username |
Constructor and Description |
---|
SettingsFragment() |
Modifier and Type | Method and Description |
---|---|
private void |
facebookPatchRequest()
Logs in the app sending Facebook's data to the backend, and updates the InSquareProfile
|
private void |
googlePatchRequest()
Logs in the app sending Google's data to the backend, and updates the InSquareProfile
|
private void |
googleSignInResult(com.google.android.gms.auth.api.signin.GoogleSignInResult result)
Called if the Google sign in procedure is successful, calls googlePatchRequest()
|
private void |
handleLogout(Context c)
Shows a dialog to confirm the logout, and eventually logs out from Google's service
|
static SettingsFragment |
newInstance() |
void |
onActivityResult(int requestCode,
int resultCode,
Intent data) |
void |
onAttach(Context context) |
void |
onConnected(Bundle bundle) |
void |
onConnectionFailed(com.google.android.gms.common.ConnectionResult connectionResult) |
void |
onConnectionSuspended(int i) |
void |
onCreate(Bundle savedInstanceState)
Sets up the authentication parameters for Google and Facebook sign-in
|
View |
onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState)
Initializes the view of this fragment
|
void |
onDetach() |
void |
onFavChanged() |
void |
onOwnedChanged() |
void |
onRecentChanged() |
void |
onResume() |
void |
onStart() |
void |
onStop() |
private void |
requestFacebookData()
Gets the Facebook Access Token and calls facebookPatchRequest()
|
private void |
setupAppInvitesButton(View layout)
Manages App Invites
|
private void |
setupFeedbackButton(View layout)
On click, it shows a dialog to get user's feedback, and sends it to the backend
|
private void |
setupLoginButtons(View layout)
Shows 2 buttons.
|
private void |
setupProfile(View layout)
Loads and shows the profile image and the username
|
private void |
setupTutorialButton(View layout)
On click, shows the tutorial of the app
|
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isVisible, onActivityCreated, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDestroyView, onHiddenChanged, onInflate, onInflate, onLowMemory, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPrepareOptionsMenu, onRequestPermissionsResult, onSaveInstanceState, onViewCreated, onViewStateRestored, registerForContextMenu, requestPermissions, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, toString, unregisterForContextMenu
private static SettingsFragment instance
private static final java.lang.String TAG
private de.hdodenhof.circleimageview.CircleImageView userAvatar
private TextView username
private TextView facebookConnectButton
private TextView googleConnectButton
private TextView inSquareDisconnectButton
private TextView appInvitesButton
private TextView feedbackSendButton
private InSquareProfile profile
private java.lang.String gAccessToken
private com.google.android.gms.common.api.GoogleApiClient gApiClient
private com.google.android.gms.auth.api.signin.GoogleSignInOptions gSo
public static final int RC_SIGN_IN
public static final int REQUEST_INVITE
private com.facebook.CallbackManager fbCallbackManager
private java.lang.String fbAccessToken
private TextView tutorialButton
public static SettingsFragment newInstance()
public void onAttach(Context context)
onAttach
in class android.support.v4.app.Fragment
public void onCreate(Bundle savedInstanceState)
onCreate
in class android.support.v4.app.Fragment
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
onCreateView
in class android.support.v4.app.Fragment
setupProfile(View)
,
setupLoginButtons(View)
,
setupFeedbackButton(View)
,
setupAppInvitesButton(View)
,
setupTutorialButton(View)
private void setupFeedbackButton(View layout)
private void setupProfile(View layout)
private void setupAppInvitesButton(View layout)
private void setupLoginButtons(View layout)
handleLogout(Context)
private void handleLogout(Context c)
public void onActivityResult(int requestCode, int resultCode, Intent data)
onActivityResult
in class android.support.v4.app.Fragment
private void googleSignInResult(com.google.android.gms.auth.api.signin.GoogleSignInResult result)
googlePatchRequest()
private void requestFacebookData()
facebookPatchRequest()
private void googlePatchRequest()
private void facebookPatchRequest()
private void setupTutorialButton(View layout)
public void onStart()
onStart
in class android.support.v4.app.Fragment
public void onStop()
onStop
in class android.support.v4.app.Fragment
public void onResume()
onResume
in class android.support.v4.app.Fragment
public void onDetach()
onDetach
in class android.support.v4.app.Fragment
public void onOwnedChanged()
onOwnedChanged
in interface InSquareProfile.InSquareProfileListener
public void onFavChanged()
onFavChanged
in interface InSquareProfile.InSquareProfileListener
public void onRecentChanged()
onRecentChanged
in interface InSquareProfile.InSquareProfileListener
public void onConnected(@Nullable Bundle bundle)
onConnected
in interface com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks
public void onConnectionSuspended(int i)
onConnectionSuspended
in interface com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks
public void onConnectionFailed(@NonNull com.google.android.gms.common.ConnectionResult connectionResult)
onConnectionFailed
in interface com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener