Rewriting deprecated code and adding view bindings to all fragments and activities. (#809)

Remove jetbrain import

Merge branch 'master' into deprecations

View bindings #3

View bindings #2

View bindings #1

Rewriting deprecated code.

Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/809
Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
Co-Authored-By: opyale <opyale@noreply.codeberg.org>
Co-Committed-By: opyale <opyale@noreply.codeberg.org>
This commit is contained in:
opyale 2021-01-26 16:10:31 +01:00 committed by M M Arif
parent 371649b8ca
commit a26737e510
94 changed files with 674 additions and 691 deletions

View File

@ -16,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.UserSearchAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityAddCollaboratorToRepositoryBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.models.UserInfo;
import org.mian.gitnex.models.UserSearch;
@ -47,13 +48,15 @@ public class AddCollaboratorToRepositoryActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ActivityAddCollaboratorToRepositoryBinding activityAddCollaboratorToRepositoryBinding = ActivityAddCollaboratorToRepositoryBinding.inflate(getLayoutInflater());
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ImageView closeActivity = findViewById(R.id.close);
addCollaboratorSearch = findViewById(R.id.addCollaboratorSearch);
mRecyclerView = findViewById(R.id.recyclerViewUserSearch);
mProgressBar = findViewById(R.id.progressBar);
noData = findViewById(R.id.noData);
ImageView closeActivity = activityAddCollaboratorToRepositoryBinding.close;
addCollaboratorSearch = activityAddCollaboratorToRepositoryBinding.addCollaboratorSearch;
mRecyclerView = activityAddCollaboratorToRepositoryBinding.recyclerViewUserSearch;
mProgressBar = activityAddCollaboratorToRepositoryBinding.progressBar;
noData = activityAddCollaboratorToRepositoryBinding.noData;
addCollaboratorSearch.requestFocus();
assert imm != null;

View File

@ -57,10 +57,9 @@ public class AddNewAccountActivity extends BaseActivity {
viewBinding.close.setOnClickListener(onClickListener);
ArrayAdapter<Protocol> adapterProtocols = new ArrayAdapter<>(ctx, R.layout.list_spinner_items, Protocol.values());
viewBinding.protocolSpinner.setAdapter(adapterProtocols);
viewBinding.protocolSpinner.setOnItemClickListener((parent, view1, position, id) -> spinnerSelectedValue = String.valueOf(parent.getItemAtPosition(position)));
viewBinding.addNewAccount.setOnClickListener(login -> {
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);

View File

@ -17,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.UserSearchForTeamMemberAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityAddNewTeamMemberBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.models.UserInfo;
import org.mian.gitnex.models.UserSearch;
@ -54,13 +55,15 @@ public class AddNewTeamMemberActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ActivityAddNewTeamMemberBinding activityAddNewTeamMemberBinding = ActivityAddNewTeamMemberBinding.inflate(getLayoutInflater());
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ImageView closeActivity = findViewById(R.id.close);
addNewTeamMember = findViewById(R.id.addNewTeamMember);
mRecyclerView = findViewById(R.id.recyclerViewUserSearch);
mProgressBar = findViewById(R.id.progress_bar);
noData = findViewById(R.id.noData);
ImageView closeActivity = activityAddNewTeamMemberBinding.close;
addNewTeamMember = activityAddNewTeamMemberBinding.addNewTeamMember;
mRecyclerView = activityAddNewTeamMemberBinding.recyclerViewUserSearch;
mProgressBar = activityAddNewTeamMemberBinding.progressBar;
noData = activityAddNewTeamMemberBinding.noData;
addNewTeamMember.requestFocus();
assert imm != null;

View File

@ -21,6 +21,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.AdminGetUsersAdapter;
import org.mian.gitnex.databinding.ActivityAdminGetUsersBinding;
import org.mian.gitnex.fragments.BottomSheetAdminUsersFragment;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -48,13 +49,15 @@ public class AdminGetUsersActivity extends BaseActivity implements BottomSheetAd
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
noDataUsers = findViewById(R.id.noDataUsers);
mRecyclerView = findViewById(R.id.recyclerView);
ActivityAdminGetUsersBinding activityAdminGetUsersBinding = ActivityAdminGetUsersBinding.inflate(getLayoutInflater());
final SwipeRefreshLayout swipeRefresh = findViewById(R.id.pullToRefresh);
ImageView closeActivity = activityAdminGetUsersBinding.close;
noDataUsers = activityAdminGetUsersBinding.noDataUsers;
mRecyclerView = activityAdminGetUsersBinding.recyclerView;
Toolbar toolbar = findViewById(R.id.toolbar);
final SwipeRefreshLayout swipeRefresh = activityAdminGetUsersBinding.pullToRefresh;
Toolbar toolbar = activityAdminGetUsersBinding.toolbar;
setSupportActionBar(toolbar);
initCloseListener();

View File

@ -21,6 +21,7 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.CommitsAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCommitsBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.StaticGlobalVariables;
import org.mian.gitnex.helpers.Toasty;
@ -60,7 +61,10 @@ public class CommitsActivity extends BaseActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toolbar toolbar = findViewById(R.id.toolbar);
ActivityCommitsBinding activityCommitsBinding = ActivityCommitsBinding.inflate(getLayoutInflater());
Toolbar toolbar = activityCommitsBinding.toolbar;
setSupportActionBar(toolbar);
String repoFullName = tinyDB.getString("repoFullName");
@ -70,15 +74,15 @@ public class CommitsActivity extends BaseActivity {
String branchName = getIntent().getStringExtra("branchName");
TextView toolbar_title = findViewById(R.id.toolbar_title);
TextView toolbar_title = activityCommitsBinding.toolbarTitle;
toolbar_title.setMovementMethod(new ScrollingMovementMethod());
toolbar_title.setText(branchName);
ImageView closeActivity = findViewById(R.id.close);
noData = findViewById(R.id.noDataCommits);
progressLoadMore = findViewById(R.id.progressLoadMore);
progressBar = findViewById(R.id.progress_bar);
SwipeRefreshLayout swipeRefresh = findViewById(R.id.pullToRefresh);
ImageView closeActivity = activityCommitsBinding.close;
noData = activityCommitsBinding.noDataCommits;
progressLoadMore = activityCommitsBinding.progressLoadMore;
progressBar = activityCommitsBinding.progressBar;
SwipeRefreshLayout swipeRefresh = activityCommitsBinding.pullToRefresh;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
@ -89,7 +93,7 @@ public class CommitsActivity extends BaseActivity {
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
}
recyclerView = findViewById(R.id.recyclerView);
recyclerView = activityCommitsBinding.recyclerView;
commitsList = new ArrayList<>();
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {

View File

@ -17,6 +17,7 @@ import androidx.annotation.NonNull;
import com.google.gson.JsonElement;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateFileBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -60,7 +61,7 @@ public class CreateFileActivity extends BaseActivity {
@Override
protected int getLayoutResourceId(){
return R.layout.activity_new_file;
return R.layout.activity_create_file;
}
@SuppressLint("ClickableViewAccessibility")
@ -69,6 +70,8 @@ public class CreateFileActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ActivityCreateFileBinding activityCreateFileBinding = ActivityCreateFileBinding.inflate(getLayoutInflater());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@ -80,12 +83,12 @@ public class CreateFileActivity extends BaseActivity {
repoName = parts[1];
instanceToken = "token " + tinyDB.getString(loginUid + "-token");
closeActivity = findViewById(R.id.close);
newFileName = findViewById(R.id.newFileName);
newFileContent = findViewById(R.id.newFileContent);
newFileBranchName = findViewById(R.id.newFileBranchName);
newFileCommitMessage = findViewById(R.id.newFileCommitMessage);
TextView toolbarTitle = findViewById(R.id.toolbarTitle);
closeActivity = activityCreateFileBinding.close;
newFileName = activityCreateFileBinding.newFileName;
newFileContent = activityCreateFileBinding.newFileContent;
newFileBranchName = activityCreateFileBinding.newFileBranchName;
newFileCommitMessage = activityCreateFileBinding.newFileCommitMessage;
TextView toolbarTitle = activityCreateFileBinding.toolbarTitle;
newFileName.requestFocus();
assert imm != null;
@ -94,7 +97,7 @@ public class CreateFileActivity extends BaseActivity {
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
newFileCreate = findViewById(R.id.newFileCreate);
newFileCreate = activityCreateFileBinding.newFileCreate;
newFileContent.setOnTouchListener((touchView, motionEvent) -> {
@ -148,7 +151,7 @@ public class CreateFileActivity extends BaseActivity {
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
newFileBranchesSpinner = findViewById(R.id.newFileBranchesSpinner);
newFileBranchesSpinner = activityCreateFileBinding.newFileBranchesSpinner;
getBranches(instanceToken, repoOwner, repoName, loginUid);
disableProcessButton();

View File

@ -15,6 +15,7 @@ import androidx.core.content.ContextCompat;
import com.pes.androidmaterialcolorpickerdialog.ColorPicker;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateLabelBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -50,6 +51,8 @@ public class CreateLabelActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ActivityCreateLabelBinding activityCreateLabelBinding = ActivityCreateLabelBinding.inflate(getLayoutInflater());
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
tinyDB = TinyDB.getInstance(appCtx);
@ -67,10 +70,10 @@ public class CreateLabelActivity extends BaseActivity {
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
ImageView closeActivity = findViewById(R.id.close);
colorPicker = findViewById(R.id.colorPicker);
labelName = findViewById(R.id.labelName);
createLabelButton = findViewById(R.id.createLabelButton);
ImageView closeActivity = activityCreateLabelBinding.close;
colorPicker = activityCreateLabelBinding.colorPicker;
labelName = activityCreateLabelBinding.labelName;
createLabelButton = activityCreateLabelBinding.createLabelButton;
labelName.requestFocus();
assert imm != null;
@ -97,7 +100,7 @@ public class CreateLabelActivity extends BaseActivity {
colorPicker.setBackgroundColor(labelColor_);
tinyDB.putString("labelColorDefault", "#" + getIntent().getStringExtra("labelColor"));
TextView toolbar_title = findViewById(R.id.toolbar_title);
TextView toolbar_title = activityCreateLabelBinding.toolbarTitle;
toolbar_title.setText(getResources().getString(R.string.pageTitleLabelUpdate));
createLabelButton.setText(getResources().getString(R.string.newUpdateButtonCopy));

View File

@ -14,6 +14,7 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateMilestoneBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -39,7 +40,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
@Override
protected int getLayoutResourceId(){
return R.layout.activity_new_milestone;
return R.layout.activity_create_milestone;
}
@SuppressLint("ClickableViewAccessibility")
@ -48,15 +49,17 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
super.onCreate(savedInstanceState);
ActivityCreateMilestoneBinding activityCreateMilestoneBinding = ActivityCreateMilestoneBinding.inflate(getLayoutInflater());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
milestoneDueDate = findViewById(R.id.milestoneDueDate);
ImageView closeActivity = findViewById(R.id.close);
createNewMilestoneButton = findViewById(R.id.createNewMilestoneButton);
milestoneTitle = findViewById(R.id.milestoneTitle);
milestoneDescription = findViewById(R.id.milestoneDescription);
milestoneDueDate = activityCreateMilestoneBinding.milestoneDueDate;
ImageView closeActivity = activityCreateMilestoneBinding.close;
createNewMilestoneButton = activityCreateMilestoneBinding.createNewMilestoneButton;
milestoneTitle = activityCreateMilestoneBinding.milestoneTitle;
milestoneDescription = activityCreateMilestoneBinding.milestoneDescription;
milestoneTitle.requestFocus();
assert imm != null;

View File

@ -12,6 +12,7 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateNewUserBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -44,16 +45,18 @@ public class CreateNewUserActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ActivityCreateNewUserBinding activityCreateNewUserBinding = ActivityCreateNewUserBinding.inflate(getLayoutInflater());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ImageView closeActivity = findViewById(R.id.close);
createUserButton = findViewById(R.id.createUserButton);
fullName = findViewById(R.id.fullName);
userUserName = findViewById(R.id.userUserName);
userEmail = findViewById(R.id.userEmail);
userPassword = findViewById(R.id.userPassword);
ImageView closeActivity = activityCreateNewUserBinding.close;
createUserButton = activityCreateNewUserBinding.createUserButton;
fullName = activityCreateNewUserBinding.fullName;
userUserName = activityCreateNewUserBinding.userUserName;
userEmail = activityCreateNewUserBinding.userEmail;
userPassword = activityCreateNewUserBinding.userPassword;
fullName.requestFocus();
assert imm != null;

View File

@ -13,6 +13,7 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateOrganizationBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -37,7 +38,7 @@ public class CreateOrganizationActivity extends BaseActivity {
@Override
protected int getLayoutResourceId(){
return R.layout.activity_new_organization;
return R.layout.activity_create_organization;
}
@SuppressLint("ClickableViewAccessibility")
@ -46,13 +47,15 @@ public class CreateOrganizationActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ActivityCreateOrganizationBinding activityCreateOrganizationBinding = ActivityCreateOrganizationBinding.inflate(getLayoutInflater());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
closeActivity = findViewById(R.id.close);
orgName = findViewById(R.id.newOrganizationName);
orgDesc = findViewById(R.id.newOrganizationDescription);
closeActivity = activityCreateOrganizationBinding.close;
orgName = activityCreateOrganizationBinding.newOrganizationName;
orgDesc = activityCreateOrganizationBinding.newOrganizationDescription;
orgName.requestFocus();
assert imm != null;
@ -72,7 +75,7 @@ public class CreateOrganizationActivity extends BaseActivity {
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
createOrganizationButton = findViewById(R.id.createNewOrganizationButton);
createOrganizationButton = activityCreateOrganizationBinding.createNewOrganizationButton;
if(!connToInternet) {

View File

@ -16,6 +16,7 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateReleaseBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -60,6 +61,8 @@ public class CreateReleaseActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ActivityCreateReleaseBinding activityCreateReleaseBinding = ActivityCreateReleaseBinding.inflate(getLayoutInflater());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@ -69,12 +72,12 @@ public class CreateReleaseActivity extends BaseActivity {
repoOwner = parts[0];
repoName = parts[1];
closeActivity = findViewById(R.id.close);
releaseTagName = findViewById(R.id.releaseTagName);
releaseTitle = findViewById(R.id.releaseTitle);
releaseContent = findViewById(R.id.releaseContent);
releaseType = findViewById(R.id.releaseType);
releaseDraft = findViewById(R.id.releaseDraft);
closeActivity = activityCreateReleaseBinding.close;
releaseTagName = activityCreateReleaseBinding.releaseTagName;
releaseTitle = activityCreateReleaseBinding.releaseTitle;
releaseContent = activityCreateReleaseBinding.releaseContent;
releaseType = activityCreateReleaseBinding.releaseType;
releaseDraft = activityCreateReleaseBinding.releaseDraft;
releaseTitle.requestFocus();
assert imm != null;
@ -94,10 +97,10 @@ public class CreateReleaseActivity extends BaseActivity {
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
releaseBranch = findViewById(R.id.releaseBranch);
releaseBranch = activityCreateReleaseBinding.releaseBranch;
getBranches(Authorization.get(ctx), repoOwner, repoName);
createNewRelease = findViewById(R.id.createNewRelease);
createNewRelease = activityCreateReleaseBinding.createNewRelease;
disableProcessButton();
if(!connToInternet) {

View File

@ -16,6 +16,7 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateRepoBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -57,7 +58,7 @@ public class CreateRepoActivity extends BaseActivity {
@Override
protected int getLayoutResourceId(){
return R.layout.activity_new_repo;
return R.layout.activity_create_repo;
}
@Override
@ -65,6 +66,8 @@ public class CreateRepoActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ActivityCreateRepoBinding activityCreateRepoBinding = ActivityCreateRepoBinding.inflate(getLayoutInflater());
boolean connToInternet = AppUtil.hasNetworkConnection(ctx);
loginUid = tinyDB.getString("loginUid");
@ -72,10 +75,10 @@ public class CreateRepoActivity extends BaseActivity {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
closeActivity = findViewById(R.id.close);
repoName = findViewById(R.id.newRepoName);
repoDesc = findViewById(R.id.newRepoDescription);
repoAccess = findViewById(R.id.newRepoPrivate);
closeActivity = activityCreateRepoBinding.close;
repoName = activityCreateRepoBinding.newRepoName;
repoDesc = activityCreateRepoBinding.newRepoDescription;
repoAccess = activityCreateRepoBinding.newRepoPrivate;
repoName.requestFocus();
assert imm != null;
@ -84,10 +87,10 @@ public class CreateRepoActivity extends BaseActivity {
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
spinner = findViewById(R.id.ownerSpinner);
spinner = activityCreateRepoBinding.ownerSpinner;
getOrganizations(Authorization.get(ctx), userLogin);
createRepo = findViewById(R.id.createNewRepoButton);
createRepo = activityCreateRepoBinding.createNewRepoButton;
disableProcessButton();
if(!connToInternet) {

View File

@ -11,8 +11,10 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.res.ResourcesCompat;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateTeamByOrgBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -74,18 +76,20 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
super.onCreate(savedInstanceState);
ActivityCreateTeamByOrgBinding activityCreateTeamByOrgBinding = ActivityCreateTeamByOrgBinding.inflate(getLayoutInflater());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ImageView closeActivity = findViewById(R.id.close);
teamName = findViewById(R.id.teamName);
teamDesc = findViewById(R.id.teamDesc);
teamPermission = findViewById(R.id.teamPermission);
teamPermissionDetail = findViewById(R.id.teamPermissionDetail);
teamAccessControls = findViewById(R.id.teamAccessControls);
teamAccessControlsArray = findViewById(R.id.teamAccessControlsArray);
createTeamButton = findViewById(R.id.createTeamButton);
ImageView closeActivity = activityCreateTeamByOrgBinding.close;
teamName = activityCreateTeamByOrgBinding.teamName;
teamDesc = activityCreateTeamByOrgBinding.teamDesc;
teamPermission = activityCreateTeamByOrgBinding.teamPermission;
teamPermissionDetail = activityCreateTeamByOrgBinding.teamPermissionDetail;
teamAccessControls = activityCreateTeamByOrgBinding.teamAccessControls;
teamAccessControlsArray = activityCreateTeamByOrgBinding.teamAccessControlsArray;
createTeamButton = activityCreateTeamByOrgBinding.createTeamButton;
teamName.requestFocus();
assert imm != null;
@ -210,9 +214,9 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
if(!connToInternet) {
createTeamButton.setEnabled(false);
GradientDrawable shape = new GradientDrawable();
shape.setCornerRadius( 8 );
shape.setColor(getResources().getColor(R.color.hintColor));
GradientDrawable shape = new GradientDrawable();
shape.setCornerRadius(8);
shape.setColor(ResourcesCompat.getColor(getResources(), R.color.hintColor, null));
createTeamButton.setBackground(shape);
}
else {

View File

@ -20,6 +20,7 @@ import androidx.annotation.NonNull;
import com.google.gson.JsonElement;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityEditIssueBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -74,6 +75,8 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
super.onCreate(savedInstanceState);
ActivityEditIssueBinding activityEditIssueBinding = ActivityEditIssueBinding.inflate(getLayoutInflater());
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
loginUid = tinyDB.getString("loginUid");
@ -84,12 +87,12 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
repoName = parts[1];
issueIndex = Integer.parseInt(tinyDB.getString("issueNumber"));
ImageView closeActivity = findViewById(R.id.close);
editIssueButton = findViewById(R.id.editIssueButton);
TextView toolbar_title = findViewById(R.id.toolbar_title);
editIssueTitle = findViewById(R.id.editIssueTitle);
editIssueDescription = findViewById(R.id.editIssueDescription);
editIssueDueDate = findViewById(R.id.editIssueDueDate);
ImageView closeActivity = activityEditIssueBinding.close;
editIssueButton = activityEditIssueBinding.editIssueButton;
TextView toolbar_title = activityEditIssueBinding.toolbarTitle;
editIssueTitle = activityEditIssueBinding.editIssueTitle;
editIssueDescription = activityEditIssueBinding.editIssueDescription;
editIssueDueDate = activityEditIssueBinding.editIssueDueDate;
// if gitea is 1.12 or higher use the new limit
if(new Version(tinyDB.getString("giteaVersion")).higherOrEqual("1.12.0")) {

View File

@ -12,6 +12,7 @@ import androidx.appcompat.widget.Toolbar;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.FilesDiffAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityFileDiffBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.ParseDiff;
import org.mian.gitnex.helpers.TinyDB;
@ -46,7 +47,9 @@ public class FileDiffActivity extends BaseActivity {
super.onCreate(savedInstanceState);
Toolbar toolbar = findViewById(R.id.toolbar);
ActivityFileDiffBinding activityFileDiffBinding = ActivityFileDiffBinding.inflate(getLayoutInflater());
Toolbar toolbar = activityFileDiffBinding.toolbar;
setSupportActionBar(toolbar);
final TinyDB tinyDb = TinyDB.getInstance(appCtx);
@ -57,10 +60,10 @@ public class FileDiffActivity extends BaseActivity {
final String loginUid = tinyDb.getString("loginUid");
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
ImageView closeActivity = findViewById(R.id.close);
toolbarTitle = findViewById(R.id.toolbar_title);
mListView = findViewById(R.id.listView);
mProgressBar = findViewById(R.id.progress_bar);
ImageView closeActivity = activityFileDiffBinding.close;
toolbarTitle = activityFileDiffBinding.toolbarTitle;
mListView = activityFileDiffBinding.listView;
mProgressBar = activityFileDiffBinding.progressBar;
mListView.setDivider(null);

View File

@ -32,6 +32,7 @@ import com.github.chrisbanes.photoview.PhotoView;
import org.apache.commons.io.FileUtils;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityFileViewBinding;
import org.mian.gitnex.fragments.BottomSheetFileViewerFragment;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
@ -82,7 +83,9 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
super.onCreate(savedInstanceState);
appUtil = new AppUtil();
Toolbar toolbar = findViewById(R.id.toolbar);
ActivityFileViewBinding activityFileViewBinding = ActivityFileViewBinding.inflate(getLayoutInflater());
Toolbar toolbar = activityFileViewBinding.toolbar;
setSupportActionBar(toolbar);
String repoFullName = tinyDB.getString("repoFullName");
@ -95,18 +98,18 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
tinyDB.putBoolean("enableMarkdownInFileView", false);
ImageView closeActivity = findViewById(R.id.close);
singleFileContents = findViewById(R.id.singleFileContents);
singleCodeContents = findViewById(R.id.singleCodeContents);
imageView = findViewById(R.id.imageView);
mProgressBar = findViewById(R.id.progress_bar);
pdfView = findViewById(R.id.pdfView);
pdfViewFrame = findViewById(R.id.pdfViewFrame);
singleFileContentsFrame = findViewById(R.id.singleFileContentsFrame);
ImageView closeActivity = activityFileViewBinding.close;
singleFileContents = activityFileViewBinding.singleFileContents;
singleCodeContents = activityFileViewBinding.singleCodeContents;
imageView = activityFileViewBinding.imageView;
mProgressBar = activityFileViewBinding.progressBar;
pdfView = activityFileViewBinding.pdfView;
pdfViewFrame = activityFileViewBinding.pdfViewFrame;
singleFileContentsFrame = activityFileViewBinding.singleFileContentsFrame;
singleFileName = getIntent().getStringExtra("singleFileName");
TextView toolbar_title = findViewById(R.id.toolbar_title);
TextView toolbar_title = activityFileViewBinding.toolbarTitle;
toolbar_title.setMovementMethod(new ScrollingMovementMethod());
initCloseListener();

View File

@ -9,7 +9,6 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Html;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
@ -22,6 +21,8 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
@ -583,9 +584,9 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
PicassoService.getInstance(ctx).get().load(singleIssue.getUser().getAvatar_url()).placeholder(R.drawable.loader_animated)
.transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(viewBinding.assigneeAvatar);
String issueNumber_ = "<font color='" + appCtx.getResources().getColor(R.color.lightGray) + "'>" + appCtx.getResources()
String issueNumber_ = "<font color='" + ResourcesCompat.getColor(getResources(), R.color.lightGray, null) + "'>" + appCtx.getResources()
.getString(R.string.hash) + singleIssue.getNumber() + "</font>";
viewBinding.issueTitle.setText(Html.fromHtml(issueNumber_ + " " + singleIssue.getTitle()));
viewBinding.issueTitle.setText(HtmlCompat.fromHtml(issueNumber_ + " " + singleIssue.getTitle(), HtmlCompat.FROM_HTML_MODE_LEGACY));
String cleanIssueDescription = singleIssue.getBody().trim();
new Markdown(ctx, EmojiParser.parseToUnicode(cleanIssueDescription), viewBinding.issueDescription);

View File

@ -10,13 +10,13 @@ import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.database.api.UserAccountsApi;
import org.mian.gitnex.database.models.UserAccount;
import org.mian.gitnex.databinding.ActivityLoginBinding;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.NetworkStatusObserver;
import org.mian.gitnex.helpers.PathsHelper;
@ -64,18 +64,20 @@ public class LoginActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ActivityLoginBinding activityLoginBinding = ActivityLoginBinding.inflate(getLayoutInflater());
NetworkStatusObserver networkStatusObserver = NetworkStatusObserver.get(ctx);
loginButton = findViewById(R.id.login_button);
instanceUrlET = findViewById(R.id.instance_url);
loginUidET = findViewById(R.id.login_uid);
loginPassword = findViewById(R.id.login_passwd);
otpCode = findViewById(R.id.otpCode);
protocolSpinner = findViewById(R.id.httpsSpinner);
loginMethod = findViewById(R.id.loginMethod);
loginTokenCode = findViewById(R.id.loginTokenCode);
loginButton = activityLoginBinding.loginButton;
instanceUrlET = activityLoginBinding.instanceUrl;
loginUidET = activityLoginBinding.loginUid;
loginPassword = activityLoginBinding.loginPasswd;
otpCode = activityLoginBinding.otpCode;
protocolSpinner = activityLoginBinding.httpsSpinner;
loginMethod = activityLoginBinding.loginMethod;
loginTokenCode = activityLoginBinding.loginTokenCode;
((TextView) findViewById(R.id.appVersion)).setText(AppUtil.getAppVersion(appCtx));
activityLoginBinding.appVersion.setText(AppUtil.getAppVersion(appCtx));
ArrayAdapter<Protocol> adapterProtocols = new ArrayAdapter<>(LoginActivity.this, R.layout.list_spinner_items, Protocol.values());

View File

@ -3,8 +3,6 @@ package org.mian.gitnex.activities;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
@ -19,6 +17,7 @@ import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
@ -31,6 +30,7 @@ import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.database.api.UserAccountsApi;
import org.mian.gitnex.database.models.UserAccount;
import org.mian.gitnex.databinding.ActivityMainBinding;
import org.mian.gitnex.fragments.AdministrationFragment;
import org.mian.gitnex.fragments.BottomSheetDraftsFragment;
import org.mian.gitnex.fragments.DraftsFragment;
@ -57,7 +57,6 @@ import org.mian.gitnex.models.NotificationCount;
import org.mian.gitnex.models.UserInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import eightbitlab.com.blurview.BlurView;
import eightbitlab.com.blurview.RenderScriptBlur;
import retrofit2.Call;
@ -97,6 +96,8 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
super.onCreate(savedInstanceState);
ActivityMainBinding activityMainBinding = ActivityMainBinding.inflate(getLayoutInflater());
tinyDB.putBoolean("noConnection", false);
String currentVersion = tinyDB.getString("giteaVersion");
@ -114,8 +115,8 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
if(tinyDB.getString("codeBlockStr").isEmpty()) {
tinyDB.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen));
tinyDB.putInt("codeBlockBackground", getResources().getColor(R.color.black));
tinyDB.putInt("codeBlockColor", ResourcesCompat.getColor(getResources(), R.color.colorLightGreen, null));
tinyDB.putInt("codeBlockBackground", ResourcesCompat.getColor(getResources(), R.color.black, null));
}
if(tinyDB.getString("enableCounterIssueBadgeInit").isEmpty()) {
@ -142,8 +143,8 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
AlertDialogs.forceLogoutDialog(ctx, getResources().getString(R.string.forceLogoutDialogHeader), getResources().getString(R.string.forceLogoutDialogDescription), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
}
Toolbar toolbar = findViewById(R.id.toolbar);
toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
Toolbar toolbar = activityMainBinding.toolbar;
toolbarTitle = activityMainBinding.toolbarTitle;
switch(tinyDB.getInt("customFontId", -1)) {
@ -210,8 +211,8 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
getNotificationsCount(instanceToken);
drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
drawer = activityMainBinding.drawerLayout;
NavigationView navigationView = activityMainBinding.navView;
navigationView.setNavigationItemSelectedListener(this);
hView = navigationView.getHeaderView(0);
@ -468,17 +469,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
}
// Changelog popup
int versionCode = 0;
try {
PackageInfo packageInfo = appCtx.getPackageManager().getPackageInfo(appCtx.getPackageName(), 0);
versionCode = packageInfo.versionCode;
}
catch(PackageManager.NameNotFoundException e) {
Log.e("changelogDialog", Objects.requireNonNull(e.getMessage()));
}
int versionCode = AppUtil.getAppBuildNo(appCtx);
if(versionCode > tinyDB.getInt("versionCode")) {

View File

@ -20,6 +20,7 @@ import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivityOrgDetailBinding;
import org.mian.gitnex.fragments.BottomSheetOrganizationFragment;
import org.mian.gitnex.fragments.MembersByOrgFragment;
import org.mian.gitnex.fragments.OrganizationInfoFragment;
@ -46,10 +47,12 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
super.onCreate(savedInstanceState);
ActivityOrgDetailBinding activityOrgDetailBinding = ActivityOrgDetailBinding.inflate(getLayoutInflater());
String orgName = tinyDB.getString("orgName");
Toolbar toolbar = findViewById(R.id.toolbar);
TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
Toolbar toolbar = activityOrgDetailBinding.toolbar;
TextView toolbarTitle = activityOrgDetailBinding.toolbarTitle;
setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setTitle(orgName);
@ -57,10 +60,10 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
OrganizationDetailActivity.SectionsPagerAdapter mSectionsPagerAdapter = new OrganizationDetailActivity.SectionsPagerAdapter(getSupportFragmentManager());
ViewPager mViewPager = findViewById(R.id.container);
ViewPager mViewPager = activityOrgDetailBinding.container;
mViewPager.setAdapter(mSectionsPagerAdapter);
TabLayout tabLayout = findViewById(R.id.tabs);
TabLayout tabLayout = activityOrgDetailBinding.tabs;
Typeface myTypeface;

View File

@ -14,6 +14,7 @@ import androidx.appcompat.widget.Toolbar;
import androidx.lifecycle.ViewModelProvider;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.TeamMembersByOrgAdapter;
import org.mian.gitnex.databinding.ActivityOrgTeamMembersBinding;
import org.mian.gitnex.fragments.BottomSheetOrganizationTeamsFragment;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
@ -44,14 +45,16 @@ public class OrganizationTeamMembersActivity extends BaseActivity implements Bot
super.onCreate(savedInstanceState);
Toolbar toolbar = findViewById(R.id.toolbar);
ActivityOrgTeamMembersBinding activityOrgTeamMembersBinding = ActivityOrgTeamMembersBinding.inflate(getLayoutInflater());
Toolbar toolbar = activityOrgTeamMembersBinding.toolbar;
setSupportActionBar(toolbar);
ImageView closeActivity = findViewById(R.id.close);
TextView toolbarTitle = findViewById(R.id.toolbar_title);
noDataMembers = findViewById(R.id.noDataMembers);
mGridView = findViewById(R.id.gridView);
progressBar = findViewById(R.id.progressBar);
ImageView closeActivity = activityOrgTeamMembersBinding.close;
TextView toolbarTitle = activityOrgTeamMembersBinding.toolbarTitle;
noDataMembers = activityOrgTeamMembersBinding.noDataMembers;
mGridView = activityOrgTeamMembersBinding.gridView;
progressBar = activityOrgTeamMembersBinding.progressBar;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);

View File

@ -13,6 +13,7 @@ import androidx.annotation.NonNull;
import com.google.gson.JsonElement;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityProfileEmailBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -45,13 +46,15 @@ public class ProfileEmailActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ActivityProfileEmailBinding activityProfileEmailBinding = ActivityProfileEmailBinding.inflate(getLayoutInflater());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ImageView closeActivity = findViewById(R.id.close);
userEmail = findViewById(R.id.userEmail);
addEmailButton = findViewById(R.id.addEmailButton);
ImageView closeActivity = activityProfileEmailBinding.close;
userEmail = activityProfileEmailBinding.userEmail;
addEmailButton = activityProfileEmailBinding.addEmailButton;
userEmail.requestFocus();
assert imm != null;

View File

@ -29,6 +29,7 @@ import com.google.android.material.tabs.TabLayout;
import com.google.gson.JsonElement;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityRepoDetailBinding;
import org.mian.gitnex.fragments.BottomSheetIssuesFilterFragment;
import org.mian.gitnex.fragments.BottomSheetMilestonesFilterFragment;
import org.mian.gitnex.fragments.BottomSheetPullRequestFilterFragment;
@ -90,13 +91,15 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
super.onCreate(savedInstanceState);
ActivityRepoDetailBinding activityRepoDetailBinding = ActivityRepoDetailBinding.inflate(getLayoutInflater());
String[] repoNameParts = tinyDB.getString("repoFullName").split("/");
repositoryOwner = repoNameParts[0];
repositoryName = repoNameParts[1];
Toolbar toolbar = findViewById(R.id.toolbar);
Toolbar toolbar = activityRepoDetailBinding.toolbar;
TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
TextView toolbarTitle = activityRepoDetailBinding.toolbarTitle;
toolbarTitle.setText(repositoryName);
setSupportActionBar(toolbar);
@ -130,7 +133,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
toolbarTitle.setTypeface(myTypeface);
TabLayout tabLayout = findViewById(R.id.tabs);
TabLayout tabLayout = activityRepoDetailBinding.tabs;
ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0);
tabsCount = viewGroup.getChildCount();
@ -164,7 +167,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
collaboratorTab.setVisibility(View.GONE);
}
mViewPager = findViewById(R.id.container);
mViewPager = activityRepoDetailBinding.container;
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));

View File

@ -24,6 +24,7 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.RepoForksAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityRepoForksBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.StaticGlobalVariables;
import org.mian.gitnex.helpers.TinyDB;
@ -56,7 +57,7 @@ public class RepoForksActivity extends BaseActivity {
@Override
protected int getLayoutResourceId() {
return R.layout.activity_forks;
return R.layout.activity_repo_forks;
}
@SuppressLint("DefaultLocale")
@ -65,7 +66,9 @@ public class RepoForksActivity extends BaseActivity {
super.onCreate(savedInstanceState);
Toolbar toolbar = findViewById(R.id.toolbar);
ActivityRepoForksBinding activityRepoForksBinding = ActivityRepoForksBinding.inflate(getLayoutInflater());
Toolbar toolbar = activityRepoForksBinding.toolbar;
setSupportActionBar(toolbar);
TinyDB tinyDb = TinyDB.getInstance(appCtx);
@ -76,15 +79,15 @@ public class RepoForksActivity extends BaseActivity {
final String repoOwner = parts[0];
final String repoName = parts[1];
TextView toolbar_title = findViewById(R.id.toolbar_title);
TextView toolbar_title = activityRepoForksBinding.toolbarTitle;
toolbar_title.setMovementMethod(new ScrollingMovementMethod());
toolbar_title.setText(String.format("%s : %s", ctx.getResources().getString(R.string.infoTabRepoForksCount), repoName));
ImageView closeActivity = findViewById(R.id.close);
noData = findViewById(R.id.noData);
progressLoadMore = findViewById(R.id.progressLoadMore);
progressBar = findViewById(R.id.progress_bar);
SwipeRefreshLayout swipeRefresh = findViewById(R.id.pullToRefresh);
ImageView closeActivity = activityRepoForksBinding.close;
noData = activityRepoForksBinding.noData;
progressLoadMore = activityRepoForksBinding.progressLoadMore;
progressBar = activityRepoForksBinding.progressBar;
SwipeRefreshLayout swipeRefresh = activityRepoForksBinding.pullToRefresh;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
@ -95,7 +98,7 @@ public class RepoForksActivity extends BaseActivity {
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
}
recyclerView = findViewById(R.id.recyclerView);
recyclerView = activityRepoForksBinding.recyclerView;
forksList = new ArrayList<>();
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),

View File

@ -9,6 +9,7 @@ import android.widget.TextView;
import androidx.lifecycle.ViewModelProvider;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.RepoStargazersAdapter;
import org.mian.gitnex.databinding.ActivityRepoStargazersBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.viewmodels.RepoStargazersViewModel;
@ -32,13 +33,15 @@ public class RepoStargazersActivity extends BaseActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
ActivityRepoStargazersBinding activityRepoStargazersBinding = ActivityRepoStargazersBinding.inflate(getLayoutInflater());
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
TextView toolbarTitle = findViewById(R.id.toolbar_title);
noDataStargazers = findViewById(R.id.noDataStargazers);
mGridView = findViewById(R.id.gridView);
mProgressBar = findViewById(R.id.progress_bar);
ImageView closeActivity = activityRepoStargazersBinding.close;
TextView toolbarTitle = activityRepoStargazersBinding.toolbarTitle;
noDataStargazers = activityRepoStargazersBinding.noDataStargazers;
mGridView = activityRepoStargazersBinding.gridView;
mProgressBar = activityRepoStargazersBinding.progressBar;
String repoFullNameForStars = getIntent().getStringExtra("repoFullNameForStars");
String[] parts = repoFullNameForStars.split("/");

View File

@ -9,6 +9,7 @@ import android.widget.TextView;
import androidx.lifecycle.ViewModelProvider;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.RepoWatchersAdapter;
import org.mian.gitnex.databinding.ActivityRepoWatchersBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.viewmodels.RepoWatchersViewModel;
@ -34,11 +35,13 @@ public class RepoWatchersActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
TextView toolbarTitle = findViewById(R.id.toolbar_title);
noDataWatchers = findViewById(R.id.noDataWatchers);
mGridView = findViewById(R.id.gridView);
mProgressBar = findViewById(R.id.progress_bar);
ActivityRepoWatchersBinding activityRepoWatchersBinding = ActivityRepoWatchersBinding.inflate(getLayoutInflater());
ImageView closeActivity = activityRepoWatchersBinding.close;
TextView toolbarTitle = activityRepoWatchersBinding.toolbarTitle;
noDataWatchers = activityRepoWatchersBinding.noDataWatchers;
mGridView = activityRepoWatchersBinding.gridView;
mProgressBar = activityRepoWatchersBinding.progressBar;
String repoFullNameForWatchers = getIntent().getStringExtra("repoFullNameForWatchers");
String[] parts = repoFullNameForWatchers.split("/");

View File

@ -8,6 +8,7 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.google.android.material.switchmaterial.SwitchMaterial;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivitySettingsAppearanceBinding;
import org.mian.gitnex.helpers.Toasty;
/**
@ -38,17 +39,19 @@ public class SettingsAppearanceActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
ActivitySettingsAppearanceBinding activitySettingsAppearanceBinding = ActivitySettingsAppearanceBinding.inflate(getLayoutInflater());
final TextView tvDateTimeSelected = findViewById(R.id.tvDateTimeSelected); // setter for time
final TextView customFontSelected = findViewById(R.id.customFontSelected); // setter for custom font
final TextView themeSelected = findViewById(R.id.themeSelected); // setter for theme
ImageView closeActivity = activitySettingsAppearanceBinding.close;
LinearLayout timeFrame = findViewById(R.id.timeFrame);
LinearLayout customFontFrame = findViewById(R.id.customFontFrame);
LinearLayout themeFrame = findViewById(R.id.themeSelectionFrame);
final TextView tvDateTimeSelected = activitySettingsAppearanceBinding.tvDateTimeSelected; // setter for time
final TextView customFontSelected = activitySettingsAppearanceBinding.customFontSelected; // setter for custom font
final TextView themeSelected = activitySettingsAppearanceBinding.themeSelected; // setter for theme
SwitchMaterial counterBadgesSwitch = findViewById(R.id.switchCounterBadge);
LinearLayout timeFrame = activitySettingsAppearanceBinding.timeFrame;
LinearLayout customFontFrame = activitySettingsAppearanceBinding.customFontFrame;
LinearLayout themeFrame = activitySettingsAppearanceBinding.themeSelectionFrame;
SwitchMaterial counterBadgesSwitch = activitySettingsAppearanceBinding.switchCounterBadge;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);

View File

@ -3,8 +3,8 @@ package org.mian.gitnex.activities;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import com.google.android.material.switchmaterial.SwitchMaterial;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivitySettingsDraftsBinding;
import org.mian.gitnex.helpers.Toasty;
/**
@ -26,17 +26,17 @@ public class SettingsDraftsActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
ActivitySettingsDraftsBinding activitySettingsDraftsBinding = ActivitySettingsDraftsBinding.inflate(getLayoutInflater());
ImageView closeActivity = activitySettingsDraftsBinding.close;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
SwitchMaterial commentsDeletionSwitch = findViewById(R.id.commentsDeletionSwitch);
commentsDeletionSwitch.setChecked(tinyDB.getBoolean("draftsCommentsDeletionEnabled"));
activitySettingsDraftsBinding.commentsDeletionSwitch.setChecked(tinyDB.getBoolean("draftsCommentsDeletionEnabled"));
// delete comments on submit switcher
commentsDeletionSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
activitySettingsDraftsBinding.commentsDeletionSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
tinyDB.putBoolean("draftsCommentsDeletionEnabled", isChecked);
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));

View File

@ -8,6 +8,7 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.google.android.material.switchmaterial.SwitchMaterial;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivitySettingsFileviewerBinding;
import org.mian.gitnex.helpers.Toasty;
/**
@ -24,7 +25,7 @@ public class SettingsFileViewerActivity extends BaseActivity {
@Override
protected int getLayoutResourceId() {
return R.layout.activity_settings_fileview;
return R.layout.activity_settings_fileviewer;
}
@Override
@ -32,16 +33,16 @@ public class SettingsFileViewerActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
ActivitySettingsFileviewerBinding activitySettingsFileviewerBinding = ActivitySettingsFileviewerBinding.inflate(getLayoutInflater());
ImageView closeActivity = activitySettingsFileviewerBinding.close;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
final TextView fileViewerSourceCodeThemesSelected = findViewById(R.id.sourceCodeThemeSelected); // setter for fileviewer theme
LinearLayout sourceCodeThemeFrame = findViewById(R.id.sourceCodeThemeFrame);
SwitchMaterial pdfModeSwitch = findViewById(R.id.switchPdfMode);
TextView fileViewerSourceCodeThemesSelected = activitySettingsFileviewerBinding.sourceCodeThemeSelected; // setter for fileviewer theme
LinearLayout sourceCodeThemeFrame = activitySettingsFileviewerBinding.sourceCodeThemeFrame;
SwitchMaterial pdfModeSwitch = activitySettingsFileviewerBinding.switchPdfMode;
if(!tinyDB.getString("fileviewerSourceCodeThemeStr").isEmpty()) {
fileViewerSourceCodeThemesSelected.setText(tinyDB.getString("fileviewerSourceCodeThemeStr"));

View File

@ -3,8 +3,8 @@ package org.mian.gitnex.activities;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import com.google.android.material.switchmaterial.SwitchMaterial;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivitySettingsReportsBinding;
import org.mian.gitnex.helpers.Toasty;
/**
@ -18,7 +18,7 @@ public class SettingsReportsActivity extends BaseActivity {
@Override
protected int getLayoutResourceId() {
return R.layout.activity_settings_reporting;
return R.layout.activity_settings_reports;
}
@Override
@ -26,17 +26,17 @@ public class SettingsReportsActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
ActivitySettingsReportsBinding activitySettingsReportsBinding = ActivitySettingsReportsBinding.inflate(getLayoutInflater());
ImageView closeActivity = activitySettingsReportsBinding.close;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
SwitchMaterial crashReportsSwitch = findViewById(R.id.crashReportsSwitch);
crashReportsSwitch.setChecked(tinyDB.getBoolean("crashReportingEnabled"));
activitySettingsReportsBinding.crashReportsSwitch.setChecked(tinyDB.getBoolean("crashReportingEnabled"));
// crash reports switcher
crashReportsSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
activitySettingsReportsBinding.crashReportsSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
tinyDB.putBoolean("crashReportingEnabled", isChecked);
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));

View File

@ -11,6 +11,7 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import org.apache.commons.io.FileUtils;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivitySettingsSecurityBinding;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.ssl.MemorizingTrustManager;
import java.io.File;
@ -41,19 +42,21 @@ public class SettingsSecurityActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
ActivitySettingsSecurityBinding activitySettingsSecurityBinding = ActivitySettingsSecurityBinding.inflate(getLayoutInflater());
ImageView closeActivity = activitySettingsSecurityBinding.close;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
TextView cacheSizeDataSelected = findViewById(R.id.cacheSizeDataSelected); // setter for data cache size
TextView cacheSizeImagesSelected = findViewById(R.id.cacheSizeImagesSelected); // setter for images cache size
TextView clearCacheSelected = findViewById(R.id.clearCacheSelected); // setter for clear cache
TextView cacheSizeDataSelected = activitySettingsSecurityBinding.cacheSizeDataSelected; // setter for data cache size
TextView cacheSizeImagesSelected = activitySettingsSecurityBinding.cacheSizeImagesSelected; // setter for images cache size
TextView clearCacheSelected = activitySettingsSecurityBinding.clearCacheSelected; // setter for clear cache
LinearLayout certsFrame = findViewById(R.id.certsFrame);
LinearLayout cacheSizeDataFrame = findViewById(R.id.cacheSizeDataSelectionFrame);
LinearLayout cacheSizeImagesFrame = findViewById(R.id.cacheSizeImagesSelectionFrame);
LinearLayout clearCacheFrame = findViewById(R.id.clearCacheSelectionFrame);
LinearLayout certsFrame = activitySettingsSecurityBinding.certsFrame;
LinearLayout cacheSizeDataFrame = activitySettingsSecurityBinding.cacheSizeDataSelectionFrame;
LinearLayout cacheSizeImagesFrame = activitySettingsSecurityBinding.cacheSizeImagesSelectionFrame;
LinearLayout clearCacheFrame = activitySettingsSecurityBinding.clearCacheSelectionFrame;
if(!tinyDB.getString("cacheSizeStr").isEmpty()) {

View File

@ -9,6 +9,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivitySettingsTranslationBinding;
import org.mian.gitnex.helpers.Toasty;
/**
@ -34,15 +35,17 @@ public class SettingsTranslationActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
ActivitySettingsTranslationBinding activitySettingsTranslationBinding = ActivitySettingsTranslationBinding.inflate(getLayoutInflater());
ImageView closeActivity = activitySettingsTranslationBinding.close;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
final TextView tvLanguageSelected = findViewById(R.id.tvLanguageSelected); // setter for en, fr
TextView helpTranslate = findViewById(R.id.helpTranslate);
final TextView tvLanguageSelected = activitySettingsTranslationBinding.tvLanguageSelected; // setter for en, fr
TextView helpTranslate = activitySettingsTranslationBinding.helpTranslate;
LinearLayout langFrame = findViewById(R.id.langFrame);
LinearLayout langFrame = activitySettingsTranslationBinding.langFrame;
helpTranslate.setOnClickListener(v12 -> {

View File

@ -9,6 +9,7 @@ import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.amulyakhare.textdrawable.TextDrawable;
import org.mian.gitnex.R;
@ -86,12 +87,12 @@ public class AdminGetUsersAdapter extends RecyclerView.Adapter<AdminGetUsersAdap
holder.userRole.setVisibility(View.VISIBLE);
TextDrawable drawable = TextDrawable.builder()
.beginConfig()
.textColor(mCtx.getResources().getColor(R.color.colorWhite))
.textColor(ResourcesCompat.getColor(mCtx.getResources(), R.color.colorWhite, null))
.fontSize(44)
.width(180)
.height(60)
.endConfig()
.buildRoundRect(mCtx.getResources().getString(R.string.userRoleAdmin).toLowerCase(), mCtx.getResources().getColor(R.color.releasePre), 8);
.buildRoundRect(mCtx.getResources().getString(R.string.userRoleAdmin).toLowerCase(), ResourcesCompat.getColor(mCtx.getResources(), R.color.releasePre, null), 8);
holder.userRole.setImageDrawable(drawable);
}
else {

View File

@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.view.LayoutInflater;
import android.view.View;
@ -12,6 +11,8 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
@ -119,8 +120,9 @@ public class DraftsAdapter extends RecyclerView.Adapter<DraftsAdapter.DraftsView
DraftWithRepository currentItem = draftsList.get(position);
String issueNumber = "<font color='" + mCtx.getResources().getColor(R.color.lightGray) + "'>" + mCtx.getResources().getString(R.string.hash) + currentItem.getIssueId() + "</font>";
Spanned headTitle = Html.fromHtml(issueNumber + " " + currentItem.getRepositoryOwner() + " / " + currentItem.getRepositoryName());
String issueNumber = "<font color='" + ResourcesCompat.getColor(mCtx.getResources(), R.color.lightGray, null) + "'>" + mCtx.getResources().getString(R.string.hash) + currentItem.getIssueId() + "</font>";
Spanned headTitle = HtmlCompat
.fromHtml(issueNumber + " " + currentItem.getRepositoryOwner() + " / " + currentItem.getRepositoryName(), HtmlCompat.FROM_HTML_MODE_LEGACY);
holder.repoInfo.setText(headTitle);
holder.draftWithRepository = currentItem;

View File

@ -3,7 +3,6 @@ package org.mian.gitnex.adapters;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -11,6 +10,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.IssueDetailActivity;
@ -161,8 +162,8 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
PicassoService.getInstance(context).get().load(issuesModel.getUser().getAvatar_url()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(issueAssigneeAvatar);
String issueNumber_ = "<font color='" + context.getResources().getColor(R.color.lightGray) + "'>" + context.getResources().getString(R.string.hash) + issuesModel.getNumber() + "</font>";
issueTitle.setText(Html.fromHtml(issueNumber_ + " " + issuesModel.getTitle()));
String issueNumber_ = "<font color='" + ResourcesCompat.getColor(context.getResources(), R.color.lightGray, null) + "'>" + context.getResources().getString(R.string.hash) + issuesModel.getNumber() + "</font>";
issueTitle.setText(HtmlCompat.fromHtml(issueNumber_ + " " + issuesModel.getTitle(), HtmlCompat.FROM_HTML_MODE_LEGACY));
issueNumber.setText(String.valueOf(issuesModel.getNumber()));
issueCommentsCount.setText(String.valueOf(issuesModel.getComments()));

View File

@ -10,6 +10,7 @@ import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.vdurmont.emoji.EmojiParser;
@ -220,7 +221,7 @@ public class MilestonesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
String dueDate = formatter.format(date);
if(date.before(new Date())) {
msDueDate.setTextColor(context.getResources().getColor(R.color.darkRed));
msDueDate.setTextColor(ResourcesCompat.getColor(context.getResources(), R.color.darkRed, null));
}
msDueDate.setText(dueDate);

View File

@ -1,7 +1,6 @@
package org.mian.gitnex.adapters;
import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -9,6 +8,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
import org.mian.gitnex.database.api.RepositoriesApi;
@ -81,10 +82,10 @@ public class NotificationsAdapter extends RecyclerView.Adapter<NotificationsAdap
NotificationThread notificationThread = notificationThreads.get(position);
String url = notificationThread.getSubject().getUrl();
String subjectId = "<font color='" + context.getResources().getColor(R.color.lightGray) + "'>" + context.getResources()
String subjectId = "<font color='" + ResourcesCompat.getColor(context.getResources(), R.color.lightGray, null) + "'>" + context.getResources()
.getString(R.string.hash) + url.substring(url.lastIndexOf("/") + 1) + "</font>";
holder.subject.setText(Html.fromHtml(subjectId + " " + notificationThread.getSubject().getTitle()));
holder.subject.setText(HtmlCompat.fromHtml(subjectId + " " + notificationThread.getSubject().getTitle(), HtmlCompat.FROM_HTML_MODE_LEGACY));
holder.repository.setText(notificationThread.getRepository().getFullName());
if(notificationThread.isPinned()) {

View File

@ -6,12 +6,13 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.amulyakhare.textdrawable.TextDrawable;
import org.mian.gitnex.R;
import org.mian.gitnex.models.Emails;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
/**
* Author M M Arif
@ -58,12 +59,12 @@ public class ProfileEmailsAdapter extends RecyclerView.Adapter<ProfileEmailsAdap
if(currentItem.getPrimary()) {
TextDrawable drawable = TextDrawable.builder()
.beginConfig()
.textColor(mCtx.getResources().getColor(R.color.colorWhite))
.textColor(ResourcesCompat.getColor(mCtx.getResources(), R.color.colorWhite, null))
.fontSize(36)
.width(220)
.height(60)
.endConfig()
.buildRoundRect(mCtx.getResources().getString(R.string.emailTypeText), mCtx.getResources().getColor(R.color.tooltipBackground), 8);
.buildRoundRect(mCtx.getResources().getString(R.string.emailTypeText), ResourcesCompat.getColor(mCtx.getResources(), R.color.tooltipBackground, null), 8);
holder.emailPrimary.setImageDrawable(drawable);
}
else {

View File

@ -3,7 +3,6 @@ package org.mian.gitnex.adapters;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -11,6 +10,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.IssueDetailActivity;
@ -183,8 +184,8 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
PicassoService.getInstance(context).get().load(prModel.getUser().getAvatar_url()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(assigneeAvatar);
}
String prNumber_ = "<font color='" + context.getResources().getColor(R.color.lightGray) + "'>" + context.getResources().getString(R.string.hash) + prModel.getNumber() + "</font>";
prTitle.setText(Html.fromHtml(prNumber_ + " " + prModel.getTitle()));
String prNumber_ = "<font color='" + ResourcesCompat.getColor(context.getResources(), R.color.lightGray, null) + "'>" + context.getResources().getString(R.string.hash) + prModel.getNumber() + "</font>";
prTitle.setText(HtmlCompat.fromHtml(prNumber_ + " " + prModel.getTitle(), HtmlCompat.FROM_HTML_MODE_LEGACY));
prNumber.setText(String.valueOf(prModel.getNumber()));
prMergeable.setText(String.valueOf(prModel.isMergeable()));

View File

@ -1,7 +1,6 @@
package org.mian.gitnex.adapters;
import android.content.Context;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
@ -11,6 +10,7 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
@ -153,11 +153,11 @@ public class ReleasesAdapter extends RecyclerView.Adapter<ReleasesAdapter.Releas
});
holder.releaseZipDownload.setText(
Html.fromHtml("<a href='" + currentItem.getZipball_url() + "'>" + mCtx.getResources().getString(R.string.zipArchiveDownloadReleasesTab) + "</a> "));
HtmlCompat.fromHtml("<a href='" + currentItem.getZipball_url() + "'>" + mCtx.getResources().getString(R.string.zipArchiveDownloadReleasesTab) + "</a> ", HtmlCompat.FROM_HTML_MODE_LEGACY));
holder.releaseZipDownload.setMovementMethod(LinkMovementMethod.getInstance());
holder.releaseTarDownload.setText(
Html.fromHtml("<a href='" + currentItem.getTarball_url() + "'>" + mCtx.getResources().getString(R.string.tarArchiveDownloadReleasesTab) + "</a> "));
HtmlCompat.fromHtml("<a href='" + currentItem.getTarball_url() + "'>" + mCtx.getResources().getString(R.string.tarArchiveDownloadReleasesTab) + "</a> ", HtmlCompat.FROM_HTML_MODE_LEGACY));
holder.releaseTarDownload.setMovementMethod(LinkMovementMethod.getInstance());
ReleasesDownloadsAdapter adapter = new ReleasesDownloadsAdapter(currentItem.getAssets());

View File

@ -1,12 +1,12 @@
package org.mian.gitnex.adapters;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
import org.mian.gitnex.models.Releases;
@ -53,7 +53,7 @@ public class ReleasesDownloadsAdapter extends RecyclerView.Adapter<ReleasesDownl
if(currentItem.getName() != null) {
holder.downloadName.setText(
Html.fromHtml("<a href='" + currentItem.getBrowser_download_url() + "'>" + currentItem.getName() + "</a> "));
HtmlCompat.fromHtml("<a href='" + currentItem.getBrowser_download_url() + "'>" + currentItem.getName() + "</a> ", HtmlCompat.FROM_HTML_MODE_LEGACY));
holder.downloadName.setMovementMethod(LinkMovementMethod.getInstance());
}

View File

@ -328,7 +328,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
return orgReposFilter;
}
private Filter orgReposFilter = new Filter() {
private final Filter orgReposFilter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
List<UserRepositories> filteredList = new ArrayList<>();

View File

@ -2,13 +2,14 @@ package org.mian.gitnex.adapters;
import android.content.Context;
import android.content.Intent;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.IssueDetailActivity;
@ -129,8 +130,8 @@ public class SearchIssuesAdapter extends RecyclerView.Adapter<SearchIssuesAdapte
PicassoService
.getInstance(mCtx).get().load(currentItem.getUser().getAvatar_url()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(holder.issueAssigneeAvatar);
String issueNumber_ = "<font color='" + mCtx.getResources().getColor(R.color.lightGray) + "'>" + currentItem.getRepository().getFull_name() + mCtx.getResources().getString(R.string.hash) + currentItem.getNumber() + "</font>";
holder.issueTitle.setText(Html.fromHtml(issueNumber_ + " " + currentItem.getTitle()));
String issueNumber_ = "<font color='" + ResourcesCompat.getColor(mCtx.getResources(), R.color.lightGray, null) + "'>" + currentItem.getRepository().getFull_name() + mCtx.getResources().getString(R.string.hash) + currentItem.getNumber() + "</font>";
holder.issueTitle.setText(HtmlCompat.fromHtml(issueNumber_ + " " + currentItem.getTitle(), HtmlCompat.FROM_HTML_MODE_LEGACY));
holder.issueNumber.setText(String.valueOf(currentItem.getNumber()));
holder.issueCommentsCount.setText(String.valueOf(currentItem.getComments()));

View File

@ -5,12 +5,11 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.AdminGetUsersActivity;
import org.mian.gitnex.databinding.FragmentAdministrationBinding;
/**
* Author M M Arif
@ -20,13 +19,12 @@ public class AdministrationFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_administration, container, false);
FragmentAdministrationBinding fragmentAdministrationBinding = FragmentAdministrationBinding.inflate(inflater, container, false);
TextView adminUsers = v.findViewById(R.id.adminUsers);
fragmentAdministrationBinding.adminUsers.setOnClickListener(v1 -> startActivity(new Intent(getContext(), AdminGetUsersActivity.class)));
adminUsers.setOnClickListener(v1 -> startActivity(new Intent(getContext(), AdminGetUsersActivity.class)));
return fragmentAdministrationBinding.getRoot();
return v;
}
}

View File

@ -5,11 +5,10 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.BottomSheetAdminUsersBinding;
/**
* Author M M Arif
@ -22,17 +21,17 @@ public class BottomSheetAdminUsersFragment extends BottomSheetDialogFragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_admin_users, container, false);
TextView createNewUser = v.findViewById(R.id.createNewUser);
BottomSheetAdminUsersBinding bottomSheetAdminUsersBinding = BottomSheetAdminUsersBinding.inflate(inflater, container, false);
createNewUser.setOnClickListener(v1 -> {
bottomSheetAdminUsersBinding.createNewUser.setOnClickListener(v1 -> {
bmListener.onButtonClicked("newUser");
dismiss();
});
return v;
return bottomSheetAdminUsersBinding.getRoot();
}
public interface BottomSheetListener {

View File

@ -6,11 +6,10 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.BottomSheetDraftsBinding;
import org.mian.gitnex.helpers.StaticGlobalVariables;
/**
@ -25,18 +24,17 @@ public class BottomSheetDraftsFragment extends BottomSheetDialogFragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_drafts, container, false);
TextView deleteAllDrafts = v.findViewById(R.id.deleteAllDrafts);
BottomSheetDraftsBinding bottomSheetDraftsBinding = BottomSheetDraftsBinding.inflate(inflater, container, false);
deleteAllDrafts.setOnClickListener(v1 -> {
bottomSheetDraftsBinding.deleteAllDrafts.setOnClickListener(v1 -> {
dismiss();
bmListener.onButtonClicked("deleteDrafts");
});
return v;
return bottomSheetDraftsBinding.getRoot();
}
public interface BottomSheetListener {

View File

@ -2,14 +2,13 @@ package org.mian.gitnex.fragments;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.BottomSheetFileViewerBinding;
/**
* Author M M Arif
@ -23,31 +22,27 @@ public class BottomSheetFileViewerFragment extends BottomSheetDialogFragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_file_viewer, container, false);
BottomSheetFileViewerBinding bottomSheetFileViewerBinding = BottomSheetFileViewerBinding.inflate(inflater, container, false);
TextView downloadFile = v.findViewById(R.id.downloadFile);
TextView deleteFile = v.findViewById(R.id.deleteFile);
TextView editFile = v.findViewById(R.id.editFile);
downloadFile.setOnClickListener(v1 -> {
bottomSheetFileViewerBinding.downloadFile.setOnClickListener(v1 -> {
bmListener.onButtonClicked("downloadFile");
dismiss();
});
deleteFile.setOnClickListener(v1 -> {
bottomSheetFileViewerBinding.deleteFile.setOnClickListener(v1 -> {
bmListener.onButtonClicked("deleteFile");
dismiss();
});
editFile.setOnClickListener(v1 -> {
bottomSheetFileViewerBinding.editFile.setOnClickListener(v1 -> {
bmListener.onButtonClicked("editFile");
dismiss();
});
return v;
return bottomSheetFileViewerBinding.getRoot();
}
public interface BottomSheetListener {

View File

@ -5,11 +5,10 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.BottomSheetIssuesFilterBinding;
/**
* Author M M Arif
@ -23,22 +22,19 @@ public class BottomSheetIssuesFilterFragment extends BottomSheetDialogFragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_issues_filter, container, false);
BottomSheetIssuesFilterBinding bottomSheetIssuesFilterBinding = BottomSheetIssuesFilterBinding.inflate(inflater, container, false);
TextView openIssues = v.findViewById(R.id.openIssues);
TextView closedIssues = v.findViewById(R.id.closedIssues);
openIssues.setOnClickListener(v1 -> {
bottomSheetIssuesFilterBinding.openIssues.setOnClickListener(v1 -> {
bmListener.onButtonClicked("openIssues");
dismiss();
});
closedIssues.setOnClickListener(v12 -> {
bottomSheetIssuesFilterBinding.closedIssues.setOnClickListener(v12 -> {
bmListener.onButtonClicked("closedIssues");
dismiss();
});
return v;
return bottomSheetIssuesFilterBinding.getRoot();
}
public interface BottomSheetListener {

View File

@ -6,11 +6,10 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.BottomSheetMilestonesFilterBinding;
/**
* Author M M Arif
@ -24,22 +23,19 @@ public class BottomSheetMilestonesFilterFragment extends BottomSheetDialogFragme
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_milestones_filter, container, false);
BottomSheetMilestonesFilterBinding bottomSheetMilestonesFilterBinding = BottomSheetMilestonesFilterBinding.inflate(inflater, container, false);
TextView openMilestone = v.findViewById(R.id.openMilestone);
TextView closedMilestone = v.findViewById(R.id.closedMilestone);
openMilestone.setOnClickListener(v1 -> {
bottomSheetMilestonesFilterBinding.openMilestone.setOnClickListener(v1 -> {
bmListener.onButtonClicked("openMilestone");
dismiss();
});
closedMilestone.setOnClickListener(v12 -> {
bottomSheetMilestonesFilterBinding.closedMilestone.setOnClickListener(v12 -> {
bmListener.onButtonClicked("closedMilestone");
dismiss();
});
return v;
return bottomSheetMilestonesFilterBinding.getRoot();
}
public interface BottomSheetListener {

View File

@ -5,11 +5,10 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.BottomSheetNotificationsFilterBinding;
import org.mian.gitnex.helpers.TinyDB;
/**
@ -33,26 +32,23 @@ public class BottomSheetNotificationsFilterFragment extends BottomSheetDialogFra
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.bottom_sheet_notifications_filter, container, false);
BottomSheetNotificationsFilterBinding bottomSheetNotificationsFilterBinding = BottomSheetNotificationsFilterBinding.inflate(inflater, container, false);
TextView readNotifications = view.findViewById(R.id.readNotifications);
TextView unreadNotifications = view.findViewById(R.id.unreadNotifications);
readNotifications.setOnClickListener(v1 -> {
bottomSheetNotificationsFilterBinding.readNotifications.setOnClickListener(v1 -> {
tinyDB.putString("notificationsFilterState", "read");
dismiss();
});
unreadNotifications.setOnClickListener(v12 -> {
bottomSheetNotificationsFilterBinding.unreadNotifications.setOnClickListener(v12 -> {
tinyDB.putString("notificationsFilterState", "unread");
dismiss();
});
return view;
return bottomSheetNotificationsFilterBinding.getRoot();
}

View File

@ -13,10 +13,10 @@ import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.actions.NotificationsActions;
import org.mian.gitnex.databinding.BottomSheetNotificationsBinding;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.models.NotificationThread;
import java.util.Objects;
/**
* Author opyale
@ -40,14 +40,14 @@ public class BottomSheetNotificationsFragment extends BottomSheetDialogFragment
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_notifications, container, false);
BottomSheetNotificationsBinding bottomSheetNotificationsBinding = BottomSheetNotificationsBinding.inflate(inflater, container, false);
TextView markRead = v.findViewById(R.id.markRead);
TextView markUnread = v.findViewById(R.id.markUnread);
TextView markPinned = v.findViewById(R.id.markPinned);
TextView markRead = bottomSheetNotificationsBinding.markRead;
TextView markUnread = bottomSheetNotificationsBinding.markUnread;
TextView markPinned = bottomSheetNotificationsBinding.markPinned;
NotificationsActions notificationsActions = new NotificationsActions(context);
Activity activity = Objects.requireNonNull(getActivity());
Activity activity = requireActivity();
if(notificationThread.isPinned()) {
@ -135,7 +135,7 @@ public class BottomSheetNotificationsFragment extends BottomSheetDialogFragment
});
return v;
return bottomSheetNotificationsBinding.getRoot();
}

View File

@ -5,11 +5,10 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.databinding.BottomSheetOrganizationBinding;
/**
* Author M M Arif
@ -23,38 +22,33 @@ public class BottomSheetOrganizationFragment extends BottomSheetDialogFragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_organization, container, false);
BottomSheetOrganizationBinding bottomSheetOrganizationBinding = BottomSheetOrganizationBinding.inflate(inflater, container, false);
TextView createTeam = v.findViewById(R.id.createTeam);
TextView createRepository = v.findViewById(R.id.createRepository);
TextView copyOrgUrl = v.findViewById(R.id.copyOrgUrl);
TextView createLabel = v.findViewById(R.id.createLabel);
createTeam.setOnClickListener(v1 -> {
bottomSheetOrganizationBinding.createTeam.setOnClickListener(v1 -> {
bmListener.onButtonClicked("team");
dismiss();
});
createLabel.setOnClickListener(v1 -> {
bottomSheetOrganizationBinding.createLabel.setOnClickListener(v1 -> {
bmListener.onButtonClicked("label");
dismiss();
});
createRepository.setOnClickListener(v12 -> {
bottomSheetOrganizationBinding.createRepository.setOnClickListener(v12 -> {
bmListener.onButtonClicked("repository");
dismiss();
});
copyOrgUrl.setOnClickListener(v1 -> {
bottomSheetOrganizationBinding.copyOrgUrl.setOnClickListener(v1 -> {
bmListener.onButtonClicked("copyOrgUrl");
dismiss();
});
return v;
return bottomSheetOrganizationBinding.getRoot();
}
public interface BottomSheetListener {

View File

@ -6,11 +6,10 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.BottomSheetOrganizationTeamsBinding;
/**
* Author M M Arif
@ -24,18 +23,16 @@ public class BottomSheetOrganizationTeamsFragment extends BottomSheetDialogFragm
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_organization_teams, container, false);
BottomSheetOrganizationTeamsBinding bottomSheetOrganizationTeamsBinding = BottomSheetOrganizationTeamsBinding.inflate(inflater, container, false);
TextView addNewMember = v.findViewById(R.id.addNewMember);
addNewMember.setOnClickListener(v1 -> {
bottomSheetOrganizationTeamsBinding.addNewMember.setOnClickListener(v1 -> {
bmListener.onButtonClicked("newMember");
dismiss();
});
return v;
return bottomSheetOrganizationTeamsBinding.getRoot();
}

View File

@ -5,12 +5,11 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.ProfileEmailActivity;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.activities.ProfileEmailActivity;
import org.mian.gitnex.databinding.BottomSheetProfileBinding;
/**
* Author M M Arif
@ -21,17 +20,16 @@ public class BottomSheetProfileFragment extends BottomSheetDialogFragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_profile, container, false);
TextView addNewEmailAddress = v.findViewById(R.id.addNewEmailAddress);
BottomSheetProfileBinding bottomSheetProfileBinding = BottomSheetProfileBinding.inflate(inflater, container, false);
addNewEmailAddress.setOnClickListener(v1 -> {
bottomSheetProfileBinding.addNewEmailAddress.setOnClickListener(v1 -> {
startActivity(new Intent(getContext(), ProfileEmailActivity.class));
dismiss();
});
return v;
return bottomSheetProfileBinding.getRoot();
}
}

View File

@ -5,11 +5,10 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.BottomSheetPullRequestFilterBinding;
/**
* Author M M Arif
@ -23,22 +22,19 @@ public class BottomSheetPullRequestFilterFragment extends BottomSheetDialogFragm
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_pull_request_filter, container, false);
BottomSheetPullRequestFilterBinding bottomSheetPullRequestFilterBinding = BottomSheetPullRequestFilterBinding.inflate(inflater, container, false);
TextView openPr = v.findViewById(R.id.openPr);
TextView closedPr = v.findViewById(R.id.closedPr);
openPr.setOnClickListener(v1 -> {
bottomSheetPullRequestFilterBinding.openPr.setOnClickListener(v1 -> {
bmListener.onButtonClicked("openPr");
dismiss();
});
closedPr.setOnClickListener(v12 -> {
bottomSheetPullRequestFilterBinding.closedPr.setOnClickListener(v12 -> {
bmListener.onButtonClicked("closedPr");
dismiss();
});
return v;
return bottomSheetPullRequestFilterBinding.getRoot();
}
public interface BottomSheetListener {

View File

@ -24,6 +24,7 @@ import org.mian.gitnex.actions.ActionResult;
import org.mian.gitnex.actions.IssueActions;
import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.database.api.DraftsApi;
import org.mian.gitnex.databinding.BottomSheetReplyLayoutBinding;
import org.mian.gitnex.helpers.StaticGlobalVariables;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Toasty;
@ -67,16 +68,16 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.bottom_sheet_reply_layout, container, false);
BottomSheetReplyLayoutBinding bottomSheetReplyLayoutBinding = BottomSheetReplyLayoutBinding.inflate(inflater, container, false);
Bundle arguments = requireArguments();
draftsHint = view.findViewById(R.id.drafts_hint);
draftsHint = bottomSheetReplyLayoutBinding.draftsHint;
EditText comment = view.findViewById(R.id.comment);
TextView toolbarTitle = view.findViewById(R.id.toolbar_title);
ImageButton close = view.findViewById(R.id.close);
ImageButton drafts = view.findViewById(R.id.drafts);
ImageButton send = view.findViewById(R.id.send);
EditText comment = bottomSheetReplyLayoutBinding.comment;
TextView toolbarTitle = bottomSheetReplyLayoutBinding.toolbarTitle;
ImageButton close = bottomSheetReplyLayoutBinding.close;
ImageButton drafts = bottomSheetReplyLayoutBinding.drafts;
ImageButton send = bottomSheetReplyLayoutBinding.send;
send.setEnabled(false);
@ -118,7 +119,7 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
comment.requestFocus();
comment.setOnTouchListener((v, event) -> {
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from((View) view.getParent());
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from((View) bottomSheetReplyLayoutBinding.getRoot().getParent());
switch(event.getAction()) {
@ -234,7 +235,7 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
}
});
return view;
return bottomSheetReplyLayoutBinding.getRoot();
}
private void saveDraft(String text, boolean remove) {

View File

@ -9,8 +9,8 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.actions.RepositoryActions;
import org.mian.gitnex.databinding.BottomSheetRepoBinding;
import org.mian.gitnex.helpers.TinyDB;
/**
@ -24,26 +24,27 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_repo, container, false);
BottomSheetRepoBinding bottomSheetRepoBinding = BottomSheetRepoBinding.inflate(inflater, container, false);
final TinyDB tinyDb = TinyDB.getInstance(getContext());
TextView createLabel = v.findViewById(R.id.createLabel);
TextView createIssue = v.findViewById(R.id.createNewIssue);
TextView createMilestone = v.findViewById(R.id.createNewMilestone);
TextView addCollaborator = v.findViewById(R.id.addCollaborator);
TextView createRelease = v.findViewById(R.id.createRelease);
TextView openWebRepo = v.findViewById(R.id.openWebRepo);
TextView newFile = v.findViewById(R.id.newFile);
TextView starRepository = v.findViewById(R.id.starRepository);
TextView unStarRepository = v.findViewById(R.id.unStarRepository);
TextView watchRepository = v.findViewById(R.id.watchRepository);
TextView unWatchRepository = v.findViewById(R.id.unWatchRepository);
TextView shareRepository = v.findViewById(R.id.shareRepository);
TextView copyRepoUrl = v.findViewById(R.id.copyRepoUrl);
View repoSettingsDivider = v.findViewById(R.id.repoSettingsDivider);
TextView repoSettings = v.findViewById(R.id.repoSettings);
TextView createPullRequest = v.findViewById(R.id.createPullRequest);
TextView createLabel = bottomSheetRepoBinding.createLabel;
TextView createIssue = bottomSheetRepoBinding.createNewIssue;
TextView createMilestone = bottomSheetRepoBinding.createNewMilestone;
TextView addCollaborator = bottomSheetRepoBinding.addCollaborator;
TextView createRelease = bottomSheetRepoBinding.createRelease;
TextView openWebRepo = bottomSheetRepoBinding.openWebRepo;
TextView newFile = bottomSheetRepoBinding.newFile;
TextView starRepository = bottomSheetRepoBinding.starRepository;
TextView unStarRepository = bottomSheetRepoBinding.unStarRepository;
TextView watchRepository = bottomSheetRepoBinding.watchRepository;
TextView unWatchRepository = bottomSheetRepoBinding.unWatchRepository;
TextView shareRepository = bottomSheetRepoBinding.shareRepository;
TextView copyRepoUrl = bottomSheetRepoBinding.copyRepoUrl;
View repoSettingsDivider = bottomSheetRepoBinding.repoSettingsDivider;
TextView repoSettings = bottomSheetRepoBinding.repoSettings;
TextView createPullRequest = bottomSheetRepoBinding.createPullRequest;
createLabel.setOnClickListener(v112 -> {
@ -186,7 +187,7 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
}
return v;
return bottomSheetRepoBinding.getRoot();
}
public interface BottomSheetListener {

View File

@ -18,6 +18,7 @@ import org.mian.gitnex.actions.IssueActions;
import org.mian.gitnex.activities.EditIssueActivity;
import org.mian.gitnex.activities.FileDiffActivity;
import org.mian.gitnex.activities.MergePullRequestActivity;
import org.mian.gitnex.databinding.BottomSheetSingleIssueBinding;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.Version;
@ -36,24 +37,24 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.bottom_sheet_single_issue, container, false);
BottomSheetSingleIssueBinding bottomSheetSingleIssueBinding = BottomSheetSingleIssueBinding.inflate(inflater, container, false);
final Context ctx = getContext();
final TinyDB tinyDB = TinyDB.getInstance(ctx);
TextView editIssue = v.findViewById(R.id.editIssue);
TextView editLabels = v.findViewById(R.id.editLabels);
TextView closeIssue = v.findViewById(R.id.closeIssue);
TextView reOpenIssue = v.findViewById(R.id.reOpenIssue);
TextView addRemoveAssignees = v.findViewById(R.id.addRemoveAssignees);
TextView copyIssueUrl = v.findViewById(R.id.copyIssueUrl);
TextView openFilesDiff = v.findViewById(R.id.openFilesDiff);
TextView mergePullRequest = v.findViewById(R.id.mergePullRequest);
TextView shareIssue = v.findViewById(R.id.shareIssue);
TextView subscribeIssue = v.findViewById(R.id.subscribeIssue);
TextView unsubscribeIssue = v.findViewById(R.id.unsubscribeIssue);
TextView editIssue = bottomSheetSingleIssueBinding.editIssue;
TextView editLabels = bottomSheetSingleIssueBinding.editLabels;
TextView closeIssue = bottomSheetSingleIssueBinding.closeIssue;
TextView reOpenIssue = bottomSheetSingleIssueBinding.reOpenIssue;
TextView addRemoveAssignees = bottomSheetSingleIssueBinding.addRemoveAssignees;
TextView copyIssueUrl = bottomSheetSingleIssueBinding.copyIssueUrl;
TextView openFilesDiff = bottomSheetSingleIssueBinding.openFilesDiff;
TextView mergePullRequest = bottomSheetSingleIssueBinding.mergePullRequest;
TextView shareIssue = bottomSheetSingleIssueBinding.shareIssue;
TextView subscribeIssue = bottomSheetSingleIssueBinding.subscribeIssue;
TextView unsubscribeIssue = bottomSheetSingleIssueBinding.unsubscribeIssue;
LinearLayout linearLayout = v.findViewById(R.id.commentReactionButtons);
LinearLayout linearLayout = bottomSheetSingleIssueBinding.commentReactionButtons;
Bundle bundle1 = new Bundle();
@ -221,7 +222,7 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
unsubscribeIssue.setVisibility(View.GONE);
}
return v;
return bottomSheetSingleIssueBinding.getRoot();
}
public interface BottomSheetListener {

View File

@ -13,8 +13,8 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.CollaboratorsAdapter;
import org.mian.gitnex.databinding.FragmentCollaboratorsBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.models.Collaborators;
import org.mian.gitnex.viewmodels.CollaboratorsViewModel;
@ -63,14 +63,15 @@ public class CollaboratorsFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_collaborators, container, false);
FragmentCollaboratorsBinding fragmentCollaboratorsBinding = FragmentCollaboratorsBinding.inflate(inflater, container, false);
noDataCollaborators = v.findViewById(R.id.noDataCollaborators);
mProgressBar = v.findViewById(R.id.progress_bar);
mGridView = v.findViewById(R.id.gridView);
noDataCollaborators = fragmentCollaboratorsBinding.noDataCollaborators;
mProgressBar = fragmentCollaboratorsBinding.progressBar;
mGridView = fragmentCollaboratorsBinding.gridView;
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName);
return v;
return fragmentCollaboratorsBinding.getRoot();
}
public void onButtonPressed(Uri uri) {

View File

@ -24,6 +24,7 @@ import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.adapters.DraftsAdapter;
import org.mian.gitnex.database.api.DraftsApi;
import org.mian.gitnex.database.models.DraftWithRepository;
import org.mian.gitnex.databinding.FragmentDraftsBinding;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Toasty;
import java.util.ArrayList;
@ -45,10 +46,11 @@ public class DraftsFragment extends Fragment {
private SwipeRefreshLayout swipeRefresh;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_drafts, container, false);
FragmentDraftsBinding fragmentDraftsBinding = FragmentDraftsBinding.inflate(inflater, container, false);
ctx = getContext();
setHasOptionsMenu(true);
@ -59,9 +61,9 @@ public class DraftsFragment extends Fragment {
draftsList_ = new ArrayList<>();
draftsApi = new DraftsApi(ctx);
noData = v.findViewById(R.id.noData);
mRecyclerView = v.findViewById(R.id.recyclerView);
swipeRefresh = v.findViewById(R.id.pullToRefresh);
noData = fragmentDraftsBinding.noData;
mRecyclerView = fragmentDraftsBinding.recyclerView;
swipeRefresh = fragmentDraftsBinding.pullToRefresh;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(ctx));
@ -81,7 +83,7 @@ public class DraftsFragment extends Fragment {
fetchDataAsync(currentActiveAccountId);
return v;
return fragmentDraftsBinding.getRoot();
}

View File

@ -16,6 +16,7 @@ import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.databinding.FragmentExploreBinding;
import org.mian.gitnex.helpers.TinyDB;
/**
@ -32,15 +33,16 @@ public class ExploreFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
FragmentExploreBinding fragmentExploreBinding = FragmentExploreBinding.inflate(inflater, container, false);
View v = inflater.inflate(R.layout.fragment_explore, container,false);
ctx = getContext();
tinyDB = TinyDB.getInstance(ctx);
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navExplore));
TabLayout tabLayout = v.findViewById(R.id.tabsExplore);
TabLayout tabLayout = fragmentExploreBinding.tabsExplore;
ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0);
tabsCount = viewGroup.getChildCount();
@ -78,7 +80,7 @@ public class ExploreFragment extends Fragment {
}
}
mViewPager = v.findViewById(R.id.containerExplore);
mViewPager = fragmentExploreBinding.containerExplore;
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
@ -86,7 +88,7 @@ public class ExploreFragment extends Fragment {
SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());
mViewPager.setAdapter(mSectionsPagerAdapter);
return v;
return fragmentExploreBinding.getRoot();
}
public class SectionsPagerAdapter extends FragmentPagerAdapter {

View File

@ -24,6 +24,7 @@ import org.mian.gitnex.R;
import org.mian.gitnex.activities.FileViewActivity;
import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.adapters.FilesAdapter;
import org.mian.gitnex.databinding.FragmentFilesBinding;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.viewmodels.FilesViewModel;
@ -85,23 +86,23 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_files, container, false);
FragmentFilesBinding fragmentFilesBinding = FragmentFilesBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
noDataFiles = v.findViewById(R.id.noDataFiles);
filesFrame = v.findViewById(R.id.filesFrame);
noDataFiles = fragmentFilesBinding.noDataFiles;
filesFrame = fragmentFilesBinding.filesFrame;
fileStructure = v.findViewById(R.id.fileStructure);
mRecyclerView = v.findViewById(R.id.recyclerView);
fileStructure = fragmentFilesBinding.fileStructure;
mRecyclerView = fragmentFilesBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar);
mProgressBar = fragmentFilesBinding.progressBar;
mBreadcrumbsView = v.findViewById(R.id.breadcrumbs_view);
mBreadcrumbsView = fragmentFilesBinding.breadcrumbsView;
mBreadcrumbsView.setItems(new ArrayList<>(Collections.singletonList(BreadcrumbItem.createSimpleItem(getResources().getString(R.string.filesBreadcrumbRoot) + getResources().getString(R.string.colonDivider) + ref))));
((RepoDetailActivity) requireActivity()).setFragmentRefreshListenerFiles(repoBranch -> {
@ -115,7 +116,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName, ref);
return v;
return fragmentFilesBinding.getRoot();
}
@Override

View File

@ -25,6 +25,7 @@ import org.mian.gitnex.R;
import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.adapters.IssuesAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentIssuesBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.StaticGlobalVariables;
import org.mian.gitnex.helpers.TinyDB;
@ -60,7 +61,8 @@ public class IssuesFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_issues, container, false);
FragmentIssuesBinding fragmentIssuesBinding = FragmentIssuesBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
context = getContext();
@ -72,19 +74,19 @@ public class IssuesFragment extends Fragment {
final String loginUid = tinyDb.getString("loginUid");
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
final SwipeRefreshLayout swipeRefresh = fragmentIssuesBinding.pullToRefresh;
// if gitea is 1.12 or higher use the new limit
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
}
recyclerView = v.findViewById(R.id.recyclerView);
recyclerView = fragmentIssuesBinding.recyclerView;
issuesList = new ArrayList<>();
progressLoadMore = v.findViewById(R.id.progressLoadMore);
mProgressBar = v.findViewById(R.id.progress_bar);
noDataIssues = v.findViewById(R.id.noDataIssues);
progressLoadMore = fragmentIssuesBinding.progressLoadMore;
mProgressBar = fragmentIssuesBinding.progressBar;
noDataIssues = fragmentIssuesBinding.noDataIssues;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -147,7 +149,7 @@ public class IssuesFragment extends Fragment {
loadInitial(Authorization.get(getContext()), repoOwner, repoName, resultLimit, requestType, tinyDb.getString("repoIssuesState"));
return v;
return fragmentIssuesBinding.getRoot();
}

View File

@ -16,8 +16,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.LabelsAdapter;
import org.mian.gitnex.databinding.FragmentLabelsBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.LabelsViewModel;
@ -69,13 +69,13 @@ public class LabelsFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_labels, container, false);
FragmentLabelsBinding fragmentLabelsBinding = FragmentLabelsBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
noData = v.findViewById(R.id.noData);
final SwipeRefreshLayout swipeRefresh = fragmentLabelsBinding.pullToRefresh;
noData = fragmentLabelsBinding.noData;
mRecyclerView = v.findViewById(R.id.recyclerView);
mRecyclerView = fragmentLabelsBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -83,7 +83,7 @@ public class LabelsFragment extends Fragment {
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar);
mProgressBar = fragmentLabelsBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -93,7 +93,7 @@ public class LabelsFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName);
return v;
return fragmentLabelsBinding.getRoot();
}
@Override

View File

@ -19,6 +19,7 @@ import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.MembersByOrgAdapter;
import org.mian.gitnex.databinding.FragmentMembersByOrgBinding;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
@ -65,20 +66,20 @@ public class MembersByOrgFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_members_by_org, container, false);
FragmentMembersByOrgBinding fragmentMembersByOrgBinding = FragmentMembersByOrgBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
TinyDB tinyDb = TinyDB.getInstance(getContext());
final String loginUid = tinyDb.getString("loginUid");
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
noDataMembers = v.findViewById(R.id.noDataMembers);
noDataMembers = fragmentMembersByOrgBinding.noDataMembers;
progressBar = v.findViewById(R.id.progressBar);
mGridView = v.findViewById(R.id.gridView);
progressBar = fragmentMembersByOrgBinding.progressBar;
mGridView = fragmentMembersByOrgBinding.gridView;
fetchDataAsync(Authorization.get(getContext()), orgName);
return v;
return fragmentMembersByOrgBinding.getRoot();
}
private void fetchDataAsync(String instanceToken, String owner) {

View File

@ -26,6 +26,7 @@ import org.mian.gitnex.R;
import org.mian.gitnex.activities.CreateRepoActivity;
import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.adapters.MyReposListAdapter;
import org.mian.gitnex.databinding.FragmentMyRepositoriesBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.MyRepositoriesViewModel;
@ -77,27 +78,28 @@ public class MyRepositoriesFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_my_repositories, container, false);
FragmentMyRepositoriesBinding fragmentMyRepositoriesBinding = FragmentMyRepositoriesBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
TinyDB tinyDb = TinyDB.getInstance(getContext());
final String userLogin = tinyDb.getString("userLogin");
tinyDb.putBoolean("isRepoAdmin", true);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
final SwipeRefreshLayout swipeRefresh = fragmentMyRepositoriesBinding.pullToRefresh;
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navMyRepos));
noDataMyRepo = v.findViewById(R.id.noDataMyRepo);
mProgressBar = v.findViewById(R.id.progress_bar);
mRecyclerView = v.findViewById(R.id.recyclerView);
noDataMyRepo = fragmentMyRepositoriesBinding.noDataMyRepo;
mProgressBar = fragmentMyRepositoriesBinding.progressBar;
mRecyclerView = fragmentMyRepositoriesBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
createNewRepo = v.findViewById(R.id.addNewRepo);
createNewRepo = fragmentMyRepositoriesBinding.addNewRepo;
createNewRepo.setOnClickListener(view -> {
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
@ -132,7 +134,7 @@ public class MyRepositoriesFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), userLogin, pageSize, resultLimit);
return v;
return fragmentMyRepositoriesBinding.getRoot();
}

View File

@ -26,6 +26,7 @@ import org.mian.gitnex.actions.NotificationsActions;
import org.mian.gitnex.activities.IssueDetailActivity;
import org.mian.gitnex.adapters.NotificationsAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentNotificationsBinding;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.InfiniteScrollListener;
import org.mian.gitnex.helpers.StaticGlobalVariables;
@ -75,7 +76,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_notifications, container, false);
FragmentNotificationsBinding fragmentNotificationsBinding = FragmentNotificationsBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
activity = requireActivity();
@ -85,10 +86,10 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
pageResultLimit = StaticGlobalVariables.getCurrentResultLimit(context);
tinyDB.putString("notificationsFilterState", currentFilterMode);
markAllAsRead = v.findViewById(R.id.markAllAsRead);
noDataNotifications = v.findViewById(R.id.noDataNotifications);
loadingMoreView = v.findViewById(R.id.loadingMoreView);
progressBar = v.findViewById(R.id.progressBar);
markAllAsRead = fragmentNotificationsBinding.markAllAsRead;
noDataNotifications = fragmentNotificationsBinding.noDataNotifications;
loadingMoreView = fragmentNotificationsBinding.loadingMoreView;
progressBar = fragmentNotificationsBinding.progressBar;
notificationThreads = new ArrayList<>();
notificationsActions = new NotificationsActions(context);
@ -96,7 +97,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
RecyclerView recyclerView = v.findViewById(R.id.notifications);
RecyclerView recyclerView = fragmentNotificationsBinding.notifications;
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(notificationsAdapter);
@ -164,7 +165,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
});
pullToRefresh = v.findViewById(R.id.pullToRefresh);
pullToRefresh = fragmentNotificationsBinding.pullToRefresh;
pullToRefresh.setOnRefreshListener(() -> {
pageCurrentIndex = 1;
@ -173,7 +174,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
});
loadNotifications(false);
return v;
return fragmentNotificationsBinding.getRoot();
}

View File

@ -16,6 +16,7 @@ import androidx.fragment.app.Fragment;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentOrganizationInfoBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.RoundedTransformation;
import org.mian.gitnex.models.Organization;
@ -64,21 +65,21 @@ public class OrganizationInfoFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_organization_info, container, false);
FragmentOrganizationInfoBinding fragmentOrganizationInfoBinding = FragmentOrganizationInfoBinding.inflate(inflater, container, false);
mProgressBar = v.findViewById(R.id.progress_bar);
orgAvatar = v.findViewById(R.id.orgAvatar);
TextView orgNameInfo = v.findViewById(R.id.orgNameInfo);
orgDescInfo = v.findViewById(R.id.orgDescInfo);
orgWebsiteInfo = v.findViewById(R.id.orgWebsiteInfo);
orgLocationInfo = v.findViewById(R.id.orgLocationInfo);
orgInfoLayout = v.findViewById(R.id.orgInfoLayout);
mProgressBar = fragmentOrganizationInfoBinding.progressBar;
orgAvatar = fragmentOrganizationInfoBinding.orgAvatar;
TextView orgNameInfo = fragmentOrganizationInfoBinding.orgNameInfo;
orgDescInfo = fragmentOrganizationInfoBinding.orgDescInfo;
orgWebsiteInfo = fragmentOrganizationInfoBinding.orgWebsiteInfo;
orgLocationInfo = fragmentOrganizationInfoBinding.orgLocationInfo;
orgInfoLayout = fragmentOrganizationInfoBinding.orgInfoLayout;
orgNameInfo.setText(orgName);
getOrgInfo(Authorization.get(getContext()), orgName);
return v;
return fragmentOrganizationInfoBinding.getRoot();
}

View File

@ -16,8 +16,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.LabelsAdapter;
import org.mian.gitnex.databinding.FragmentLabelsBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.OrganizationLabelsViewModel;
@ -62,13 +62,13 @@ public class OrganizationLabelsFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_labels, container, false);
FragmentLabelsBinding fragmentLabelsBinding = FragmentLabelsBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
noData = v.findViewById(R.id.noData);
final SwipeRefreshLayout swipeRefresh = fragmentLabelsBinding.pullToRefresh;
noData = fragmentLabelsBinding.noData;
mRecyclerView = v.findViewById(R.id.recyclerView);
mRecyclerView = fragmentLabelsBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -76,7 +76,7 @@ public class OrganizationLabelsFragment extends Fragment {
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar);
mProgressBar = fragmentLabelsBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -87,7 +87,7 @@ public class OrganizationLabelsFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), repoOwner);
return v;
return fragmentLabelsBinding.getRoot();
}

View File

@ -26,6 +26,7 @@ import org.mian.gitnex.R;
import org.mian.gitnex.activities.CreateOrganizationActivity;
import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.adapters.OrganizationsListAdapter;
import org.mian.gitnex.databinding.FragmentOrganizationsBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.OrganizationListViewModel;
@ -46,16 +47,16 @@ public class OrganizationsFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_organizations, container, false);
FragmentOrganizationsBinding fragmentOrganizationsBinding = FragmentOrganizationsBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
final SwipeRefreshLayout swipeRefresh = fragmentOrganizationsBinding.pullToRefresh;
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navOrgs));
mProgressBar = v.findViewById(R.id.progress_bar);
noDataOrg = v.findViewById(R.id.noDataOrg);
mRecyclerView = v.findViewById(R.id.recyclerView);
mProgressBar = fragmentOrganizationsBinding.progressBar;
noDataOrg = fragmentOrganizationsBinding.noDataOrg;
mRecyclerView = fragmentOrganizationsBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -63,7 +64,7 @@ public class OrganizationsFragment extends Fragment {
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
createNewOrganization = v.findViewById(R.id.addNewOrganization);
createNewOrganization = fragmentOrganizationsBinding.addNewOrganization;
createNewOrganization.setOnClickListener(view -> {
@ -96,7 +97,7 @@ public class OrganizationsFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()));
return v;
return fragmentOrganizationsBinding.getRoot();
}

View File

@ -17,8 +17,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.ProfileEmailsAdapter;
import org.mian.gitnex.databinding.FragmentProfileEmailsBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.models.Emails;
import org.mian.gitnex.viewmodels.ProfileEmailsViewModel;
@ -67,12 +67,12 @@ public class ProfileEmailsFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_profile_emails, container, false);
FragmentProfileEmailsBinding fragmentProfileEmailsBinding = FragmentProfileEmailsBinding.inflate(inflater, container, false);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
final SwipeRefreshLayout swipeRefresh = fragmentProfileEmailsBinding.pullToRefresh;
noDataEmails = v.findViewById(R.id.noDataEmails);
mRecyclerView = v.findViewById(R.id.recyclerView);
noDataEmails = fragmentProfileEmailsBinding.noDataEmails;
mRecyclerView = fragmentProfileEmailsBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -81,7 +81,7 @@ public class ProfileEmailsFragment extends Fragment {
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar);
mProgressBar = fragmentProfileEmailsBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -92,7 +92,7 @@ public class ProfileEmailsFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()));
return v;
return fragmentProfileEmailsBinding.getRoot();
}

View File

@ -18,8 +18,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.ProfileFollowersAdapter;
import org.mian.gitnex.databinding.FragmentProfileFollowersBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.models.UserInfo;
import org.mian.gitnex.viewmodels.ProfileFollowersViewModel;
@ -67,12 +67,13 @@ public class ProfileFollowersFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_profile_followers, container, false);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
FragmentProfileFollowersBinding fragmentProfileFollowersBinding = FragmentProfileFollowersBinding.inflate(inflater, container, false);
noDataFollowers = v.findViewById(R.id.noDataFollowers);
mRecyclerView = v.findViewById(R.id.recyclerView);
final SwipeRefreshLayout swipeRefresh = fragmentProfileFollowersBinding.pullToRefresh;
noDataFollowers = fragmentProfileFollowersBinding.noDataFollowers;
mRecyclerView = fragmentProfileFollowersBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -81,7 +82,7 @@ public class ProfileFollowersFragment extends Fragment {
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar);
mProgressBar = fragmentProfileFollowersBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -92,7 +93,7 @@ public class ProfileFollowersFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()));
return v;
return fragmentProfileFollowersBinding.getRoot();
}
private void fetchDataAsync(String instanceToken) {

View File

@ -18,8 +18,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.ProfileFollowingAdapter;
import org.mian.gitnex.databinding.FragmentProfileFollowingBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.models.UserInfo;
@ -68,14 +68,15 @@ public class ProfileFollowingFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_profile_following, container, false);
FragmentProfileFollowingBinding fragmentProfileFollowingBinding = FragmentProfileFollowingBinding.inflate(inflater, container, false);
TinyDB tinyDb = TinyDB.getInstance(getContext());
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
final SwipeRefreshLayout swipeRefresh = fragmentProfileFollowingBinding.pullToRefresh;
noDataFollowing = v.findViewById(R.id.noDataFollowing);
mRecyclerView = v.findViewById(R.id.recyclerView);
noDataFollowing = fragmentProfileFollowingBinding.noDataFollowing;
mRecyclerView = fragmentProfileFollowingBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -84,7 +85,7 @@ public class ProfileFollowingFragment extends Fragment {
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar);
mProgressBar = fragmentProfileFollowingBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -95,7 +96,7 @@ public class ProfileFollowingFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()));
return v;
return fragmentProfileFollowingBinding.getRoot();
}
private void fetchDataAsync(String instanceToken) {

View File

@ -10,7 +10,6 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -24,11 +23,11 @@ import com.squareup.picasso.Callback;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.databinding.FragmentProfileBinding;
import org.mian.gitnex.helpers.ColorInverter;
import org.mian.gitnex.helpers.RoundedTransformation;
import org.mian.gitnex.helpers.TinyDB;
import java.util.Locale;
import eightbitlab.com.blurview.BlurView;
import eightbitlab.com.blurview.RenderScriptBlur;
/**
@ -45,63 +44,55 @@ public class ProfileFragment extends Fragment {
ctx = getContext();
View v = inflater.inflate(R.layout.fragment_profile, container, false);
FragmentProfileBinding fragmentProfileBinding = FragmentProfileBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navProfile));
TinyDB tinyDb = TinyDB.getInstance(getContext());
BlurView blurView = v.findViewById(R.id.blurView);
TextView userFullName = v.findViewById(R.id.userFullName);
ImageView userAvatarBackground = v.findViewById(R.id.userAvatarBackground);
ImageView userAvatar = v.findViewById(R.id.userAvatar);
TextView userLogin = v.findViewById(R.id.userLogin);
View divider = v.findViewById(R.id.divider);
TextView userLanguage = v.findViewById(R.id.userLanguage);
ImageView userLanguageIcon = v.findViewById(R.id.userLanguageIcon);
ViewGroup aboutFrame = v.findViewById(R.id.aboutFrame);
ViewGroup aboutFrame = fragmentProfileBinding.aboutFrame;
String[] userLanguageCodes = tinyDb.getString("userLang").split("-");
if(userLanguageCodes.length >= 2) {
Locale locale = new Locale(userLanguageCodes[0], userLanguageCodes[1]);
userLanguage.setText(locale.getDisplayLanguage());
fragmentProfileBinding.userLanguage.setText(locale.getDisplayLanguage());
}
else {
userLanguage.setText(R.string.notSupported);
fragmentProfileBinding.userLanguage.setText(R.string.notSupported);
}
userFullName.setText(tinyDb.getString("userFullname"));
userLogin.setText(getString(R.string.usernameWithAt, tinyDb.getString("userLogin")));
fragmentProfileBinding.userFullName.setText(tinyDb.getString("userFullname"));
fragmentProfileBinding.userLogin.setText(getString(R.string.usernameWithAt, tinyDb.getString("userLogin")));
PicassoService.getInstance(ctx).get()
.load(tinyDb.getString("userAvatar"))
.transform(new RoundedTransformation(8, 0))
.placeholder(R.drawable.loader_animated)
.resize(120, 120)
.centerCrop().into(userAvatar);
.centerCrop().into(fragmentProfileBinding.userAvatar);
PicassoService.getInstance(ctx).get()
.load(tinyDb.getString("userAvatar"))
.into(userAvatarBackground, new Callback() {
.into(fragmentProfileBinding.userAvatarBackground, new Callback() {
@Override
public void onSuccess() {
int invertedColor = new ColorInverter().getImageViewContrastColor(userAvatarBackground);
int invertedColor = new ColorInverter().getImageViewContrastColor(fragmentProfileBinding.userAvatarBackground);
userFullName.setTextColor(invertedColor);
divider.setBackgroundColor(invertedColor);
userLogin.setTextColor(invertedColor);
userLanguage.setTextColor(invertedColor);
fragmentProfileBinding.userFullName.setTextColor(invertedColor);
fragmentProfileBinding.divider.setBackgroundColor(invertedColor);
fragmentProfileBinding.userLogin.setTextColor(invertedColor);
fragmentProfileBinding.userLanguage.setTextColor(invertedColor);
ImageViewCompat.setImageTintList(userLanguageIcon, ColorStateList.valueOf(invertedColor));
ImageViewCompat.setImageTintList(fragmentProfileBinding.userLanguageIcon, ColorStateList.valueOf(invertedColor));
blurView.setupWith(aboutFrame)
fragmentProfileBinding.blurView.setupWith(aboutFrame)
.setBlurAlgorithm(new RenderScriptBlur(ctx))
.setBlurRadius(3)
.setHasFixedTransformationMatrix(true);
@ -116,7 +107,7 @@ public class ProfileFragment extends Fragment {
ProfileFragment.SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());
ViewPager mViewPager = v.findViewById(R.id.container);
ViewPager mViewPager = fragmentProfileBinding.container;
mViewPager.setAdapter(mSectionsPagerAdapter);
Typeface myTypeface;
@ -137,7 +128,7 @@ public class ProfileFragment extends Fragment {
}
TabLayout tabLayout = v.findViewById(R.id.tabs);
TabLayout tabLayout = fragmentProfileBinding.tabs;
ViewGroup vg = (ViewGroup) tabLayout.getChildAt(0);
int tabsCount = vg.getChildCount();
@ -160,7 +151,7 @@ public class ProfileFragment extends Fragment {
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
return v;
return fragmentProfileBinding.getRoot();
}

View File

@ -25,6 +25,7 @@ import org.mian.gitnex.R;
import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.adapters.PullRequestsAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentPullRequestsBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.StaticGlobalVariables;
import org.mian.gitnex.helpers.TinyDB;
@ -59,7 +60,8 @@ public class PullRequestsFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_pull_requests, container, false);
FragmentPullRequestsBinding fragmentPullRequestsBinding = FragmentPullRequestsBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
context = getContext();
@ -71,19 +73,19 @@ public class PullRequestsFragment extends Fragment {
final String loginUid = tinyDb.getString("loginUid");
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
final SwipeRefreshLayout swipeRefresh = fragmentPullRequestsBinding.pullToRefresh;
// if gitea is 1.12 or higher use the new limit
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
}
recyclerView = v.findViewById(R.id.recyclerView);
recyclerView = fragmentPullRequestsBinding.recyclerView;
prList = new ArrayList<>();
progressLoadMore = v.findViewById(R.id.progressLoadMore);
mProgressBar = v.findViewById(R.id.progress_bar);
noData = v.findViewById(R.id.noData);
progressLoadMore = fragmentPullRequestsBinding.progressLoadMore;
mProgressBar = fragmentPullRequestsBinding.progressBar;
noData = fragmentPullRequestsBinding.noData;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -145,7 +147,8 @@ public class PullRequestsFragment extends Fragment {
});
loadInitial(Authorization.get(getContext()), repoOwner, repoName, pageSize, tinyDb.getString("repoPrState"), resultLimit);
return v;
return fragmentPullRequestsBinding.getRoot();
}

View File

@ -18,8 +18,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.ReleasesAdapter;
import org.mian.gitnex.databinding.FragmentReleasesBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.models.Releases;
@ -69,13 +69,13 @@ public class ReleasesFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_releases, container, false);
FragmentReleasesBinding fragmentReleasesBinding = FragmentReleasesBinding.inflate(inflater, container, false);
noDataReleases = v.findViewById(R.id.noDataReleases);
noDataReleases = fragmentReleasesBinding.noDataReleases;
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
final SwipeRefreshLayout swipeRefresh = fragmentReleasesBinding.pullToRefresh;
mRecyclerView = v.findViewById(R.id.recyclerView);
mRecyclerView = fragmentReleasesBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -83,7 +83,7 @@ public class ReleasesFragment extends Fragment {
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar);
mProgressBar = fragmentReleasesBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -94,7 +94,7 @@ public class ReleasesFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName);
return v;
return fragmentReleasesBinding.getRoot();
}

View File

@ -22,6 +22,7 @@ import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.activities.RepoStargazersActivity;
import org.mian.gitnex.activities.RepoWatchersActivity;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentRepoInfoBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.ClickListener;
@ -93,7 +94,7 @@ public class RepoInfoFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_repo_info, container, false);
FragmentRepoInfoBinding fragmentRepoInfoBinding = FragmentRepoInfoBinding.inflate(inflater, container, false);
TinyDB tinyDb = TinyDB.getInstance(getContext());
@ -102,31 +103,31 @@ public class RepoInfoFragment extends Fragment {
ctx = getActivity();
pageContent = v.findViewById(R.id.repoInfoLayout);
pageContent = fragmentRepoInfoBinding.repoInfoLayout;
pageContent.setVisibility(View.GONE);
mProgressBar = v.findViewById(R.id.progress_bar);
repoMetaName = v.findViewById(R.id.repoMetaName);
repoMetaDescription = v.findViewById(R.id.repoMetaDescription);
repoMetaStars = v.findViewById(R.id.repoMetaStars);
repoMetaPullRequests = v.findViewById(R.id.repoMetaPullRequests);
repoMetaPullRequestsFrame = v.findViewById(R.id.repoMetaPullRequestsFrame);
repoMetaForks = v.findViewById(R.id.repoMetaForks);
repoMetaSize = v.findViewById(R.id.repoMetaSize);
repoMetaWatchers = v.findViewById(R.id.repoMetaWatchers);
repoMetaCreatedAt = v.findViewById(R.id.repoMetaCreatedAt);
repoMetaWebsite = v.findViewById(R.id.repoMetaWebsite);
repoAdditionalButton = v.findViewById(R.id.repoAdditionalButton);
repoFileContents = v.findViewById(R.id.repoFileContents);
repoMetaFrame = v.findViewById(R.id.repoMetaFrame);
LinearLayout repoMetaFrameHeader = v.findViewById(R.id.repoMetaFrameHeader);
repoMetaDataExpandCollapse = v.findViewById(R.id.repoMetaDataExpandCollapse);
repoFilenameExpandCollapse = v.findViewById(R.id.repoFilenameExpandCollapse);
fileContentsFrameHeader = v.findViewById(R.id.fileContentsFrameHeader);
fileContentsFrame = v.findViewById(R.id.fileContentsFrame);
LinearLayout repoMetaStarsFrame = v.findViewById(R.id.repoMetaStarsFrame);
LinearLayout repoMetaForksFrame = v.findViewById(R.id.repoMetaForksFrame);
LinearLayout repoMetaWatchersFrame = v.findViewById(R.id.repoMetaWatchersFrame);
mProgressBar = fragmentRepoInfoBinding.progressBar;
repoMetaName = fragmentRepoInfoBinding.repoMetaName;
repoMetaDescription = fragmentRepoInfoBinding.repoMetaDescription;
repoMetaStars = fragmentRepoInfoBinding.repoMetaStars;
repoMetaPullRequests = fragmentRepoInfoBinding.repoMetaPullRequests;
repoMetaPullRequestsFrame = fragmentRepoInfoBinding.repoMetaPullRequestsFrame;
repoMetaForks = fragmentRepoInfoBinding.repoMetaForks;
repoMetaSize = fragmentRepoInfoBinding.repoMetaSize;
repoMetaWatchers = fragmentRepoInfoBinding.repoMetaWatchers;
repoMetaCreatedAt = fragmentRepoInfoBinding.repoMetaCreatedAt;
repoMetaWebsite = fragmentRepoInfoBinding.repoMetaWebsite;
repoAdditionalButton = fragmentRepoInfoBinding.repoAdditionalButton;
repoFileContents = fragmentRepoInfoBinding.repoFileContents;
repoMetaFrame = fragmentRepoInfoBinding.repoMetaFrame;
LinearLayout repoMetaFrameHeader = fragmentRepoInfoBinding.repoMetaFrameHeader;
repoMetaDataExpandCollapse = fragmentRepoInfoBinding.repoMetaDataExpandCollapse;
repoFilenameExpandCollapse = fragmentRepoInfoBinding.repoFilenameExpandCollapse;
fileContentsFrameHeader = fragmentRepoInfoBinding.fileContentsFrameHeader;
fileContentsFrame = fragmentRepoInfoBinding.fileContentsFrame;
LinearLayout repoMetaStarsFrame = fragmentRepoInfoBinding.repoMetaStarsFrame;
LinearLayout repoMetaForksFrame = fragmentRepoInfoBinding.repoMetaForksFrame;
LinearLayout repoMetaWatchersFrame = fragmentRepoInfoBinding.repoMetaWatchersFrame;
repoMetaFrame.setVisibility(View.GONE);
@ -161,7 +162,7 @@ public class RepoInfoFragment extends Fragment {
repoMetaPullRequestsFrame.setOnClickListener(metaPR -> RepoDetailActivity.mViewPager.setCurrentItem(3));
return v;
return fragmentRepoInfoBinding.getRoot();
}
public void onButtonPressed(Uri uri) {

View File

@ -24,6 +24,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.RepositoriesByOrgAdapter;
import org.mian.gitnex.databinding.FragmentRepositoriesByOrgBinding;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
@ -71,13 +72,14 @@ public class RepositoriesByOrgFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_repositories_by_org, container, false);
FragmentRepositoriesByOrgBinding fragmentRepositoriesByOrgBinding = FragmentRepositoriesByOrgBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
noData = v.findViewById(R.id.noData);
noData = fragmentRepositoriesByOrgBinding.noData;
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
final SwipeRefreshLayout swipeRefresh = fragmentRepositoriesByOrgBinding.pullToRefresh;
mRecyclerView = v.findViewById(R.id.recyclerView);
mRecyclerView = fragmentRepositoriesByOrgBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -85,7 +87,7 @@ public class RepositoriesByOrgFragment extends Fragment {
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar);
mProgressBar = fragmentRepositoriesByOrgBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -96,7 +98,7 @@ public class RepositoriesByOrgFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), orgName, pageSize, resultLimit);
return v;
return fragmentRepositoriesByOrgBinding.getRoot();
}
@Override

View File

@ -26,6 +26,7 @@ import org.mian.gitnex.R;
import org.mian.gitnex.activities.CreateRepoActivity;
import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.adapters.ReposListAdapter;
import org.mian.gitnex.databinding.FragmentRepositoriesBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.RepositoriesListViewModel;
@ -41,23 +42,24 @@ public class RepositoriesFragment extends Fragment {
private ReposListAdapter adapter;
private ExtendedFloatingActionButton createNewRepo;
private TextView noDataRepo;
private int pageSize = 1;
private int resultLimit = 50;
private final int pageSize = 1;
private final int resultLimit = 50;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_repositories, container, false);
FragmentRepositoriesBinding fragmentRepositoriesBinding = FragmentRepositoriesBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
final SwipeRefreshLayout swipeRefresh = fragmentRepositoriesBinding.pullToRefresh;
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navRepos));
noDataRepo = v.findViewById(R.id.noData);
mProgressBar = v.findViewById(R.id.progress_bar);
mRecyclerView = v.findViewById(R.id.recyclerView);
noDataRepo = fragmentRepositoriesBinding.noData;
mProgressBar = fragmentRepositoriesBinding.progressBar;
mRecyclerView = fragmentRepositoriesBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -65,7 +67,7 @@ public class RepositoriesFragment extends Fragment {
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
createNewRepo = v.findViewById(R.id.addNewRepo);
createNewRepo = fragmentRepositoriesBinding.addNewRepo;
createNewRepo.setOnClickListener(view -> {
@ -98,7 +100,7 @@ public class RepositoriesFragment extends Fragment {
}, 50));
fetchDataAsync(Authorization.get(getContext()), pageSize, resultLimit);
return v;
return fragmentRepositoriesBinding.getRoot();
}

View File

@ -8,7 +8,6 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@ -22,6 +21,7 @@ import org.mian.gitnex.activities.SettingsNotificationsActivity;
import org.mian.gitnex.activities.SettingsReportsActivity;
import org.mian.gitnex.activities.SettingsSecurityActivity;
import org.mian.gitnex.activities.SettingsTranslationActivity;
import org.mian.gitnex.databinding.FragmentSettingsBinding;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Version;
@ -38,49 +38,39 @@ public class SettingsFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_settings, container, false);
FragmentSettingsBinding fragmentSettingsBinding = FragmentSettingsBinding.inflate(inflater, container, false);
ctx = getContext();
tinyDB = TinyDB.getInstance(ctx);
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navSettings));
LinearLayout generalFrame = v.findViewById(R.id.generalFrame);
LinearLayout appearanceFrame = v.findViewById(R.id.appearanceFrame);
LinearLayout fileViewerFrame = v.findViewById(R.id.fileViewerFrame);
LinearLayout draftsFrame = v.findViewById(R.id.draftsFrame);
LinearLayout securityFrame = v.findViewById(R.id.securityFrame);
LinearLayout notificationsFrame = v.findViewById(R.id.notificationsFrame);
LinearLayout languagesFrame = v.findViewById(R.id.languagesFrame);
LinearLayout reportsFrame = v.findViewById(R.id.reportsFrame);
LinearLayout rateAppFrame = v.findViewById(R.id.rateAppFrame);
LinearLayout aboutAppFrame = v.findViewById(R.id.aboutAppFrame);
if(new Version(tinyDB.getString("giteaVersion")).higherOrEqual("1.12.3")) {
notificationsFrame.setVisibility(View.VISIBLE);
fragmentSettingsBinding.notificationsFrame.setVisibility(View.VISIBLE);
}
generalFrame.setOnClickListener(generalFrameCall -> startActivity(new Intent(ctx, SettingsGeneralActivity.class)));
fragmentSettingsBinding.generalFrame.setOnClickListener(generalFrameCall -> startActivity(new Intent(ctx, SettingsGeneralActivity.class)));
appearanceFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsAppearanceActivity.class)));
fragmentSettingsBinding.appearanceFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsAppearanceActivity.class)));
fileViewerFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsFileViewerActivity.class)));
fragmentSettingsBinding.fileViewerFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsFileViewerActivity.class)));
draftsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsDraftsActivity.class)));
fragmentSettingsBinding.draftsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsDraftsActivity.class)));
securityFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsSecurityActivity.class)));
fragmentSettingsBinding.securityFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsSecurityActivity.class)));
notificationsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsNotificationsActivity.class)));
fragmentSettingsBinding.notificationsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsNotificationsActivity.class)));
languagesFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsTranslationActivity.class)));
fragmentSettingsBinding.languagesFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsTranslationActivity.class)));
reportsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsReportsActivity.class)));
fragmentSettingsBinding.reportsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsReportsActivity.class)));
rateAppFrame.setOnClickListener(aboutApp -> rateThisApp());
fragmentSettingsBinding.rateAppFrame.setOnClickListener(aboutApp -> rateThisApp());
aboutAppFrame.setOnClickListener(aboutApp -> requireActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new AboutFragment()).commit());
fragmentSettingsBinding.aboutAppFrame.setOnClickListener(aboutApp -> requireActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new AboutFragment()).commit());
return v;
return fragmentSettingsBinding.getRoot();
}
public void rateThisApp() {

View File

@ -26,6 +26,7 @@ import org.mian.gitnex.R;
import org.mian.gitnex.activities.CreateRepoActivity;
import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.adapters.StarredReposListAdapter;
import org.mian.gitnex.databinding.FragmentStarredRepositoriesBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.StarredRepositoriesViewModel;
@ -73,16 +74,16 @@ public class StarredRepositoriesFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_starred_repositories, container, false);
FragmentStarredRepositoriesBinding fragmentStarredRepositoriesBinding = FragmentStarredRepositoriesBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
final SwipeRefreshLayout swipeRefresh = fragmentStarredRepositoriesBinding.pullToRefresh;
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navStarredRepos));
noData = v.findViewById(R.id.noData);
mProgressBar = v.findViewById(R.id.progress_bar);
mRecyclerView = v.findViewById(R.id.recyclerView);
noData = fragmentStarredRepositoriesBinding.noData;
mProgressBar = fragmentStarredRepositoriesBinding.progressBar;
mRecyclerView = fragmentStarredRepositoriesBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -90,7 +91,7 @@ public class StarredRepositoriesFragment extends Fragment {
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
createNewRepo = v.findViewById(R.id.addNewRepo);
createNewRepo = fragmentStarredRepositoriesBinding.addNewRepo;
createNewRepo.setOnClickListener(view -> {
@ -124,7 +125,7 @@ public class StarredRepositoriesFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), pageSize, resultLimit);
return v;
return fragmentStarredRepositoriesBinding.getRoot();
}
@Override

View File

@ -24,6 +24,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.TeamsByOrgAdapter;
import org.mian.gitnex.databinding.FragmentTeamsByOrgBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.models.Teams;
@ -68,14 +69,14 @@ public class TeamsByOrgFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_teams_by_org, container, false);
FragmentTeamsByOrgBinding fragmentTeamsByOrgBinding = FragmentTeamsByOrgBinding.inflate(inflater, container, false);
setHasOptionsMenu(true);
noDataTeams = v.findViewById(R.id.noDataTeams);
noDataTeams = fragmentTeamsByOrgBinding.noDataTeams;
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
final SwipeRefreshLayout swipeRefresh = fragmentTeamsByOrgBinding.pullToRefresh;
mRecyclerView = v.findViewById(R.id.recyclerView);
mRecyclerView = fragmentTeamsByOrgBinding.recyclerView;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -83,7 +84,7 @@ public class TeamsByOrgFragment extends Fragment {
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar);
mProgressBar = fragmentTeamsByOrgBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -94,7 +95,7 @@ public class TeamsByOrgFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), orgName);
return v;
return fragmentTeamsByOrgBinding.getRoot();
}
@Override

View File

@ -20,6 +20,7 @@ import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.adapters.UserAccountsAdapter;
import org.mian.gitnex.database.api.UserAccountsApi;
import org.mian.gitnex.database.models.UserAccount;
import org.mian.gitnex.databinding.FragmentUserAccountsBinding;
import java.util.ArrayList;
import java.util.List;
@ -40,7 +41,7 @@ public class UserAccountsFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_user_accounts, container, false);
FragmentUserAccountsBinding fragmentUserAccountsBinding = FragmentUserAccountsBinding.inflate(inflater, container, false);
ctx = getContext();
setHasOptionsMenu(true);
@ -49,8 +50,8 @@ public class UserAccountsFragment extends Fragment {
userAccountsList = new ArrayList<>();
userAccountsApi = new UserAccountsApi(ctx);
mRecyclerView = v.findViewById(R.id.recyclerView);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
mRecyclerView = fragmentUserAccountsBinding.recyclerView;
final SwipeRefreshLayout swipeRefresh = fragmentUserAccountsBinding.pullToRefresh;
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(ctx));
@ -69,7 +70,7 @@ public class UserAccountsFragment extends Fragment {
}, 250));
addNewAccount = v.findViewById(R.id.addNewAccount);
addNewAccount = fragmentUserAccountsBinding.addNewAccount;
addNewAccount.setOnClickListener(view -> {
Intent intent = new Intent(view.getContext(), AddNewAccountActivity.class);
@ -78,7 +79,7 @@ public class UserAccountsFragment extends Fragment {
fetchDataAsync();
return v;
return fragmentUserAccountsBinding.getRoot();
}

View File

@ -4,9 +4,9 @@ import android.app.Activity;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.text.Html;
import android.util.Log;
import androidx.appcompat.app.AlertDialog;
import androidx.core.text.HtmlCompat;
import org.mian.gitnex.R;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@ -93,7 +93,7 @@ public class ChangeLog {
AlertDialog.Builder builder = new AlertDialog.Builder(changelogActivity);
builder.setTitle(R.string.changelogTitle);
builder.setMessage(Html.fromHtml("<small>" + changelogMessage + "</small>"));
builder.setMessage(HtmlCompat.fromHtml("<small>" + changelogMessage + "</small>", HtmlCompat.FROM_HTML_MODE_LEGACY));
builder.setNeutralButton(R.string.close, null);
builder.setCancelable(false);

View File

@ -5,6 +5,7 @@ import android.graphics.Typeface;
import android.text.Spanned;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.PicassoService;
import java.util.concurrent.ExecutorService;
@ -76,7 +77,7 @@ public class Markdown {
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
builder.codeBlockTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/sourcecodeproregular.ttf"));
builder.codeTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/sourcecodeproregular.ttf"));
builder.linkColor(context.getResources().getColor(R.color.lightBlue));
builder.linkColor(ResourcesCompat.getColor(context.getResources(), R.color.lightBlue, null));
}
});

View File

@ -4,10 +4,8 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@ -20,8 +18,6 @@ public class TinyDB {
private static TinyDB tinyDB;
private final SharedPreferences preferences;
private String DEFAULT_APP_IMAGEDATA_DIRECTORY;
private String lastImagePath = "";
private TinyDB(Context appContext) {
preferences = appContext.getSharedPreferences(appContext.getPackageName() + "_preferences", Context.MODE_PRIVATE);
@ -35,57 +31,6 @@ public class TinyDB {
return tinyDB;
}
/**
* Decodes the Bitmap from 'path' and returns it
* @param path image path
* @return the Bitmap from 'path'
*/
public Bitmap getImage(String path) {
Bitmap bitmapFromPath = null;
try {
bitmapFromPath = BitmapFactory.decodeFile(path);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return bitmapFromPath;
}
/**
* Returns the String path of the last saved image
* @return string path of the last saved image
*/
public String getSavedImagePath() {
return lastImagePath;
}
/**
* Saves 'theBitmap' into folder 'theFolder' with the name 'theImageName'
* @param theFolder the folder path dir you want to save it to e.g "DropBox/WorkImages"
* @param theImageName the name you want to assign to the image file e.g "MeAtLunch.png"
* @param theBitmap the image you want to save as a Bitmap
* @return returns the full path(file system address) of the saved image
*/
public String putImage(String theFolder, String theImageName, Bitmap theBitmap) {
if (theFolder == null || theImageName == null || theBitmap == null)
return null;
this.DEFAULT_APP_IMAGEDATA_DIRECTORY = theFolder;
String mFullPath = setupFullPath(theImageName);
if (!mFullPath.equals("")) {
lastImagePath = mFullPath;
saveBitmap(mFullPath, theBitmap);
}
return mFullPath;
}
/**
* Saves 'theBitmap' into 'fullPath'
* @param fullPath full path of the image file e.g. "Images/MeAtLunch.png"
@ -96,24 +41,6 @@ public class TinyDB {
return !(fullPath == null || theBitmap == null) && saveBitmap(fullPath, theBitmap);
}
/**
* Creates the path for the image with name 'imageName' in DEFAULT_APP.. directory
* @param imageName name of the image
* @return the full path of the image. If it failed to create directory, return empty string
*/
private String setupFullPath(String imageName) {
File mFolder = new File(Environment.getExternalStorageDirectory(), DEFAULT_APP_IMAGEDATA_DIRECTORY);
if (isExternalStorageReadable() && isExternalStorageWritable() && !mFolder.exists()) {
if (!mFolder.mkdirs()) {
Log.e("ERROR", "Failed to setup folder");
return "";
}
}
return mFolder.getPath() + '/' + imageName;
}
/**
* Saves the Bitmap as a PNG file at path 'fullPath'
* @param fullPath path of the image file

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import androidx.core.content.res.ResourcesCompat;
import org.mian.gitnex.R;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -25,7 +26,7 @@ public class UserMentions {
int indexStart = String.valueOf(bodyWithMD).indexOf(matcher.group());
int indexEnd = indexStart + matcher.group().length();
bodyWithMentions.setSpan(new ForegroundColorSpan(mCtx.getResources().getColor(R.color.colorDarkGreen)), indexStart, indexEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
bodyWithMentions.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(mCtx.getResources(), R.color.colorDarkGreen, null)), indexStart, indexEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return bodyWithMentions;