Enable user link handler and fix click on users in admin section (#957)

addresses #955
This pr does the following:
1. enables the users link handler
2. it allows clicks on the full `itemView` in the admin users section (related to https://codeberg.org/gitnex/GitNex/pulls/931#issuecomment-211296)

- [X] I carefully read the [contribution guidelines](https://codeberg.org/GitNex/GitNex/src/branch/main/CONTRIBUTING.md).
- [X] I'm following the code standards as defined [here](https://codeberg.org/gitnex/GitNex/wiki/Code-Standards).
- [X] By submitting this pull request, I permit GitNex to license my work under the [GNU General Public License v3](https://codeberg.org/GitNex/GitNex/src/branch/main/LICENSE).

Co-authored-by: qwerty287 <ndev@web.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/957
Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
qwerty287 2021-08-11 14:47:31 +02:00 committed by M M Arif
parent bb392fb639
commit f88a2df749
2 changed files with 6 additions and 9 deletions

View File

@ -12,6 +12,7 @@ import org.apache.commons.lang3.StringUtils;
import org.gitnex.tea4j.models.Files; import org.gitnex.tea4j.models.Files;
import org.gitnex.tea4j.models.Organization; import org.gitnex.tea4j.models.Organization;
import org.gitnex.tea4j.models.PullRequests; import org.gitnex.tea4j.models.PullRequests;
import org.gitnex.tea4j.models.UserInfo;
import org.gitnex.tea4j.models.UserRepositories; import org.gitnex.tea4j.models.UserRepositories;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.mian.gitnex.R; import org.mian.gitnex.R;
@ -63,8 +64,7 @@ public class DeepLinksActivity extends BaseActivity {
issueIntent = new Intent(ctx, IssueDetailActivity.class); issueIntent = new Intent(ctx, IssueDetailActivity.class);
repoIntent = new Intent(ctx, RepoDetailActivity.class); repoIntent = new Intent(ctx, RepoDetailActivity.class);
orgIntent = new Intent(ctx, OrganizationDetailActivity.class); orgIntent = new Intent(ctx, OrganizationDetailActivity.class);
// TODO: enable if UserProfile Activity exist userIntent = new Intent(ctx, ProfileActivity.class);
//userIntent = new Intent(ctx, ProfileActivity.class)
Intent intent = getIntent(); Intent intent = getIntent();
Uri data = intent.getData(); Uri data = intent.getData();
@ -557,9 +557,7 @@ public class DeepLinksActivity extends BaseActivity {
} }
private void getUser(String url, String instanceToken, String userName) { private void getUser(String url, String instanceToken, String userName) {
// TODO: enable if UserProfile Activity exist Call<UserInfo> call = RetrofitClient.getApiInterface(ctx, url).getUserProfile(instanceToken, userName);
showNoActionButtons();
/*Call<UserInfo> call = RetrofitClient.getApiInterface(ctx, url).getUserProfile(instanceToken, userName);
call.enqueue(new Callback<UserInfo>() { call.enqueue(new Callback<UserInfo>() {
@ -569,13 +567,12 @@ public class DeepLinksActivity extends BaseActivity {
assert response.body() != null; assert response.body() != null;
userIntent.putExtra("username", response.body().getLogin()); userIntent.putExtra("username", response.body().getLogin());
ctx.startActivity(userIntent); ctx.startActivity(userIntent);
finish();
} }
else { else {
Log.e("getUser-code", String.valueOf(response.code())); Log.e("getUser-code", String.valueOf(response.code()));
ctx.startActivity(mainIntent); ctx.startActivity(mainIntent);
finish();
} }
finish();
} }
@Override @Override
@ -584,7 +581,7 @@ public class DeepLinksActivity extends BaseActivity {
ctx.startActivity(mainIntent); ctx.startActivity(mainIntent);
finish(); finish();
} }
});*/ });
} }
private void getFile(String url, String instanceToken, String owner, String repo, String filePath, String branch) { private void getFile(String url, String instanceToken, String owner, String repo, String filePath, String branch) {

View File

@ -53,7 +53,7 @@ public class AdminGetUsersAdapter extends RecyclerView.Adapter<AdminGetUsersAdap
userEmail = itemView.findViewById(R.id.userEmail); userEmail = itemView.findViewById(R.id.userEmail);
userRole = itemView.findViewById(R.id.userRole); userRole = itemView.findViewById(R.id.userRole);
userAvatar.setOnClickListener(loginId -> { itemView.setOnClickListener(loginId -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
intent.putExtra("username", userLoginId); intent.putExtra("username", userLoginId);
context.startActivity(intent); context.startActivity(intent);