From 093204df4394e139d8f28ba612574987b316abaf Mon Sep 17 00:00:00 2001 From: opyale Date: Tue, 26 Jan 2021 18:43:25 +0100 Subject: [PATCH] Fixing layout issues and crashes. (#810) Fixing layout issues and crashes. Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/810 Reviewed-by: M M Arif Co-Authored-By: opyale Co-Committed-By: opyale --- .../AddCollaboratorToRepositoryActivity.java | 7 +-- .../activities/AddNewAccountActivity.java | 9 +--- .../activities/AddNewTeamMemberActivity.java | 7 +-- .../activities/AdminGetUsersActivity.java | 6 +-- .../mian/gitnex/activities/BaseActivity.java | 3 -- .../gitnex/activities/CommitsActivity.java | 7 +-- .../gitnex/activities/CreateFileActivity.java | 6 +-- .../activities/CreateIssueActivity.java | 8 +-- .../activities/CreateLabelActivity.java | 6 +-- .../activities/CreateMilestoneActivity.java | 6 +-- .../activities/CreateNewUserActivity.java | 6 +-- .../CreateOrganizationActivity.java | 6 +-- .../activities/CreatePullRequestActivity.java | 11 +---- .../activities/CreateReleaseActivity.java | 6 +-- .../gitnex/activities/CreateRepoActivity.java | 6 +-- .../activities/CreateTeamByOrgActivity.java | 6 +-- .../gitnex/activities/DeepLinksActivity.java | 9 +--- .../gitnex/activities/EditIssueActivity.java | 6 +-- .../gitnex/activities/FileDiffActivity.java | 7 +-- .../gitnex/activities/FileViewActivity.java | 7 +-- .../activities/IssueDetailActivity.java | 9 +--- .../mian/gitnex/activities/LoginActivity.java | 7 +-- .../mian/gitnex/activities/MainActivity.java | 7 +-- .../activities/MergePullRequestActivity.java | 9 +--- .../OrganizationDetailActivity.java | 16 ++---- .../OrganizationTeamMembersActivity.java | 6 +-- .../activities/ProfileEmailActivity.java | 6 +-- .../gitnex/activities/RepoDetailActivity.java | 17 ++----- .../gitnex/activities/RepoForksActivity.java | 7 +-- .../activities/RepoStargazersActivity.java | 6 +-- .../activities/RepoWatchersActivity.java | 6 +-- .../RepositorySettingsActivity.java | 8 +-- .../SettingsAppearanceActivity.java | 7 +-- .../activities/SettingsDraftsActivity.java | 7 +-- .../SettingsFileViewerActivity.java | 7 +-- .../activities/SettingsGeneralActivity.java | 9 +--- .../SettingsNotificationsActivity.java | 9 +--- .../activities/SettingsReportsActivity.java | 7 +-- .../activities/SettingsSecurityActivity.java | 7 +-- .../SettingsTranslationActivity.java | 7 +-- .../gitnex/fragments/ExploreFragment.java | 10 ++-- .../gitnex/fragments/ProfileFragment.java | 49 +++++++++++-------- .../main/res/layout/activity_repo_detail.xml | 16 +++--- 43 files changed, 89 insertions(+), 285 deletions(-) diff --git a/app/src/main/java/org/mian/gitnex/activities/AddCollaboratorToRepositoryActivity.java b/app/src/main/java/org/mian/gitnex/activities/AddCollaboratorToRepositoryActivity.java index ce1c3eda..5737e84a 100644 --- a/app/src/main/java/org/mian/gitnex/activities/AddCollaboratorToRepositoryActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/AddCollaboratorToRepositoryActivity.java @@ -13,7 +13,6 @@ 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; @@ -38,17 +37,13 @@ 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); diff --git a/app/src/main/java/org/mian/gitnex/activities/AddNewAccountActivity.java b/app/src/main/java/org/mian/gitnex/activities/AddNewAccountActivity.java index 540d75ef..f81d5b70 100644 --- a/app/src/main/java/org/mian/gitnex/activities/AddNewAccountActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/AddNewAccountActivity.java @@ -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)); diff --git a/app/src/main/java/org/mian/gitnex/activities/AddNewTeamMemberActivity.java b/app/src/main/java/org/mian/gitnex/activities/AddNewTeamMemberActivity.java index 1e3c4608..914fb6ee 100644 --- a/app/src/main/java/org/mian/gitnex/activities/AddNewTeamMemberActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/AddNewTeamMemberActivity.java @@ -14,7 +14,6 @@ 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; @@ -45,17 +44,13 @@ 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); diff --git a/app/src/main/java/org/mian/gitnex/activities/AdminGetUsersActivity.java b/app/src/main/java/org/mian/gitnex/activities/AdminGetUsersActivity.java index ac82442f..fa0adadb 100644 --- a/app/src/main/java/org/mian/gitnex/activities/AdminGetUsersActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/AdminGetUsersActivity.java @@ -39,17 +39,13 @@ 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); ActivityAdminGetUsersBinding activityAdminGetUsersBinding = ActivityAdminGetUsersBinding.inflate(getLayoutInflater()); + setContentView(activityAdminGetUsersBinding.getRoot()); ImageView closeActivity = activityAdminGetUsersBinding.close; noDataUsers = activityAdminGetUsersBinding.noDataUsers; diff --git a/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java b/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java index 4fb677d0..b5637853 100644 --- a/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java @@ -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(); - } diff --git a/app/src/main/java/org/mian/gitnex/activities/CommitsActivity.java b/app/src/main/java/org/mian/gitnex/activities/CommitsActivity.java index 37502c7f..b652675b 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CommitsActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CommitsActivity.java @@ -51,18 +51,13 @@ 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); ActivityCommitsBinding activityCommitsBinding = ActivityCommitsBinding.inflate(getLayoutInflater()); + setContentView(activityCommitsBinding.getRoot()); Toolbar toolbar = activityCommitsBinding.toolbar; setSupportActionBar(toolbar); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java index 00b307db..14f0f963 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java @@ -59,11 +59,6 @@ public class CreateFileActivity extends BaseActivity { private String selectedBranch; - @Override - protected int getLayoutResourceId(){ - return R.layout.activity_create_file; - } - @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { @@ -71,6 +66,7 @@ public class CreateFileActivity extends BaseActivity { super.onCreate(savedInstanceState); ActivityCreateFileBinding activityCreateFileBinding = ActivityCreateFileBinding.inflate(getLayoutInflater()); + setContentView(activityCreateFileBinding.getRoot()); boolean connToInternet = AppUtil.hasNetworkConnection(appCtx); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java index 6b2bb2f2..fbdad652 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java @@ -71,11 +71,6 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis private List assigneesList = new ArrayList<>(); private List 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); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateLabelActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateLabelActivity.java index 2c34c2b9..70751fa1 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateLabelActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateLabelActivity.java @@ -41,17 +41,13 @@ 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); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java index 8d616ac5..647834f5 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java @@ -38,11 +38,6 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic private EditText milestoneDescription; private Button createNewMilestoneButton; - @Override - protected int getLayoutResourceId(){ - return R.layout.activity_create_milestone; - } - @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { @@ -50,6 +45,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic super.onCreate(savedInstanceState); ActivityCreateMilestoneBinding activityCreateMilestoneBinding = ActivityCreateMilestoneBinding.inflate(getLayoutInflater()); + setContentView(activityCreateMilestoneBinding.getRoot()); boolean connToInternet = AppUtil.hasNetworkConnection(appCtx); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateNewUserActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateNewUserActivity.java index 08696eab..7464795e 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateNewUserActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateNewUserActivity.java @@ -35,17 +35,13 @@ 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); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateOrganizationActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateOrganizationActivity.java index 3ce5f152..6514596f 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateOrganizationActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateOrganizationActivity.java @@ -36,11 +36,6 @@ public class CreateOrganizationActivity extends BaseActivity { private EditText orgName; private EditText orgDesc; - @Override - protected int getLayoutResourceId(){ - return R.layout.activity_create_organization; - } - @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { @@ -48,6 +43,7 @@ public class CreateOrganizationActivity extends BaseActivity { super.onCreate(savedInstanceState); ActivityCreateOrganizationBinding activityCreateOrganizationBinding = ActivityCreateOrganizationBinding.inflate(getLayoutInflater()); + setContentView(activityCreateOrganizationBinding.getRoot()); boolean connToInternet = AppUtil.hasNetworkConnection(appCtx); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java index ed13ab48..a8351f3e 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java @@ -61,14 +61,6 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis List branchesList = new ArrayList<>(); List 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"); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java index 88b6eaaa..f09182c0 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java @@ -50,11 +50,6 @@ public class CreateReleaseActivity extends BaseActivity { List branchesList = new ArrayList<>(); - @Override - protected int getLayoutResourceId(){ - return R.layout.activity_create_release; - } - @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { @@ -62,6 +57,7 @@ public class CreateReleaseActivity extends BaseActivity { super.onCreate(savedInstanceState); ActivityCreateReleaseBinding activityCreateReleaseBinding = ActivityCreateReleaseBinding.inflate(getLayoutInflater()); + setContentView(activityCreateReleaseBinding.getRoot()); boolean connToInternet = AppUtil.hasNetworkConnection(appCtx); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java index 85cd4faa..73214690 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java @@ -56,17 +56,13 @@ public class CreateRepoActivity extends BaseActivity { final List reservedRepoNames = Arrays.asList(".", ".."); final Pattern reservedRepoPatterns = Pattern.compile("\\.(git|wiki)$"); - @Override - protected int getLayoutResourceId(){ - return R.layout.activity_create_repo; - } - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivityCreateRepoBinding activityCreateRepoBinding = ActivityCreateRepoBinding.inflate(getLayoutInflater()); + setContentView(activityCreateRepoBinding.getRoot()); boolean connToInternet = AppUtil.hasNetworkConnection(ctx); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateTeamByOrgActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateTeamByOrgActivity.java index b4f699a4..cb9eec7a 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateTeamByOrgActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateTeamByOrgActivity.java @@ -44,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", @@ -77,6 +72,7 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic super.onCreate(savedInstanceState); ActivityCreateTeamByOrgBinding activityCreateTeamByOrgBinding = ActivityCreateTeamByOrgBinding.inflate(getLayoutInflater()); + setContentView(activityCreateTeamByOrgBinding.getRoot()); boolean connToInternet = AppUtil.hasNetworkConnection(appCtx); diff --git a/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java b/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java index cdb39050..3d56aef1 100644 --- a/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java @@ -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); diff --git a/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java b/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java index 190539ce..f7592f9e 100644 --- a/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java @@ -64,11 +64,6 @@ 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) { @@ -76,6 +71,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe super.onCreate(savedInstanceState); ActivityEditIssueBinding activityEditIssueBinding = ActivityEditIssueBinding.inflate(getLayoutInflater()); + setContentView(activityEditIssueBinding.getRoot()); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); diff --git a/app/src/main/java/org/mian/gitnex/activities/FileDiffActivity.java b/app/src/main/java/org/mian/gitnex/activities/FileDiffActivity.java index 7c037f16..95da2dca 100644 --- a/app/src/main/java/org/mian/gitnex/activities/FileDiffActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/FileDiffActivity.java @@ -36,18 +36,13 @@ 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); ActivityFileDiffBinding activityFileDiffBinding = ActivityFileDiffBinding.inflate(getLayoutInflater()); + setContentView(activityFileDiffBinding.getRoot()); Toolbar toolbar = activityFileDiffBinding.toolbar; setSupportActionBar(toolbar); diff --git a/app/src/main/java/org/mian/gitnex/activities/FileViewActivity.java b/app/src/main/java/org/mian/gitnex/activities/FileViewActivity.java index ad09a92d..650ec3e6 100644 --- a/app/src/main/java/org/mian/gitnex/activities/FileViewActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/FileViewActivity.java @@ -71,12 +71,6 @@ 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) { @@ -84,6 +78,7 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie appUtil = new AppUtil(); ActivityFileViewBinding activityFileViewBinding = ActivityFileViewBinding.inflate(getLayoutInflater()); + setContentView(activityFileViewBinding.getRoot()); Toolbar toolbar = activityFileViewBinding.toolbar; setSupportActionBar(toolbar); diff --git a/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java index a868617f..e263953a 100644 --- a/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java @@ -102,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("/"); diff --git a/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java b/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java index bdced73c..3926e121 100644 --- a/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java @@ -53,18 +53,13 @@ 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); diff --git a/app/src/main/java/org/mian/gitnex/activities/MainActivity.java b/app/src/main/java/org/mian/gitnex/activities/MainActivity.java index 6ca6beb8..e2f9f061 100644 --- a/app/src/main/java/org/mian/gitnex/activities/MainActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/MainActivity.java @@ -85,18 +85,13 @@ 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); diff --git a/app/src/main/java/org/mian/gitnex/activities/MergePullRequestActivity.java b/app/src/main/java/org/mian/gitnex/activities/MergePullRequestActivity.java index 5b217e61..32ddb423 100644 --- a/app/src/main/java/org/mian/gitnex/activities/MergePullRequestActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/MergePullRequestActivity.java @@ -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("/"); diff --git a/app/src/main/java/org/mian/gitnex/activities/OrganizationDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/OrganizationDetailActivity.java index eee0a8cd..8b69b5f6 100644 --- a/app/src/main/java/org/mian/gitnex/activities/OrganizationDetailActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/OrganizationDetailActivity.java @@ -20,7 +20,6 @@ import androidx.fragment.app.FragmentPagerAdapter; import androidx.viewpager.widget.ViewPager; import com.google.android.material.tabs.TabLayout; import org.mian.gitnex.R; -import org.mian.gitnex.databinding.ActivityOrgDetailBinding; import org.mian.gitnex.fragments.BottomSheetOrganizationFragment; import org.mian.gitnex.fragments.MembersByOrgFragment; import org.mian.gitnex.fragments.OrganizationInfoFragment; @@ -37,22 +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); - ActivityOrgDetailBinding activityOrgDetailBinding = ActivityOrgDetailBinding.inflate(getLayoutInflater()); + setContentView(R.layout.activity_org_detail); String orgName = tinyDB.getString("orgName"); - Toolbar toolbar = activityOrgDetailBinding.toolbar; - TextView toolbarTitle = activityOrgDetailBinding.toolbarTitle; + Toolbar toolbar = findViewById(R.id.toolbar); + TextView toolbarTitle = findViewById(R.id.toolbar_title); setSupportActionBar(toolbar); Objects.requireNonNull(getSupportActionBar()).setTitle(orgName); @@ -60,10 +54,10 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh OrganizationDetailActivity.SectionsPagerAdapter mSectionsPagerAdapter = new OrganizationDetailActivity.SectionsPagerAdapter(getSupportFragmentManager()); - ViewPager mViewPager = activityOrgDetailBinding.container; + ViewPager mViewPager = findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); - TabLayout tabLayout = activityOrgDetailBinding.tabs; + TabLayout tabLayout = findViewById(R.id.tabs); Typeface myTypeface; diff --git a/app/src/main/java/org/mian/gitnex/activities/OrganizationTeamMembersActivity.java b/app/src/main/java/org/mian/gitnex/activities/OrganizationTeamMembersActivity.java index a30de6c7..6d561af6 100644 --- a/app/src/main/java/org/mian/gitnex/activities/OrganizationTeamMembersActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/OrganizationTeamMembersActivity.java @@ -35,17 +35,13 @@ 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); ActivityOrgTeamMembersBinding activityOrgTeamMembersBinding = ActivityOrgTeamMembersBinding.inflate(getLayoutInflater()); + setContentView(activityOrgTeamMembersBinding.getRoot()); Toolbar toolbar = activityOrgTeamMembersBinding.toolbar; setSupportActionBar(toolbar); diff --git a/app/src/main/java/org/mian/gitnex/activities/ProfileEmailActivity.java b/app/src/main/java/org/mian/gitnex/activities/ProfileEmailActivity.java index 1f13681e..398277da 100644 --- a/app/src/main/java/org/mian/gitnex/activities/ProfileEmailActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/ProfileEmailActivity.java @@ -36,17 +36,13 @@ 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); diff --git a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java index 937425be..7abf2742 100644 --- a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java @@ -29,7 +29,6 @@ import com.google.android.material.tabs.TabLayout; import com.google.gson.JsonElement; import org.mian.gitnex.R; import org.mian.gitnex.clients.RetrofitClient; -import org.mian.gitnex.databinding.ActivityRepoDetailBinding; import org.mian.gitnex.fragments.BottomSheetIssuesFilterFragment; import org.mian.gitnex.fragments.BottomSheetMilestonesFilterFragment; import org.mian.gitnex.fragments.BottomSheetPullRequestFilterFragment; @@ -80,26 +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); - ActivityRepoDetailBinding activityRepoDetailBinding = ActivityRepoDetailBinding.inflate(getLayoutInflater()); + setContentView(R.layout.activity_repo_detail); String[] repoNameParts = tinyDB.getString("repoFullName").split("/"); repositoryOwner = repoNameParts[0]; repositoryName = repoNameParts[1]; - Toolbar toolbar = activityRepoDetailBinding.toolbar; + Toolbar toolbar = findViewById(R.id.toolbar); - TextView toolbarTitle = activityRepoDetailBinding.toolbarTitle; + TextView toolbarTitle = findViewById(R.id.toolbar_title); toolbarTitle.setText(repositoryName); setSupportActionBar(toolbar); @@ -133,7 +126,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF toolbarTitle.setTypeface(myTypeface); - TabLayout tabLayout = activityRepoDetailBinding.tabs; + TabLayout tabLayout = findViewById(R.id.tabs); ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0); tabsCount = viewGroup.getChildCount(); @@ -167,7 +160,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF collaboratorTab.setVisibility(View.GONE); } - mViewPager = activityRepoDetailBinding.container; + mViewPager = findViewById(R.id.container); mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager)); diff --git a/app/src/main/java/org/mian/gitnex/activities/RepoForksActivity.java b/app/src/main/java/org/mian/gitnex/activities/RepoForksActivity.java index 71c986e4..b69c54b4 100644 --- a/app/src/main/java/org/mian/gitnex/activities/RepoForksActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/RepoForksActivity.java @@ -54,12 +54,6 @@ public class RepoForksActivity extends BaseActivity { private RepoForksAdapter adapter; private ProgressBar progressLoadMore; - @Override - protected int getLayoutResourceId() { - - return R.layout.activity_repo_forks; - } - @SuppressLint("DefaultLocale") @Override public void onCreate(Bundle savedInstanceState) { @@ -67,6 +61,7 @@ public class RepoForksActivity extends BaseActivity { super.onCreate(savedInstanceState); ActivityRepoForksBinding activityRepoForksBinding = ActivityRepoForksBinding.inflate(getLayoutInflater()); + setContentView(activityRepoForksBinding.getRoot()); Toolbar toolbar = activityRepoForksBinding.toolbar; setSupportActionBar(toolbar); diff --git a/app/src/main/java/org/mian/gitnex/activities/RepoStargazersActivity.java b/app/src/main/java/org/mian/gitnex/activities/RepoStargazersActivity.java index 3b6bcc8c..9ea12885 100644 --- a/app/src/main/java/org/mian/gitnex/activities/RepoStargazersActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/RepoStargazersActivity.java @@ -25,15 +25,11 @@ 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); diff --git a/app/src/main/java/org/mian/gitnex/activities/RepoWatchersActivity.java b/app/src/main/java/org/mian/gitnex/activities/RepoWatchersActivity.java index 51ce32c9..9df2acbf 100644 --- a/app/src/main/java/org/mian/gitnex/activities/RepoWatchersActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/RepoWatchersActivity.java @@ -25,17 +25,13 @@ 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); ActivityRepoWatchersBinding activityRepoWatchersBinding = ActivityRepoWatchersBinding.inflate(getLayoutInflater()); + setContentView(activityRepoWatchersBinding.getRoot()); ImageView closeActivity = activityRepoWatchersBinding.close; TextView toolbarTitle = activityRepoWatchersBinding.toolbarTitle; diff --git a/app/src/main/java/org/mian/gitnex/activities/RepositorySettingsActivity.java b/app/src/main/java/org/mian/gitnex/activities/RepositorySettingsActivity.java index 42735f5a..98448a64 100644 --- a/app/src/main/java/org/mian/gitnex/activities/RepositorySettingsActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/RepositorySettingsActivity.java @@ -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"); diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java index d4704394..373f0851 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java @@ -28,18 +28,13 @@ 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); ActivitySettingsAppearanceBinding activitySettingsAppearanceBinding = ActivitySettingsAppearanceBinding.inflate(getLayoutInflater()); + setContentView(activitySettingsAppearanceBinding.getRoot()); ImageView closeActivity = activitySettingsAppearanceBinding.close; diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsDraftsActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsDraftsActivity.java index 1c1e5a09..34f580eb 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SettingsDraftsActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SettingsDraftsActivity.java @@ -15,18 +15,13 @@ 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); ActivitySettingsDraftsBinding activitySettingsDraftsBinding = ActivitySettingsDraftsBinding.inflate(getLayoutInflater()); + setContentView(activitySettingsDraftsBinding.getRoot()); ImageView closeActivity = activitySettingsDraftsBinding.close; diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsFileViewerActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsFileViewerActivity.java index df32f824..42f37e8c 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SettingsFileViewerActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SettingsFileViewerActivity.java @@ -22,18 +22,13 @@ 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_fileviewer; - } - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivitySettingsFileviewerBinding activitySettingsFileviewerBinding = ActivitySettingsFileviewerBinding.inflate(getLayoutInflater()); + setContentView(activitySettingsFileviewerBinding.getRoot()); ImageView closeActivity = activitySettingsFileviewerBinding.close; diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsGeneralActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsGeneralActivity.java index 1dc290ec..a96bbb2c 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SettingsGeneralActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SettingsGeneralActivity.java @@ -26,20 +26,13 @@ public class SettingsGeneralActivity extends BaseActivity { private List 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); diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsNotificationsActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsNotificationsActivity.java index 2ba73e5e..3a231f34 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SettingsNotificationsActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SettingsNotificationsActivity.java @@ -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(); diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsReportsActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsReportsActivity.java index b3be8ffc..ec97f84c 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SettingsReportsActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SettingsReportsActivity.java @@ -15,18 +15,13 @@ public class SettingsReportsActivity extends BaseActivity { private View.OnClickListener onClickListener; - @Override - protected int getLayoutResourceId() { - - return R.layout.activity_settings_reports; - } - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivitySettingsReportsBinding activitySettingsReportsBinding = ActivitySettingsReportsBinding.inflate(getLayoutInflater()); + setContentView(activitySettingsReportsBinding.getRoot()); ImageView closeActivity = activitySettingsReportsBinding.close; diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsSecurityActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsSecurityActivity.java index 87295926..ad86d2ab 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SettingsSecurityActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SettingsSecurityActivity.java @@ -31,18 +31,13 @@ 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); ActivitySettingsSecurityBinding activitySettingsSecurityBinding = ActivitySettingsSecurityBinding.inflate(getLayoutInflater()); + setContentView(activitySettingsSecurityBinding.getRoot()); ImageView closeActivity = activitySettingsSecurityBinding.close; diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsTranslationActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsTranslationActivity.java index 05737f4e..45b3e8ac 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SettingsTranslationActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SettingsTranslationActivity.java @@ -24,18 +24,13 @@ 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); ActivitySettingsTranslationBinding activitySettingsTranslationBinding = ActivitySettingsTranslationBinding.inflate(getLayoutInflater()); + setContentView(activitySettingsTranslationBinding.getRoot()); ImageView closeActivity = activitySettingsTranslationBinding.close; diff --git a/app/src/main/java/org/mian/gitnex/fragments/ExploreFragment.java b/app/src/main/java/org/mian/gitnex/fragments/ExploreFragment.java index eede2192..58544f8f 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/ExploreFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/ExploreFragment.java @@ -16,7 +16,6 @@ import androidx.viewpager.widget.ViewPager; import com.google.android.material.tabs.TabLayout; import org.mian.gitnex.R; import org.mian.gitnex.activities.MainActivity; -import org.mian.gitnex.databinding.FragmentExploreBinding; import org.mian.gitnex.helpers.TinyDB; /** @@ -35,14 +34,14 @@ public class ExploreFragment extends Fragment { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - FragmentExploreBinding fragmentExploreBinding = FragmentExploreBinding.inflate(inflater, container, false); + View view = inflater.inflate(R.layout.fragment_explore, container, false); ctx = getContext(); tinyDB = TinyDB.getInstance(ctx); ((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navExplore)); - TabLayout tabLayout = fragmentExploreBinding.tabsExplore; + TabLayout tabLayout = view.findViewById(R.id.tabsExplore); ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0); tabsCount = viewGroup.getChildCount(); @@ -80,7 +79,7 @@ public class ExploreFragment extends Fragment { } } - mViewPager = fragmentExploreBinding.containerExplore; + mViewPager = view.findViewById(R.id.containerExplore); mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager)); @@ -88,7 +87,8 @@ public class ExploreFragment extends Fragment { SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager()); mViewPager.setAdapter(mSectionsPagerAdapter); - return fragmentExploreBinding.getRoot(); + return view; + } public class SectionsPagerAdapter extends FragmentPagerAdapter { diff --git a/app/src/main/java/org/mian/gitnex/fragments/ProfileFragment.java b/app/src/main/java/org/mian/gitnex/fragments/ProfileFragment.java index a276dab2..cb08ce87 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/ProfileFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/ProfileFragment.java @@ -10,6 +10,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -23,11 +24,11 @@ import com.squareup.picasso.Callback; import org.mian.gitnex.R; import org.mian.gitnex.activities.MainActivity; import org.mian.gitnex.clients.PicassoService; -import org.mian.gitnex.databinding.FragmentProfileBinding; import org.mian.gitnex.helpers.ColorInverter; import org.mian.gitnex.helpers.RoundedTransformation; import org.mian.gitnex.helpers.TinyDB; import java.util.Locale; +import eightbitlab.com.blurview.BlurView; import eightbitlab.com.blurview.RenderScriptBlur; /** @@ -44,55 +45,63 @@ public class ProfileFragment extends Fragment { ctx = getContext(); - FragmentProfileBinding fragmentProfileBinding = FragmentProfileBinding.inflate(inflater, container, false); - + View v = inflater.inflate(R.layout.fragment_profile, container, false); setHasOptionsMenu(true); ((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navProfile)); TinyDB tinyDb = TinyDB.getInstance(getContext()); - ViewGroup aboutFrame = fragmentProfileBinding.aboutFrame; + BlurView blurView = v.findViewById(R.id.blurView); + TextView userFullName = v.findViewById(R.id.userFullName); + ImageView userAvatarBackground = v.findViewById(R.id.userAvatarBackground); + ImageView userAvatar = v.findViewById(R.id.userAvatar); + TextView userLogin = v.findViewById(R.id.userLogin); + View divider = v.findViewById(R.id.divider); + TextView userLanguage = v.findViewById(R.id.userLanguage); + ImageView userLanguageIcon = v.findViewById(R.id.userLanguageIcon); + + ViewGroup aboutFrame = v.findViewById(R.id.aboutFrame); String[] userLanguageCodes = tinyDb.getString("userLang").split("-"); if(userLanguageCodes.length >= 2) { Locale locale = new Locale(userLanguageCodes[0], userLanguageCodes[1]); - fragmentProfileBinding.userLanguage.setText(locale.getDisplayLanguage()); + userLanguage.setText(locale.getDisplayLanguage()); } else { - fragmentProfileBinding.userLanguage.setText(R.string.notSupported); + userLanguage.setText(R.string.notSupported); } - fragmentProfileBinding.userFullName.setText(tinyDb.getString("userFullname")); - fragmentProfileBinding.userLogin.setText(getString(R.string.usernameWithAt, tinyDb.getString("userLogin"))); + userFullName.setText(tinyDb.getString("userFullname")); + userLogin.setText(getString(R.string.usernameWithAt, tinyDb.getString("userLogin"))); PicassoService.getInstance(ctx).get() .load(tinyDb.getString("userAvatar")) .transform(new RoundedTransformation(8, 0)) .placeholder(R.drawable.loader_animated) .resize(120, 120) - .centerCrop().into(fragmentProfileBinding.userAvatar); + .centerCrop().into(userAvatar); PicassoService.getInstance(ctx).get() .load(tinyDb.getString("userAvatar")) - .into(fragmentProfileBinding.userAvatarBackground, new Callback() { + .into(userAvatarBackground, new Callback() { @Override public void onSuccess() { - int invertedColor = new ColorInverter().getImageViewContrastColor(fragmentProfileBinding.userAvatarBackground); + int invertedColor = new ColorInverter().getImageViewContrastColor(userAvatarBackground); - fragmentProfileBinding.userFullName.setTextColor(invertedColor); - fragmentProfileBinding.divider.setBackgroundColor(invertedColor); - fragmentProfileBinding.userLogin.setTextColor(invertedColor); - fragmentProfileBinding.userLanguage.setTextColor(invertedColor); + userFullName.setTextColor(invertedColor); + divider.setBackgroundColor(invertedColor); + userLogin.setTextColor(invertedColor); + userLanguage.setTextColor(invertedColor); - ImageViewCompat.setImageTintList(fragmentProfileBinding.userLanguageIcon, ColorStateList.valueOf(invertedColor)); + ImageViewCompat.setImageTintList(userLanguageIcon, ColorStateList.valueOf(invertedColor)); - fragmentProfileBinding.blurView.setupWith(aboutFrame) + blurView.setupWith(aboutFrame) .setBlurAlgorithm(new RenderScriptBlur(ctx)) .setBlurRadius(3) .setHasFixedTransformationMatrix(true); @@ -107,7 +116,7 @@ public class ProfileFragment extends Fragment { ProfileFragment.SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager()); - ViewPager mViewPager = fragmentProfileBinding.container; + ViewPager mViewPager = v.findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); Typeface myTypeface; @@ -128,7 +137,7 @@ public class ProfileFragment extends Fragment { } - TabLayout tabLayout = fragmentProfileBinding.tabs; + TabLayout tabLayout = v.findViewById(R.id.tabs); ViewGroup vg = (ViewGroup) tabLayout.getChildAt(0); int tabsCount = vg.getChildCount(); @@ -151,7 +160,7 @@ public class ProfileFragment extends Fragment { mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager)); - return fragmentProfileBinding.getRoot(); + return v; } diff --git a/app/src/main/res/layout/activity_repo_detail.xml b/app/src/main/res/layout/activity_repo_detail.xml index b9bfae2e..b512856f 100644 --- a/app/src/main/res/layout/activity_repo_detail.xml +++ b/app/src/main/res/layout/activity_repo_detail.xml @@ -45,49 +45,49 @@ android:layout_height="wrap_content">