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