Handle popular links (#730)
Fix settings layout Merge branch 'master' into deeplinks Support for all links, check gitea instance, add progress indicator Enhance account checks, improve the experience of coming from links Merge branch 'master' into deeplinks Update libs Minor layout fixes gradle update Fix show/hide views Handle pr, repos. Handle settings for no action. open issue from link Add new settings section translation ready - General for generic settings wip on handle popular links Co-authored-by: M M Arif <mmarif@swatian.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: 6543 <6543@noreply.codeberg.org> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/730
This commit is contained in:
@@ -20,6 +20,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.mian.gitnex.R;
|
||||
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;
|
||||
@@ -51,6 +52,8 @@ public class DraftsFragment extends Fragment {
|
||||
ctx = getContext();
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.titleDrafts));
|
||||
|
||||
TinyDB tinyDb = new TinyDB(ctx);
|
||||
|
||||
draftsList_ = new ArrayList<>();
|
||||
|
||||
@@ -15,9 +15,7 @@ import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -26,14 +24,12 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||
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.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.viewmodels.MyRepositoriesViewModel;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -82,7 +78,7 @@ public class MyRepositoriesFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(Objects.requireNonNull(getContext()));
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(requireContext());
|
||||
|
||||
final View v = inflater.inflate(R.layout.fragment_my_repositories, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
@@ -96,6 +92,8 @@ public class MyRepositoriesFragment extends Fragment {
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.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);
|
||||
@@ -164,29 +162,28 @@ public class MyRepositoriesFragment extends Fragment {
|
||||
|
||||
MyRepositoriesViewModel myRepoModel = new ViewModelProvider(this).get(MyRepositoriesViewModel.class);
|
||||
|
||||
myRepoModel.getCurrentUserRepositories(instanceUrl, instanceToken, userLogin, getContext(), pageSize, resultLimit).observe(getViewLifecycleOwner(), new Observer<List<UserRepositories>>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable List<UserRepositories> myReposListMain) {
|
||||
adapter = new MyReposListAdapter(getContext(), myReposListMain);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataMyRepo.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataMyRepo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
myRepoModel.getCurrentUserRepositories(instanceUrl, instanceToken, userLogin, getContext(), pageSize, resultLimit).observe(getViewLifecycleOwner(),
|
||||
myReposListMain -> {
|
||||
|
||||
adapter = new MyReposListAdapter(getContext(), myReposListMain);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataMyRepo.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataMyRepo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(Objects.requireNonNull(getContext()));
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(requireContext());
|
||||
|
||||
inflater.inflate(R.menu.search_menu, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
||||
@@ -16,7 +16,6 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -25,14 +24,12 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||
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.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.models.UserOrganizations;
|
||||
import org.mian.gitnex.viewmodels.OrganizationListViewModel;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -53,7 +50,7 @@ public class OrganizationsFragment extends Fragment {
|
||||
final View v = inflater.inflate(R.layout.fragment_organizations, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(Objects.requireNonNull(getContext()));
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(requireContext());
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getContext());
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
@@ -62,6 +59,8 @@ public class OrganizationsFragment extends Fragment {
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.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);
|
||||
@@ -74,14 +73,10 @@ public class OrganizationsFragment extends Fragment {
|
||||
|
||||
createNewOrganization = v.findViewById(R.id.addNewOrganization);
|
||||
|
||||
createNewOrganization.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(view.getContext(), CreateOrganizationActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
createNewOrganization.setOnClickListener(view -> {
|
||||
|
||||
Intent intent = new Intent(view.getContext(), CreateOrganizationActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@@ -131,21 +126,19 @@ public class OrganizationsFragment extends Fragment {
|
||||
|
||||
OrganizationListViewModel orgModel = new ViewModelProvider(this).get(OrganizationListViewModel.class);
|
||||
|
||||
orgModel.getUserOrgs(instanceUrl, instanceToken, getContext()).observe(getViewLifecycleOwner(), new Observer<List<UserOrganizations>>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable List<UserOrganizations> orgsListMain) {
|
||||
adapter = new OrganizationsListAdapter(getContext(), orgsListMain);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataOrg.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataOrg.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
orgModel.getUserOrgs(instanceUrl, instanceToken, getContext()).observe(getViewLifecycleOwner(), orgsListMain -> {
|
||||
adapter = new OrganizationsListAdapter(getContext(), orgsListMain);
|
||||
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataOrg.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataOrg.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
}
|
||||
@@ -153,7 +146,7 @@ public class OrganizationsFragment extends Fragment {
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(Objects.requireNonNull(getContext()));
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(requireContext());
|
||||
|
||||
inflater.inflate(R.menu.search_menu, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.mian.gitnex.helpers.ColorInverter;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import eightbitlab.com.blurview.BlurView;
|
||||
import eightbitlab.com.blurview.RenderScriptBlur;
|
||||
|
||||
@@ -49,6 +48,8 @@ public class ProfileFragment extends Fragment {
|
||||
View v = inflater.inflate(R.layout.fragment_profile, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navProfile));
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getContext());
|
||||
|
||||
BlurView blurView = v.findViewById(R.id.blurView);
|
||||
@@ -123,15 +124,15 @@ public class ProfileFragment extends Fragment {
|
||||
switch(tinyDb.getInt("customFontId", -1)) {
|
||||
|
||||
case 0:
|
||||
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getContext()).getAssets(), "fonts/roboto.ttf");
|
||||
myTypeface = Typeface.createFromAsset(requireContext().getAssets(), "fonts/roboto.ttf");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getContext()).getAssets(), "fonts/sourcecodeproregular.ttf");
|
||||
myTypeface = Typeface.createFromAsset(requireContext().getAssets(), "fonts/sourcecodeproregular.ttf");
|
||||
break;
|
||||
|
||||
default:
|
||||
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getContext()).getAssets(), "fonts/manroperegular.ttf");
|
||||
myTypeface = Typeface.createFromAsset(requireContext().getAssets(), "fonts/manroperegular.ttf");
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -203,7 +204,7 @@ public class ProfileFragment extends Fragment {
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
|
||||
menu.clear();
|
||||
Objects.requireNonNull(getActivity()).getMenuInflater().inflate(R.menu.profile_dotted_menu, menu);
|
||||
requireActivity().getMenuInflater().inflate(R.menu.profile_dotted_menu, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -25,14 +24,12 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||
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.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.viewmodels.RepositoriesListViewModel;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -52,7 +49,7 @@ public class RepositoriesFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(Objects.requireNonNull(getContext()));
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(requireContext());
|
||||
|
||||
final View v = inflater.inflate(R.layout.fragment_repositories, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
@@ -64,6 +61,8 @@ public class RepositoriesFragment extends Fragment {
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.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);
|
||||
@@ -130,29 +129,28 @@ public class RepositoriesFragment extends Fragment {
|
||||
|
||||
RepositoriesListViewModel repoModel = new ViewModelProvider(this).get(RepositoriesListViewModel.class);
|
||||
|
||||
repoModel.getUserRepositories(instanceUrl, instanceToken, getContext(), pageSize, resultLimit).observe(getViewLifecycleOwner(), new Observer<List<UserRepositories>>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable List<UserRepositories> reposListMain) {
|
||||
adapter = new ReposListAdapter(getContext(), reposListMain);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataRepo.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataRepo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
repoModel.getUserRepositories(instanceUrl, instanceToken, getContext(), pageSize, resultLimit).observe(getViewLifecycleOwner(),
|
||||
reposListMain -> {
|
||||
|
||||
adapter = new ReposListAdapter(getContext(), reposListMain);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataRepo.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataRepo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(Objects.requireNonNull(getContext()));
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(requireContext());
|
||||
|
||||
inflater.inflate(R.menu.search_menu, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
||||
@@ -12,9 +12,11 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.activities.SettingsAppearanceActivity;
|
||||
import org.mian.gitnex.activities.SettingsDraftsActivity;
|
||||
import org.mian.gitnex.activities.SettingsFileViewerActivity;
|
||||
import org.mian.gitnex.activities.SettingsGeneralActivity;
|
||||
import org.mian.gitnex.activities.SettingsReportsActivity;
|
||||
import org.mian.gitnex.activities.SettingsSecurityActivity;
|
||||
import org.mian.gitnex.activities.SettingsTranslationActivity;
|
||||
@@ -32,6 +34,9 @@ public class SettingsFragment extends Fragment {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_settings, container, false);
|
||||
|
||||
((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);
|
||||
@@ -41,6 +46,8 @@ public class SettingsFragment extends Fragment {
|
||||
LinearLayout rateAppFrame = v.findViewById(R.id.rateAppFrame);
|
||||
LinearLayout aboutAppFrame = v.findViewById(R.id.aboutAppFrame);
|
||||
|
||||
generalFrame.setOnClickListener(generalFrameCall -> startActivity(new Intent(getContext(), SettingsGeneralActivity.class)));
|
||||
|
||||
appearanceFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsAppearanceActivity.class)));
|
||||
|
||||
fileViewerFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsFileViewerActivity.class)));
|
||||
|
||||
@@ -15,9 +15,7 @@ import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -26,14 +24,12 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||
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.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.viewmodels.StarredRepositoriesViewModel;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -79,7 +75,7 @@ public class StarredRepositoriesFragment extends Fragment {
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_starred_repositories, container, false);
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(Objects.requireNonNull(getContext()));
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(requireContext());
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
TinyDB tinyDb = new TinyDB(getContext());
|
||||
@@ -89,6 +85,8 @@ public class StarredRepositoriesFragment extends Fragment {
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.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);
|
||||
@@ -159,29 +157,28 @@ public class StarredRepositoriesFragment extends Fragment {
|
||||
|
||||
StarredRepositoriesViewModel starredRepoModel = new ViewModelProvider(this).get(StarredRepositoriesViewModel.class);
|
||||
|
||||
starredRepoModel.getUserStarredRepositories(instanceUrl, instanceToken, getContext(), pageSize, resultLimit).observe(getViewLifecycleOwner(), new Observer<List<UserRepositories>>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable List<UserRepositories> starredReposListMain) {
|
||||
adapter = new StarredReposListAdapter(getContext(), starredReposListMain);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noData.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noData.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
starredRepoModel.getUserStarredRepositories(instanceUrl, instanceToken, getContext(), pageSize, resultLimit).observe(getViewLifecycleOwner(),
|
||||
starredReposListMain -> {
|
||||
|
||||
adapter = new StarredReposListAdapter(getContext(), starredReposListMain);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noData.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noData.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(Objects.requireNonNull(getContext()));
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(requireContext());
|
||||
|
||||
inflater.inflate(R.menu.search_menu, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
||||
@@ -16,6 +16,7 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.AddNewAccountActivity;
|
||||
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;
|
||||
@@ -43,6 +44,8 @@ public class UserAccountsFragment extends Fragment {
|
||||
ctx = getContext();
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.pageTitleUserAccounts));
|
||||
|
||||
userAccountsList = new ArrayList<>();
|
||||
userAccountsApi = new UserAccountsApi(ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user