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

View File

@ -57,10 +57,9 @@ public class AddNewAccountActivity extends BaseActivity {
viewBinding.close.setOnClickListener(onClickListener); viewBinding.close.setOnClickListener(onClickListener);
ArrayAdapter<Protocol> adapterProtocols = new ArrayAdapter<>(ctx, R.layout.list_spinner_items, Protocol.values()); ArrayAdapter<Protocol> adapterProtocols = new ArrayAdapter<>(ctx, R.layout.list_spinner_items, Protocol.values());
viewBinding.protocolSpinner.setAdapter(adapterProtocols); viewBinding.protocolSpinner.setAdapter(adapterProtocols);
viewBinding.protocolSpinner.setOnItemClickListener((parent, view1, position, id) -> spinnerSelectedValue = String.valueOf(parent.getItemAtPosition(position))); viewBinding.protocolSpinner.setOnItemClickListener((parent, view1, position, id) -> spinnerSelectedValue = String.valueOf(parent.getItemAtPosition(position)));
viewBinding.addNewAccount.setOnClickListener(login -> { viewBinding.addNewAccount.setOnClickListener(login -> {
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx); 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.R;
import org.mian.gitnex.adapters.UserSearchForTeamMemberAdapter; import org.mian.gitnex.adapters.UserSearchForTeamMemberAdapter;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityAddNewTeamMemberBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.models.UserInfo; import org.mian.gitnex.models.UserInfo;
import org.mian.gitnex.models.UserSearch; import org.mian.gitnex.models.UserSearch;
@ -54,13 +55,15 @@ public class AddNewTeamMemberActivity extends BaseActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityAddNewTeamMemberBinding activityAddNewTeamMemberBinding = ActivityAddNewTeamMemberBinding.inflate(getLayoutInflater());
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ImageView closeActivity = findViewById(R.id.close); ImageView closeActivity = activityAddNewTeamMemberBinding.close;
addNewTeamMember = findViewById(R.id.addNewTeamMember); addNewTeamMember = activityAddNewTeamMemberBinding.addNewTeamMember;
mRecyclerView = findViewById(R.id.recyclerViewUserSearch); mRecyclerView = activityAddNewTeamMemberBinding.recyclerViewUserSearch;
mProgressBar = findViewById(R.id.progress_bar); mProgressBar = activityAddNewTeamMemberBinding.progressBar;
noData = findViewById(R.id.noData); noData = activityAddNewTeamMemberBinding.noData;
addNewTeamMember.requestFocus(); addNewTeamMember.requestFocus();
assert imm != null; assert imm != null;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,6 +20,7 @@ import androidx.annotation.NonNull;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityEditIssueBinding;
import org.mian.gitnex.helpers.AlertDialogs; import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
@ -74,6 +75,8 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityEditIssueBinding activityEditIssueBinding = ActivityEditIssueBinding.inflate(getLayoutInflater());
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
loginUid = tinyDB.getString("loginUid"); loginUid = tinyDB.getString("loginUid");
@ -84,12 +87,12 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
repoName = parts[1]; repoName = parts[1];
issueIndex = Integer.parseInt(tinyDB.getString("issueNumber")); issueIndex = Integer.parseInt(tinyDB.getString("issueNumber"));
ImageView closeActivity = findViewById(R.id.close); ImageView closeActivity = activityEditIssueBinding.close;
editIssueButton = findViewById(R.id.editIssueButton); editIssueButton = activityEditIssueBinding.editIssueButton;
TextView toolbar_title = findViewById(R.id.toolbar_title); TextView toolbar_title = activityEditIssueBinding.toolbarTitle;
editIssueTitle = findViewById(R.id.editIssueTitle); editIssueTitle = activityEditIssueBinding.editIssueTitle;
editIssueDescription = findViewById(R.id.editIssueDescription); editIssueDescription = activityEditIssueBinding.editIssueDescription;
editIssueDueDate = findViewById(R.id.editIssueDueDate); editIssueDueDate = activityEditIssueBinding.editIssueDueDate;
// if gitea is 1.12 or higher use the new limit // if gitea is 1.12 or higher use the new limit
if(new Version(tinyDB.getString("giteaVersion")).higherOrEqual("1.12.0")) { 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.R;
import org.mian.gitnex.adapters.FilesDiffAdapter; import org.mian.gitnex.adapters.FilesDiffAdapter;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityFileDiffBinding;
import org.mian.gitnex.helpers.AlertDialogs; import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.ParseDiff; import org.mian.gitnex.helpers.ParseDiff;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
@ -46,7 +47,9 @@ public class FileDiffActivity extends BaseActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Toolbar toolbar = findViewById(R.id.toolbar); ActivityFileDiffBinding activityFileDiffBinding = ActivityFileDiffBinding.inflate(getLayoutInflater());
Toolbar toolbar = activityFileDiffBinding.toolbar;
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
final TinyDB tinyDb = TinyDB.getInstance(appCtx); final TinyDB tinyDb = TinyDB.getInstance(appCtx);
@ -57,10 +60,10 @@ public class FileDiffActivity extends BaseActivity {
final String loginUid = tinyDb.getString("loginUid"); final String loginUid = tinyDb.getString("loginUid");
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token"); final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
ImageView closeActivity = findViewById(R.id.close); ImageView closeActivity = activityFileDiffBinding.close;
toolbarTitle = findViewById(R.id.toolbar_title); toolbarTitle = activityFileDiffBinding.toolbarTitle;
mListView = findViewById(R.id.listView); mListView = activityFileDiffBinding.listView;
mProgressBar = findViewById(R.id.progress_bar); mProgressBar = activityFileDiffBinding.progressBar;
mListView.setDivider(null); mListView.setDivider(null);

View File

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

View File

@ -9,7 +9,6 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.text.Html;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -22,6 +21,8 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.ScrollView; import android.widget.ScrollView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager; 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) 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); .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>"; .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(); String cleanIssueDescription = singleIssue.getBody().trim();
new Markdown(ctx, EmojiParser.parseToUnicode(cleanIssueDescription), viewBinding.issueDescription); 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.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.database.api.UserAccountsApi; import org.mian.gitnex.database.api.UserAccountsApi;
import org.mian.gitnex.database.models.UserAccount; import org.mian.gitnex.database.models.UserAccount;
import org.mian.gitnex.databinding.ActivityLoginBinding;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.NetworkStatusObserver; import org.mian.gitnex.helpers.NetworkStatusObserver;
import org.mian.gitnex.helpers.PathsHelper; import org.mian.gitnex.helpers.PathsHelper;
@ -64,18 +64,20 @@ public class LoginActivity extends BaseActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityLoginBinding activityLoginBinding = ActivityLoginBinding.inflate(getLayoutInflater());
NetworkStatusObserver networkStatusObserver = NetworkStatusObserver.get(ctx); NetworkStatusObserver networkStatusObserver = NetworkStatusObserver.get(ctx);
loginButton = findViewById(R.id.login_button); loginButton = activityLoginBinding.loginButton;
instanceUrlET = findViewById(R.id.instance_url); instanceUrlET = activityLoginBinding.instanceUrl;
loginUidET = findViewById(R.id.login_uid); loginUidET = activityLoginBinding.loginUid;
loginPassword = findViewById(R.id.login_passwd); loginPassword = activityLoginBinding.loginPasswd;
otpCode = findViewById(R.id.otpCode); otpCode = activityLoginBinding.otpCode;
protocolSpinner = findViewById(R.id.httpsSpinner); protocolSpinner = activityLoginBinding.httpsSpinner;
loginMethod = findViewById(R.id.loginMethod); loginMethod = activityLoginBinding.loginMethod;
loginTokenCode = findViewById(R.id.loginTokenCode); 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()); 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.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@ -19,6 +17,7 @@ import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.view.GravityCompat; import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout; import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment; 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.clients.RetrofitClient;
import org.mian.gitnex.database.api.UserAccountsApi; import org.mian.gitnex.database.api.UserAccountsApi;
import org.mian.gitnex.database.models.UserAccount; import org.mian.gitnex.database.models.UserAccount;
import org.mian.gitnex.databinding.ActivityMainBinding;
import org.mian.gitnex.fragments.AdministrationFragment; import org.mian.gitnex.fragments.AdministrationFragment;
import org.mian.gitnex.fragments.BottomSheetDraftsFragment; import org.mian.gitnex.fragments.BottomSheetDraftsFragment;
import org.mian.gitnex.fragments.DraftsFragment; import org.mian.gitnex.fragments.DraftsFragment;
@ -57,7 +57,6 @@ import org.mian.gitnex.models.NotificationCount;
import org.mian.gitnex.models.UserInfo; import org.mian.gitnex.models.UserInfo;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import eightbitlab.com.blurview.BlurView; import eightbitlab.com.blurview.BlurView;
import eightbitlab.com.blurview.RenderScriptBlur; import eightbitlab.com.blurview.RenderScriptBlur;
import retrofit2.Call; import retrofit2.Call;
@ -97,6 +96,8 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityMainBinding activityMainBinding = ActivityMainBinding.inflate(getLayoutInflater());
tinyDB.putBoolean("noConnection", false); tinyDB.putBoolean("noConnection", false);
String currentVersion = tinyDB.getString("giteaVersion"); String currentVersion = tinyDB.getString("giteaVersion");
@ -114,8 +115,8 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
if(tinyDB.getString("codeBlockStr").isEmpty()) { if(tinyDB.getString("codeBlockStr").isEmpty()) {
tinyDB.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen)); tinyDB.putInt("codeBlockColor", ResourcesCompat.getColor(getResources(), R.color.colorLightGreen, null));
tinyDB.putInt("codeBlockBackground", getResources().getColor(R.color.black)); tinyDB.putInt("codeBlockBackground", ResourcesCompat.getColor(getResources(), R.color.black, null));
} }
if(tinyDB.getString("enableCounterIssueBadgeInit").isEmpty()) { 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)); AlertDialogs.forceLogoutDialog(ctx, getResources().getString(R.string.forceLogoutDialogHeader), getResources().getString(R.string.forceLogoutDialogDescription), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
} }
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = activityMainBinding.toolbar;
toolbarTitle = toolbar.findViewById(R.id.toolbar_title); toolbarTitle = activityMainBinding.toolbarTitle;
switch(tinyDB.getInt("customFontId", -1)) { switch(tinyDB.getInt("customFontId", -1)) {
@ -210,8 +211,8 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
getNotificationsCount(instanceToken); getNotificationsCount(instanceToken);
drawer = findViewById(R.id.drawer_layout); drawer = activityMainBinding.drawerLayout;
NavigationView navigationView = findViewById(R.id.nav_view); NavigationView navigationView = activityMainBinding.navView;
navigationView.setNavigationItemSelectedListener(this); navigationView.setNavigationItemSelectedListener(this);
hView = navigationView.getHeaderView(0); hView = navigationView.getHeaderView(0);
@ -468,17 +469,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
} }
// Changelog popup // Changelog popup
int versionCode = 0; int versionCode = AppUtil.getAppBuildNo(appCtx);
try {
PackageInfo packageInfo = appCtx.getPackageManager().getPackageInfo(appCtx.getPackageName(), 0);
versionCode = packageInfo.versionCode;
}
catch(PackageManager.NameNotFoundException e) {
Log.e("changelogDialog", Objects.requireNonNull(e.getMessage()));
}
if(versionCode > tinyDB.getInt("versionCode")) { if(versionCode > tinyDB.getInt("versionCode")) {

View File

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

View File

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

View File

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

View File

@ -29,6 +29,7 @@ import com.google.android.material.tabs.TabLayout;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityRepoDetailBinding;
import org.mian.gitnex.fragments.BottomSheetIssuesFilterFragment; import org.mian.gitnex.fragments.BottomSheetIssuesFilterFragment;
import org.mian.gitnex.fragments.BottomSheetMilestonesFilterFragment; import org.mian.gitnex.fragments.BottomSheetMilestonesFilterFragment;
import org.mian.gitnex.fragments.BottomSheetPullRequestFilterFragment; import org.mian.gitnex.fragments.BottomSheetPullRequestFilterFragment;
@ -90,13 +91,15 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityRepoDetailBinding activityRepoDetailBinding = ActivityRepoDetailBinding.inflate(getLayoutInflater());
String[] repoNameParts = tinyDB.getString("repoFullName").split("/"); String[] repoNameParts = tinyDB.getString("repoFullName").split("/");
repositoryOwner = repoNameParts[0]; repositoryOwner = repoNameParts[0];
repositoryName = repoNameParts[1]; 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); toolbarTitle.setText(repositoryName);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
@ -130,7 +133,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
toolbarTitle.setTypeface(myTypeface); toolbarTitle.setTypeface(myTypeface);
TabLayout tabLayout = findViewById(R.id.tabs); TabLayout tabLayout = activityRepoDetailBinding.tabs;
ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0); ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0);
tabsCount = viewGroup.getChildCount(); tabsCount = viewGroup.getChildCount();
@ -164,7 +167,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
collaboratorTab.setVisibility(View.GONE); collaboratorTab.setVisibility(View.GONE);
} }
mViewPager = findViewById(R.id.container); mViewPager = activityRepoDetailBinding.container;
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager)); 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.R;
import org.mian.gitnex.adapters.RepoForksAdapter; import org.mian.gitnex.adapters.RepoForksAdapter;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityRepoForksBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.StaticGlobalVariables; import org.mian.gitnex.helpers.StaticGlobalVariables;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
@ -56,7 +57,7 @@ public class RepoForksActivity extends BaseActivity {
@Override @Override
protected int getLayoutResourceId() { protected int getLayoutResourceId() {
return R.layout.activity_forks; return R.layout.activity_repo_forks;
} }
@SuppressLint("DefaultLocale") @SuppressLint("DefaultLocale")
@ -65,7 +66,9 @@ public class RepoForksActivity extends BaseActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Toolbar toolbar = findViewById(R.id.toolbar); ActivityRepoForksBinding activityRepoForksBinding = ActivityRepoForksBinding.inflate(getLayoutInflater());
Toolbar toolbar = activityRepoForksBinding.toolbar;
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
TinyDB tinyDb = TinyDB.getInstance(appCtx); TinyDB tinyDb = TinyDB.getInstance(appCtx);
@ -76,15 +79,15 @@ public class RepoForksActivity extends BaseActivity {
final String repoOwner = parts[0]; final String repoOwner = parts[0];
final String repoName = parts[1]; 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.setMovementMethod(new ScrollingMovementMethod());
toolbar_title.setText(String.format("%s : %s", ctx.getResources().getString(R.string.infoTabRepoForksCount), repoName)); toolbar_title.setText(String.format("%s : %s", ctx.getResources().getString(R.string.infoTabRepoForksCount), repoName));
ImageView closeActivity = findViewById(R.id.close); ImageView closeActivity = activityRepoForksBinding.close;
noData = findViewById(R.id.noData); noData = activityRepoForksBinding.noData;
progressLoadMore = findViewById(R.id.progressLoadMore); progressLoadMore = activityRepoForksBinding.progressLoadMore;
progressBar = findViewById(R.id.progress_bar); progressBar = activityRepoForksBinding.progressBar;
SwipeRefreshLayout swipeRefresh = findViewById(R.id.pullToRefresh); SwipeRefreshLayout swipeRefresh = activityRepoForksBinding.pullToRefresh;
initCloseListener(); initCloseListener();
closeActivity.setOnClickListener(onClickListener); closeActivity.setOnClickListener(onClickListener);
@ -95,7 +98,7 @@ public class RepoForksActivity extends BaseActivity {
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances; resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
} }
recyclerView = findViewById(R.id.recyclerView); recyclerView = activityRepoForksBinding.recyclerView;
forksList = new ArrayList<>(); forksList = new ArrayList<>();
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,6 @@ package org.mian.gitnex.adapters;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -11,6 +10,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.IssueDetailActivity; 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); 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>"; String issueNumber_ = "<font color='" + ResourcesCompat.getColor(context.getResources(), R.color.lightGray, null) + "'>" + context.getResources().getString(R.string.hash) + issuesModel.getNumber() + "</font>";
issueTitle.setText(Html.fromHtml(issueNumber_ + " " + issuesModel.getTitle())); issueTitle.setText(HtmlCompat.fromHtml(issueNumber_ + " " + issuesModel.getTitle(), HtmlCompat.FROM_HTML_MODE_LEGACY));
issueNumber.setText(String.valueOf(issuesModel.getNumber())); issueNumber.setText(String.valueOf(issuesModel.getNumber()));
issueCommentsCount.setText(String.valueOf(issuesModel.getComments())); issueCommentsCount.setText(String.valueOf(issuesModel.getComments()));

View File

@ -10,6 +10,7 @@ import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.bottomsheet.BottomSheetDialog; import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.vdurmont.emoji.EmojiParser; import com.vdurmont.emoji.EmojiParser;
@ -220,7 +221,7 @@ public class MilestonesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
String dueDate = formatter.format(date); String dueDate = formatter.format(date);
if(date.before(new 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); msDueDate.setText(dueDate);

View File

@ -1,7 +1,6 @@
package org.mian.gitnex.adapters; package org.mian.gitnex.adapters;
import android.content.Context; import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -9,6 +8,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.database.api.RepositoriesApi; import org.mian.gitnex.database.api.RepositoriesApi;
@ -81,10 +82,10 @@ public class NotificationsAdapter extends RecyclerView.Adapter<NotificationsAdap
NotificationThread notificationThread = notificationThreads.get(position); NotificationThread notificationThread = notificationThreads.get(position);
String url = notificationThread.getSubject().getUrl(); 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>"; .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()); holder.repository.setText(notificationThread.getRepository().getFullName());
if(notificationThread.isPinned()) { if(notificationThread.isPinned()) {

View File

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

View File

@ -3,7 +3,6 @@ package org.mian.gitnex.adapters;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -11,6 +10,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.IssueDetailActivity; 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); 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>"; String prNumber_ = "<font color='" + ResourcesCompat.getColor(context.getResources(), R.color.lightGray, null) + "'>" + context.getResources().getString(R.string.hash) + prModel.getNumber() + "</font>";
prTitle.setText(Html.fromHtml(prNumber_ + " " + prModel.getTitle())); prTitle.setText(HtmlCompat.fromHtml(prNumber_ + " " + prModel.getTitle(), HtmlCompat.FROM_HTML_MODE_LEGACY));
prNumber.setText(String.valueOf(prModel.getNumber())); prNumber.setText(String.valueOf(prModel.getNumber()));
prMergeable.setText(String.valueOf(prModel.isMergeable())); prMergeable.setText(String.valueOf(prModel.isMergeable()));

View File

@ -1,7 +1,6 @@
package org.mian.gitnex.adapters; package org.mian.gitnex.adapters;
import android.content.Context; import android.content.Context;
import android.text.Html;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -11,6 +10,7 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R; import org.mian.gitnex.R;
@ -153,11 +153,11 @@ public class ReleasesAdapter extends RecyclerView.Adapter<ReleasesAdapter.Releas
}); });
holder.releaseZipDownload.setText( 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.releaseZipDownload.setMovementMethod(LinkMovementMethod.getInstance());
holder.releaseTarDownload.setText( 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()); holder.releaseTarDownload.setMovementMethod(LinkMovementMethod.getInstance());
ReleasesDownloadsAdapter adapter = new ReleasesDownloadsAdapter(currentItem.getAssets()); ReleasesDownloadsAdapter adapter = new ReleasesDownloadsAdapter(currentItem.getAssets());

View File

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

View File

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

View File

@ -2,13 +2,14 @@ package org.mian.gitnex.adapters;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.IssueDetailActivity; import org.mian.gitnex.activities.IssueDetailActivity;
@ -129,8 +130,8 @@ public class SearchIssuesAdapter extends RecyclerView.Adapter<SearchIssuesAdapte
PicassoService 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); .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>"; 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(Html.fromHtml(issueNumber_ + " " + currentItem.getTitle())); holder.issueTitle.setText(HtmlCompat.fromHtml(issueNumber_ + " " + currentItem.getTitle(), HtmlCompat.FROM_HTML_MODE_LEGACY));
holder.issueNumber.setText(String.valueOf(currentItem.getNumber())); holder.issueNumber.setText(String.valueOf(currentItem.getNumber()));
holder.issueCommentsCount.setText(String.valueOf(currentItem.getComments())); holder.issueCommentsCount.setText(String.valueOf(currentItem.getComments()));

View File

@ -5,12 +5,11 @@ import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.AdminGetUsersActivity; import org.mian.gitnex.activities.AdminGetUsersActivity;
import org.mian.gitnex.databinding.FragmentAdministrationBinding;
/** /**
* Author M M Arif * 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) { 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.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R; import org.mian.gitnex.databinding.BottomSheetAdminUsersBinding;
/** /**
* Author M M Arif * Author M M Arif
@ -22,17 +21,17 @@ public class BottomSheetAdminUsersFragment extends BottomSheetDialogFragment {
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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"); bmListener.onButtonClicked("newUser");
dismiss(); dismiss();
}); });
return v; return bottomSheetAdminUsersBinding.getRoot();
} }
public interface BottomSheetListener { public interface BottomSheetListener {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,10 +13,10 @@ import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.actions.NotificationsActions; import org.mian.gitnex.actions.NotificationsActions;
import org.mian.gitnex.databinding.BottomSheetNotificationsBinding;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.models.NotificationThread; import org.mian.gitnex.models.NotificationThread;
import java.util.Objects;
/** /**
* Author opyale * Author opyale
@ -40,14 +40,14 @@ public class BottomSheetNotificationsFragment extends BottomSheetDialogFragment
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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 markRead = bottomSheetNotificationsBinding.markRead;
TextView markUnread = v.findViewById(R.id.markUnread); TextView markUnread = bottomSheetNotificationsBinding.markUnread;
TextView markPinned = v.findViewById(R.id.markPinned); TextView markPinned = bottomSheetNotificationsBinding.markPinned;
NotificationsActions notificationsActions = new NotificationsActions(context); NotificationsActions notificationsActions = new NotificationsActions(context);
Activity activity = Objects.requireNonNull(getActivity()); Activity activity = requireActivity();
if(notificationThread.isPinned()) { 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.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; 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.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.databinding.BottomSheetOrganizationBinding;
/** /**
* Author M M Arif * Author M M Arif
@ -23,38 +22,33 @@ public class BottomSheetOrganizationFragment extends BottomSheetDialogFragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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); bottomSheetOrganizationBinding.createTeam.setOnClickListener(v1 -> {
TextView createRepository = v.findViewById(R.id.createRepository);
TextView copyOrgUrl = v.findViewById(R.id.copyOrgUrl);
TextView createLabel = v.findViewById(R.id.createLabel);
createTeam.setOnClickListener(v1 -> {
bmListener.onButtonClicked("team"); bmListener.onButtonClicked("team");
dismiss(); dismiss();
}); });
createLabel.setOnClickListener(v1 -> { bottomSheetOrganizationBinding.createLabel.setOnClickListener(v1 -> {
bmListener.onButtonClicked("label"); bmListener.onButtonClicked("label");
dismiss(); dismiss();
}); });
createRepository.setOnClickListener(v12 -> { bottomSheetOrganizationBinding.createRepository.setOnClickListener(v12 -> {
bmListener.onButtonClicked("repository"); bmListener.onButtonClicked("repository");
dismiss(); dismiss();
}); });
copyOrgUrl.setOnClickListener(v1 -> { bottomSheetOrganizationBinding.copyOrgUrl.setOnClickListener(v1 -> {
bmListener.onButtonClicked("copyOrgUrl"); bmListener.onButtonClicked("copyOrgUrl");
dismiss(); dismiss();
}); });
return v; return bottomSheetOrganizationBinding.getRoot();
} }
public interface BottomSheetListener { public interface BottomSheetListener {

View File

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

View File

@ -5,12 +5,11 @@ import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; 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.NonNull;
import androidx.annotation.Nullable; 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 * Author M M Arif
@ -21,17 +20,16 @@ public class BottomSheetProfileFragment extends BottomSheetDialogFragment {
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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)); startActivity(new Intent(getContext(), ProfileEmailActivity.class));
dismiss(); dismiss();
}); });
return v; return bottomSheetProfileBinding.getRoot();
} }
} }

View File

@ -5,11 +5,10 @@ import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R; import org.mian.gitnex.databinding.BottomSheetPullRequestFilterBinding;
/** /**
* Author M M Arif * Author M M Arif
@ -23,22 +22,19 @@ public class BottomSheetPullRequestFilterFragment extends BottomSheetDialogFragm
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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); bottomSheetPullRequestFilterBinding.openPr.setOnClickListener(v1 -> {
TextView closedPr = v.findViewById(R.id.closedPr);
openPr.setOnClickListener(v1 -> {
bmListener.onButtonClicked("openPr"); bmListener.onButtonClicked("openPr");
dismiss(); dismiss();
}); });
closedPr.setOnClickListener(v12 -> { bottomSheetPullRequestFilterBinding.closedPr.setOnClickListener(v12 -> {
bmListener.onButtonClicked("closedPr"); bmListener.onButtonClicked("closedPr");
dismiss(); dismiss();
}); });
return v; return bottomSheetPullRequestFilterBinding.getRoot();
} }
public interface BottomSheetListener { 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.actions.IssueActions;
import org.mian.gitnex.activities.MainActivity; import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.database.api.DraftsApi; import org.mian.gitnex.database.api.DraftsApi;
import org.mian.gitnex.databinding.BottomSheetReplyLayoutBinding;
import org.mian.gitnex.helpers.StaticGlobalVariables; import org.mian.gitnex.helpers.StaticGlobalVariables;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.Toasty;
@ -67,16 +68,16 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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(); Bundle arguments = requireArguments();
draftsHint = view.findViewById(R.id.drafts_hint); draftsHint = bottomSheetReplyLayoutBinding.draftsHint;
EditText comment = view.findViewById(R.id.comment); EditText comment = bottomSheetReplyLayoutBinding.comment;
TextView toolbarTitle = view.findViewById(R.id.toolbar_title); TextView toolbarTitle = bottomSheetReplyLayoutBinding.toolbarTitle;
ImageButton close = view.findViewById(R.id.close); ImageButton close = bottomSheetReplyLayoutBinding.close;
ImageButton drafts = view.findViewById(R.id.drafts); ImageButton drafts = bottomSheetReplyLayoutBinding.drafts;
ImageButton send = view.findViewById(R.id.send); ImageButton send = bottomSheetReplyLayoutBinding.send;
send.setEnabled(false); send.setEnabled(false);
@ -118,7 +119,7 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
comment.requestFocus(); comment.requestFocus();
comment.setOnTouchListener((v, event) -> { comment.setOnTouchListener((v, event) -> {
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from((View) view.getParent()); BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from((View) bottomSheetReplyLayoutBinding.getRoot().getParent());
switch(event.getAction()) { switch(event.getAction()) {
@ -234,7 +235,7 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
} }
}); });
return view; return bottomSheetReplyLayoutBinding.getRoot();
} }
private void saveDraft(String text, boolean remove) { private void saveDraft(String text, boolean remove) {

View File

@ -9,8 +9,8 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R;
import org.mian.gitnex.actions.RepositoryActions; import org.mian.gitnex.actions.RepositoryActions;
import org.mian.gitnex.databinding.BottomSheetRepoBinding;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
/** /**
@ -24,26 +24,27 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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()); final TinyDB tinyDb = TinyDB.getInstance(getContext());
TextView createLabel = v.findViewById(R.id.createLabel); TextView createLabel = bottomSheetRepoBinding.createLabel;
TextView createIssue = v.findViewById(R.id.createNewIssue); TextView createIssue = bottomSheetRepoBinding.createNewIssue;
TextView createMilestone = v.findViewById(R.id.createNewMilestone); TextView createMilestone = bottomSheetRepoBinding.createNewMilestone;
TextView addCollaborator = v.findViewById(R.id.addCollaborator); TextView addCollaborator = bottomSheetRepoBinding.addCollaborator;
TextView createRelease = v.findViewById(R.id.createRelease); TextView createRelease = bottomSheetRepoBinding.createRelease;
TextView openWebRepo = v.findViewById(R.id.openWebRepo); TextView openWebRepo = bottomSheetRepoBinding.openWebRepo;
TextView newFile = v.findViewById(R.id.newFile); TextView newFile = bottomSheetRepoBinding.newFile;
TextView starRepository = v.findViewById(R.id.starRepository); TextView starRepository = bottomSheetRepoBinding.starRepository;
TextView unStarRepository = v.findViewById(R.id.unStarRepository); TextView unStarRepository = bottomSheetRepoBinding.unStarRepository;
TextView watchRepository = v.findViewById(R.id.watchRepository); TextView watchRepository = bottomSheetRepoBinding.watchRepository;
TextView unWatchRepository = v.findViewById(R.id.unWatchRepository); TextView unWatchRepository = bottomSheetRepoBinding.unWatchRepository;
TextView shareRepository = v.findViewById(R.id.shareRepository); TextView shareRepository = bottomSheetRepoBinding.shareRepository;
TextView copyRepoUrl = v.findViewById(R.id.copyRepoUrl); TextView copyRepoUrl = bottomSheetRepoBinding.copyRepoUrl;
View repoSettingsDivider = v.findViewById(R.id.repoSettingsDivider); View repoSettingsDivider = bottomSheetRepoBinding.repoSettingsDivider;
TextView repoSettings = v.findViewById(R.id.repoSettings); TextView repoSettings = bottomSheetRepoBinding.repoSettings;
TextView createPullRequest = v.findViewById(R.id.createPullRequest); TextView createPullRequest = bottomSheetRepoBinding.createPullRequest;
createLabel.setOnClickListener(v112 -> { createLabel.setOnClickListener(v112 -> {
@ -186,7 +187,7 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
} }
return v; return bottomSheetRepoBinding.getRoot();
} }
public interface BottomSheetListener { 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.EditIssueActivity;
import org.mian.gitnex.activities.FileDiffActivity; import org.mian.gitnex.activities.FileDiffActivity;
import org.mian.gitnex.activities.MergePullRequestActivity; import org.mian.gitnex.activities.MergePullRequestActivity;
import org.mian.gitnex.databinding.BottomSheetSingleIssueBinding;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.Version; import org.mian.gitnex.helpers.Version;
@ -36,24 +37,24 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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 Context ctx = getContext();
final TinyDB tinyDB = TinyDB.getInstance(ctx); final TinyDB tinyDB = TinyDB.getInstance(ctx);
TextView editIssue = v.findViewById(R.id.editIssue); TextView editIssue = bottomSheetSingleIssueBinding.editIssue;
TextView editLabels = v.findViewById(R.id.editLabels); TextView editLabels = bottomSheetSingleIssueBinding.editLabels;
TextView closeIssue = v.findViewById(R.id.closeIssue); TextView closeIssue = bottomSheetSingleIssueBinding.closeIssue;
TextView reOpenIssue = v.findViewById(R.id.reOpenIssue); TextView reOpenIssue = bottomSheetSingleIssueBinding.reOpenIssue;
TextView addRemoveAssignees = v.findViewById(R.id.addRemoveAssignees); TextView addRemoveAssignees = bottomSheetSingleIssueBinding.addRemoveAssignees;
TextView copyIssueUrl = v.findViewById(R.id.copyIssueUrl); TextView copyIssueUrl = bottomSheetSingleIssueBinding.copyIssueUrl;
TextView openFilesDiff = v.findViewById(R.id.openFilesDiff); TextView openFilesDiff = bottomSheetSingleIssueBinding.openFilesDiff;
TextView mergePullRequest = v.findViewById(R.id.mergePullRequest); TextView mergePullRequest = bottomSheetSingleIssueBinding.mergePullRequest;
TextView shareIssue = v.findViewById(R.id.shareIssue); TextView shareIssue = bottomSheetSingleIssueBinding.shareIssue;
TextView subscribeIssue = v.findViewById(R.id.subscribeIssue); TextView subscribeIssue = bottomSheetSingleIssueBinding.subscribeIssue;
TextView unsubscribeIssue = v.findViewById(R.id.unsubscribeIssue); TextView unsubscribeIssue = bottomSheetSingleIssueBinding.unsubscribeIssue;
LinearLayout linearLayout = v.findViewById(R.id.commentReactionButtons); LinearLayout linearLayout = bottomSheetSingleIssueBinding.commentReactionButtons;
Bundle bundle1 = new Bundle(); Bundle bundle1 = new Bundle();
@ -221,7 +222,7 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
unsubscribeIssue.setVisibility(View.GONE); unsubscribeIssue.setVisibility(View.GONE);
} }
return v; return bottomSheetSingleIssueBinding.getRoot();
} }
public interface BottomSheetListener { public interface BottomSheetListener {

View File

@ -13,8 +13,8 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer; import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.CollaboratorsAdapter; import org.mian.gitnex.adapters.CollaboratorsAdapter;
import org.mian.gitnex.databinding.FragmentCollaboratorsBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.models.Collaborators; import org.mian.gitnex.models.Collaborators;
import org.mian.gitnex.viewmodels.CollaboratorsViewModel; import org.mian.gitnex.viewmodels.CollaboratorsViewModel;
@ -63,14 +63,15 @@ public class CollaboratorsFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { 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); noDataCollaborators = fragmentCollaboratorsBinding.noDataCollaborators;
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentCollaboratorsBinding.progressBar;
mGridView = v.findViewById(R.id.gridView); mGridView = fragmentCollaboratorsBinding.gridView;
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName); fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName);
return v; return fragmentCollaboratorsBinding.getRoot();
} }
public void onButtonPressed(Uri uri) { 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.adapters.DraftsAdapter;
import org.mian.gitnex.database.api.DraftsApi; import org.mian.gitnex.database.api.DraftsApi;
import org.mian.gitnex.database.models.DraftWithRepository; import org.mian.gitnex.database.models.DraftWithRepository;
import org.mian.gitnex.databinding.FragmentDraftsBinding;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.Toasty;
import java.util.ArrayList; import java.util.ArrayList;
@ -45,10 +46,11 @@ public class DraftsFragment extends Fragment {
private SwipeRefreshLayout swipeRefresh; private SwipeRefreshLayout swipeRefresh;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_drafts, container, false); FragmentDraftsBinding fragmentDraftsBinding = FragmentDraftsBinding.inflate(inflater, container, false);
ctx = getContext(); ctx = getContext();
setHasOptionsMenu(true); setHasOptionsMenu(true);
@ -59,9 +61,9 @@ public class DraftsFragment extends Fragment {
draftsList_ = new ArrayList<>(); draftsList_ = new ArrayList<>();
draftsApi = new DraftsApi(ctx); draftsApi = new DraftsApi(ctx);
noData = v.findViewById(R.id.noData); noData = fragmentDraftsBinding.noData;
mRecyclerView = v.findViewById(R.id.recyclerView); mRecyclerView = fragmentDraftsBinding.recyclerView;
swipeRefresh = v.findViewById(R.id.pullToRefresh); swipeRefresh = fragmentDraftsBinding.pullToRefresh;
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(ctx)); mRecyclerView.setLayoutManager(new LinearLayoutManager(ctx));
@ -81,7 +83,7 @@ public class DraftsFragment extends Fragment {
fetchDataAsync(currentActiveAccountId); 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 com.google.android.material.tabs.TabLayout;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.MainActivity; import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.databinding.FragmentExploreBinding;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
/** /**
@ -32,15 +33,16 @@ public class ExploreFragment extends Fragment {
@Nullable @Nullable
@Override @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(); ctx = getContext();
tinyDB = TinyDB.getInstance(ctx); tinyDB = TinyDB.getInstance(ctx);
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navExplore)); ((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); ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0);
tabsCount = viewGroup.getChildCount(); 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)); mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager)); tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
@ -86,7 +88,7 @@ public class ExploreFragment extends Fragment {
SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager()); SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());
mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setAdapter(mSectionsPagerAdapter);
return v; return fragmentExploreBinding.getRoot();
} }
public class SectionsPagerAdapter extends FragmentPagerAdapter { 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.FileViewActivity;
import org.mian.gitnex.activities.RepoDetailActivity; import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.adapters.FilesAdapter; import org.mian.gitnex.adapters.FilesAdapter;
import org.mian.gitnex.databinding.FragmentFilesBinding;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.viewmodels.FilesViewModel; import org.mian.gitnex.viewmodels.FilesViewModel;
@ -85,23 +86,23 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 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); setHasOptionsMenu(true);
noDataFiles = v.findViewById(R.id.noDataFiles); noDataFiles = fragmentFilesBinding.noDataFiles;
filesFrame = v.findViewById(R.id.filesFrame); filesFrame = fragmentFilesBinding.filesFrame;
fileStructure = v.findViewById(R.id.fileStructure); fileStructure = fragmentFilesBinding.fileStructure;
mRecyclerView = v.findViewById(R.id.recyclerView); mRecyclerView = fragmentFilesBinding.recyclerView;
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL); DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration); 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)))); mBreadcrumbsView.setItems(new ArrayList<>(Collections.singletonList(BreadcrumbItem.createSimpleItem(getResources().getString(R.string.filesBreadcrumbRoot) + getResources().getString(R.string.colonDivider) + ref))));
((RepoDetailActivity) requireActivity()).setFragmentRefreshListenerFiles(repoBranch -> { ((RepoDetailActivity) requireActivity()).setFragmentRefreshListenerFiles(repoBranch -> {
@ -115,7 +116,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName, ref); fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName, ref);
return v; return fragmentFilesBinding.getRoot();
} }
@Override @Override

View File

@ -25,6 +25,7 @@ import org.mian.gitnex.R;
import org.mian.gitnex.activities.RepoDetailActivity; import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.adapters.IssuesAdapter; import org.mian.gitnex.adapters.IssuesAdapter;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentIssuesBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.StaticGlobalVariables; import org.mian.gitnex.helpers.StaticGlobalVariables;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
@ -60,7 +61,8 @@ public class IssuesFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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); setHasOptionsMenu(true);
context = getContext(); context = getContext();
@ -72,19 +74,19 @@ public class IssuesFragment extends Fragment {
final String loginUid = tinyDb.getString("loginUid"); final String loginUid = tinyDb.getString("loginUid");
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token"); 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 gitea is 1.12 or higher use the new limit
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) { if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances; resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
} }
recyclerView = v.findViewById(R.id.recyclerView); recyclerView = fragmentIssuesBinding.recyclerView;
issuesList = new ArrayList<>(); issuesList = new ArrayList<>();
progressLoadMore = v.findViewById(R.id.progressLoadMore); progressLoadMore = fragmentIssuesBinding.progressLoadMore;
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentIssuesBinding.progressBar;
noDataIssues = v.findViewById(R.id.noDataIssues); noDataIssues = fragmentIssuesBinding.noDataIssues;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { 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")); 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.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.LabelsAdapter; import org.mian.gitnex.adapters.LabelsAdapter;
import org.mian.gitnex.databinding.FragmentLabelsBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.LabelsViewModel; import org.mian.gitnex.viewmodels.LabelsViewModel;
@ -69,13 +69,13 @@ public class LabelsFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 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); setHasOptionsMenu(true);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh); final SwipeRefreshLayout swipeRefresh = fragmentLabelsBinding.pullToRefresh;
noData = v.findViewById(R.id.noData); noData = fragmentLabelsBinding.noData;
mRecyclerView = v.findViewById(R.id.recyclerView); mRecyclerView = fragmentLabelsBinding.recyclerView;
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -83,7 +83,7 @@ public class LabelsFragment extends Fragment {
DividerItemDecoration.VERTICAL); DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration); mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentLabelsBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -93,7 +93,7 @@ public class LabelsFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName); fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName);
return v; return fragmentLabelsBinding.getRoot();
} }
@Override @Override

View File

@ -19,6 +19,7 @@ import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.adapters.MembersByOrgAdapter; import org.mian.gitnex.adapters.MembersByOrgAdapter;
import org.mian.gitnex.databinding.FragmentMembersByOrgBinding;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
@ -65,20 +66,20 @@ public class MembersByOrgFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_members_by_org, container, false); FragmentMembersByOrgBinding fragmentMembersByOrgBinding = FragmentMembersByOrgBinding.inflate(inflater, container, false);
setHasOptionsMenu(true); setHasOptionsMenu(true);
TinyDB tinyDb = TinyDB.getInstance(getContext()); TinyDB tinyDb = TinyDB.getInstance(getContext());
final String loginUid = tinyDb.getString("loginUid"); final String loginUid = tinyDb.getString("loginUid");
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token"); final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
noDataMembers = v.findViewById(R.id.noDataMembers); noDataMembers = fragmentMembersByOrgBinding.noDataMembers;
progressBar = v.findViewById(R.id.progressBar); progressBar = fragmentMembersByOrgBinding.progressBar;
mGridView = v.findViewById(R.id.gridView); mGridView = fragmentMembersByOrgBinding.gridView;
fetchDataAsync(Authorization.get(getContext()), orgName); fetchDataAsync(Authorization.get(getContext()), orgName);
return v; return fragmentMembersByOrgBinding.getRoot();
} }
private void fetchDataAsync(String instanceToken, String owner) { 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.CreateRepoActivity;
import org.mian.gitnex.activities.MainActivity; import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.adapters.MyReposListAdapter; import org.mian.gitnex.adapters.MyReposListAdapter;
import org.mian.gitnex.databinding.FragmentMyRepositoriesBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.MyRepositoriesViewModel; import org.mian.gitnex.viewmodels.MyRepositoriesViewModel;
@ -77,27 +78,28 @@ public class MyRepositoriesFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.fragment_my_repositories, container, false); FragmentMyRepositoriesBinding fragmentMyRepositoriesBinding = FragmentMyRepositoriesBinding.inflate(inflater, container, false);
setHasOptionsMenu(true); setHasOptionsMenu(true);
TinyDB tinyDb = TinyDB.getInstance(getContext()); TinyDB tinyDb = TinyDB.getInstance(getContext());
final String userLogin = tinyDb.getString("userLogin"); final String userLogin = tinyDb.getString("userLogin");
tinyDb.putBoolean("isRepoAdmin", true); 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)); ((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navMyRepos));
noDataMyRepo = v.findViewById(R.id.noDataMyRepo); noDataMyRepo = fragmentMyRepositoriesBinding.noDataMyRepo;
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentMyRepositoriesBinding.progressBar;
mRecyclerView = v.findViewById(R.id.recyclerView); mRecyclerView = fragmentMyRepositoriesBinding.recyclerView;
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL); DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration); mRecyclerView.addItemDecoration(dividerItemDecoration);
createNewRepo = v.findViewById(R.id.addNewRepo); createNewRepo = fragmentMyRepositoriesBinding.addNewRepo;
createNewRepo.setOnClickListener(view -> { createNewRepo.setOnClickListener(view -> {
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class); Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
@ -132,7 +134,7 @@ public class MyRepositoriesFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), userLogin, pageSize, resultLimit); 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.activities.IssueDetailActivity;
import org.mian.gitnex.adapters.NotificationsAdapter; import org.mian.gitnex.adapters.NotificationsAdapter;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentNotificationsBinding;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.InfiniteScrollListener; import org.mian.gitnex.helpers.InfiniteScrollListener;
import org.mian.gitnex.helpers.StaticGlobalVariables; import org.mian.gitnex.helpers.StaticGlobalVariables;
@ -75,7 +76,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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); setHasOptionsMenu(true);
activity = requireActivity(); activity = requireActivity();
@ -85,10 +86,10 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
pageResultLimit = StaticGlobalVariables.getCurrentResultLimit(context); pageResultLimit = StaticGlobalVariables.getCurrentResultLimit(context);
tinyDB.putString("notificationsFilterState", currentFilterMode); tinyDB.putString("notificationsFilterState", currentFilterMode);
markAllAsRead = v.findViewById(R.id.markAllAsRead); markAllAsRead = fragmentNotificationsBinding.markAllAsRead;
noDataNotifications = v.findViewById(R.id.noDataNotifications); noDataNotifications = fragmentNotificationsBinding.noDataNotifications;
loadingMoreView = v.findViewById(R.id.loadingMoreView); loadingMoreView = fragmentNotificationsBinding.loadingMoreView;
progressBar = v.findViewById(R.id.progressBar); progressBar = fragmentNotificationsBinding.progressBar;
notificationThreads = new ArrayList<>(); notificationThreads = new ArrayList<>();
notificationsActions = new NotificationsActions(context); notificationsActions = new NotificationsActions(context);
@ -96,7 +97,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
RecyclerView recyclerView = v.findViewById(R.id.notifications); RecyclerView recyclerView = fragmentNotificationsBinding.notifications;
recyclerView.setHasFixedSize(true); recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(notificationsAdapter); 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(() -> { pullToRefresh.setOnRefreshListener(() -> {
pageCurrentIndex = 1; pageCurrentIndex = 1;
@ -173,7 +174,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
}); });
loadNotifications(false); 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.R;
import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentOrganizationInfoBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.RoundedTransformation; import org.mian.gitnex.helpers.RoundedTransformation;
import org.mian.gitnex.models.Organization; import org.mian.gitnex.models.Organization;
@ -64,21 +65,21 @@ public class OrganizationInfoFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { 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); mProgressBar = fragmentOrganizationInfoBinding.progressBar;
orgAvatar = v.findViewById(R.id.orgAvatar); orgAvatar = fragmentOrganizationInfoBinding.orgAvatar;
TextView orgNameInfo = v.findViewById(R.id.orgNameInfo); TextView orgNameInfo = fragmentOrganizationInfoBinding.orgNameInfo;
orgDescInfo = v.findViewById(R.id.orgDescInfo); orgDescInfo = fragmentOrganizationInfoBinding.orgDescInfo;
orgWebsiteInfo = v.findViewById(R.id.orgWebsiteInfo); orgWebsiteInfo = fragmentOrganizationInfoBinding.orgWebsiteInfo;
orgLocationInfo = v.findViewById(R.id.orgLocationInfo); orgLocationInfo = fragmentOrganizationInfoBinding.orgLocationInfo;
orgInfoLayout = v.findViewById(R.id.orgInfoLayout); orgInfoLayout = fragmentOrganizationInfoBinding.orgInfoLayout;
orgNameInfo.setText(orgName); orgNameInfo.setText(orgName);
getOrgInfo(Authorization.get(getContext()), 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.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.LabelsAdapter; import org.mian.gitnex.adapters.LabelsAdapter;
import org.mian.gitnex.databinding.FragmentLabelsBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.OrganizationLabelsViewModel; import org.mian.gitnex.viewmodels.OrganizationLabelsViewModel;
@ -62,13 +62,13 @@ public class OrganizationLabelsFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 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); setHasOptionsMenu(true);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh); final SwipeRefreshLayout swipeRefresh = fragmentLabelsBinding.pullToRefresh;
noData = v.findViewById(R.id.noData); noData = fragmentLabelsBinding.noData;
mRecyclerView = v.findViewById(R.id.recyclerView); mRecyclerView = fragmentLabelsBinding.recyclerView;
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -76,7 +76,7 @@ public class OrganizationLabelsFragment extends Fragment {
DividerItemDecoration.VERTICAL); DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration); mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentLabelsBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -87,7 +87,7 @@ public class OrganizationLabelsFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), repoOwner); 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.CreateOrganizationActivity;
import org.mian.gitnex.activities.MainActivity; import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.adapters.OrganizationsListAdapter; import org.mian.gitnex.adapters.OrganizationsListAdapter;
import org.mian.gitnex.databinding.FragmentOrganizationsBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.OrganizationListViewModel; import org.mian.gitnex.viewmodels.OrganizationListViewModel;
@ -46,16 +47,16 @@ public class OrganizationsFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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); setHasOptionsMenu(true);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh); final SwipeRefreshLayout swipeRefresh = fragmentOrganizationsBinding.pullToRefresh;
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navOrgs)); ((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navOrgs));
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentOrganizationsBinding.progressBar;
noDataOrg = v.findViewById(R.id.noDataOrg); noDataOrg = fragmentOrganizationsBinding.noDataOrg;
mRecyclerView = v.findViewById(R.id.recyclerView); mRecyclerView = fragmentOrganizationsBinding.recyclerView;
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -63,7 +64,7 @@ public class OrganizationsFragment extends Fragment {
DividerItemDecoration.VERTICAL); DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration); mRecyclerView.addItemDecoration(dividerItemDecoration);
createNewOrganization = v.findViewById(R.id.addNewOrganization); createNewOrganization = fragmentOrganizationsBinding.addNewOrganization;
createNewOrganization.setOnClickListener(view -> { createNewOrganization.setOnClickListener(view -> {
@ -96,7 +97,7 @@ public class OrganizationsFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext())); 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.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.ProfileEmailsAdapter; import org.mian.gitnex.adapters.ProfileEmailsAdapter;
import org.mian.gitnex.databinding.FragmentProfileEmailsBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.models.Emails; import org.mian.gitnex.models.Emails;
import org.mian.gitnex.viewmodels.ProfileEmailsViewModel; import org.mian.gitnex.viewmodels.ProfileEmailsViewModel;
@ -67,12 +67,12 @@ public class ProfileEmailsFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { 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); noDataEmails = fragmentProfileEmailsBinding.noDataEmails;
mRecyclerView = v.findViewById(R.id.recyclerView); mRecyclerView = fragmentProfileEmailsBinding.recyclerView;
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -81,7 +81,7 @@ public class ProfileEmailsFragment extends Fragment {
DividerItemDecoration.VERTICAL); DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration); mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentProfileEmailsBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -92,7 +92,7 @@ public class ProfileEmailsFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext())); 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.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.ProfileFollowersAdapter; import org.mian.gitnex.adapters.ProfileFollowersAdapter;
import org.mian.gitnex.databinding.FragmentProfileFollowersBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.models.UserInfo; import org.mian.gitnex.models.UserInfo;
import org.mian.gitnex.viewmodels.ProfileFollowersViewModel; import org.mian.gitnex.viewmodels.ProfileFollowersViewModel;
@ -67,12 +67,13 @@ public class ProfileFollowersFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { 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); final SwipeRefreshLayout swipeRefresh = fragmentProfileFollowersBinding.pullToRefresh;
mRecyclerView = v.findViewById(R.id.recyclerView);
noDataFollowers = fragmentProfileFollowersBinding.noDataFollowers;
mRecyclerView = fragmentProfileFollowersBinding.recyclerView;
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -81,7 +82,7 @@ public class ProfileFollowersFragment extends Fragment {
DividerItemDecoration.VERTICAL); DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration); mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentProfileFollowersBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -92,7 +93,7 @@ public class ProfileFollowersFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext())); fetchDataAsync(Authorization.get(getContext()));
return v; return fragmentProfileFollowersBinding.getRoot();
} }
private void fetchDataAsync(String instanceToken) { 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.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.ProfileFollowingAdapter; import org.mian.gitnex.adapters.ProfileFollowingAdapter;
import org.mian.gitnex.databinding.FragmentProfileFollowingBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.models.UserInfo; import org.mian.gitnex.models.UserInfo;
@ -68,14 +68,15 @@ public class ProfileFollowingFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { 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()); TinyDB tinyDb = TinyDB.getInstance(getContext());
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh); final SwipeRefreshLayout swipeRefresh = fragmentProfileFollowingBinding.pullToRefresh;
noDataFollowing = v.findViewById(R.id.noDataFollowing); noDataFollowing = fragmentProfileFollowingBinding.noDataFollowing;
mRecyclerView = v.findViewById(R.id.recyclerView); mRecyclerView = fragmentProfileFollowingBinding.recyclerView;
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -84,7 +85,7 @@ public class ProfileFollowingFragment extends Fragment {
DividerItemDecoration.VERTICAL); DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration); mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentProfileFollowingBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -95,7 +96,7 @@ public class ProfileFollowingFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext())); fetchDataAsync(Authorization.get(getContext()));
return v; return fragmentProfileFollowingBinding.getRoot();
} }
private void fetchDataAsync(String instanceToken) { private void fetchDataAsync(String instanceToken) {

View File

@ -10,7 +10,6 @@ import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -24,11 +23,11 @@ import com.squareup.picasso.Callback;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.MainActivity; import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.databinding.FragmentProfileBinding;
import org.mian.gitnex.helpers.ColorInverter; import org.mian.gitnex.helpers.ColorInverter;
import org.mian.gitnex.helpers.RoundedTransformation; import org.mian.gitnex.helpers.RoundedTransformation;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import java.util.Locale; import java.util.Locale;
import eightbitlab.com.blurview.BlurView;
import eightbitlab.com.blurview.RenderScriptBlur; import eightbitlab.com.blurview.RenderScriptBlur;
/** /**
@ -45,63 +44,55 @@ public class ProfileFragment extends Fragment {
ctx = getContext(); ctx = getContext();
View v = inflater.inflate(R.layout.fragment_profile, container, false); FragmentProfileBinding fragmentProfileBinding = FragmentProfileBinding.inflate(inflater, container, false);
setHasOptionsMenu(true); setHasOptionsMenu(true);
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navProfile)); ((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navProfile));
TinyDB tinyDb = TinyDB.getInstance(getContext()); TinyDB tinyDb = TinyDB.getInstance(getContext());
BlurView blurView = v.findViewById(R.id.blurView); ViewGroup aboutFrame = fragmentProfileBinding.aboutFrame;
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);
String[] userLanguageCodes = tinyDb.getString("userLang").split("-"); String[] userLanguageCodes = tinyDb.getString("userLang").split("-");
if(userLanguageCodes.length >= 2) { if(userLanguageCodes.length >= 2) {
Locale locale = new Locale(userLanguageCodes[0], userLanguageCodes[1]); Locale locale = new Locale(userLanguageCodes[0], userLanguageCodes[1]);
userLanguage.setText(locale.getDisplayLanguage()); fragmentProfileBinding.userLanguage.setText(locale.getDisplayLanguage());
} }
else { else {
userLanguage.setText(R.string.notSupported); fragmentProfileBinding.userLanguage.setText(R.string.notSupported);
} }
userFullName.setText(tinyDb.getString("userFullname")); fragmentProfileBinding.userFullName.setText(tinyDb.getString("userFullname"));
userLogin.setText(getString(R.string.usernameWithAt, tinyDb.getString("userLogin"))); fragmentProfileBinding.userLogin.setText(getString(R.string.usernameWithAt, tinyDb.getString("userLogin")));
PicassoService.getInstance(ctx).get() PicassoService.getInstance(ctx).get()
.load(tinyDb.getString("userAvatar")) .load(tinyDb.getString("userAvatar"))
.transform(new RoundedTransformation(8, 0)) .transform(new RoundedTransformation(8, 0))
.placeholder(R.drawable.loader_animated) .placeholder(R.drawable.loader_animated)
.resize(120, 120) .resize(120, 120)
.centerCrop().into(userAvatar); .centerCrop().into(fragmentProfileBinding.userAvatar);
PicassoService.getInstance(ctx).get() PicassoService.getInstance(ctx).get()
.load(tinyDb.getString("userAvatar")) .load(tinyDb.getString("userAvatar"))
.into(userAvatarBackground, new Callback() { .into(fragmentProfileBinding.userAvatarBackground, new Callback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
int invertedColor = new ColorInverter().getImageViewContrastColor(userAvatarBackground); int invertedColor = new ColorInverter().getImageViewContrastColor(fragmentProfileBinding.userAvatarBackground);
userFullName.setTextColor(invertedColor); fragmentProfileBinding.userFullName.setTextColor(invertedColor);
divider.setBackgroundColor(invertedColor); fragmentProfileBinding.divider.setBackgroundColor(invertedColor);
userLogin.setTextColor(invertedColor); fragmentProfileBinding.userLogin.setTextColor(invertedColor);
userLanguage.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)) .setBlurAlgorithm(new RenderScriptBlur(ctx))
.setBlurRadius(3) .setBlurRadius(3)
.setHasFixedTransformationMatrix(true); .setHasFixedTransformationMatrix(true);
@ -116,7 +107,7 @@ public class ProfileFragment extends Fragment {
ProfileFragment.SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager()); ProfileFragment.SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());
ViewPager mViewPager = v.findViewById(R.id.container); ViewPager mViewPager = fragmentProfileBinding.container;
mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setAdapter(mSectionsPagerAdapter);
Typeface myTypeface; 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); ViewGroup vg = (ViewGroup) tabLayout.getChildAt(0);
int tabsCount = vg.getChildCount(); int tabsCount = vg.getChildCount();
@ -160,7 +151,7 @@ public class ProfileFragment extends Fragment {
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager)); 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.activities.RepoDetailActivity;
import org.mian.gitnex.adapters.PullRequestsAdapter; import org.mian.gitnex.adapters.PullRequestsAdapter;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentPullRequestsBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.StaticGlobalVariables; import org.mian.gitnex.helpers.StaticGlobalVariables;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
@ -59,7 +60,8 @@ public class PullRequestsFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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); setHasOptionsMenu(true);
context = getContext(); context = getContext();
@ -71,19 +73,19 @@ public class PullRequestsFragment extends Fragment {
final String loginUid = tinyDb.getString("loginUid"); final String loginUid = tinyDb.getString("loginUid");
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token"); 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 gitea is 1.12 or higher use the new limit
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) { if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances; resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
} }
recyclerView = v.findViewById(R.id.recyclerView); recyclerView = fragmentPullRequestsBinding.recyclerView;
prList = new ArrayList<>(); prList = new ArrayList<>();
progressLoadMore = v.findViewById(R.id.progressLoadMore); progressLoadMore = fragmentPullRequestsBinding.progressLoadMore;
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentPullRequestsBinding.progressBar;
noData = v.findViewById(R.id.noData); noData = fragmentPullRequestsBinding.noData;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { 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); 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.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.ReleasesAdapter; import org.mian.gitnex.adapters.ReleasesAdapter;
import org.mian.gitnex.databinding.FragmentReleasesBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.models.Releases; import org.mian.gitnex.models.Releases;
@ -69,13 +69,13 @@ public class ReleasesFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { 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.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -83,7 +83,7 @@ public class ReleasesFragment extends Fragment {
DividerItemDecoration.VERTICAL); DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration); mRecyclerView.addItemDecoration(dividerItemDecoration);
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentReleasesBinding.progressBar;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
@ -94,7 +94,7 @@ public class ReleasesFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName); 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.RepoStargazersActivity;
import org.mian.gitnex.activities.RepoWatchersActivity; import org.mian.gitnex.activities.RepoWatchersActivity;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentRepoInfoBinding;
import org.mian.gitnex.helpers.AlertDialogs; import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.ClickListener; import org.mian.gitnex.helpers.ClickListener;
@ -93,7 +94,7 @@ public class RepoInfoFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 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()); TinyDB tinyDb = TinyDB.getInstance(getContext());
@ -102,31 +103,31 @@ public class RepoInfoFragment extends Fragment {
ctx = getActivity(); ctx = getActivity();
pageContent = v.findViewById(R.id.repoInfoLayout); pageContent = fragmentRepoInfoBinding.repoInfoLayout;
pageContent.setVisibility(View.GONE); pageContent.setVisibility(View.GONE);
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentRepoInfoBinding.progressBar;
repoMetaName = v.findViewById(R.id.repoMetaName); repoMetaName = fragmentRepoInfoBinding.repoMetaName;
repoMetaDescription = v.findViewById(R.id.repoMetaDescription); repoMetaDescription = fragmentRepoInfoBinding.repoMetaDescription;
repoMetaStars = v.findViewById(R.id.repoMetaStars); repoMetaStars = fragmentRepoInfoBinding.repoMetaStars;
repoMetaPullRequests = v.findViewById(R.id.repoMetaPullRequests); repoMetaPullRequests = fragmentRepoInfoBinding.repoMetaPullRequests;
repoMetaPullRequestsFrame = v.findViewById(R.id.repoMetaPullRequestsFrame); repoMetaPullRequestsFrame = fragmentRepoInfoBinding.repoMetaPullRequestsFrame;
repoMetaForks = v.findViewById(R.id.repoMetaForks); repoMetaForks = fragmentRepoInfoBinding.repoMetaForks;
repoMetaSize = v.findViewById(R.id.repoMetaSize); repoMetaSize = fragmentRepoInfoBinding.repoMetaSize;
repoMetaWatchers = v.findViewById(R.id.repoMetaWatchers); repoMetaWatchers = fragmentRepoInfoBinding.repoMetaWatchers;
repoMetaCreatedAt = v.findViewById(R.id.repoMetaCreatedAt); repoMetaCreatedAt = fragmentRepoInfoBinding.repoMetaCreatedAt;
repoMetaWebsite = v.findViewById(R.id.repoMetaWebsite); repoMetaWebsite = fragmentRepoInfoBinding.repoMetaWebsite;
repoAdditionalButton = v.findViewById(R.id.repoAdditionalButton); repoAdditionalButton = fragmentRepoInfoBinding.repoAdditionalButton;
repoFileContents = v.findViewById(R.id.repoFileContents); repoFileContents = fragmentRepoInfoBinding.repoFileContents;
repoMetaFrame = v.findViewById(R.id.repoMetaFrame); repoMetaFrame = fragmentRepoInfoBinding.repoMetaFrame;
LinearLayout repoMetaFrameHeader = v.findViewById(R.id.repoMetaFrameHeader); LinearLayout repoMetaFrameHeader = fragmentRepoInfoBinding.repoMetaFrameHeader;
repoMetaDataExpandCollapse = v.findViewById(R.id.repoMetaDataExpandCollapse); repoMetaDataExpandCollapse = fragmentRepoInfoBinding.repoMetaDataExpandCollapse;
repoFilenameExpandCollapse = v.findViewById(R.id.repoFilenameExpandCollapse); repoFilenameExpandCollapse = fragmentRepoInfoBinding.repoFilenameExpandCollapse;
fileContentsFrameHeader = v.findViewById(R.id.fileContentsFrameHeader); fileContentsFrameHeader = fragmentRepoInfoBinding.fileContentsFrameHeader;
fileContentsFrame = v.findViewById(R.id.fileContentsFrame); fileContentsFrame = fragmentRepoInfoBinding.fileContentsFrame;
LinearLayout repoMetaStarsFrame = v.findViewById(R.id.repoMetaStarsFrame); LinearLayout repoMetaStarsFrame = fragmentRepoInfoBinding.repoMetaStarsFrame;
LinearLayout repoMetaForksFrame = v.findViewById(R.id.repoMetaForksFrame); LinearLayout repoMetaForksFrame = fragmentRepoInfoBinding.repoMetaForksFrame;
LinearLayout repoMetaWatchersFrame = v.findViewById(R.id.repoMetaWatchersFrame); LinearLayout repoMetaWatchersFrame = fragmentRepoInfoBinding.repoMetaWatchersFrame;
repoMetaFrame.setVisibility(View.GONE); repoMetaFrame.setVisibility(View.GONE);
@ -161,7 +162,7 @@ public class RepoInfoFragment extends Fragment {
repoMetaPullRequestsFrame.setOnClickListener(metaPR -> RepoDetailActivity.mViewPager.setCurrentItem(3)); repoMetaPullRequestsFrame.setOnClickListener(metaPR -> RepoDetailActivity.mViewPager.setCurrentItem(3));
return v; return fragmentRepoInfoBinding.getRoot();
} }
public void onButtonPressed(Uri uri) { public void onButtonPressed(Uri uri) {

View File

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

View File

@ -26,6 +26,7 @@ import org.mian.gitnex.R;
import org.mian.gitnex.activities.CreateRepoActivity; import org.mian.gitnex.activities.CreateRepoActivity;
import org.mian.gitnex.activities.MainActivity; import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.adapters.ReposListAdapter; import org.mian.gitnex.adapters.ReposListAdapter;
import org.mian.gitnex.databinding.FragmentRepositoriesBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.RepositoriesListViewModel; import org.mian.gitnex.viewmodels.RepositoriesListViewModel;
@ -41,23 +42,24 @@ public class RepositoriesFragment extends Fragment {
private ReposListAdapter adapter; private ReposListAdapter adapter;
private ExtendedFloatingActionButton createNewRepo; private ExtendedFloatingActionButton createNewRepo;
private TextView noDataRepo; private TextView noDataRepo;
private int pageSize = 1; private final int pageSize = 1;
private int resultLimit = 50; private final int resultLimit = 50;
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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); setHasOptionsMenu(true);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh); final SwipeRefreshLayout swipeRefresh = fragmentRepositoriesBinding.pullToRefresh;
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navRepos)); ((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navRepos));
noDataRepo = v.findViewById(R.id.noData); noDataRepo = fragmentRepositoriesBinding.noData;
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentRepositoriesBinding.progressBar;
mRecyclerView = v.findViewById(R.id.recyclerView); mRecyclerView = fragmentRepositoriesBinding.recyclerView;
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -65,7 +67,7 @@ public class RepositoriesFragment extends Fragment {
DividerItemDecoration.VERTICAL); DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration); mRecyclerView.addItemDecoration(dividerItemDecoration);
createNewRepo = v.findViewById(R.id.addNewRepo); createNewRepo = fragmentRepositoriesBinding.addNewRepo;
createNewRepo.setOnClickListener(view -> { createNewRepo.setOnClickListener(view -> {
@ -98,7 +100,7 @@ public class RepositoriesFragment extends Fragment {
}, 50)); }, 50));
fetchDataAsync(Authorization.get(getContext()), pageSize, resultLimit); 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.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment; 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.SettingsReportsActivity;
import org.mian.gitnex.activities.SettingsSecurityActivity; import org.mian.gitnex.activities.SettingsSecurityActivity;
import org.mian.gitnex.activities.SettingsTranslationActivity; import org.mian.gitnex.activities.SettingsTranslationActivity;
import org.mian.gitnex.databinding.FragmentSettingsBinding;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Version; import org.mian.gitnex.helpers.Version;
@ -38,49 +38,39 @@ public class SettingsFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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(); ctx = getContext();
tinyDB = TinyDB.getInstance(ctx); tinyDB = TinyDB.getInstance(ctx);
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navSettings)); ((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")) { 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() { 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.CreateRepoActivity;
import org.mian.gitnex.activities.MainActivity; import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.adapters.StarredReposListAdapter; import org.mian.gitnex.adapters.StarredReposListAdapter;
import org.mian.gitnex.databinding.FragmentStarredRepositoriesBinding;
import org.mian.gitnex.helpers.Authorization; import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.StarredRepositoriesViewModel; import org.mian.gitnex.viewmodels.StarredRepositoriesViewModel;
@ -73,16 +74,16 @@ public class StarredRepositoriesFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_starred_repositories, container, false); FragmentStarredRepositoriesBinding fragmentStarredRepositoriesBinding = FragmentStarredRepositoriesBinding.inflate(inflater, container, false);
setHasOptionsMenu(true); setHasOptionsMenu(true);
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh); final SwipeRefreshLayout swipeRefresh = fragmentStarredRepositoriesBinding.pullToRefresh;
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navStarredRepos)); ((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navStarredRepos));
noData = v.findViewById(R.id.noData); noData = fragmentStarredRepositoriesBinding.noData;
mProgressBar = v.findViewById(R.id.progress_bar); mProgressBar = fragmentStarredRepositoriesBinding.progressBar;
mRecyclerView = v.findViewById(R.id.recyclerView); mRecyclerView = fragmentStarredRepositoriesBinding.recyclerView;
mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -90,7 +91,7 @@ public class StarredRepositoriesFragment extends Fragment {
DividerItemDecoration.VERTICAL); DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration); mRecyclerView.addItemDecoration(dividerItemDecoration);
createNewRepo = v.findViewById(R.id.addNewRepo); createNewRepo = fragmentStarredRepositoriesBinding.addNewRepo;
createNewRepo.setOnClickListener(view -> { createNewRepo.setOnClickListener(view -> {
@ -124,7 +125,7 @@ public class StarredRepositoriesFragment extends Fragment {
fetchDataAsync(Authorization.get(getContext()), pageSize, resultLimit); fetchDataAsync(Authorization.get(getContext()), pageSize, resultLimit);
return v; return fragmentStarredRepositoriesBinding.getRoot();
} }
@Override @Override

View File

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

View File

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

View File

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

View File

@ -5,6 +5,7 @@ import android.graphics.Typeface;
import android.text.Spanned; import android.text.Spanned;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.PicassoService;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
@ -76,7 +77,7 @@ public class Markdown {
public void configureTheme(@NonNull MarkwonTheme.Builder builder) { public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
builder.codeBlockTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/sourcecodeproregular.ttf")); builder.codeBlockTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/sourcecodeproregular.ttf"));
builder.codeTypeface(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.content.SharedPreferences;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat; import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.os.Environment; import android.os.Environment;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -20,8 +18,6 @@ public class TinyDB {
private static TinyDB tinyDB; private static TinyDB tinyDB;
private final SharedPreferences preferences; private final SharedPreferences preferences;
private String DEFAULT_APP_IMAGEDATA_DIRECTORY;
private String lastImagePath = "";
private TinyDB(Context appContext) { private TinyDB(Context appContext) {
preferences = appContext.getSharedPreferences(appContext.getPackageName() + "_preferences", Context.MODE_PRIVATE); preferences = appContext.getSharedPreferences(appContext.getPackageName() + "_preferences", Context.MODE_PRIVATE);
@ -35,57 +31,6 @@ public class TinyDB {
return 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' * Saves 'theBitmap' into 'fullPath'
* @param fullPath full path of the image file e.g. "Images/MeAtLunch.png" * @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); 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' * Saves the Bitmap as a PNG file at path 'fullPath'
* @param fullPath path of the image file * @param fullPath path of the image file

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import androidx.core.content.res.ResourcesCompat;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -25,7 +26,7 @@ public class UserMentions {
int indexStart = String.valueOf(bodyWithMD).indexOf(matcher.group()); int indexStart = String.valueOf(bodyWithMD).indexOf(matcher.group());
int indexEnd = indexStart + matcher.group().length(); 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; return bodyWithMentions;