Merge branch 'master' into 7-assign-team-to-repo

This commit is contained in:
M M Arif 2021-01-26 18:57:15 +01:00
commit c6ebca8a08
107 changed files with 715 additions and 922 deletions

View File

@ -60,8 +60,8 @@ dependencies {
def acra = "5.7.0"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
implementation 'com.google.android.material:material:1.3.0-alpha03'
implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
implementation 'com.google.android.material:material:1.3.0-alpha03' // Upgrading to rc01 results in failing builds
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"

View File

@ -19,3 +19,5 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-optimizationpasses 30
-allowaccessmodification

View File

@ -13,9 +13,9 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.UserSearchAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityAddCollaboratorToRepositoryBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.models.UserInfo;
import org.mian.gitnex.models.UserSearch;
@ -37,23 +37,21 @@ public class AddCollaboratorToRepositoryActivity extends BaseActivity {
private RecyclerView mRecyclerView;
@Override
protected int getLayoutResourceId(){
return R.layout.activity_add_collaborator_to_repository;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityAddCollaboratorToRepositoryBinding activityAddCollaboratorToRepositoryBinding = ActivityAddCollaboratorToRepositoryBinding.inflate(getLayoutInflater());
setContentView(activityAddCollaboratorToRepositoryBinding.getRoot());
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ImageView closeActivity = findViewById(R.id.close);
addCollaboratorSearch = findViewById(R.id.addCollaboratorSearch);
mRecyclerView = findViewById(R.id.recyclerViewUserSearch);
mProgressBar = findViewById(R.id.progressBar);
noData = findViewById(R.id.noData);
ImageView closeActivity = activityAddCollaboratorToRepositoryBinding.close;
addCollaboratorSearch = activityAddCollaboratorToRepositoryBinding.addCollaboratorSearch;
mRecyclerView = activityAddCollaboratorToRepositoryBinding.recyclerViewUserSearch;
mProgressBar = activityAddCollaboratorToRepositoryBinding.progressBar;
noData = activityAddCollaboratorToRepositoryBinding.noData;
addCollaboratorSearch.requestFocus();
assert imm != null;

View File

@ -36,20 +36,13 @@ public class AddNewAccountActivity extends BaseActivity {
private enum Protocol {HTTPS, HTTP}
private String spinnerSelectedValue;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_add_new_account;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewBinding = ActivityAddNewAccountBinding.inflate(getLayoutInflater());
View view = viewBinding.getRoot();
setContentView(view);
setContentView(viewBinding.getRoot());
getWindow().getDecorView().setBackground(new ColorDrawable(Color.TRANSPARENT));
@ -57,10 +50,9 @@ public class AddNewAccountActivity extends BaseActivity {
viewBinding.close.setOnClickListener(onClickListener);
ArrayAdapter<Protocol> adapterProtocols = new ArrayAdapter<>(ctx, R.layout.list_spinner_items, Protocol.values());
viewBinding.protocolSpinner.setAdapter(adapterProtocols);
viewBinding.protocolSpinner.setOnItemClickListener((parent, view1, position, id) -> spinnerSelectedValue = String.valueOf(parent.getItemAtPosition(position)));
viewBinding.addNewAccount.setOnClickListener(login -> {
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);

View File

@ -14,9 +14,9 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.UserSearchForTeamMemberAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityAddNewTeamMemberBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.models.UserInfo;
import org.mian.gitnex.models.UserSearch;
@ -44,23 +44,21 @@ public class AddNewTeamMemberActivity extends BaseActivity {
private String teamId;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_add_new_team_member;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityAddNewTeamMemberBinding activityAddNewTeamMemberBinding = ActivityAddNewTeamMemberBinding.inflate(getLayoutInflater());
setContentView(activityAddNewTeamMemberBinding.getRoot());
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ImageView closeActivity = findViewById(R.id.close);
addNewTeamMember = findViewById(R.id.addNewTeamMember);
mRecyclerView = findViewById(R.id.recyclerViewUserSearch);
mProgressBar = findViewById(R.id.progress_bar);
noData = findViewById(R.id.noData);
ImageView closeActivity = activityAddNewTeamMemberBinding.close;
addNewTeamMember = activityAddNewTeamMemberBinding.addNewTeamMember;
mRecyclerView = activityAddNewTeamMemberBinding.recyclerViewUserSearch;
mProgressBar = activityAddNewTeamMemberBinding.progressBar;
noData = activityAddNewTeamMemberBinding.noData;
addNewTeamMember.requestFocus();
assert imm != null;

View File

@ -21,6 +21,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.AdminGetUsersAdapter;
import org.mian.gitnex.databinding.ActivityAdminGetUsersBinding;
import org.mian.gitnex.fragments.BottomSheetAdminUsersFragment;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -38,23 +39,21 @@ public class AdminGetUsersActivity extends BaseActivity implements BottomSheetAd
private TextView noDataUsers;
private Boolean searchFilter = false;
@Override
protected int getLayoutResourceId(){
return R.layout.activity_admin_get_users;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
noDataUsers = findViewById(R.id.noDataUsers);
mRecyclerView = findViewById(R.id.recyclerView);
ActivityAdminGetUsersBinding activityAdminGetUsersBinding = ActivityAdminGetUsersBinding.inflate(getLayoutInflater());
setContentView(activityAdminGetUsersBinding.getRoot());
final SwipeRefreshLayout swipeRefresh = findViewById(R.id.pullToRefresh);
ImageView closeActivity = activityAdminGetUsersBinding.close;
noDataUsers = activityAdminGetUsersBinding.noDataUsers;
mRecyclerView = activityAdminGetUsersBinding.recyclerView;
Toolbar toolbar = findViewById(R.id.toolbar);
final SwipeRefreshLayout swipeRefresh = activityAdminGetUsersBinding.pullToRefresh;
Toolbar toolbar = activityAdminGetUsersBinding.toolbar;
setSupportActionBar(toolbar);
initCloseListener();

View File

@ -100,7 +100,6 @@ public abstract class BaseActivity extends AppCompatActivity {
AppUtil.setAppLocale(getResources(), appLocale);
super.onCreate(savedInstanceState);
setContentView(getLayoutResourceId());
// FIXME Performance nightmare
switch(tinyDB.getInt("customFontId", -1)) {
@ -177,8 +176,6 @@ public abstract class BaseActivity extends AppCompatActivity {
}
}
protected abstract int getLayoutResourceId();
}

View File

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

View File

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

View File

@ -71,11 +71,6 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
private List<Collaborators> assigneesList = new ArrayList<>();
private List<String> assigneesListData = new ArrayList<>();
@Override
protected int getLayoutResourceId() {
return R.layout.activity_create_issue;
}
@SuppressLint("ClickableViewAccessibility")
@Override
public void onCreate(Bundle savedInstanceState) {
@ -83,8 +78,7 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
super.onCreate(savedInstanceState);
viewBinding = ActivityCreateIssueBinding.inflate(getLayoutInflater());
View view = viewBinding.getRoot();
setContentView(view);
setContentView(viewBinding.getRoot());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);

View File

@ -15,6 +15,7 @@ import androidx.core.content.ContextCompat;
import com.pes.androidmaterialcolorpickerdialog.ColorPicker;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateLabelBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -40,16 +41,14 @@ public class CreateLabelActivity extends BaseActivity {
private Button createLabelButton;
private TinyDB tinyDB;
@Override
protected int getLayoutResourceId(){
return R.layout.activity_create_label;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityCreateLabelBinding activityCreateLabelBinding = ActivityCreateLabelBinding.inflate(getLayoutInflater());
setContentView(activityCreateLabelBinding.getRoot());
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
tinyDB = TinyDB.getInstance(appCtx);
@ -67,10 +66,10 @@ public class CreateLabelActivity extends BaseActivity {
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
ImageView closeActivity = findViewById(R.id.close);
colorPicker = findViewById(R.id.colorPicker);
labelName = findViewById(R.id.labelName);
createLabelButton = findViewById(R.id.createLabelButton);
ImageView closeActivity = activityCreateLabelBinding.close;
colorPicker = activityCreateLabelBinding.colorPicker;
labelName = activityCreateLabelBinding.labelName;
createLabelButton = activityCreateLabelBinding.createLabelButton;
labelName.requestFocus();
assert imm != null;
@ -97,7 +96,7 @@ public class CreateLabelActivity extends BaseActivity {
colorPicker.setBackgroundColor(labelColor_);
tinyDB.putString("labelColorDefault", "#" + getIntent().getStringExtra("labelColor"));
TextView toolbar_title = findViewById(R.id.toolbar_title);
TextView toolbar_title = activityCreateLabelBinding.toolbarTitle;
toolbar_title.setText(getResources().getString(R.string.pageTitleLabelUpdate));
createLabelButton.setText(getResources().getString(R.string.newUpdateButtonCopy));

View File

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

View File

@ -12,6 +12,7 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateNewUserBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -34,26 +35,24 @@ public class CreateNewUserActivity extends BaseActivity {
private EditText userPassword;
private Button createUserButton;
@Override
protected int getLayoutResourceId(){
return R.layout.activity_create_new_user;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityCreateNewUserBinding activityCreateNewUserBinding = ActivityCreateNewUserBinding.inflate(getLayoutInflater());
setContentView(activityCreateNewUserBinding.getRoot());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ImageView closeActivity = findViewById(R.id.close);
createUserButton = findViewById(R.id.createUserButton);
fullName = findViewById(R.id.fullName);
userUserName = findViewById(R.id.userUserName);
userEmail = findViewById(R.id.userEmail);
userPassword = findViewById(R.id.userPassword);
ImageView closeActivity = activityCreateNewUserBinding.close;
createUserButton = activityCreateNewUserBinding.createUserButton;
fullName = activityCreateNewUserBinding.fullName;
userUserName = activityCreateNewUserBinding.userUserName;
userEmail = activityCreateNewUserBinding.userEmail;
userPassword = activityCreateNewUserBinding.userPassword;
fullName.requestFocus();
assert imm != null;

View File

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

View File

@ -61,14 +61,6 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
List<Branches> branchesList = new ArrayList<>();
List<Labels> labelsList = new ArrayList<>();
public CreatePullRequestActivity() {
}
@Override
protected int getLayoutResourceId(){
return R.layout.activity_create_pr;
}
@SuppressLint("ClickableViewAccessibility")
@Override
public void onCreate(Bundle savedInstanceState) {
@ -76,8 +68,7 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
super.onCreate(savedInstanceState);
viewBinding = ActivityCreatePrBinding.inflate(getLayoutInflater());
View view = viewBinding.getRoot();
setContentView(view);
setContentView(viewBinding.getRoot());
loginUid = tinyDB.getString("loginUid");
String repoFullName = tinyDB.getString("repoFullName");

View File

@ -16,6 +16,7 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateReleaseBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -49,17 +50,15 @@ public class CreateReleaseActivity extends BaseActivity {
List<Branches> branchesList = new ArrayList<>();
@Override
protected int getLayoutResourceId(){
return R.layout.activity_create_release;
}
@SuppressLint("ClickableViewAccessibility")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityCreateReleaseBinding activityCreateReleaseBinding = ActivityCreateReleaseBinding.inflate(getLayoutInflater());
setContentView(activityCreateReleaseBinding.getRoot());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@ -69,12 +68,12 @@ public class CreateReleaseActivity extends BaseActivity {
repoOwner = parts[0];
repoName = parts[1];
closeActivity = findViewById(R.id.close);
releaseTagName = findViewById(R.id.releaseTagName);
releaseTitle = findViewById(R.id.releaseTitle);
releaseContent = findViewById(R.id.releaseContent);
releaseType = findViewById(R.id.releaseType);
releaseDraft = findViewById(R.id.releaseDraft);
closeActivity = activityCreateReleaseBinding.close;
releaseTagName = activityCreateReleaseBinding.releaseTagName;
releaseTitle = activityCreateReleaseBinding.releaseTitle;
releaseContent = activityCreateReleaseBinding.releaseContent;
releaseType = activityCreateReleaseBinding.releaseType;
releaseDraft = activityCreateReleaseBinding.releaseDraft;
releaseTitle.requestFocus();
assert imm != null;
@ -94,10 +93,10 @@ public class CreateReleaseActivity extends BaseActivity {
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
releaseBranch = findViewById(R.id.releaseBranch);
releaseBranch = activityCreateReleaseBinding.releaseBranch;
getBranches(Authorization.get(ctx), repoOwner, repoName);
createNewRelease = findViewById(R.id.createNewRelease);
createNewRelease = activityCreateReleaseBinding.createNewRelease;
disableProcessButton();
if(!connToInternet) {

View File

@ -16,6 +16,7 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateRepoBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -55,16 +56,14 @@ public class CreateRepoActivity extends BaseActivity {
final List<String> reservedRepoNames = Arrays.asList(".", "..");
final Pattern reservedRepoPatterns = Pattern.compile("\\.(git|wiki)$");
@Override
protected int getLayoutResourceId(){
return R.layout.activity_new_repo;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityCreateRepoBinding activityCreateRepoBinding = ActivityCreateRepoBinding.inflate(getLayoutInflater());
setContentView(activityCreateRepoBinding.getRoot());
boolean connToInternet = AppUtil.hasNetworkConnection(ctx);
loginUid = tinyDB.getString("loginUid");
@ -72,10 +71,10 @@ public class CreateRepoActivity extends BaseActivity {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
closeActivity = findViewById(R.id.close);
repoName = findViewById(R.id.newRepoName);
repoDesc = findViewById(R.id.newRepoDescription);
repoAccess = findViewById(R.id.newRepoPrivate);
closeActivity = activityCreateRepoBinding.close;
repoName = activityCreateRepoBinding.newRepoName;
repoDesc = activityCreateRepoBinding.newRepoDescription;
repoAccess = activityCreateRepoBinding.newRepoPrivate;
repoName.requestFocus();
assert imm != null;
@ -84,10 +83,10 @@ public class CreateRepoActivity extends BaseActivity {
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
spinner = findViewById(R.id.ownerSpinner);
spinner = activityCreateRepoBinding.ownerSpinner;
getOrganizations(Authorization.get(ctx), userLogin);
createRepo = findViewById(R.id.createNewRepoButton);
createRepo = activityCreateRepoBinding.createNewRepoButton;
disableProcessButton();
if(!connToInternet) {

View File

@ -11,8 +11,10 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.res.ResourcesCompat;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateTeamByOrgBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -42,11 +44,6 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
private final String[] permissionList = {"Read", "Write", "Admin"};
public int permissionSelectedChoice = -1;
@Override
protected int getLayoutResourceId(){
return R.layout.activity_create_team_by_org;
}
private final String[] accessControlsList = new String[] {
"Code",
"Issues",
@ -74,18 +71,21 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
super.onCreate(savedInstanceState);
ActivityCreateTeamByOrgBinding activityCreateTeamByOrgBinding = ActivityCreateTeamByOrgBinding.inflate(getLayoutInflater());
setContentView(activityCreateTeamByOrgBinding.getRoot());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ImageView closeActivity = findViewById(R.id.close);
teamName = findViewById(R.id.teamName);
teamDesc = findViewById(R.id.teamDesc);
teamPermission = findViewById(R.id.teamPermission);
teamPermissionDetail = findViewById(R.id.teamPermissionDetail);
teamAccessControls = findViewById(R.id.teamAccessControls);
teamAccessControlsArray = findViewById(R.id.teamAccessControlsArray);
createTeamButton = findViewById(R.id.createTeamButton);
ImageView closeActivity = activityCreateTeamByOrgBinding.close;
teamName = activityCreateTeamByOrgBinding.teamName;
teamDesc = activityCreateTeamByOrgBinding.teamDesc;
teamPermission = activityCreateTeamByOrgBinding.teamPermission;
teamPermissionDetail = activityCreateTeamByOrgBinding.teamPermissionDetail;
teamAccessControls = activityCreateTeamByOrgBinding.teamAccessControls;
teamAccessControlsArray = activityCreateTeamByOrgBinding.teamAccessControlsArray;
createTeamButton = activityCreateTeamByOrgBinding.createTeamButton;
teamName.requestFocus();
assert imm != null;
@ -210,9 +210,9 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
if(!connToInternet) {
createTeamButton.setEnabled(false);
GradientDrawable shape = new GradientDrawable();
shape.setCornerRadius( 8 );
shape.setColor(getResources().getColor(R.color.hintColor));
GradientDrawable shape = new GradientDrawable();
shape.setCornerRadius(8);
shape.setColor(ResourcesCompat.getColor(getResources(), R.color.hintColor, null));
createTeamButton.setBackground(shape);
}
else {

View File

@ -41,20 +41,13 @@ public class DeepLinksActivity extends BaseActivity {
private Intent issueIntent;
private Intent repoIntent;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_deeplinks;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewBinding = ActivityDeeplinksBinding.inflate(getLayoutInflater());
View view = viewBinding.getRoot();
setContentView(view);
setContentView(viewBinding.getRoot());
mainIntent = new Intent(ctx, MainActivity.class);
issueIntent = new Intent(ctx, IssueDetailActivity.class);

View File

@ -20,6 +20,7 @@ import androidx.annotation.NonNull;
import com.google.gson.JsonElement;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityEditIssueBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -63,17 +64,15 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
private String repoName;
private int issueIndex;
@Override
protected int getLayoutResourceId(){
return R.layout.activity_edit_issue;
}
@SuppressLint("ClickableViewAccessibility")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityEditIssueBinding activityEditIssueBinding = ActivityEditIssueBinding.inflate(getLayoutInflater());
setContentView(activityEditIssueBinding.getRoot());
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
loginUid = tinyDB.getString("loginUid");
@ -84,12 +83,12 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
repoName = parts[1];
issueIndex = Integer.parseInt(tinyDB.getString("issueNumber"));
ImageView closeActivity = findViewById(R.id.close);
editIssueButton = findViewById(R.id.editIssueButton);
TextView toolbar_title = findViewById(R.id.toolbar_title);
editIssueTitle = findViewById(R.id.editIssueTitle);
editIssueDescription = findViewById(R.id.editIssueDescription);
editIssueDueDate = findViewById(R.id.editIssueDueDate);
ImageView closeActivity = activityEditIssueBinding.close;
editIssueButton = activityEditIssueBinding.editIssueButton;
TextView toolbar_title = activityEditIssueBinding.toolbarTitle;
editIssueTitle = activityEditIssueBinding.editIssueTitle;
editIssueDescription = activityEditIssueBinding.editIssueDescription;
editIssueDueDate = activityEditIssueBinding.editIssueDueDate;
// if gitea is 1.12 or higher use the new limit
if(new Version(tinyDB.getString("giteaVersion")).higherOrEqual("1.12.0")) {

View File

@ -12,6 +12,7 @@ import androidx.appcompat.widget.Toolbar;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.FilesDiffAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityFileDiffBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.ParseDiff;
import org.mian.gitnex.helpers.TinyDB;
@ -35,18 +36,15 @@ public class FileDiffActivity extends BaseActivity {
private ListView mListView;
private ProgressBar mProgressBar;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_file_diff;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toolbar toolbar = findViewById(R.id.toolbar);
ActivityFileDiffBinding activityFileDiffBinding = ActivityFileDiffBinding.inflate(getLayoutInflater());
setContentView(activityFileDiffBinding.getRoot());
Toolbar toolbar = activityFileDiffBinding.toolbar;
setSupportActionBar(toolbar);
final TinyDB tinyDb = TinyDB.getInstance(appCtx);
@ -57,10 +55,10 @@ public class FileDiffActivity extends BaseActivity {
final String loginUid = tinyDb.getString("loginUid");
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
ImageView closeActivity = findViewById(R.id.close);
toolbarTitle = findViewById(R.id.toolbar_title);
mListView = findViewById(R.id.listView);
mProgressBar = findViewById(R.id.progress_bar);
ImageView closeActivity = activityFileDiffBinding.close;
toolbarTitle = activityFileDiffBinding.toolbarTitle;
mListView = activityFileDiffBinding.listView;
mProgressBar = activityFileDiffBinding.progressBar;
mListView.setDivider(null);

View File

@ -29,9 +29,11 @@ import androidx.appcompat.widget.Toolbar;
import com.github.barteksc.pdfviewer.PDFView;
import com.github.barteksc.pdfviewer.util.FitPolicy;
import com.github.chrisbanes.photoview.PhotoView;
import com.vdurmont.emoji.EmojiParser;
import org.apache.commons.io.FileUtils;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityFileViewBinding;
import org.mian.gitnex.fragments.BottomSheetFileViewerFragment;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
@ -70,19 +72,16 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
private String fileSha;
private AppUtil appUtil;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_file_view;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
appUtil = new AppUtil();
Toolbar toolbar = findViewById(R.id.toolbar);
ActivityFileViewBinding activityFileViewBinding = ActivityFileViewBinding.inflate(getLayoutInflater());
setContentView(activityFileViewBinding.getRoot());
Toolbar toolbar = activityFileViewBinding.toolbar;
setSupportActionBar(toolbar);
String repoFullName = tinyDB.getString("repoFullName");
@ -95,18 +94,18 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
tinyDB.putBoolean("enableMarkdownInFileView", false);
ImageView closeActivity = findViewById(R.id.close);
singleFileContents = findViewById(R.id.singleFileContents);
singleCodeContents = findViewById(R.id.singleCodeContents);
imageView = findViewById(R.id.imageView);
mProgressBar = findViewById(R.id.progress_bar);
pdfView = findViewById(R.id.pdfView);
pdfViewFrame = findViewById(R.id.pdfViewFrame);
singleFileContentsFrame = findViewById(R.id.singleFileContentsFrame);
ImageView closeActivity = activityFileViewBinding.close;
singleFileContents = activityFileViewBinding.singleFileContents;
singleCodeContents = activityFileViewBinding.singleCodeContents;
imageView = activityFileViewBinding.imageView;
mProgressBar = activityFileViewBinding.progressBar;
pdfView = activityFileViewBinding.pdfView;
pdfViewFrame = activityFileViewBinding.pdfViewFrame;
singleFileContentsFrame = activityFileViewBinding.singleFileContentsFrame;
singleFileName = getIntent().getStringExtra("singleFileName");
TextView toolbar_title = findViewById(R.id.toolbar_title);
TextView toolbar_title = activityFileViewBinding.toolbarTitle;
toolbar_title.setMovementMethod(new ScrollingMovementMethod());
initCloseListener();
@ -324,7 +323,7 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
}
else if(id == R.id.markdown) {
new Markdown(ctx, appUtil.decodeBase64(tinyDB.getString("downloadFileContents")), singleFileContents);
new Markdown(ctx, EmojiParser.parseToUnicode(appUtil.decodeBase64(tinyDB.getString("downloadFileContents"))), singleFileContents);
if(!tinyDB.getBoolean("enableMarkdownInFileView")) {

View File

@ -9,7 +9,6 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Html;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
@ -22,6 +21,8 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
@ -89,8 +90,8 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
private List<Integer> currentLabelsIds = new ArrayList<>();
private List<Integer> labelsIds = new ArrayList<>();
private List<Labels> labelsList = new ArrayList<>();
private List<Collaborators> assigneesList = new ArrayList<>();
private final List<Labels> labelsList = new ArrayList<>();
private final List<Collaborators> assigneesList = new ArrayList<>();
private List<String> assigneesListData = new ArrayList<>();
private List<String> currentAssignees = new ArrayList<>();
@ -101,20 +102,13 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
private CustomAssigneesSelectionDialogBinding assigneesBinding;
private ActivityIssueDetailBinding viewBinding;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_issue_detail;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewBinding = ActivityIssueDetailBinding.inflate(getLayoutInflater());
View view = viewBinding.getRoot();
setContentView(view);
setContentView(viewBinding.getRoot());
String repoFullName = tinyDB.getString("repoFullName");
String[] parts = repoFullName.split("/");
@ -583,9 +577,9 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
PicassoService.getInstance(ctx).get().load(singleIssue.getUser().getAvatar_url()).placeholder(R.drawable.loader_animated)
.transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(viewBinding.assigneeAvatar);
String issueNumber_ = "<font color='" + appCtx.getResources().getColor(R.color.lightGray) + "'>" + appCtx.getResources()
String issueNumber_ = "<font color='" + ResourcesCompat.getColor(getResources(), R.color.lightGray, null) + "'>" + appCtx.getResources()
.getString(R.string.hash) + singleIssue.getNumber() + "</font>";
viewBinding.issueTitle.setText(Html.fromHtml(issueNumber_ + " " + singleIssue.getTitle()));
viewBinding.issueTitle.setText(HtmlCompat.fromHtml(issueNumber_ + " " + EmojiParser.parseToUnicode(singleIssue.getTitle()), HtmlCompat.FROM_HTML_MODE_LEGACY));
String cleanIssueDescription = singleIssue.getBody().trim();
new Markdown(ctx, EmojiParser.parseToUnicode(cleanIssueDescription), viewBinding.issueDescription);

View File

@ -10,13 +10,13 @@ import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.database.api.UserAccountsApi;
import org.mian.gitnex.database.models.UserAccount;
import org.mian.gitnex.databinding.ActivityLoginBinding;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.NetworkStatusObserver;
import org.mian.gitnex.helpers.PathsHelper;
@ -53,29 +53,26 @@ public class LoginActivity extends BaseActivity {
private String device_id = "token";
private String selectedProtocol;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_login;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityLoginBinding activityLoginBinding = ActivityLoginBinding.inflate(getLayoutInflater());
setContentView(activityLoginBinding.getRoot());
NetworkStatusObserver networkStatusObserver = NetworkStatusObserver.get(ctx);
loginButton = findViewById(R.id.login_button);
instanceUrlET = findViewById(R.id.instance_url);
loginUidET = findViewById(R.id.login_uid);
loginPassword = findViewById(R.id.login_passwd);
otpCode = findViewById(R.id.otpCode);
protocolSpinner = findViewById(R.id.httpsSpinner);
loginMethod = findViewById(R.id.loginMethod);
loginTokenCode = findViewById(R.id.loginTokenCode);
loginButton = activityLoginBinding.loginButton;
instanceUrlET = activityLoginBinding.instanceUrl;
loginUidET = activityLoginBinding.loginUid;
loginPassword = activityLoginBinding.loginPasswd;
otpCode = activityLoginBinding.otpCode;
protocolSpinner = activityLoginBinding.httpsSpinner;
loginMethod = activityLoginBinding.loginMethod;
loginTokenCode = activityLoginBinding.loginTokenCode;
((TextView) findViewById(R.id.appVersion)).setText(AppUtil.getAppVersion(appCtx));
activityLoginBinding.appVersion.setText(AppUtil.getAppVersion(appCtx));
ArrayAdapter<Protocol> adapterProtocols = new ArrayAdapter<>(LoginActivity.this, R.layout.list_spinner_items, Protocol.values());

View File

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

View File

@ -41,12 +41,6 @@ public class MergePullRequestActivity extends BaseActivity {
private String Do;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_merge_pull_request;
}
@SuppressLint("SetTextI18n")
@Override
public void onCreate(Bundle savedInstanceState) {
@ -54,8 +48,7 @@ public class MergePullRequestActivity extends BaseActivity {
super.onCreate(savedInstanceState);
viewBinding = ActivityMergePullRequestBinding.inflate(getLayoutInflater());
View view = viewBinding.getRoot();
setContentView(view);
setContentView(viewBinding.getRoot());
String repoFullName = tinyDB.getString("repoFullName");
String[] parts = repoFullName.split("/");

View File

@ -36,20 +36,17 @@ import io.mikael.urlbuilder.UrlBuilder;
public class OrganizationDetailActivity extends BaseActivity implements BottomSheetOrganizationFragment.BottomSheetListener {
@Override
protected int getLayoutResourceId(){
return R.layout.activity_org_detail;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_org_detail);
String orgName = tinyDB.getString("orgName");
Toolbar toolbar = findViewById(R.id.toolbar);
TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
TextView toolbarTitle = findViewById(R.id.toolbar_title);
setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setTitle(orgName);

View File

@ -14,6 +14,7 @@ import androidx.appcompat.widget.Toolbar;
import androidx.lifecycle.ViewModelProvider;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.TeamMembersByOrgAdapter;
import org.mian.gitnex.databinding.ActivityOrgTeamMembersBinding;
import org.mian.gitnex.fragments.BottomSheetOrganizationTeamsFragment;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB;
@ -34,24 +35,22 @@ public class OrganizationTeamMembersActivity extends BaseActivity implements Bot
private String teamId;
@Override
protected int getLayoutResourceId(){
return R.layout.activity_org_team_members;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toolbar toolbar = findViewById(R.id.toolbar);
ActivityOrgTeamMembersBinding activityOrgTeamMembersBinding = ActivityOrgTeamMembersBinding.inflate(getLayoutInflater());
setContentView(activityOrgTeamMembersBinding.getRoot());
Toolbar toolbar = activityOrgTeamMembersBinding.toolbar;
setSupportActionBar(toolbar);
ImageView closeActivity = findViewById(R.id.close);
TextView toolbarTitle = findViewById(R.id.toolbar_title);
noDataMembers = findViewById(R.id.noDataMembers);
mGridView = findViewById(R.id.gridView);
progressBar = findViewById(R.id.progressBar);
ImageView closeActivity = activityOrgTeamMembersBinding.close;
TextView toolbarTitle = activityOrgTeamMembersBinding.toolbarTitle;
noDataMembers = activityOrgTeamMembersBinding.noDataMembers;
mGridView = activityOrgTeamMembersBinding.gridView;
progressBar = activityOrgTeamMembersBinding.progressBar;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);

View File

@ -13,6 +13,7 @@ import androidx.annotation.NonNull;
import com.google.gson.JsonElement;
import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityProfileEmailBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Authorization;
@ -35,23 +36,21 @@ public class ProfileEmailActivity extends BaseActivity {
private EditText userEmail;
private Button addEmailButton;
@Override
protected int getLayoutResourceId(){
return R.layout.activity_profile_email;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityProfileEmailBinding activityProfileEmailBinding = ActivityProfileEmailBinding.inflate(getLayoutInflater());
setContentView(activityProfileEmailBinding.getRoot());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
ImageView closeActivity = findViewById(R.id.close);
userEmail = findViewById(R.id.userEmail);
addEmailButton = findViewById(R.id.addEmailButton);
ImageView closeActivity = activityProfileEmailBinding.close;
userEmail = activityProfileEmailBinding.userEmail;
addEmailButton = activityProfileEmailBinding.addEmailButton;
userEmail.requestFocus();
assert imm != null;

View File

@ -79,24 +79,20 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
public static ViewPager mViewPager;
private int tabsCount;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_repo_detail;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_repo_detail);
String[] repoNameParts = tinyDB.getString("repoFullName").split("/");
repositoryOwner = repoNameParts[0];
repositoryName = repoNameParts[1];
Toolbar toolbar = findViewById(R.id.toolbar);
TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
TextView toolbarTitle = findViewById(R.id.toolbar_title);
toolbarTitle.setText(repositoryName);
setSupportActionBar(toolbar);

View File

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

View File

@ -9,6 +9,7 @@ import android.widget.TextView;
import androidx.lifecycle.ViewModelProvider;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.RepoStargazersAdapter;
import org.mian.gitnex.databinding.ActivityRepoStargazersBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.viewmodels.RepoStargazersViewModel;
@ -24,21 +25,19 @@ public class RepoStargazersActivity extends BaseActivity {
private GridView mGridView;
private ProgressBar mProgressBar;
@Override
protected int getLayoutResourceId(){
return R.layout.activity_repo_stargazers;
}
@Override
public void onCreate(Bundle savedInstanceState) {
ActivityRepoStargazersBinding activityRepoStargazersBinding = ActivityRepoStargazersBinding.inflate(getLayoutInflater());
setContentView(activityRepoStargazersBinding.getRoot());
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
TextView toolbarTitle = findViewById(R.id.toolbar_title);
noDataStargazers = findViewById(R.id.noDataStargazers);
mGridView = findViewById(R.id.gridView);
mProgressBar = findViewById(R.id.progress_bar);
ImageView closeActivity = activityRepoStargazersBinding.close;
TextView toolbarTitle = activityRepoStargazersBinding.toolbarTitle;
noDataStargazers = activityRepoStargazersBinding.noDataStargazers;
mGridView = activityRepoStargazersBinding.gridView;
mProgressBar = activityRepoStargazersBinding.progressBar;
String repoFullNameForStars = getIntent().getStringExtra("repoFullNameForStars");
String[] parts = repoFullNameForStars.split("/");

View File

@ -9,6 +9,7 @@ import android.widget.TextView;
import androidx.lifecycle.ViewModelProvider;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.RepoWatchersAdapter;
import org.mian.gitnex.databinding.ActivityRepoWatchersBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.viewmodels.RepoWatchersViewModel;
@ -24,21 +25,19 @@ public class RepoWatchersActivity extends BaseActivity {
private GridView mGridView;
private ProgressBar mProgressBar;
@Override
protected int getLayoutResourceId(){
return R.layout.activity_repo_watchers;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
TextView toolbarTitle = findViewById(R.id.toolbar_title);
noDataWatchers = findViewById(R.id.noDataWatchers);
mGridView = findViewById(R.id.gridView);
mProgressBar = findViewById(R.id.progress_bar);
ActivityRepoWatchersBinding activityRepoWatchersBinding = ActivityRepoWatchersBinding.inflate(getLayoutInflater());
setContentView(activityRepoWatchersBinding.getRoot());
ImageView closeActivity = activityRepoWatchersBinding.close;
TextView toolbarTitle = activityRepoWatchersBinding.toolbarTitle;
noDataWatchers = activityRepoWatchersBinding.noDataWatchers;
mGridView = activityRepoWatchersBinding.gridView;
mProgressBar = activityRepoWatchersBinding.progressBar;
String repoFullNameForWatchers = getIntent().getStringExtra("repoFullNameForWatchers");
String[] parts = repoFullNameForWatchers.split("/");

View File

@ -45,19 +45,13 @@ public class RepositorySettingsActivity extends BaseActivity {
private String repositoryOwner;
private String repositoryName;
@Override
protected int getLayoutResourceId(){
return R.layout.activity_repository_settings;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewBinding = ActivityRepositorySettingsBinding.inflate(getLayoutInflater());
View view = viewBinding.getRoot();
setContentView(view);
setContentView(viewBinding.getRoot());
loginUid = tinyDB.getString("loginUid");
String repoFullName = tinyDB.getString("repoFullName");

View File

@ -8,6 +8,7 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.google.android.material.switchmaterial.SwitchMaterial;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivitySettingsAppearanceBinding;
import org.mian.gitnex.helpers.Toasty;
/**
@ -27,28 +28,25 @@ public class SettingsAppearanceActivity extends BaseActivity {
private static final String[] themeList = {"Dark", "Light", "Auto (Light / Dark)", "Retro", "Auto (Retro / Dark)", "Pitch Black"};
private static int themeSelectedChoice = 0;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_settings_appearance;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
ActivitySettingsAppearanceBinding activitySettingsAppearanceBinding = ActivitySettingsAppearanceBinding.inflate(getLayoutInflater());
setContentView(activitySettingsAppearanceBinding.getRoot());
final TextView tvDateTimeSelected = findViewById(R.id.tvDateTimeSelected); // setter for time
final TextView customFontSelected = findViewById(R.id.customFontSelected); // setter for custom font
final TextView themeSelected = findViewById(R.id.themeSelected); // setter for theme
ImageView closeActivity = activitySettingsAppearanceBinding.close;
LinearLayout timeFrame = findViewById(R.id.timeFrame);
LinearLayout customFontFrame = findViewById(R.id.customFontFrame);
LinearLayout themeFrame = findViewById(R.id.themeSelectionFrame);
final TextView tvDateTimeSelected = activitySettingsAppearanceBinding.tvDateTimeSelected; // setter for time
final TextView customFontSelected = activitySettingsAppearanceBinding.customFontSelected; // setter for custom font
final TextView themeSelected = activitySettingsAppearanceBinding.themeSelected; // setter for theme
SwitchMaterial counterBadgesSwitch = findViewById(R.id.switchCounterBadge);
LinearLayout timeFrame = activitySettingsAppearanceBinding.timeFrame;
LinearLayout customFontFrame = activitySettingsAppearanceBinding.customFontFrame;
LinearLayout themeFrame = activitySettingsAppearanceBinding.themeSelectionFrame;
SwitchMaterial counterBadgesSwitch = activitySettingsAppearanceBinding.switchCounterBadge;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);

View File

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

View File

@ -8,6 +8,7 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.google.android.material.switchmaterial.SwitchMaterial;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivitySettingsFileviewerBinding;
import org.mian.gitnex.helpers.Toasty;
/**
@ -21,27 +22,22 @@ public class SettingsFileViewerActivity extends BaseActivity {
private static final String[] fileViewerSourceCodeThemesList = {"Sublime", "Arduino Light", "Github", "Far ", "Ir Black", "Android Studio"};
private static int fileViewerSourceCodeThemesSelectedChoice = 0;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_settings_fileview;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
ActivitySettingsFileviewerBinding activitySettingsFileviewerBinding = ActivitySettingsFileviewerBinding.inflate(getLayoutInflater());
setContentView(activitySettingsFileviewerBinding.getRoot());
ImageView closeActivity = activitySettingsFileviewerBinding.close;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
final TextView fileViewerSourceCodeThemesSelected = findViewById(R.id.sourceCodeThemeSelected); // setter for fileviewer theme
LinearLayout sourceCodeThemeFrame = findViewById(R.id.sourceCodeThemeFrame);
SwitchMaterial pdfModeSwitch = findViewById(R.id.switchPdfMode);
TextView fileViewerSourceCodeThemesSelected = activitySettingsFileviewerBinding.sourceCodeThemeSelected; // setter for fileviewer theme
LinearLayout sourceCodeThemeFrame = activitySettingsFileviewerBinding.sourceCodeThemeFrame;
SwitchMaterial pdfModeSwitch = activitySettingsFileviewerBinding.switchPdfMode;
if(!tinyDB.getString("fileviewerSourceCodeThemeStr").isEmpty()) {
fileViewerSourceCodeThemesSelected.setText(tinyDB.getString("fileviewerSourceCodeThemeStr"));

View File

@ -26,20 +26,13 @@ public class SettingsGeneralActivity extends BaseActivity {
private List<String> defaultScreen;
private static int defaultLinkHandlerScreenSelectedChoice = 0;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_settings_general;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewBinding = ActivitySettingsGeneralBinding.inflate(getLayoutInflater());
View view = viewBinding.getRoot();
setContentView(view);
setContentView(viewBinding.getRoot());
initCloseListener();
viewBinding.close.setOnClickListener(onClickListener);

View File

@ -21,20 +21,13 @@ public class SettingsNotificationsActivity extends BaseActivity {
private ActivitySettingsNotificationsBinding viewBinding;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_settings_notifications;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewBinding = ActivitySettingsNotificationsBinding.inflate(getLayoutInflater());
View view = viewBinding.getRoot();
setContentView(view);
setContentView(viewBinding.getRoot());
View.OnClickListener onClickListener = viewClose -> finish();

View File

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

View File

@ -11,6 +11,7 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import org.apache.commons.io.FileUtils;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivitySettingsSecurityBinding;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.ssl.MemorizingTrustManager;
import java.io.File;
@ -30,30 +31,27 @@ public class SettingsSecurityActivity extends BaseActivity {
private static final String[] cacheSizeImagesList = {"50 MB", "100 MB", "250 MB", "500 MB", "1 GB"};
private static int cacheSizeImagesSelectedChoice = 0;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_settings_security;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
ActivitySettingsSecurityBinding activitySettingsSecurityBinding = ActivitySettingsSecurityBinding.inflate(getLayoutInflater());
setContentView(activitySettingsSecurityBinding.getRoot());
ImageView closeActivity = activitySettingsSecurityBinding.close;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
TextView cacheSizeDataSelected = findViewById(R.id.cacheSizeDataSelected); // setter for data cache size
TextView cacheSizeImagesSelected = findViewById(R.id.cacheSizeImagesSelected); // setter for images cache size
TextView clearCacheSelected = findViewById(R.id.clearCacheSelected); // setter for clear cache
TextView cacheSizeDataSelected = activitySettingsSecurityBinding.cacheSizeDataSelected; // setter for data cache size
TextView cacheSizeImagesSelected = activitySettingsSecurityBinding.cacheSizeImagesSelected; // setter for images cache size
TextView clearCacheSelected = activitySettingsSecurityBinding.clearCacheSelected; // setter for clear cache
LinearLayout certsFrame = findViewById(R.id.certsFrame);
LinearLayout cacheSizeDataFrame = findViewById(R.id.cacheSizeDataSelectionFrame);
LinearLayout cacheSizeImagesFrame = findViewById(R.id.cacheSizeImagesSelectionFrame);
LinearLayout clearCacheFrame = findViewById(R.id.clearCacheSelectionFrame);
LinearLayout certsFrame = activitySettingsSecurityBinding.certsFrame;
LinearLayout cacheSizeDataFrame = activitySettingsSecurityBinding.cacheSizeDataSelectionFrame;
LinearLayout cacheSizeImagesFrame = activitySettingsSecurityBinding.cacheSizeImagesSelectionFrame;
LinearLayout clearCacheFrame = activitySettingsSecurityBinding.clearCacheSelectionFrame;
if(!tinyDB.getString("cacheSizeStr").isEmpty()) {

View File

@ -9,6 +9,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivitySettingsTranslationBinding;
import org.mian.gitnex.helpers.Toasty;
/**
@ -23,26 +24,23 @@ public class SettingsTranslationActivity extends BaseActivity {
"Polish", "Portuguese/Brazilian", "Russian", "Serbian", "Spanish", "Turkish", "Ukrainian"};
private static int langSelectedChoice = 0;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_settings_translation;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImageView closeActivity = findViewById(R.id.close);
ActivitySettingsTranslationBinding activitySettingsTranslationBinding = ActivitySettingsTranslationBinding.inflate(getLayoutInflater());
setContentView(activitySettingsTranslationBinding.getRoot());
ImageView closeActivity = activitySettingsTranslationBinding.close;
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
final TextView tvLanguageSelected = findViewById(R.id.tvLanguageSelected); // setter for en, fr
TextView helpTranslate = findViewById(R.id.helpTranslate);
final TextView tvLanguageSelected = activitySettingsTranslationBinding.tvLanguageSelected; // setter for en, fr
TextView helpTranslate = activitySettingsTranslationBinding.helpTranslate;
LinearLayout langFrame = findViewById(R.id.langFrame);
LinearLayout langFrame = activitySettingsTranslationBinding.langFrame;
helpTranslate.setOnClickListener(v12 -> {

View File

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

View File

@ -11,6 +11,7 @@ import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.vdurmont.emoji.EmojiParser;
import org.mian.gitnex.R;
import org.mian.gitnex.helpers.ClickListener;
import org.mian.gitnex.helpers.TimeHelper;
@ -25,7 +26,7 @@ import java.util.Locale;
public class CommitsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private Context ctx;
private final Context ctx;
private final int TYPE_LOAD = 0;
private List<Commits> commitsList;
private CommitsAdapter.OnLoadMoreListener loadMoreListener;
@ -116,7 +117,7 @@ public class CommitsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
final String locale = tinyDb.getString("locale");
final String timeFormat = tinyDb.getString("dateFormat");
commitTitle.setText(commitsModel.getCommit().getMessage());
commitTitle.setText(EmojiParser.parseToUnicode(commitsModel.getCommit().getMessage()));
commitCommitter.setText(ctx.getString(R.string.commitCommittedBy, commitsModel.getCommit().getCommitter().getName()));
commitDate.setText(TimeHelper.formatTime(commitsModel.getCommit().getCommitter().getDate(), new Locale(locale), timeFormat, ctx));

View File

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

View File

@ -3,7 +3,6 @@ package org.mian.gitnex.adapters;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -11,7 +10,10 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.vdurmont.emoji.EmojiParser;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.IssueDetailActivity;
import org.mian.gitnex.clients.PicassoService;
@ -32,7 +34,7 @@ import java.util.Locale;
public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private Context context;
private final Context context;
private final int TYPE_LOAD = 0;
private List<Issues> issuesList;
private OnLoadMoreListener loadMoreListener;
@ -99,11 +101,11 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
class IssuesHolder extends RecyclerView.ViewHolder {
private TextView issueNumber;
private ImageView issueAssigneeAvatar;
private TextView issueTitle;
private TextView issueCreatedTime;
private TextView issueCommentsCount;
private final TextView issueNumber;
private final ImageView issueAssigneeAvatar;
private final TextView issueTitle;
private final TextView issueCreatedTime;
private final TextView issueCommentsCount;
IssuesHolder(View itemView) {
@ -161,8 +163,8 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
PicassoService.getInstance(context).get().load(issuesModel.getUser().getAvatar_url()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(issueAssigneeAvatar);
String issueNumber_ = "<font color='" + context.getResources().getColor(R.color.lightGray) + "'>" + context.getResources().getString(R.string.hash) + issuesModel.getNumber() + "</font>";
issueTitle.setText(Html.fromHtml(issueNumber_ + " " + issuesModel.getTitle()));
String issueNumber_ = "<font color='" + ResourcesCompat.getColor(context.getResources(), R.color.lightGray, null) + "'>" + context.getResources().getString(R.string.hash) + issuesModel.getNumber() + "</font>";
issueTitle.setText(HtmlCompat.fromHtml(issueNumber_ + " " + EmojiParser.parseToUnicode(issuesModel.getTitle()), HtmlCompat.FROM_HTML_MODE_LEGACY));
issueNumber.setText(String.valueOf(issuesModel.getNumber()));
issueCommentsCount.setText(String.valueOf(issuesModel.getComments()));

View File

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

View File

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

View File

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

View File

@ -3,7 +3,6 @@ package org.mian.gitnex.adapters;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -11,7 +10,10 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.vdurmont.emoji.EmojiParser;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.IssueDetailActivity;
import org.mian.gitnex.clients.PicassoService;
@ -29,7 +31,7 @@ import java.util.Locale;
public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private Context context;
private final Context context;
private final int TYPE_LOAD = 0;
private List<PullRequests> prList;
private PullRequestsAdapter.OnLoadMoreListener loadMoreListener;
@ -96,15 +98,15 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
class PullRequestsHolder extends RecyclerView.ViewHolder {
private TextView prNumber;
private TextView prMergeable;
private TextView prHeadBranch;
private TextView prIsFork;
private TextView prForkFullName;
private ImageView assigneeAvatar;
private TextView prTitle;
private TextView prCreatedTime;
private TextView prCommentsCount;
private final TextView prNumber;
private final TextView prMergeable;
private final TextView prHeadBranch;
private final TextView prIsFork;
private final TextView prForkFullName;
private final ImageView assigneeAvatar;
private final TextView prTitle;
private final TextView prCreatedTime;
private final TextView prCommentsCount;
PullRequestsHolder(View itemView) {
@ -183,8 +185,8 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
PicassoService.getInstance(context).get().load(prModel.getUser().getAvatar_url()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(assigneeAvatar);
}
String prNumber_ = "<font color='" + context.getResources().getColor(R.color.lightGray) + "'>" + context.getResources().getString(R.string.hash) + prModel.getNumber() + "</font>";
prTitle.setText(Html.fromHtml(prNumber_ + " " + prModel.getTitle()));
String prNumber_ = "<font color='" + ResourcesCompat.getColor(context.getResources(), R.color.lightGray, null) + "'>" + context.getResources().getString(R.string.hash) + prModel.getNumber() + "</font>";
prTitle.setText(HtmlCompat.fromHtml(prNumber_ + " " + EmojiParser.parseToUnicode(prModel.getTitle()), HtmlCompat.FROM_HTML_MODE_LEGACY));
prNumber.setText(String.valueOf(prModel.getNumber()));
prMergeable.setText(String.valueOf(prModel.isMergeable()));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,15 +32,16 @@ public class ExploreFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_explore, container, false);
View v = inflater.inflate(R.layout.fragment_explore, container,false);
ctx = getContext();
tinyDB = TinyDB.getInstance(ctx);
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navExplore));
TabLayout tabLayout = v.findViewById(R.id.tabsExplore);
TabLayout tabLayout = view.findViewById(R.id.tabsExplore);
ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0);
tabsCount = viewGroup.getChildCount();
@ -78,7 +79,7 @@ public class ExploreFragment extends Fragment {
}
}
mViewPager = v.findViewById(R.id.containerExplore);
mViewPager = view.findViewById(R.id.containerExplore);
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
@ -86,7 +87,8 @@ public class ExploreFragment extends Fragment {
SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());
mViewPager.setAdapter(mSectionsPagerAdapter);
return v;
return view;
}
public class SectionsPagerAdapter extends FragmentPagerAdapter {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -204,7 +204,7 @@ public class AppUtil {
public Boolean sourceCodeExtension(String ext) {
String[] extValues = new String[]{"md", "json", "java", "go", "php", "c", "cc", "cpp", "h", "cxx", "cyc", "m", "cs", "bash", "sh", "bsh", "cv", "python", "perl", "pm", "rb", "ruby", "javascript", "coffee", "rc", "rs", "rust", "basic", "clj", "css", "dart", "lisp", "erl", "hs", "lsp", "rkt", "ss", "llvm", "ll", "lua", "matlab", "pascal", "r", "scala", "sql", "latex", "tex", "vb", "vbs", "vhd", "tcl", "wiki.meta", "yaml", "yml", "markdown", "xml", "proto", "regex", "py", "pl", "js", "html", "htm", "volt", "ini", "htaccess", "conf", "gitignore", "gradle", "txt", "properties", "bat", "twig", "cvs", "cmake", "in", "info", "spec", "m4", "am", "dist", "pam"};
String[] extValues = new String[]{"md", "json", "java", "go", "php", "c", "cc", "cpp", "h", "cxx", "cyc", "m", "cs", "bash", "sh", "bsh", "cv", "python", "perl", "pm", "rb", "ruby", "javascript", "coffee", "rc", "rs", "rust", "basic", "clj", "css", "dart", "lisp", "erl", "hs", "lsp", "rkt", "ss", "llvm", "ll", "lua", "matlab", "pascal", "r", "scala", "sql", "latex", "tex", "vb", "vbs", "vhd", "tcl", "wiki.meta", "yaml", "yml", "markdown", "xml", "proto", "regex", "py", "pl", "js", "html", "htm", "volt", "ini", "htaccess", "conf", "gitignore", "gradle", "txt", "properties", "bat", "twig", "cvs", "cmake", "in", "info", "spec", "m4", "am", "dist", "pam", "hx", "ts"};
return Arrays.asList(extValues).contains(ext);

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More