From 87376a2104eedbb767e11f0ec54e9aeab3d378ed Mon Sep 17 00:00:00 2001 From: M M Arif Date: Thu, 12 Sep 2019 10:21:53 +0500 Subject: [PATCH 1/3] Fix collaborator not found text --- app/src/main/AndroidManifest.xml | 1 - .../org/mian/gitnex/fragments/CollaboratorsFragment.java | 5 +++++ app/src/main/res/layout/fragment_branches.xml | 4 ++-- app/src/main/res/layout/fragment_collaborators.xml | 9 +++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9e25b314..ea556b0b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,7 +34,6 @@ - diff --git a/app/src/main/java/org/mian/gitnex/fragments/CollaboratorsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/CollaboratorsFragment.java index 42d50c88..4156a5ab 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/CollaboratorsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/CollaboratorsFragment.java @@ -11,6 +11,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.GridView; +import android.widget.ProgressBar; import android.widget.TextView; import org.mian.gitnex.R; import org.mian.gitnex.adapters.CollaboratorsAdapter; @@ -26,6 +27,7 @@ import java.util.List; public class CollaboratorsFragment extends Fragment { + private ProgressBar mProgressBar; private CollaboratorsAdapter adapter; private GridView mGridView; private TextView noDataCollaborators; @@ -69,6 +71,8 @@ public class CollaboratorsFragment extends Fragment { final String instanceToken = "token " + tinyDb.getString(loginUid + "-token"); noDataCollaborators = v.findViewById(R.id.noDataCollaborators); + mProgressBar = v.findViewById(R.id.progress_bar); + mGridView = v.findViewById(R.id.gridView); fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName); @@ -109,6 +113,7 @@ public class CollaboratorsFragment extends Fragment { mGridView.setAdapter(adapter); noDataCollaborators.setVisibility(View.VISIBLE); } + mProgressBar.setVisibility(View.GONE); } }); diff --git a/app/src/main/res/layout/fragment_branches.xml b/app/src/main/res/layout/fragment_branches.xml index 6b529726..11717de8 100644 --- a/app/src/main/res/layout/fragment_branches.xml +++ b/app/src/main/res/layout/fragment_branches.xml @@ -20,7 +20,7 @@ android:scrollbars="vertical" /> - - + + \ No newline at end of file From 6710aa0810ca6cc4e8bec68d011bc1a410ba3d41 Mon Sep 17 00:00:00 2001 From: M M Arif Date: Thu, 12 Sep 2019 10:29:41 +0500 Subject: [PATCH 2/3] clean up unwanted namespaces from layouts --- .../res/layout/activity_add_collaborator_to_repository.xml | 3 +-- app/src/main/res/layout/activity_create_label.xml | 2 -- app/src/main/res/layout/activity_create_new_user.xml | 4 ---- app/src/main/res/layout/activity_create_release.xml | 4 ---- app/src/main/res/layout/activity_create_team_by_org.xml | 4 ---- app/src/main/res/layout/activity_login.xml | 1 - app/src/main/res/layout/activity_new_organization.xml | 2 -- app/src/main/res/layout/activity_profile_email.xml | 2 -- app/src/main/res/layout/activity_sponsors.xml | 3 --- app/src/main/res/layout/branches_list.xml | 2 +- app/src/main/res/layout/custom_multi_select.xml | 2 +- app/src/main/res/layout/fragment_issues_closed.xml | 2 +- app/src/main/res/layout/fragment_labels.xml | 2 +- app/src/main/res/layout/fragment_milestones.xml | 2 +- app/src/main/res/layout/fragment_my_repositories.xml | 2 +- app/src/main/res/layout/fragment_organization_info.xml | 3 +-- app/src/main/res/layout/fragment_organizations.xml | 2 +- app/src/main/res/layout/fragment_releases.xml | 2 +- app/src/main/res/layout/fragment_repo_info.xml | 2 +- app/src/main/res/layout/fragment_repositories.xml | 2 +- app/src/main/res/layout/fragment_repositories_by_org.xml | 2 +- app/src/main/res/layout/fragment_settings.xml | 1 - app/src/main/res/layout/fragment_starred_repositories.xml | 2 +- app/src/main/res/layout/fragment_teams_by_org.xml | 2 +- app/src/main/res/layout/labels_list.xml | 2 +- app/src/main/res/layout/milestones_list.xml | 2 +- app/src/main/res/layout/my_repos_list.xml | 2 +- app/src/main/res/layout/nav_header.xml | 1 - app/src/main/res/layout/organizations_list.xml | 2 +- app/src/main/res/layout/releases_list.xml | 2 +- app/src/main/res/layout/repo_detail_issues_list.xml | 2 +- app/src/main/res/layout/repos_list.xml | 2 +- app/src/main/res/layout/repositories_by_org_list.xml | 2 +- app/src/main/res/layout/starred_repos_list.xml | 2 +- app/src/main/res/layout/teams_by_org_list.xml | 2 +- 35 files changed, 25 insertions(+), 51 deletions(-) diff --git a/app/src/main/res/layout/activity_add_collaborator_to_repository.xml b/app/src/main/res/layout/activity_add_collaborator_to_repository.xml index bb7f7050..33e81021 100644 --- a/app/src/main/res/layout/activity_add_collaborator_to_repository.xml +++ b/app/src/main/res/layout/activity_add_collaborator_to_repository.xml @@ -10,7 +10,6 @@ android:layout_height="wrap_content"> - - - - - - - + /> diff --git a/app/src/main/res/layout/fragment_organizations.xml b/app/src/main/res/layout/fragment_organizations.xml index 61d4d9d1..ad2f1a38 100644 --- a/app/src/main/res/layout/fragment_organizations.xml +++ b/app/src/main/res/layout/fragment_organizations.xml @@ -19,7 +19,7 @@ - - + /> diff --git a/app/src/main/res/layout/fragment_repositories.xml b/app/src/main/res/layout/fragment_repositories.xml index a008ccbe..9ebb0f8c 100644 --- a/app/src/main/res/layout/fragment_repositories.xml +++ b/app/src/main/res/layout/fragment_repositories.xml @@ -32,7 +32,7 @@ android:textSize="20sp" android:visibility="gone" /> - - - - - - - - - - - - - - Date: Thu, 12 Sep 2019 13:30:07 +0500 Subject: [PATCH 3/3] libs update, fixes search tap crashing. remove depricated classes --- app/build.gradle | 10 ++++----- .../adapters/OrganizationsListAdapter.java | 1 - .../gitnex/fragments/BranchesFragment.java | 4 ++-- .../fragments/CollaboratorsFragment.java | 4 ++-- .../mian/gitnex/fragments/LabelsFragment.java | 4 ++-- .../fragments/MembersByOrgFragment.java | 8 ++++--- .../gitnex/fragments/MilestonesFragment.java | 8 ++++--- .../fragments/MyRepositoriesFragment.java | 8 ++++--- .../fragments/OrganizationsFragment.java | 8 ++++--- .../fragments/ProfileEmailsFragment.java | 4 ++-- .../fragments/ProfileFollowersFragment.java | 4 ++-- .../fragments/ProfileFollowingFragment.java | 4 ++-- .../gitnex/fragments/ReleasesFragment.java | 4 ++-- .../fragments/RepositoriesByOrgFragment.java | 8 ++++--- .../fragments/RepositoriesFragment.java | 8 ++++--- .../gitnex/fragments/SettingsFragment.java | 21 ++++--------------- .../StarredRepositoriesFragment.java | 8 ++++--- .../gitnex/fragments/TeamsByOrgFragment.java | 8 ++++--- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 20 files changed, 66 insertions(+), 64 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0a037217..faa99c29 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "org.mian.gitnex" minSdkVersion 21 targetSdkVersion 28 - versionCode 45 - versionName "1.5.0" + versionCode 55 + versionName "2.0.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -23,12 +23,12 @@ android { } dependencies { - def lifecycle_version = "2.2.0-alpha01" + def lifecycle_version = "2.2.0-alpha04" final def markwon_version = "3.0.0" implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'androidx.appcompat:appcompat:1.1.0-beta01' - implementation 'com.google.android.material:material:1.1.0-alpha07' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'com.google.android.material:material:1.1.0-alpha10' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.legacy:legacy-support-v4:1.0.0' testImplementation 'junit:junit:4.12' diff --git a/app/src/main/java/org/mian/gitnex/adapters/OrganizationsListAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/OrganizationsListAdapter.java index aade6390..c35e8266 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/OrganizationsListAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/OrganizationsListAdapter.java @@ -76,7 +76,6 @@ public class OrganizationsListAdapter extends RecyclerView.Adapter>() { @Override diff --git a/app/src/main/java/org/mian/gitnex/fragments/CollaboratorsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/CollaboratorsFragment.java index 4156a5ab..c5b7608a 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/CollaboratorsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/CollaboratorsFragment.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -98,7 +98,7 @@ public class CollaboratorsFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) { - CollaboratorsViewModel collaboratorsModel = ViewModelProviders.of(this).get(CollaboratorsViewModel.class); + CollaboratorsViewModel collaboratorsModel = new ViewModelProvider(this).get(CollaboratorsViewModel.class); collaboratorsModel.getCollaboratorsList(instanceUrl, instanceToken, owner, repo).observe(this, new Observer>() { @Override diff --git a/app/src/main/java/org/mian/gitnex/fragments/LabelsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/LabelsFragment.java index bf9c1a66..37b4eb74 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/LabelsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/LabelsFragment.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -142,7 +142,7 @@ public class LabelsFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) { - LabelsViewModel labelsModel = ViewModelProviders.of(this).get(LabelsViewModel.class); + LabelsViewModel labelsModel = new ViewModelProvider(this).get(LabelsViewModel.class); labelsModel.getLabelsList(instanceUrl, instanceToken, owner, repo).observe(this, new Observer>() { @Override diff --git a/app/src/main/java/org/mian/gitnex/fragments/MembersByOrgFragment.java b/app/src/main/java/org/mian/gitnex/fragments/MembersByOrgFragment.java index 2ffe7bd6..1e7d1cea 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/MembersByOrgFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/MembersByOrgFragment.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -81,7 +81,7 @@ public class MembersByOrgFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken, String owner) { - MembersByOrgViewModel membersModel = ViewModelProviders.of(this).get(MembersByOrgViewModel.class); + MembersByOrgViewModel membersModel= new ViewModelProvider(this).get(MembersByOrgViewModel.class); membersModel.getMembersList(instanceUrl, instanceToken, owner).observe(this, new Observer>() { @Override @@ -125,7 +125,9 @@ public class MembersByOrgFragment extends Fragment { @Override public boolean onQueryTextChange(String newText) { - adapter.getFilter().filter(newText); + if(mGridView.getAdapter() != null) { + adapter.getFilter().filter(newText); + } return false; } }); diff --git a/app/src/main/java/org/mian/gitnex/fragments/MilestonesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/MilestonesFragment.java index 11968373..d354e09b 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/MilestonesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/MilestonesFragment.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -150,7 +150,7 @@ public class MilestonesFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) { - MilestonesViewModel msModel = ViewModelProviders.of(this).get(MilestonesViewModel.class); + MilestonesViewModel msModel = new ViewModelProvider(this).get(MilestonesViewModel.class); msModel.getMilestonesList(instanceUrl, instanceToken, owner, repo).observe(this, new Observer>() { @Override @@ -195,7 +195,9 @@ public class MilestonesFragment extends Fragment { @Override public boolean onQueryTextChange(String newText) { - adapter.getFilter().filter(newText); + if(mRecyclerView.getAdapter() != null) { + adapter.getFilter().filter(newText); + } return false; } }); diff --git a/app/src/main/java/org/mian/gitnex/fragments/MyRepositoriesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/MyRepositoriesFragment.java index 0b466a32..8880b001 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/MyRepositoriesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/MyRepositoriesFragment.java @@ -7,7 +7,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -171,7 +171,7 @@ public class MyRepositoriesFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken, String username) { - MyRepositoriesViewModel myRepoModel = ViewModelProviders.of(this).get(MyRepositoriesViewModel.class); + MyRepositoriesViewModel myRepoModel = new ViewModelProvider(this).get(MyRepositoriesViewModel.class); myRepoModel.getCurrentUserRepositories(instanceUrl, instanceToken, username).observe(this, new Observer>() { @Override @@ -216,7 +216,9 @@ public class MyRepositoriesFragment extends Fragment { @Override public boolean onQueryTextChange(String newText) { - adapter.getFilter().filter(newText); + if(mRecyclerView.getAdapter() != null) { + adapter.getFilter().filter(newText); + } return false; } }); diff --git a/app/src/main/java/org/mian/gitnex/fragments/OrganizationsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/OrganizationsFragment.java index f70b36cf..681bc3e3 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/OrganizationsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/OrganizationsFragment.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -141,7 +141,7 @@ public class OrganizationsFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken) { - OrganizationListViewModel orgModel = ViewModelProviders.of(this).get(OrganizationListViewModel.class); + OrganizationListViewModel orgModel = new ViewModelProvider(this).get(OrganizationListViewModel.class); orgModel.getUserOrgs(instanceUrl, instanceToken).observe(this, new Observer>() { @Override @@ -186,7 +186,9 @@ public class OrganizationsFragment extends Fragment { @Override public boolean onQueryTextChange(String newText) { - adapter.getFilter().filter(newText); + if(mRecyclerView.getAdapter() != null) { + adapter.getFilter().filter(newText); + } return false; } }); diff --git a/app/src/main/java/org/mian/gitnex/fragments/ProfileEmailsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/ProfileEmailsFragment.java index 875e88c3..6da1c40b 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/ProfileEmailsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/ProfileEmailsFragment.java @@ -5,7 +5,7 @@ import android.os.Bundle; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -109,7 +109,7 @@ public class ProfileEmailsFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken) { - ProfileEmailsViewModel profileEmailModel = ViewModelProviders.of(this).get(ProfileEmailsViewModel.class); + ProfileEmailsViewModel profileEmailModel = new ViewModelProvider(this).get(ProfileEmailsViewModel.class); profileEmailModel.getEmailsList(instanceUrl, instanceToken).observe(this, new Observer>() { @Override diff --git a/app/src/main/java/org/mian/gitnex/fragments/ProfileFollowersFragment.java b/app/src/main/java/org/mian/gitnex/fragments/ProfileFollowersFragment.java index 415e89f8..c35caefc 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/ProfileFollowersFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/ProfileFollowersFragment.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -108,7 +108,7 @@ public class ProfileFollowersFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken) { - ProfileFollowersViewModel pfModel = ViewModelProviders.of(this).get(ProfileFollowersViewModel.class); + ProfileFollowersViewModel pfModel = new ViewModelProvider(this).get(ProfileFollowersViewModel.class); pfModel.getFollowersList(instanceUrl, instanceToken).observe(this, new Observer>() { @Override diff --git a/app/src/main/java/org/mian/gitnex/fragments/ProfileFollowingFragment.java b/app/src/main/java/org/mian/gitnex/fragments/ProfileFollowingFragment.java index 654e85cc..38e9a8a6 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/ProfileFollowingFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/ProfileFollowingFragment.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -108,7 +108,7 @@ public class ProfileFollowingFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken) { - ProfileFollowingViewModel pfModel = ViewModelProviders.of(this).get(ProfileFollowingViewModel.class); + ProfileFollowingViewModel pfModel = new ViewModelProvider(this).get(ProfileFollowingViewModel.class); pfModel.getFollowingList(instanceUrl, instanceToken).observe(this, new Observer>() { @Override diff --git a/app/src/main/java/org/mian/gitnex/fragments/ReleasesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/ReleasesFragment.java index dd6aa446..59057c5c 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/ReleasesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/ReleasesFragment.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -141,7 +141,7 @@ public class ReleasesFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) { - ReleasesViewModel releasesModel = ViewModelProviders.of(this).get(ReleasesViewModel.class); + ReleasesViewModel releasesModel = new ViewModelProvider(this).get(ReleasesViewModel.class); releasesModel.getReleasesList(instanceUrl, instanceToken, owner, repo).observe(this, new Observer>() { @Override diff --git a/app/src/main/java/org/mian/gitnex/fragments/RepositoriesByOrgFragment.java b/app/src/main/java/org/mian/gitnex/fragments/RepositoriesByOrgFragment.java index 58e2089e..f7bd5ee2 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/RepositoriesByOrgFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/RepositoriesByOrgFragment.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -123,7 +123,7 @@ public class RepositoriesByOrgFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken, String owner) { - RepositoriesByOrgViewModel orgRepoModel = ViewModelProviders.of(this).get(RepositoriesByOrgViewModel.class); + RepositoriesByOrgViewModel orgRepoModel = new ViewModelProvider(this).get(RepositoriesByOrgViewModel.class); orgRepoModel.getRepositoriesByOrg(instanceUrl, instanceToken, owner).observe(this, new Observer>() { @Override @@ -168,7 +168,9 @@ public class RepositoriesByOrgFragment extends Fragment { @Override public boolean onQueryTextChange(String newText) { - adapter.getFilter().filter(newText); + if(mRecyclerView.getAdapter() != null) { + adapter.getFilter().filter(newText); + } return false; } }); diff --git a/app/src/main/java/org/mian/gitnex/fragments/RepositoriesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/RepositoriesFragment.java index c4d57e9a..77189dbd 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/RepositoriesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/RepositoriesFragment.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -144,7 +144,7 @@ public class RepositoriesFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken) { - RepositoriesListViewModel repoModel = ViewModelProviders.of(this).get(RepositoriesListViewModel.class); + RepositoriesListViewModel repoModel = new ViewModelProvider(this).get(RepositoriesListViewModel.class); repoModel.getUserRepositories(instanceUrl, instanceToken).observe(this, new Observer>() { @Override @@ -189,7 +189,9 @@ public class RepositoriesFragment extends Fragment { @Override public boolean onQueryTextChange(String newText) { - adapter.getFilter().filter(newText); + if(mRecyclerView.getAdapter() != null) { + adapter.getFilter().filter(newText); + } return false; } }); diff --git a/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java index 007f5821..c4dcf6c3 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java @@ -185,10 +185,6 @@ public class SettingsFragment extends Fragment { tinyDb.putInt("codeBlockId", i); switch (codeBlockList[i]) { - case "Green - Black": - tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen)); - tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black)); - break; case "White - Black": tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.white)); tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black)); @@ -248,9 +244,6 @@ public class SettingsFragment extends Fragment { tinyDb.putInt("langId", i); switch (langList[i]) { - case "English": - tinyDb.putString("locale", "en"); - break; case "French": tinyDb.putString("locale", "fr"); break; @@ -309,16 +302,10 @@ public class SettingsFragment extends Fragment { tinyDb.putString("timeStr", timeList[i]); tinyDb.putInt("timeId", i); - switch (timeList[i]) { - case "Pretty": - tinyDb.putString("dateFormat", "pretty"); - break; - case "Normal": - tinyDb.putString("dateFormat", "normal"); - break; - default: - tinyDb.putString("dateFormat", "pretty"); - break; + if ("Normal".equals(timeList[i])) { + tinyDb.putString("dateFormat", "normal"); + } else { + tinyDb.putString("dateFormat", "pretty"); } dialogInterfaceTime.dismiss(); diff --git a/app/src/main/java/org/mian/gitnex/fragments/StarredRepositoriesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/StarredRepositoriesFragment.java index f0d036ae..cf081dca 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/StarredRepositoriesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/StarredRepositoriesFragment.java @@ -7,7 +7,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -166,7 +166,7 @@ public class StarredRepositoriesFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken) { - StarredRepositoriesViewModel starredRepoModel = ViewModelProviders.of(this).get(StarredRepositoriesViewModel.class); + StarredRepositoriesViewModel starredRepoModel = new ViewModelProvider(this).get(StarredRepositoriesViewModel.class); starredRepoModel.getUserStarredRepositories(instanceUrl, instanceToken).observe(this, new Observer>() { @Override @@ -211,7 +211,9 @@ public class StarredRepositoriesFragment extends Fragment { @Override public boolean onQueryTextChange(String newText) { - adapter.getFilter().filter(newText); + if(mRecyclerView.getAdapter() != null) { + adapter.getFilter().filter(newText); + } return false; } }); diff --git a/app/src/main/java/org/mian/gitnex/fragments/TeamsByOrgFragment.java b/app/src/main/java/org/mian/gitnex/fragments/TeamsByOrgFragment.java index 6d96ef63..56f1afd0 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/TeamsByOrgFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/TeamsByOrgFragment.java @@ -6,7 +6,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -124,7 +124,7 @@ public class TeamsByOrgFragment extends Fragment { private void fetchDataAsync(String instanceUrl, String instanceToken, String owner) { - TeamsByOrgViewModel teamModel = ViewModelProviders.of(this).get(TeamsByOrgViewModel.class); + TeamsByOrgViewModel teamModel = new ViewModelProvider(this).get(TeamsByOrgViewModel.class); teamModel.getTeamsByOrg(instanceUrl, instanceToken, owner).observe(this, new Observer>() { @Override @@ -169,7 +169,9 @@ public class TeamsByOrgFragment extends Fragment { @Override public boolean onQueryTextChange(String newText) { - adapter.getFilter().filter(newText); + if(mRecyclerView.getAdapter() != null) { + adapter.getFilter().filter(newText); + } return false; } }); diff --git a/build.gradle b/build.gradle index 05a6488b..e29809a6 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.4.0' + classpath 'com.android.tools.build:gradle:3.5.0' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 740cc6e8..e2b44955 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Apr 18 19:09:46 SGT 2019 +#Thu Sep 12 16:12:36 SGT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip