|
@ -12,7 +12,6 @@ import android.text.style.RelativeSizeSpan; |
|
|
import android.text.style.StyleSpan; |
|
|
import android.text.style.StyleSpan; |
|
|
import android.util.Log; |
|
|
import android.util.Log; |
|
|
import android.view.ActionMode; |
|
|
import android.view.ActionMode; |
|
|
import android.view.Gravity; |
|
|
|
|
|
import android.view.LayoutInflater; |
|
|
import android.view.LayoutInflater; |
|
|
import android.view.Menu; |
|
|
import android.view.Menu; |
|
|
import android.view.MenuInflater; |
|
|
import android.view.MenuInflater; |
|
@ -604,14 +603,16 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe |
|
|
usernameTemp = usernameTemp.substring(1); |
|
|
usernameTemp = usernameTemp.substring(1); |
|
|
} |
|
|
} |
|
|
if (TextUtils.isEmpty(usernameTemp)) { |
|
|
if (TextUtils.isEmpty(usernameTemp)) { |
|
|
profileModel = appStateViewModel.getCurrentUser(); |
|
|
|
|
|
if (profileModel != null) { |
|
|
|
|
|
|
|
|
appStateViewModel.getCurrentUserLiveData().observe(getViewLifecycleOwner(), user -> { |
|
|
|
|
|
if (user == null) return; |
|
|
|
|
|
profileModel = user; |
|
|
username = profileModel.getUsername(); |
|
|
username = profileModel.getUsername(); |
|
|
setUsernameDelayed(); |
|
|
setUsernameDelayed(); |
|
|
setProfileDetails(); |
|
|
setProfileDetails(); |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
else if (isLoggedIn) { |
|
|
|
|
|
|
|
|
if (isLoggedIn) { |
|
|
userService.getUsernameInfo(usernameTemp, new ServiceCallback<User>() { |
|
|
userService.getUsernameInfo(usernameTemp, new ServiceCallback<User>() { |
|
|
@Override |
|
|
@Override |
|
|
public void onSuccess(final User user) { |
|
|
public void onSuccess(final User user) { |
|
@ -645,8 +646,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe |
|
|
} catch (final Throwable ignored) {} |
|
|
} catch (final Throwable ignored) {} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
else { |
|
|
|
|
|
graphQLService.fetchUser(usernameTemp, new ServiceCallback<User>() { |
|
|
graphQLService.fetchUser(usernameTemp, new ServiceCallback<User>() { |
|
|
@Override |
|
|
@Override |
|
|
public void onSuccess(final User user) { |
|
|
public void onSuccess(final User user) { |
|
@ -665,7 +666,6 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setProfileDetails() { |
|
|
private void setProfileDetails() { |
|
|
final Context context = getContext(); |
|
|
final Context context = getContext(); |
|
@ -989,6 +989,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void updateAccountInfo() { |
|
|
private void updateAccountInfo() { |
|
|
|
|
|
if (profileModel == null) return; |
|
|
accountRepository.insertOrUpdateAccount( |
|
|
accountRepository.insertOrUpdateAccount( |
|
|
profileModel.getPk(), |
|
|
profileModel.getPk(), |
|
|
profileModel.getUsername(), |
|
|
profileModel.getUsername(), |
|
|