check if repo issues is enalbed or disabled
This commit is contained in:
		@@ -8,6 +8,7 @@ import android.view.ViewGroup;
 | 
			
		||||
import android.widget.TextView;
 | 
			
		||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
 | 
			
		||||
import org.mian.gitnex.R;
 | 
			
		||||
import org.mian.gitnex.util.TinyDB;
 | 
			
		||||
import androidx.annotation.NonNull;
 | 
			
		||||
import androidx.annotation.Nullable;
 | 
			
		||||
 | 
			
		||||
@@ -24,6 +25,8 @@ public class RepoBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 | 
			
		||||
        View v = inflater.inflate(R.layout.repo_bottom_sheet_layout, container, false);
 | 
			
		||||
 | 
			
		||||
        final TinyDB tinyDb = new TinyDB(getContext());
 | 
			
		||||
 | 
			
		||||
        TextView createLabel = v.findViewById(R.id.createLabel);
 | 
			
		||||
        TextView createIssue = v.findViewById(R.id.createNewIssue);
 | 
			
		||||
        TextView createMilestone = v.findViewById(R.id.createNewMilestone);
 | 
			
		||||
@@ -40,13 +43,19 @@ public class RepoBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        createIssue.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View v) {
 | 
			
		||||
                bmListener.onButtonClicked("newIssue");
 | 
			
		||||
                dismiss();
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        if(tinyDb.getBoolean("hasIssues")) {
 | 
			
		||||
            createIssue.setVisibility(View.VISIBLE);
 | 
			
		||||
            createIssue.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
                @Override
 | 
			
		||||
                public void onClick(View v) {
 | 
			
		||||
                    bmListener.onButtonClicked("newIssue");
 | 
			
		||||
                    dismiss();
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            createIssue.setVisibility(View.GONE);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        createMilestone.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
 
 | 
			
		||||
@@ -215,6 +215,8 @@ public class RepoInfoFragment extends Fragment {
 | 
			
		||||
 | 
			
		||||
    private void getRepoInfo(String instanceUrl, String token, final String owner, String repo, final String locale, final String timeFormat) {
 | 
			
		||||
 | 
			
		||||
        final TinyDB tinyDb = new TinyDB(getContext());
 | 
			
		||||
 | 
			
		||||
        Call<UserRepositories> call = RetrofitClient
 | 
			
		||||
                .getInstance(instanceUrl)
 | 
			
		||||
                .getApiInterface()
 | 
			
		||||
@@ -245,6 +247,13 @@ public class RepoInfoFragment extends Fragment {
 | 
			
		||||
                            repoRepoUrlInfo.setText(repoInfo.getHtml_url());
 | 
			
		||||
                            repoForksCountInfo.setText(repoInfo.getForks_count());
 | 
			
		||||
 | 
			
		||||
                            if(repoInfo.getHas_issues()) {
 | 
			
		||||
                                tinyDb.putBoolean("hasIssues", repoInfo.getHas_issues());
 | 
			
		||||
                            }
 | 
			
		||||
                            else {
 | 
			
		||||
                                tinyDb.putBoolean("hasIssues", true);
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            switch (timeFormat) {
 | 
			
		||||
                                case "pretty": {
 | 
			
		||||
                                    PrettyTime prettyTime = new PrettyTime(new Locale(locale));
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ public class UserRepositories {
 | 
			
		||||
    private String ssh_url;
 | 
			
		||||
    private String website;
 | 
			
		||||
    private String forks_count;
 | 
			
		||||
 | 
			
		||||
    private Boolean has_issues;
 | 
			
		||||
 | 
			
		||||
    public int getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
@@ -96,4 +96,8 @@ public class UserRepositories {
 | 
			
		||||
    public String getForks_count() {
 | 
			
		||||
        return forks_count;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Boolean getHas_issues() {
 | 
			
		||||
        return has_issues;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user