Rewriting deprecated code and adding view bindings to all fragments and activities. (#809)
Remove jetbrain import Merge branch 'master' into deprecations View bindings #3 View bindings #2 View bindings #1 Rewriting deprecated code. Co-authored-by: M M Arif <mmarif@swatian.com> Co-authored-by: M M Arif <mmarif@noreply.codeberg.org> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/809 Reviewed-by: M M Arif <mmarif@noreply.codeberg.org> Co-Authored-By: opyale <opyale@noreply.codeberg.org> Co-Committed-By: opyale <opyale@noreply.codeberg.org>
This commit is contained in:
@@ -5,12 +5,11 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.AdminGetUsersActivity;
|
||||
import org.mian.gitnex.databinding.FragmentAdministrationBinding;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -20,13 +19,12 @@ public class AdministrationFragment extends Fragment {
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_administration, container, false);
|
||||
FragmentAdministrationBinding fragmentAdministrationBinding = FragmentAdministrationBinding.inflate(inflater, container, false);
|
||||
|
||||
TextView adminUsers = v.findViewById(R.id.adminUsers);
|
||||
fragmentAdministrationBinding.adminUsers.setOnClickListener(v1 -> startActivity(new Intent(getContext(), AdminGetUsersActivity.class)));
|
||||
|
||||
adminUsers.setOnClickListener(v1 -> startActivity(new Intent(getContext(), AdminGetUsersActivity.class)));
|
||||
return fragmentAdministrationBinding.getRoot();
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,11 +5,10 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.BottomSheetAdminUsersBinding;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -22,17 +21,17 @@ public class BottomSheetAdminUsersFragment extends BottomSheetDialogFragment {
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_admin_users, container, false);
|
||||
|
||||
TextView createNewUser = v.findViewById(R.id.createNewUser);
|
||||
BottomSheetAdminUsersBinding bottomSheetAdminUsersBinding = BottomSheetAdminUsersBinding.inflate(inflater, container, false);
|
||||
|
||||
createNewUser.setOnClickListener(v1 -> {
|
||||
bottomSheetAdminUsersBinding.createNewUser.setOnClickListener(v1 -> {
|
||||
|
||||
bmListener.onButtonClicked("newUser");
|
||||
dismiss();
|
||||
|
||||
});
|
||||
|
||||
return v;
|
||||
return bottomSheetAdminUsersBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
@@ -6,11 +6,10 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.BottomSheetDraftsBinding;
|
||||
import org.mian.gitnex.helpers.StaticGlobalVariables;
|
||||
|
||||
/**
|
||||
@@ -25,18 +24,17 @@ public class BottomSheetDraftsFragment extends BottomSheetDialogFragment {
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_drafts, container, false);
|
||||
|
||||
TextView deleteAllDrafts = v.findViewById(R.id.deleteAllDrafts);
|
||||
BottomSheetDraftsBinding bottomSheetDraftsBinding = BottomSheetDraftsBinding.inflate(inflater, container, false);
|
||||
|
||||
deleteAllDrafts.setOnClickListener(v1 -> {
|
||||
bottomSheetDraftsBinding.deleteAllDrafts.setOnClickListener(v1 -> {
|
||||
|
||||
dismiss();
|
||||
bmListener.onButtonClicked("deleteDrafts");
|
||||
|
||||
});
|
||||
|
||||
return v;
|
||||
return bottomSheetDraftsBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
@@ -2,14 +2,13 @@ package org.mian.gitnex.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.BottomSheetFileViewerBinding;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -23,31 +22,27 @@ public class BottomSheetFileViewerFragment extends BottomSheetDialogFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_file_viewer, container, false);
|
||||
BottomSheetFileViewerBinding bottomSheetFileViewerBinding = BottomSheetFileViewerBinding.inflate(inflater, container, false);
|
||||
|
||||
TextView downloadFile = v.findViewById(R.id.downloadFile);
|
||||
TextView deleteFile = v.findViewById(R.id.deleteFile);
|
||||
TextView editFile = v.findViewById(R.id.editFile);
|
||||
|
||||
downloadFile.setOnClickListener(v1 -> {
|
||||
bottomSheetFileViewerBinding.downloadFile.setOnClickListener(v1 -> {
|
||||
|
||||
bmListener.onButtonClicked("downloadFile");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
deleteFile.setOnClickListener(v1 -> {
|
||||
bottomSheetFileViewerBinding.deleteFile.setOnClickListener(v1 -> {
|
||||
|
||||
bmListener.onButtonClicked("deleteFile");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
editFile.setOnClickListener(v1 -> {
|
||||
bottomSheetFileViewerBinding.editFile.setOnClickListener(v1 -> {
|
||||
|
||||
bmListener.onButtonClicked("editFile");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return v;
|
||||
return bottomSheetFileViewerBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
@@ -5,11 +5,10 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.BottomSheetIssuesFilterBinding;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -23,22 +22,19 @@ public class BottomSheetIssuesFilterFragment extends BottomSheetDialogFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_issues_filter, container, false);
|
||||
BottomSheetIssuesFilterBinding bottomSheetIssuesFilterBinding = BottomSheetIssuesFilterBinding.inflate(inflater, container, false);
|
||||
|
||||
TextView openIssues = v.findViewById(R.id.openIssues);
|
||||
TextView closedIssues = v.findViewById(R.id.closedIssues);
|
||||
|
||||
openIssues.setOnClickListener(v1 -> {
|
||||
bottomSheetIssuesFilterBinding.openIssues.setOnClickListener(v1 -> {
|
||||
bmListener.onButtonClicked("openIssues");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
closedIssues.setOnClickListener(v12 -> {
|
||||
bottomSheetIssuesFilterBinding.closedIssues.setOnClickListener(v12 -> {
|
||||
bmListener.onButtonClicked("closedIssues");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return v;
|
||||
return bottomSheetIssuesFilterBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
@@ -6,11 +6,10 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.BottomSheetMilestonesFilterBinding;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -24,22 +23,19 @@ public class BottomSheetMilestonesFilterFragment extends BottomSheetDialogFragme
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_milestones_filter, container, false);
|
||||
BottomSheetMilestonesFilterBinding bottomSheetMilestonesFilterBinding = BottomSheetMilestonesFilterBinding.inflate(inflater, container, false);
|
||||
|
||||
TextView openMilestone = v.findViewById(R.id.openMilestone);
|
||||
TextView closedMilestone = v.findViewById(R.id.closedMilestone);
|
||||
|
||||
openMilestone.setOnClickListener(v1 -> {
|
||||
bottomSheetMilestonesFilterBinding.openMilestone.setOnClickListener(v1 -> {
|
||||
bmListener.onButtonClicked("openMilestone");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
closedMilestone.setOnClickListener(v12 -> {
|
||||
bottomSheetMilestonesFilterBinding.closedMilestone.setOnClickListener(v12 -> {
|
||||
bmListener.onButtonClicked("closedMilestone");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return v;
|
||||
return bottomSheetMilestonesFilterBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
@@ -5,11 +5,10 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.BottomSheetNotificationsFilterBinding;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
|
||||
/**
|
||||
@@ -33,26 +32,23 @@ public class BottomSheetNotificationsFilterFragment extends BottomSheetDialogFra
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.bottom_sheet_notifications_filter, container, false);
|
||||
BottomSheetNotificationsFilterBinding bottomSheetNotificationsFilterBinding = BottomSheetNotificationsFilterBinding.inflate(inflater, container, false);
|
||||
|
||||
TextView readNotifications = view.findViewById(R.id.readNotifications);
|
||||
TextView unreadNotifications = view.findViewById(R.id.unreadNotifications);
|
||||
|
||||
readNotifications.setOnClickListener(v1 -> {
|
||||
bottomSheetNotificationsFilterBinding.readNotifications.setOnClickListener(v1 -> {
|
||||
|
||||
tinyDB.putString("notificationsFilterState", "read");
|
||||
dismiss();
|
||||
|
||||
});
|
||||
|
||||
unreadNotifications.setOnClickListener(v12 -> {
|
||||
bottomSheetNotificationsFilterBinding.unreadNotifications.setOnClickListener(v12 -> {
|
||||
|
||||
tinyDB.putString("notificationsFilterState", "unread");
|
||||
dismiss();
|
||||
|
||||
});
|
||||
|
||||
return view;
|
||||
return bottomSheetNotificationsFilterBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.actions.NotificationsActions;
|
||||
import org.mian.gitnex.databinding.BottomSheetNotificationsBinding;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.models.NotificationThread;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Author opyale
|
||||
@@ -40,14 +40,14 @@ public class BottomSheetNotificationsFragment extends BottomSheetDialogFragment
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_notifications, container, false);
|
||||
BottomSheetNotificationsBinding bottomSheetNotificationsBinding = BottomSheetNotificationsBinding.inflate(inflater, container, false);
|
||||
|
||||
TextView markRead = v.findViewById(R.id.markRead);
|
||||
TextView markUnread = v.findViewById(R.id.markUnread);
|
||||
TextView markPinned = v.findViewById(R.id.markPinned);
|
||||
TextView markRead = bottomSheetNotificationsBinding.markRead;
|
||||
TextView markUnread = bottomSheetNotificationsBinding.markUnread;
|
||||
TextView markPinned = bottomSheetNotificationsBinding.markPinned;
|
||||
|
||||
NotificationsActions notificationsActions = new NotificationsActions(context);
|
||||
Activity activity = Objects.requireNonNull(getActivity());
|
||||
Activity activity = requireActivity();
|
||||
|
||||
if(notificationThread.isPinned()) {
|
||||
|
||||
@@ -135,7 +135,7 @@ public class BottomSheetNotificationsFragment extends BottomSheetDialogFragment
|
||||
|
||||
});
|
||||
|
||||
return v;
|
||||
return bottomSheetNotificationsBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,10 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.databinding.BottomSheetOrganizationBinding;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -23,38 +22,33 @@ public class BottomSheetOrganizationFragment extends BottomSheetDialogFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_organization, container, false);
|
||||
BottomSheetOrganizationBinding bottomSheetOrganizationBinding = BottomSheetOrganizationBinding.inflate(inflater, container, false);
|
||||
|
||||
TextView createTeam = v.findViewById(R.id.createTeam);
|
||||
TextView createRepository = v.findViewById(R.id.createRepository);
|
||||
TextView copyOrgUrl = v.findViewById(R.id.copyOrgUrl);
|
||||
TextView createLabel = v.findViewById(R.id.createLabel);
|
||||
|
||||
createTeam.setOnClickListener(v1 -> {
|
||||
bottomSheetOrganizationBinding.createTeam.setOnClickListener(v1 -> {
|
||||
|
||||
bmListener.onButtonClicked("team");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
createLabel.setOnClickListener(v1 -> {
|
||||
bottomSheetOrganizationBinding.createLabel.setOnClickListener(v1 -> {
|
||||
|
||||
bmListener.onButtonClicked("label");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
createRepository.setOnClickListener(v12 -> {
|
||||
bottomSheetOrganizationBinding.createRepository.setOnClickListener(v12 -> {
|
||||
|
||||
bmListener.onButtonClicked("repository");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
copyOrgUrl.setOnClickListener(v1 -> {
|
||||
bottomSheetOrganizationBinding.copyOrgUrl.setOnClickListener(v1 -> {
|
||||
|
||||
bmListener.onButtonClicked("copyOrgUrl");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return v;
|
||||
return bottomSheetOrganizationBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
@@ -6,11 +6,10 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.BottomSheetOrganizationTeamsBinding;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -24,18 +23,16 @@ public class BottomSheetOrganizationTeamsFragment extends BottomSheetDialogFragm
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_organization_teams, container, false);
|
||||
BottomSheetOrganizationTeamsBinding bottomSheetOrganizationTeamsBinding = BottomSheetOrganizationTeamsBinding.inflate(inflater, container, false);
|
||||
|
||||
TextView addNewMember = v.findViewById(R.id.addNewMember);
|
||||
|
||||
addNewMember.setOnClickListener(v1 -> {
|
||||
bottomSheetOrganizationTeamsBinding.addNewMember.setOnClickListener(v1 -> {
|
||||
|
||||
bmListener.onButtonClicked("newMember");
|
||||
dismiss();
|
||||
|
||||
});
|
||||
|
||||
return v;
|
||||
return bottomSheetOrganizationTeamsBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,11 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.ProfileEmailActivity;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.activities.ProfileEmailActivity;
|
||||
import org.mian.gitnex.databinding.BottomSheetProfileBinding;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -21,17 +20,16 @@ public class BottomSheetProfileFragment extends BottomSheetDialogFragment {
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_profile, container, false);
|
||||
|
||||
TextView addNewEmailAddress = v.findViewById(R.id.addNewEmailAddress);
|
||||
BottomSheetProfileBinding bottomSheetProfileBinding = BottomSheetProfileBinding.inflate(inflater, container, false);
|
||||
|
||||
addNewEmailAddress.setOnClickListener(v1 -> {
|
||||
bottomSheetProfileBinding.addNewEmailAddress.setOnClickListener(v1 -> {
|
||||
|
||||
startActivity(new Intent(getContext(), ProfileEmailActivity.class));
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return v;
|
||||
return bottomSheetProfileBinding.getRoot();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,11 +5,10 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.BottomSheetPullRequestFilterBinding;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -23,22 +22,19 @@ public class BottomSheetPullRequestFilterFragment extends BottomSheetDialogFragm
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_pull_request_filter, container, false);
|
||||
BottomSheetPullRequestFilterBinding bottomSheetPullRequestFilterBinding = BottomSheetPullRequestFilterBinding.inflate(inflater, container, false);
|
||||
|
||||
TextView openPr = v.findViewById(R.id.openPr);
|
||||
TextView closedPr = v.findViewById(R.id.closedPr);
|
||||
|
||||
openPr.setOnClickListener(v1 -> {
|
||||
bottomSheetPullRequestFilterBinding.openPr.setOnClickListener(v1 -> {
|
||||
bmListener.onButtonClicked("openPr");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
closedPr.setOnClickListener(v12 -> {
|
||||
bottomSheetPullRequestFilterBinding.closedPr.setOnClickListener(v12 -> {
|
||||
bmListener.onButtonClicked("closedPr");
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return v;
|
||||
return bottomSheetPullRequestFilterBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.mian.gitnex.actions.ActionResult;
|
||||
import org.mian.gitnex.actions.IssueActions;
|
||||
import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.database.api.DraftsApi;
|
||||
import org.mian.gitnex.databinding.BottomSheetReplyLayoutBinding;
|
||||
import org.mian.gitnex.helpers.StaticGlobalVariables;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
@@ -67,16 +68,16 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.bottom_sheet_reply_layout, container, false);
|
||||
BottomSheetReplyLayoutBinding bottomSheetReplyLayoutBinding = BottomSheetReplyLayoutBinding.inflate(inflater, container, false);
|
||||
Bundle arguments = requireArguments();
|
||||
|
||||
draftsHint = view.findViewById(R.id.drafts_hint);
|
||||
draftsHint = bottomSheetReplyLayoutBinding.draftsHint;
|
||||
|
||||
EditText comment = view.findViewById(R.id.comment);
|
||||
TextView toolbarTitle = view.findViewById(R.id.toolbar_title);
|
||||
ImageButton close = view.findViewById(R.id.close);
|
||||
ImageButton drafts = view.findViewById(R.id.drafts);
|
||||
ImageButton send = view.findViewById(R.id.send);
|
||||
EditText comment = bottomSheetReplyLayoutBinding.comment;
|
||||
TextView toolbarTitle = bottomSheetReplyLayoutBinding.toolbarTitle;
|
||||
ImageButton close = bottomSheetReplyLayoutBinding.close;
|
||||
ImageButton drafts = bottomSheetReplyLayoutBinding.drafts;
|
||||
ImageButton send = bottomSheetReplyLayoutBinding.send;
|
||||
|
||||
send.setEnabled(false);
|
||||
|
||||
@@ -118,7 +119,7 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
|
||||
comment.requestFocus();
|
||||
comment.setOnTouchListener((v, event) -> {
|
||||
|
||||
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from((View) view.getParent());
|
||||
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from((View) bottomSheetReplyLayoutBinding.getRoot().getParent());
|
||||
|
||||
switch(event.getAction()) {
|
||||
|
||||
@@ -234,7 +235,7 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
return bottomSheetReplyLayoutBinding.getRoot();
|
||||
}
|
||||
|
||||
private void saveDraft(String text, boolean remove) {
|
||||
|
||||
@@ -9,8 +9,8 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.actions.RepositoryActions;
|
||||
import org.mian.gitnex.databinding.BottomSheetRepoBinding;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
|
||||
/**
|
||||
@@ -24,26 +24,27 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_repo, container, false);
|
||||
|
||||
BottomSheetRepoBinding bottomSheetRepoBinding = BottomSheetRepoBinding.inflate(inflater, container, false);
|
||||
|
||||
final TinyDB tinyDb = TinyDB.getInstance(getContext());
|
||||
|
||||
TextView createLabel = v.findViewById(R.id.createLabel);
|
||||
TextView createIssue = v.findViewById(R.id.createNewIssue);
|
||||
TextView createMilestone = v.findViewById(R.id.createNewMilestone);
|
||||
TextView addCollaborator = v.findViewById(R.id.addCollaborator);
|
||||
TextView createRelease = v.findViewById(R.id.createRelease);
|
||||
TextView openWebRepo = v.findViewById(R.id.openWebRepo);
|
||||
TextView newFile = v.findViewById(R.id.newFile);
|
||||
TextView starRepository = v.findViewById(R.id.starRepository);
|
||||
TextView unStarRepository = v.findViewById(R.id.unStarRepository);
|
||||
TextView watchRepository = v.findViewById(R.id.watchRepository);
|
||||
TextView unWatchRepository = v.findViewById(R.id.unWatchRepository);
|
||||
TextView shareRepository = v.findViewById(R.id.shareRepository);
|
||||
TextView copyRepoUrl = v.findViewById(R.id.copyRepoUrl);
|
||||
View repoSettingsDivider = v.findViewById(R.id.repoSettingsDivider);
|
||||
TextView repoSettings = v.findViewById(R.id.repoSettings);
|
||||
TextView createPullRequest = v.findViewById(R.id.createPullRequest);
|
||||
TextView createLabel = bottomSheetRepoBinding.createLabel;
|
||||
TextView createIssue = bottomSheetRepoBinding.createNewIssue;
|
||||
TextView createMilestone = bottomSheetRepoBinding.createNewMilestone;
|
||||
TextView addCollaborator = bottomSheetRepoBinding.addCollaborator;
|
||||
TextView createRelease = bottomSheetRepoBinding.createRelease;
|
||||
TextView openWebRepo = bottomSheetRepoBinding.openWebRepo;
|
||||
TextView newFile = bottomSheetRepoBinding.newFile;
|
||||
TextView starRepository = bottomSheetRepoBinding.starRepository;
|
||||
TextView unStarRepository = bottomSheetRepoBinding.unStarRepository;
|
||||
TextView watchRepository = bottomSheetRepoBinding.watchRepository;
|
||||
TextView unWatchRepository = bottomSheetRepoBinding.unWatchRepository;
|
||||
TextView shareRepository = bottomSheetRepoBinding.shareRepository;
|
||||
TextView copyRepoUrl = bottomSheetRepoBinding.copyRepoUrl;
|
||||
View repoSettingsDivider = bottomSheetRepoBinding.repoSettingsDivider;
|
||||
TextView repoSettings = bottomSheetRepoBinding.repoSettings;
|
||||
TextView createPullRequest = bottomSheetRepoBinding.createPullRequest;
|
||||
|
||||
createLabel.setOnClickListener(v112 -> {
|
||||
|
||||
@@ -186,7 +187,7 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
|
||||
|
||||
}
|
||||
|
||||
return v;
|
||||
return bottomSheetRepoBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.mian.gitnex.actions.IssueActions;
|
||||
import org.mian.gitnex.activities.EditIssueActivity;
|
||||
import org.mian.gitnex.activities.FileDiffActivity;
|
||||
import org.mian.gitnex.activities.MergePullRequestActivity;
|
||||
import org.mian.gitnex.databinding.BottomSheetSingleIssueBinding;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.helpers.Version;
|
||||
@@ -36,24 +37,24 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.bottom_sheet_single_issue, container, false);
|
||||
BottomSheetSingleIssueBinding bottomSheetSingleIssueBinding = BottomSheetSingleIssueBinding.inflate(inflater, container, false);
|
||||
|
||||
final Context ctx = getContext();
|
||||
final TinyDB tinyDB = TinyDB.getInstance(ctx);
|
||||
|
||||
TextView editIssue = v.findViewById(R.id.editIssue);
|
||||
TextView editLabels = v.findViewById(R.id.editLabels);
|
||||
TextView closeIssue = v.findViewById(R.id.closeIssue);
|
||||
TextView reOpenIssue = v.findViewById(R.id.reOpenIssue);
|
||||
TextView addRemoveAssignees = v.findViewById(R.id.addRemoveAssignees);
|
||||
TextView copyIssueUrl = v.findViewById(R.id.copyIssueUrl);
|
||||
TextView openFilesDiff = v.findViewById(R.id.openFilesDiff);
|
||||
TextView mergePullRequest = v.findViewById(R.id.mergePullRequest);
|
||||
TextView shareIssue = v.findViewById(R.id.shareIssue);
|
||||
TextView subscribeIssue = v.findViewById(R.id.subscribeIssue);
|
||||
TextView unsubscribeIssue = v.findViewById(R.id.unsubscribeIssue);
|
||||
TextView editIssue = bottomSheetSingleIssueBinding.editIssue;
|
||||
TextView editLabels = bottomSheetSingleIssueBinding.editLabels;
|
||||
TextView closeIssue = bottomSheetSingleIssueBinding.closeIssue;
|
||||
TextView reOpenIssue = bottomSheetSingleIssueBinding.reOpenIssue;
|
||||
TextView addRemoveAssignees = bottomSheetSingleIssueBinding.addRemoveAssignees;
|
||||
TextView copyIssueUrl = bottomSheetSingleIssueBinding.copyIssueUrl;
|
||||
TextView openFilesDiff = bottomSheetSingleIssueBinding.openFilesDiff;
|
||||
TextView mergePullRequest = bottomSheetSingleIssueBinding.mergePullRequest;
|
||||
TextView shareIssue = bottomSheetSingleIssueBinding.shareIssue;
|
||||
TextView subscribeIssue = bottomSheetSingleIssueBinding.subscribeIssue;
|
||||
TextView unsubscribeIssue = bottomSheetSingleIssueBinding.unsubscribeIssue;
|
||||
|
||||
LinearLayout linearLayout = v.findViewById(R.id.commentReactionButtons);
|
||||
LinearLayout linearLayout = bottomSheetSingleIssueBinding.commentReactionButtons;
|
||||
|
||||
Bundle bundle1 = new Bundle();
|
||||
|
||||
@@ -221,7 +222,7 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
|
||||
unsubscribeIssue.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
return v;
|
||||
return bottomSheetSingleIssueBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
@@ -13,8 +13,8 @@ import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.CollaboratorsAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentCollaboratorsBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.models.Collaborators;
|
||||
import org.mian.gitnex.viewmodels.CollaboratorsViewModel;
|
||||
@@ -63,14 +63,15 @@ public class CollaboratorsFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_collaborators, container, false);
|
||||
FragmentCollaboratorsBinding fragmentCollaboratorsBinding = FragmentCollaboratorsBinding.inflate(inflater, container, false);
|
||||
|
||||
noDataCollaborators = v.findViewById(R.id.noDataCollaborators);
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mGridView = v.findViewById(R.id.gridView);
|
||||
noDataCollaborators = fragmentCollaboratorsBinding.noDataCollaborators;
|
||||
mProgressBar = fragmentCollaboratorsBinding.progressBar;
|
||||
mGridView = fragmentCollaboratorsBinding.gridView;
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName);
|
||||
return v;
|
||||
return fragmentCollaboratorsBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
public void onButtonPressed(Uri uri) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.adapters.DraftsAdapter;
|
||||
import org.mian.gitnex.database.api.DraftsApi;
|
||||
import org.mian.gitnex.database.models.DraftWithRepository;
|
||||
import org.mian.gitnex.databinding.FragmentDraftsBinding;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import java.util.ArrayList;
|
||||
@@ -45,10 +46,11 @@ public class DraftsFragment extends Fragment {
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_drafts, container, false);
|
||||
FragmentDraftsBinding fragmentDraftsBinding = FragmentDraftsBinding.inflate(inflater, container, false);
|
||||
|
||||
ctx = getContext();
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
@@ -59,9 +61,9 @@ public class DraftsFragment extends Fragment {
|
||||
draftsList_ = new ArrayList<>();
|
||||
draftsApi = new DraftsApi(ctx);
|
||||
|
||||
noData = v.findViewById(R.id.noData);
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
noData = fragmentDraftsBinding.noData;
|
||||
mRecyclerView = fragmentDraftsBinding.recyclerView;
|
||||
swipeRefresh = fragmentDraftsBinding.pullToRefresh;
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(ctx));
|
||||
@@ -81,7 +83,7 @@ public class DraftsFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(currentActiveAccountId);
|
||||
|
||||
return v;
|
||||
return fragmentDraftsBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -32,15 +33,16 @@ public class ExploreFragment extends Fragment {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
FragmentExploreBinding fragmentExploreBinding = FragmentExploreBinding.inflate(inflater, container, false);
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_explore, container,false);
|
||||
ctx = getContext();
|
||||
tinyDB = TinyDB.getInstance(ctx);
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navExplore));
|
||||
|
||||
TabLayout tabLayout = v.findViewById(R.id.tabsExplore);
|
||||
TabLayout tabLayout = fragmentExploreBinding.tabsExplore;
|
||||
|
||||
ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0);
|
||||
tabsCount = viewGroup.getChildCount();
|
||||
@@ -78,7 +80,7 @@ public class ExploreFragment extends Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
mViewPager = v.findViewById(R.id.containerExplore);
|
||||
mViewPager = fragmentExploreBinding.containerExplore;
|
||||
|
||||
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
|
||||
@@ -86,7 +88,7 @@ public class ExploreFragment extends Fragment {
|
||||
SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());
|
||||
mViewPager.setAdapter(mSectionsPagerAdapter);
|
||||
|
||||
return v;
|
||||
return fragmentExploreBinding.getRoot();
|
||||
}
|
||||
|
||||
public class SectionsPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.FileViewActivity;
|
||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
import org.mian.gitnex.adapters.FilesAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentFilesBinding;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.viewmodels.FilesViewModel;
|
||||
@@ -85,23 +86,23 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_files, container, false);
|
||||
FragmentFilesBinding fragmentFilesBinding = FragmentFilesBinding.inflate(inflater, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
noDataFiles = v.findViewById(R.id.noDataFiles);
|
||||
filesFrame = v.findViewById(R.id.filesFrame);
|
||||
noDataFiles = fragmentFilesBinding.noDataFiles;
|
||||
filesFrame = fragmentFilesBinding.filesFrame;
|
||||
|
||||
fileStructure = v.findViewById(R.id.fileStructure);
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
fileStructure = fragmentFilesBinding.fileStructure;
|
||||
mRecyclerView = fragmentFilesBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mProgressBar = fragmentFilesBinding.progressBar;
|
||||
|
||||
mBreadcrumbsView = v.findViewById(R.id.breadcrumbs_view);
|
||||
mBreadcrumbsView = fragmentFilesBinding.breadcrumbsView;
|
||||
mBreadcrumbsView.setItems(new ArrayList<>(Collections.singletonList(BreadcrumbItem.createSimpleItem(getResources().getString(R.string.filesBreadcrumbRoot) + getResources().getString(R.string.colonDivider) + ref))));
|
||||
|
||||
((RepoDetailActivity) requireActivity()).setFragmentRefreshListenerFiles(repoBranch -> {
|
||||
@@ -115,7 +116,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName, ref);
|
||||
|
||||
return v;
|
||||
return fragmentFilesBinding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
import org.mian.gitnex.adapters.IssuesAdapter;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.databinding.FragmentIssuesBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.StaticGlobalVariables;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
@@ -60,7 +61,8 @@ public class IssuesFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
final View v = inflater.inflate(R.layout.fragment_issues, container, false);
|
||||
FragmentIssuesBinding fragmentIssuesBinding = FragmentIssuesBinding.inflate(inflater, container, false);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
context = getContext();
|
||||
|
||||
@@ -72,19 +74,19 @@ public class IssuesFragment extends Fragment {
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentIssuesBinding.pullToRefresh;
|
||||
|
||||
// if gitea is 1.12 or higher use the new limit
|
||||
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
|
||||
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
|
||||
}
|
||||
|
||||
recyclerView = v.findViewById(R.id.recyclerView);
|
||||
recyclerView = fragmentIssuesBinding.recyclerView;
|
||||
issuesList = new ArrayList<>();
|
||||
|
||||
progressLoadMore = v.findViewById(R.id.progressLoadMore);
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
noDataIssues = v.findViewById(R.id.noDataIssues);
|
||||
progressLoadMore = fragmentIssuesBinding.progressLoadMore;
|
||||
mProgressBar = fragmentIssuesBinding.progressBar;
|
||||
noDataIssues = fragmentIssuesBinding.noDataIssues;
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
@@ -147,7 +149,7 @@ public class IssuesFragment extends Fragment {
|
||||
|
||||
loadInitial(Authorization.get(getContext()), repoOwner, repoName, resultLimit, requestType, tinyDb.getString("repoIssuesState"));
|
||||
|
||||
return v;
|
||||
return fragmentIssuesBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.LabelsAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentLabelsBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.viewmodels.LabelsViewModel;
|
||||
@@ -69,13 +69,13 @@ public class LabelsFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
final View v = inflater.inflate(R.layout.fragment_labels, container, false);
|
||||
FragmentLabelsBinding fragmentLabelsBinding = FragmentLabelsBinding.inflate(inflater, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
noData = v.findViewById(R.id.noData);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentLabelsBinding.pullToRefresh;
|
||||
noData = fragmentLabelsBinding.noData;
|
||||
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
mRecyclerView = fragmentLabelsBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
@@ -83,7 +83,7 @@ public class LabelsFragment extends Fragment {
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mProgressBar = fragmentLabelsBinding.progressBar;
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
@@ -93,7 +93,7 @@ public class LabelsFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName);
|
||||
|
||||
return v;
|
||||
return fragmentLabelsBinding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@ import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.MembersByOrgAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentMembersByOrgBinding;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
@@ -65,20 +66,20 @@ public class MembersByOrgFragment extends Fragment {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_members_by_org, container, false);
|
||||
FragmentMembersByOrgBinding fragmentMembersByOrgBinding = FragmentMembersByOrgBinding.inflate(inflater, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
TinyDB tinyDb = TinyDB.getInstance(getContext());
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
noDataMembers = v.findViewById(R.id.noDataMembers);
|
||||
noDataMembers = fragmentMembersByOrgBinding.noDataMembers;
|
||||
|
||||
progressBar = v.findViewById(R.id.progressBar);
|
||||
mGridView = v.findViewById(R.id.gridView);
|
||||
progressBar = fragmentMembersByOrgBinding.progressBar;
|
||||
mGridView = fragmentMembersByOrgBinding.gridView;
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()), orgName);
|
||||
|
||||
return v;
|
||||
return fragmentMembersByOrgBinding.getRoot();
|
||||
}
|
||||
|
||||
private void fetchDataAsync(String instanceToken, String owner) {
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.CreateRepoActivity;
|
||||
import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.adapters.MyReposListAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentMyRepositoriesBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.viewmodels.MyRepositoriesViewModel;
|
||||
@@ -77,27 +78,28 @@ public class MyRepositoriesFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
final View v = inflater.inflate(R.layout.fragment_my_repositories, container, false);
|
||||
FragmentMyRepositoriesBinding fragmentMyRepositoriesBinding = FragmentMyRepositoriesBinding.inflate(inflater, container, false);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
TinyDB tinyDb = TinyDB.getInstance(getContext());
|
||||
final String userLogin = tinyDb.getString("userLogin");
|
||||
tinyDb.putBoolean("isRepoAdmin", true);
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentMyRepositoriesBinding.pullToRefresh;
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navMyRepos));
|
||||
|
||||
noDataMyRepo = v.findViewById(R.id.noDataMyRepo);
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
noDataMyRepo = fragmentMyRepositoriesBinding.noDataMyRepo;
|
||||
mProgressBar = fragmentMyRepositoriesBinding.progressBar;
|
||||
mRecyclerView = fragmentMyRepositoriesBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
createNewRepo = v.findViewById(R.id.addNewRepo);
|
||||
createNewRepo = fragmentMyRepositoriesBinding.addNewRepo;
|
||||
createNewRepo.setOnClickListener(view -> {
|
||||
|
||||
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
||||
@@ -132,7 +134,7 @@ public class MyRepositoriesFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()), userLogin, pageSize, resultLimit);
|
||||
|
||||
return v;
|
||||
return fragmentMyRepositoriesBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.mian.gitnex.actions.NotificationsActions;
|
||||
import org.mian.gitnex.activities.IssueDetailActivity;
|
||||
import org.mian.gitnex.adapters.NotificationsAdapter;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.databinding.FragmentNotificationsBinding;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.InfiniteScrollListener;
|
||||
import org.mian.gitnex.helpers.StaticGlobalVariables;
|
||||
@@ -75,7 +76,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_notifications, container, false);
|
||||
FragmentNotificationsBinding fragmentNotificationsBinding = FragmentNotificationsBinding.inflate(inflater, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
activity = requireActivity();
|
||||
@@ -85,10 +86,10 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
|
||||
pageResultLimit = StaticGlobalVariables.getCurrentResultLimit(context);
|
||||
tinyDB.putString("notificationsFilterState", currentFilterMode);
|
||||
|
||||
markAllAsRead = v.findViewById(R.id.markAllAsRead);
|
||||
noDataNotifications = v.findViewById(R.id.noDataNotifications);
|
||||
loadingMoreView = v.findViewById(R.id.loadingMoreView);
|
||||
progressBar = v.findViewById(R.id.progressBar);
|
||||
markAllAsRead = fragmentNotificationsBinding.markAllAsRead;
|
||||
noDataNotifications = fragmentNotificationsBinding.noDataNotifications;
|
||||
loadingMoreView = fragmentNotificationsBinding.loadingMoreView;
|
||||
progressBar = fragmentNotificationsBinding.progressBar;
|
||||
|
||||
notificationThreads = new ArrayList<>();
|
||||
notificationsActions = new NotificationsActions(context);
|
||||
@@ -96,7 +97,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
|
||||
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
|
||||
|
||||
RecyclerView recyclerView = v.findViewById(R.id.notifications);
|
||||
RecyclerView recyclerView = fragmentNotificationsBinding.notifications;
|
||||
recyclerView.setHasFixedSize(true);
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
recyclerView.setAdapter(notificationsAdapter);
|
||||
@@ -164,7 +165,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
|
||||
|
||||
});
|
||||
|
||||
pullToRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
pullToRefresh = fragmentNotificationsBinding.pullToRefresh;
|
||||
pullToRefresh.setOnRefreshListener(() -> {
|
||||
|
||||
pageCurrentIndex = 1;
|
||||
@@ -173,7 +174,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
|
||||
});
|
||||
|
||||
loadNotifications(false);
|
||||
return v;
|
||||
return fragmentNotificationsBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import androidx.fragment.app.Fragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.PicassoService;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.databinding.FragmentOrganizationInfoBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.models.Organization;
|
||||
@@ -64,21 +65,21 @@ public class OrganizationInfoFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_organization_info, container, false);
|
||||
FragmentOrganizationInfoBinding fragmentOrganizationInfoBinding = FragmentOrganizationInfoBinding.inflate(inflater, container, false);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
orgAvatar = v.findViewById(R.id.orgAvatar);
|
||||
TextView orgNameInfo = v.findViewById(R.id.orgNameInfo);
|
||||
orgDescInfo = v.findViewById(R.id.orgDescInfo);
|
||||
orgWebsiteInfo = v.findViewById(R.id.orgWebsiteInfo);
|
||||
orgLocationInfo = v.findViewById(R.id.orgLocationInfo);
|
||||
orgInfoLayout = v.findViewById(R.id.orgInfoLayout);
|
||||
mProgressBar = fragmentOrganizationInfoBinding.progressBar;
|
||||
orgAvatar = fragmentOrganizationInfoBinding.orgAvatar;
|
||||
TextView orgNameInfo = fragmentOrganizationInfoBinding.orgNameInfo;
|
||||
orgDescInfo = fragmentOrganizationInfoBinding.orgDescInfo;
|
||||
orgWebsiteInfo = fragmentOrganizationInfoBinding.orgWebsiteInfo;
|
||||
orgLocationInfo = fragmentOrganizationInfoBinding.orgLocationInfo;
|
||||
orgInfoLayout = fragmentOrganizationInfoBinding.orgInfoLayout;
|
||||
|
||||
orgNameInfo.setText(orgName);
|
||||
|
||||
getOrgInfo(Authorization.get(getContext()), orgName);
|
||||
|
||||
return v;
|
||||
return fragmentOrganizationInfoBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.LabelsAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentLabelsBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.viewmodels.OrganizationLabelsViewModel;
|
||||
@@ -62,13 +62,13 @@ public class OrganizationLabelsFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
final View v = inflater.inflate(R.layout.fragment_labels, container, false);
|
||||
FragmentLabelsBinding fragmentLabelsBinding = FragmentLabelsBinding.inflate(inflater, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
noData = v.findViewById(R.id.noData);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentLabelsBinding.pullToRefresh;
|
||||
noData = fragmentLabelsBinding.noData;
|
||||
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
mRecyclerView = fragmentLabelsBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
@@ -76,7 +76,7 @@ public class OrganizationLabelsFragment extends Fragment {
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mProgressBar = fragmentLabelsBinding.progressBar;
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
@@ -87,7 +87,7 @@ public class OrganizationLabelsFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()), repoOwner);
|
||||
|
||||
return v;
|
||||
return fragmentLabelsBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.CreateOrganizationActivity;
|
||||
import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.adapters.OrganizationsListAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentOrganizationsBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.viewmodels.OrganizationListViewModel;
|
||||
@@ -46,16 +47,16 @@ public class OrganizationsFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
final View v = inflater.inflate(R.layout.fragment_organizations, container, false);
|
||||
FragmentOrganizationsBinding fragmentOrganizationsBinding = FragmentOrganizationsBinding.inflate(inflater, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentOrganizationsBinding.pullToRefresh;
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navOrgs));
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
noDataOrg = v.findViewById(R.id.noDataOrg);
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
mProgressBar = fragmentOrganizationsBinding.progressBar;
|
||||
noDataOrg = fragmentOrganizationsBinding.noDataOrg;
|
||||
mRecyclerView = fragmentOrganizationsBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
@@ -63,7 +64,7 @@ public class OrganizationsFragment extends Fragment {
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
createNewOrganization = v.findViewById(R.id.addNewOrganization);
|
||||
createNewOrganization = fragmentOrganizationsBinding.addNewOrganization;
|
||||
|
||||
createNewOrganization.setOnClickListener(view -> {
|
||||
|
||||
@@ -96,7 +97,7 @@ public class OrganizationsFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()));
|
||||
|
||||
return v;
|
||||
return fragmentOrganizationsBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.ProfileEmailsAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentProfileEmailsBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.models.Emails;
|
||||
import org.mian.gitnex.viewmodels.ProfileEmailsViewModel;
|
||||
@@ -67,12 +67,12 @@ public class ProfileEmailsFragment extends Fragment {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
final View v = inflater.inflate(R.layout.fragment_profile_emails, container, false);
|
||||
FragmentProfileEmailsBinding fragmentProfileEmailsBinding = FragmentProfileEmailsBinding.inflate(inflater, container, false);
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentProfileEmailsBinding.pullToRefresh;
|
||||
|
||||
noDataEmails = v.findViewById(R.id.noDataEmails);
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
noDataEmails = fragmentProfileEmailsBinding.noDataEmails;
|
||||
mRecyclerView = fragmentProfileEmailsBinding.recyclerView;
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
@@ -81,7 +81,7 @@ public class ProfileEmailsFragment extends Fragment {
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mProgressBar = fragmentProfileEmailsBinding.progressBar;
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ProfileEmailsFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()));
|
||||
|
||||
return v;
|
||||
return fragmentProfileEmailsBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.ProfileFollowersAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentProfileFollowersBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.models.UserInfo;
|
||||
import org.mian.gitnex.viewmodels.ProfileFollowersViewModel;
|
||||
@@ -67,12 +67,13 @@ public class ProfileFollowersFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
final View v = inflater.inflate(R.layout.fragment_profile_followers, container, false);
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
FragmentProfileFollowersBinding fragmentProfileFollowersBinding = FragmentProfileFollowersBinding.inflate(inflater, container, false);
|
||||
|
||||
noDataFollowers = v.findViewById(R.id.noDataFollowers);
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentProfileFollowersBinding.pullToRefresh;
|
||||
|
||||
noDataFollowers = fragmentProfileFollowersBinding.noDataFollowers;
|
||||
mRecyclerView = fragmentProfileFollowersBinding.recyclerView;
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
@@ -81,7 +82,7 @@ public class ProfileFollowersFragment extends Fragment {
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mProgressBar = fragmentProfileFollowersBinding.progressBar;
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
@@ -92,7 +93,7 @@ public class ProfileFollowersFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()));
|
||||
|
||||
return v;
|
||||
return fragmentProfileFollowersBinding.getRoot();
|
||||
}
|
||||
|
||||
private void fetchDataAsync(String instanceToken) {
|
||||
|
||||
@@ -18,8 +18,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.ProfileFollowingAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentProfileFollowingBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.models.UserInfo;
|
||||
@@ -68,14 +68,15 @@ public class ProfileFollowingFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
final View v = inflater.inflate(R.layout.fragment_profile_following, container, false);
|
||||
|
||||
FragmentProfileFollowingBinding fragmentProfileFollowingBinding = FragmentProfileFollowingBinding.inflate(inflater, container, false);
|
||||
|
||||
TinyDB tinyDb = TinyDB.getInstance(getContext());
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentProfileFollowingBinding.pullToRefresh;
|
||||
|
||||
noDataFollowing = v.findViewById(R.id.noDataFollowing);
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
noDataFollowing = fragmentProfileFollowingBinding.noDataFollowing;
|
||||
mRecyclerView = fragmentProfileFollowingBinding.recyclerView;
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
@@ -84,7 +85,7 @@ public class ProfileFollowingFragment extends Fragment {
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mProgressBar = fragmentProfileFollowingBinding.progressBar;
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
@@ -95,7 +96,7 @@ public class ProfileFollowingFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()));
|
||||
|
||||
return v;
|
||||
return fragmentProfileFollowingBinding.getRoot();
|
||||
}
|
||||
|
||||
private void fetchDataAsync(String instanceToken) {
|
||||
|
||||
@@ -10,7 +10,6 @@ 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;
|
||||
@@ -24,11 +23,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;
|
||||
|
||||
/**
|
||||
@@ -45,63 +44,55 @@ public class ProfileFragment extends Fragment {
|
||||
|
||||
ctx = getContext();
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_profile, container, false);
|
||||
FragmentProfileBinding fragmentProfileBinding = FragmentProfileBinding.inflate(inflater, container, false);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navProfile));
|
||||
|
||||
TinyDB tinyDb = TinyDB.getInstance(getContext());
|
||||
|
||||
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);
|
||||
ViewGroup aboutFrame = fragmentProfileBinding.aboutFrame;
|
||||
|
||||
String[] userLanguageCodes = tinyDb.getString("userLang").split("-");
|
||||
|
||||
if(userLanguageCodes.length >= 2) {
|
||||
|
||||
Locale locale = new Locale(userLanguageCodes[0], userLanguageCodes[1]);
|
||||
userLanguage.setText(locale.getDisplayLanguage());
|
||||
fragmentProfileBinding.userLanguage.setText(locale.getDisplayLanguage());
|
||||
}
|
||||
else {
|
||||
|
||||
userLanguage.setText(R.string.notSupported);
|
||||
fragmentProfileBinding.userLanguage.setText(R.string.notSupported);
|
||||
}
|
||||
|
||||
userFullName.setText(tinyDb.getString("userFullname"));
|
||||
userLogin.setText(getString(R.string.usernameWithAt, tinyDb.getString("userLogin")));
|
||||
fragmentProfileBinding.userFullName.setText(tinyDb.getString("userFullname"));
|
||||
fragmentProfileBinding.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(userAvatar);
|
||||
.centerCrop().into(fragmentProfileBinding.userAvatar);
|
||||
|
||||
PicassoService.getInstance(ctx).get()
|
||||
.load(tinyDb.getString("userAvatar"))
|
||||
.into(userAvatarBackground, new Callback() {
|
||||
.into(fragmentProfileBinding.userAvatarBackground, new Callback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
int invertedColor = new ColorInverter().getImageViewContrastColor(userAvatarBackground);
|
||||
int invertedColor = new ColorInverter().getImageViewContrastColor(fragmentProfileBinding.userAvatarBackground);
|
||||
|
||||
userFullName.setTextColor(invertedColor);
|
||||
divider.setBackgroundColor(invertedColor);
|
||||
userLogin.setTextColor(invertedColor);
|
||||
userLanguage.setTextColor(invertedColor);
|
||||
fragmentProfileBinding.userFullName.setTextColor(invertedColor);
|
||||
fragmentProfileBinding.divider.setBackgroundColor(invertedColor);
|
||||
fragmentProfileBinding.userLogin.setTextColor(invertedColor);
|
||||
fragmentProfileBinding.userLanguage.setTextColor(invertedColor);
|
||||
|
||||
ImageViewCompat.setImageTintList(userLanguageIcon, ColorStateList.valueOf(invertedColor));
|
||||
ImageViewCompat.setImageTintList(fragmentProfileBinding.userLanguageIcon, ColorStateList.valueOf(invertedColor));
|
||||
|
||||
blurView.setupWith(aboutFrame)
|
||||
fragmentProfileBinding.blurView.setupWith(aboutFrame)
|
||||
.setBlurAlgorithm(new RenderScriptBlur(ctx))
|
||||
.setBlurRadius(3)
|
||||
.setHasFixedTransformationMatrix(true);
|
||||
@@ -116,7 +107,7 @@ public class ProfileFragment extends Fragment {
|
||||
|
||||
ProfileFragment.SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());
|
||||
|
||||
ViewPager mViewPager = v.findViewById(R.id.container);
|
||||
ViewPager mViewPager = fragmentProfileBinding.container;
|
||||
mViewPager.setAdapter(mSectionsPagerAdapter);
|
||||
|
||||
Typeface myTypeface;
|
||||
@@ -137,7 +128,7 @@ public class ProfileFragment extends Fragment {
|
||||
|
||||
}
|
||||
|
||||
TabLayout tabLayout = v.findViewById(R.id.tabs);
|
||||
TabLayout tabLayout = fragmentProfileBinding.tabs;
|
||||
|
||||
ViewGroup vg = (ViewGroup) tabLayout.getChildAt(0);
|
||||
int tabsCount = vg.getChildCount();
|
||||
@@ -160,7 +151,7 @@ public class ProfileFragment extends Fragment {
|
||||
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
|
||||
|
||||
return v;
|
||||
return fragmentProfileBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
import org.mian.gitnex.adapters.PullRequestsAdapter;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.databinding.FragmentPullRequestsBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.StaticGlobalVariables;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
@@ -59,7 +60,8 @@ public class PullRequestsFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
final View v = inflater.inflate(R.layout.fragment_pull_requests, container, false);
|
||||
FragmentPullRequestsBinding fragmentPullRequestsBinding = FragmentPullRequestsBinding.inflate(inflater, container, false);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
context = getContext();
|
||||
|
||||
@@ -71,19 +73,19 @@ public class PullRequestsFragment extends Fragment {
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentPullRequestsBinding.pullToRefresh;
|
||||
|
||||
// if gitea is 1.12 or higher use the new limit
|
||||
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
|
||||
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
|
||||
}
|
||||
|
||||
recyclerView = v.findViewById(R.id.recyclerView);
|
||||
recyclerView = fragmentPullRequestsBinding.recyclerView;
|
||||
prList = new ArrayList<>();
|
||||
|
||||
progressLoadMore = v.findViewById(R.id.progressLoadMore);
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
noData = v.findViewById(R.id.noData);
|
||||
progressLoadMore = fragmentPullRequestsBinding.progressLoadMore;
|
||||
mProgressBar = fragmentPullRequestsBinding.progressBar;
|
||||
noData = fragmentPullRequestsBinding.noData;
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
@@ -145,7 +147,8 @@ public class PullRequestsFragment extends Fragment {
|
||||
});
|
||||
|
||||
loadInitial(Authorization.get(getContext()), repoOwner, repoName, pageSize, tinyDb.getString("repoPrState"), resultLimit);
|
||||
return v;
|
||||
|
||||
return fragmentPullRequestsBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.ReleasesAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentReleasesBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.models.Releases;
|
||||
@@ -69,13 +69,13 @@ public class ReleasesFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_releases, container, false);
|
||||
FragmentReleasesBinding fragmentReleasesBinding = FragmentReleasesBinding.inflate(inflater, container, false);
|
||||
|
||||
noDataReleases = v.findViewById(R.id.noDataReleases);
|
||||
noDataReleases = fragmentReleasesBinding.noDataReleases;
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentReleasesBinding.pullToRefresh;
|
||||
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
mRecyclerView = fragmentReleasesBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ReleasesFragment extends Fragment {
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mProgressBar = fragmentReleasesBinding.progressBar;
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ReleasesFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()), repoOwner, repoName);
|
||||
|
||||
return v;
|
||||
return fragmentReleasesBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.databinding.FragmentRepoInfoBinding;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.ClickListener;
|
||||
@@ -93,7 +94,7 @@ public class RepoInfoFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_repo_info, container, false);
|
||||
FragmentRepoInfoBinding fragmentRepoInfoBinding = FragmentRepoInfoBinding.inflate(inflater, container, false);
|
||||
|
||||
TinyDB tinyDb = TinyDB.getInstance(getContext());
|
||||
|
||||
@@ -102,31 +103,31 @@ public class RepoInfoFragment extends Fragment {
|
||||
|
||||
ctx = getActivity();
|
||||
|
||||
pageContent = v.findViewById(R.id.repoInfoLayout);
|
||||
pageContent = fragmentRepoInfoBinding.repoInfoLayout;
|
||||
pageContent.setVisibility(View.GONE);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
repoMetaName = v.findViewById(R.id.repoMetaName);
|
||||
repoMetaDescription = v.findViewById(R.id.repoMetaDescription);
|
||||
repoMetaStars = v.findViewById(R.id.repoMetaStars);
|
||||
repoMetaPullRequests = v.findViewById(R.id.repoMetaPullRequests);
|
||||
repoMetaPullRequestsFrame = v.findViewById(R.id.repoMetaPullRequestsFrame);
|
||||
repoMetaForks = v.findViewById(R.id.repoMetaForks);
|
||||
repoMetaSize = v.findViewById(R.id.repoMetaSize);
|
||||
repoMetaWatchers = v.findViewById(R.id.repoMetaWatchers);
|
||||
repoMetaCreatedAt = v.findViewById(R.id.repoMetaCreatedAt);
|
||||
repoMetaWebsite = v.findViewById(R.id.repoMetaWebsite);
|
||||
repoAdditionalButton = v.findViewById(R.id.repoAdditionalButton);
|
||||
repoFileContents = v.findViewById(R.id.repoFileContents);
|
||||
repoMetaFrame = v.findViewById(R.id.repoMetaFrame);
|
||||
LinearLayout repoMetaFrameHeader = v.findViewById(R.id.repoMetaFrameHeader);
|
||||
repoMetaDataExpandCollapse = v.findViewById(R.id.repoMetaDataExpandCollapse);
|
||||
repoFilenameExpandCollapse = v.findViewById(R.id.repoFilenameExpandCollapse);
|
||||
fileContentsFrameHeader = v.findViewById(R.id.fileContentsFrameHeader);
|
||||
fileContentsFrame = v.findViewById(R.id.fileContentsFrame);
|
||||
LinearLayout repoMetaStarsFrame = v.findViewById(R.id.repoMetaStarsFrame);
|
||||
LinearLayout repoMetaForksFrame = v.findViewById(R.id.repoMetaForksFrame);
|
||||
LinearLayout repoMetaWatchersFrame = v.findViewById(R.id.repoMetaWatchersFrame);
|
||||
mProgressBar = fragmentRepoInfoBinding.progressBar;
|
||||
repoMetaName = fragmentRepoInfoBinding.repoMetaName;
|
||||
repoMetaDescription = fragmentRepoInfoBinding.repoMetaDescription;
|
||||
repoMetaStars = fragmentRepoInfoBinding.repoMetaStars;
|
||||
repoMetaPullRequests = fragmentRepoInfoBinding.repoMetaPullRequests;
|
||||
repoMetaPullRequestsFrame = fragmentRepoInfoBinding.repoMetaPullRequestsFrame;
|
||||
repoMetaForks = fragmentRepoInfoBinding.repoMetaForks;
|
||||
repoMetaSize = fragmentRepoInfoBinding.repoMetaSize;
|
||||
repoMetaWatchers = fragmentRepoInfoBinding.repoMetaWatchers;
|
||||
repoMetaCreatedAt = fragmentRepoInfoBinding.repoMetaCreatedAt;
|
||||
repoMetaWebsite = fragmentRepoInfoBinding.repoMetaWebsite;
|
||||
repoAdditionalButton = fragmentRepoInfoBinding.repoAdditionalButton;
|
||||
repoFileContents = fragmentRepoInfoBinding.repoFileContents;
|
||||
repoMetaFrame = fragmentRepoInfoBinding.repoMetaFrame;
|
||||
LinearLayout repoMetaFrameHeader = fragmentRepoInfoBinding.repoMetaFrameHeader;
|
||||
repoMetaDataExpandCollapse = fragmentRepoInfoBinding.repoMetaDataExpandCollapse;
|
||||
repoFilenameExpandCollapse = fragmentRepoInfoBinding.repoFilenameExpandCollapse;
|
||||
fileContentsFrameHeader = fragmentRepoInfoBinding.fileContentsFrameHeader;
|
||||
fileContentsFrame = fragmentRepoInfoBinding.fileContentsFrame;
|
||||
LinearLayout repoMetaStarsFrame = fragmentRepoInfoBinding.repoMetaStarsFrame;
|
||||
LinearLayout repoMetaForksFrame = fragmentRepoInfoBinding.repoMetaForksFrame;
|
||||
LinearLayout repoMetaWatchersFrame = fragmentRepoInfoBinding.repoMetaWatchersFrame;
|
||||
|
||||
repoMetaFrame.setVisibility(View.GONE);
|
||||
|
||||
@@ -161,7 +162,7 @@ public class RepoInfoFragment extends Fragment {
|
||||
|
||||
repoMetaPullRequestsFrame.setOnClickListener(metaPR -> RepoDetailActivity.mViewPager.setCurrentItem(3));
|
||||
|
||||
return v;
|
||||
return fragmentRepoInfoBinding.getRoot();
|
||||
}
|
||||
|
||||
public void onButtonPressed(Uri uri) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.RepositoriesByOrgAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentRepositoriesByOrgBinding;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
@@ -71,13 +72,14 @@ public class RepositoriesByOrgFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_repositories_by_org, container, false);
|
||||
FragmentRepositoriesByOrgBinding fragmentRepositoriesByOrgBinding = FragmentRepositoriesByOrgBinding.inflate(inflater, container, false);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
noData = v.findViewById(R.id.noData);
|
||||
noData = fragmentRepositoriesByOrgBinding.noData;
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentRepositoriesByOrgBinding.pullToRefresh;
|
||||
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
mRecyclerView = fragmentRepositoriesByOrgBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
@@ -85,7 +87,7 @@ public class RepositoriesByOrgFragment extends Fragment {
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mProgressBar = fragmentRepositoriesByOrgBinding.progressBar;
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
@@ -96,7 +98,7 @@ public class RepositoriesByOrgFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()), orgName, pageSize, resultLimit);
|
||||
|
||||
return v;
|
||||
return fragmentRepositoriesByOrgBinding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.CreateRepoActivity;
|
||||
import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.adapters.ReposListAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentRepositoriesBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.viewmodels.RepositoriesListViewModel;
|
||||
@@ -41,23 +42,24 @@ public class RepositoriesFragment extends Fragment {
|
||||
private ReposListAdapter adapter;
|
||||
private ExtendedFloatingActionButton createNewRepo;
|
||||
private TextView noDataRepo;
|
||||
private int pageSize = 1;
|
||||
private int resultLimit = 50;
|
||||
private final int pageSize = 1;
|
||||
private final int resultLimit = 50;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
final View v = inflater.inflate(R.layout.fragment_repositories, container, false);
|
||||
FragmentRepositoriesBinding fragmentRepositoriesBinding = FragmentRepositoriesBinding.inflate(inflater, container, false);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentRepositoriesBinding.pullToRefresh;
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navRepos));
|
||||
|
||||
noDataRepo = v.findViewById(R.id.noData);
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
noDataRepo = fragmentRepositoriesBinding.noData;
|
||||
mProgressBar = fragmentRepositoriesBinding.progressBar;
|
||||
mRecyclerView = fragmentRepositoriesBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
@@ -65,7 +67,7 @@ public class RepositoriesFragment extends Fragment {
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
createNewRepo = v.findViewById(R.id.addNewRepo);
|
||||
createNewRepo = fragmentRepositoriesBinding.addNewRepo;
|
||||
|
||||
createNewRepo.setOnClickListener(view -> {
|
||||
|
||||
@@ -98,7 +100,7 @@ public class RepositoriesFragment extends Fragment {
|
||||
}, 50));
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()), pageSize, resultLimit);
|
||||
return v;
|
||||
return fragmentRepositoriesBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -22,6 +21,7 @@ import org.mian.gitnex.activities.SettingsNotificationsActivity;
|
||||
import org.mian.gitnex.activities.SettingsReportsActivity;
|
||||
import org.mian.gitnex.activities.SettingsSecurityActivity;
|
||||
import org.mian.gitnex.activities.SettingsTranslationActivity;
|
||||
import org.mian.gitnex.databinding.FragmentSettingsBinding;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.helpers.Version;
|
||||
|
||||
@@ -38,49 +38,39 @@ public class SettingsFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_settings, container, false);
|
||||
FragmentSettingsBinding fragmentSettingsBinding = FragmentSettingsBinding.inflate(inflater, container, false);
|
||||
|
||||
ctx = getContext();
|
||||
tinyDB = TinyDB.getInstance(ctx);
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navSettings));
|
||||
|
||||
LinearLayout generalFrame = v.findViewById(R.id.generalFrame);
|
||||
LinearLayout appearanceFrame = v.findViewById(R.id.appearanceFrame);
|
||||
LinearLayout fileViewerFrame = v.findViewById(R.id.fileViewerFrame);
|
||||
LinearLayout draftsFrame = v.findViewById(R.id.draftsFrame);
|
||||
LinearLayout securityFrame = v.findViewById(R.id.securityFrame);
|
||||
LinearLayout notificationsFrame = v.findViewById(R.id.notificationsFrame);
|
||||
LinearLayout languagesFrame = v.findViewById(R.id.languagesFrame);
|
||||
LinearLayout reportsFrame = v.findViewById(R.id.reportsFrame);
|
||||
LinearLayout rateAppFrame = v.findViewById(R.id.rateAppFrame);
|
||||
LinearLayout aboutAppFrame = v.findViewById(R.id.aboutAppFrame);
|
||||
|
||||
if(new Version(tinyDB.getString("giteaVersion")).higherOrEqual("1.12.3")) {
|
||||
|
||||
notificationsFrame.setVisibility(View.VISIBLE);
|
||||
fragmentSettingsBinding.notificationsFrame.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
generalFrame.setOnClickListener(generalFrameCall -> startActivity(new Intent(ctx, SettingsGeneralActivity.class)));
|
||||
fragmentSettingsBinding.generalFrame.setOnClickListener(generalFrameCall -> startActivity(new Intent(ctx, SettingsGeneralActivity.class)));
|
||||
|
||||
appearanceFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsAppearanceActivity.class)));
|
||||
fragmentSettingsBinding.appearanceFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsAppearanceActivity.class)));
|
||||
|
||||
fileViewerFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsFileViewerActivity.class)));
|
||||
fragmentSettingsBinding.fileViewerFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsFileViewerActivity.class)));
|
||||
|
||||
draftsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsDraftsActivity.class)));
|
||||
fragmentSettingsBinding.draftsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsDraftsActivity.class)));
|
||||
|
||||
securityFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsSecurityActivity.class)));
|
||||
fragmentSettingsBinding.securityFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsSecurityActivity.class)));
|
||||
|
||||
notificationsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsNotificationsActivity.class)));
|
||||
fragmentSettingsBinding.notificationsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsNotificationsActivity.class)));
|
||||
|
||||
languagesFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsTranslationActivity.class)));
|
||||
fragmentSettingsBinding.languagesFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsTranslationActivity.class)));
|
||||
|
||||
reportsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsReportsActivity.class)));
|
||||
fragmentSettingsBinding.reportsFrame.setOnClickListener(v1 -> startActivity(new Intent(ctx, SettingsReportsActivity.class)));
|
||||
|
||||
rateAppFrame.setOnClickListener(aboutApp -> rateThisApp());
|
||||
fragmentSettingsBinding.rateAppFrame.setOnClickListener(aboutApp -> rateThisApp());
|
||||
|
||||
aboutAppFrame.setOnClickListener(aboutApp -> requireActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new AboutFragment()).commit());
|
||||
fragmentSettingsBinding.aboutAppFrame.setOnClickListener(aboutApp -> requireActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new AboutFragment()).commit());
|
||||
|
||||
return v;
|
||||
return fragmentSettingsBinding.getRoot();
|
||||
}
|
||||
|
||||
public void rateThisApp() {
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.CreateRepoActivity;
|
||||
import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.adapters.StarredReposListAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentStarredRepositoriesBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.viewmodels.StarredRepositoriesViewModel;
|
||||
@@ -73,16 +74,16 @@ public class StarredRepositoriesFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_starred_repositories, container, false);
|
||||
FragmentStarredRepositoriesBinding fragmentStarredRepositoriesBinding = FragmentStarredRepositoriesBinding.inflate(inflater, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentStarredRepositoriesBinding.pullToRefresh;
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navStarredRepos));
|
||||
|
||||
noData = v.findViewById(R.id.noData);
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
noData = fragmentStarredRepositoriesBinding.noData;
|
||||
mProgressBar = fragmentStarredRepositoriesBinding.progressBar;
|
||||
mRecyclerView = fragmentStarredRepositoriesBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
@@ -90,7 +91,7 @@ public class StarredRepositoriesFragment extends Fragment {
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
createNewRepo = v.findViewById(R.id.addNewRepo);
|
||||
createNewRepo = fragmentStarredRepositoriesBinding.addNewRepo;
|
||||
|
||||
createNewRepo.setOnClickListener(view -> {
|
||||
|
||||
@@ -124,7 +125,7 @@ public class StarredRepositoriesFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()), pageSize, resultLimit);
|
||||
|
||||
return v;
|
||||
return fragmentStarredRepositoriesBinding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.TeamsByOrgAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentTeamsByOrgBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.models.Teams;
|
||||
@@ -68,14 +69,14 @@ public class TeamsByOrgFragment extends Fragment {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_teams_by_org, container, false);
|
||||
FragmentTeamsByOrgBinding fragmentTeamsByOrgBinding = FragmentTeamsByOrgBinding.inflate(inflater, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
noDataTeams = v.findViewById(R.id.noDataTeams);
|
||||
noDataTeams = fragmentTeamsByOrgBinding.noDataTeams;
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentTeamsByOrgBinding.pullToRefresh;
|
||||
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
mRecyclerView = fragmentTeamsByOrgBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
@@ -83,7 +84,7 @@ public class TeamsByOrgFragment extends Fragment {
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
mProgressBar = v.findViewById(R.id.progress_bar);
|
||||
mProgressBar = fragmentTeamsByOrgBinding.progressBar;
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
@@ -94,7 +95,7 @@ public class TeamsByOrgFragment extends Fragment {
|
||||
|
||||
fetchDataAsync(Authorization.get(getContext()), orgName);
|
||||
|
||||
return v;
|
||||
return fragmentTeamsByOrgBinding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.adapters.UserAccountsAdapter;
|
||||
import org.mian.gitnex.database.api.UserAccountsApi;
|
||||
import org.mian.gitnex.database.models.UserAccount;
|
||||
import org.mian.gitnex.databinding.FragmentUserAccountsBinding;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -40,7 +41,7 @@ public class UserAccountsFragment extends Fragment {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_user_accounts, container, false);
|
||||
FragmentUserAccountsBinding fragmentUserAccountsBinding = FragmentUserAccountsBinding.inflate(inflater, container, false);
|
||||
ctx = getContext();
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
@@ -49,8 +50,8 @@ public class UserAccountsFragment extends Fragment {
|
||||
userAccountsList = new ArrayList<>();
|
||||
userAccountsApi = new UserAccountsApi(ctx);
|
||||
|
||||
mRecyclerView = v.findViewById(R.id.recyclerView);
|
||||
final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
|
||||
mRecyclerView = fragmentUserAccountsBinding.recyclerView;
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentUserAccountsBinding.pullToRefresh;
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(ctx));
|
||||
@@ -69,7 +70,7 @@ public class UserAccountsFragment extends Fragment {
|
||||
|
||||
}, 250));
|
||||
|
||||
addNewAccount = v.findViewById(R.id.addNewAccount);
|
||||
addNewAccount = fragmentUserAccountsBinding.addNewAccount;
|
||||
addNewAccount.setOnClickListener(view -> {
|
||||
|
||||
Intent intent = new Intent(view.getContext(), AddNewAccountActivity.class);
|
||||
@@ -78,7 +79,7 @@ public class UserAccountsFragment extends Fragment {
|
||||
|
||||
fetchDataAsync();
|
||||
|
||||
return v;
|
||||
return fragmentUserAccountsBinding.getRoot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user