Merge branch '130-star-a-repo' of gitnex/GitNex into master
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.actions.RepositoryActions;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -34,6 +35,8 @@ public class RepoBottomSheetFragment extends BottomSheetDialogFragment {
|
||||
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);
|
||||
|
||||
createLabel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -97,6 +100,37 @@ public class RepoBottomSheetFragment extends BottomSheetDialogFragment {
|
||||
}
|
||||
});
|
||||
|
||||
if(tinyDb.getInt("repositoryStarStatus") == 204) { // star a repo
|
||||
|
||||
starRepository.setVisibility(View.GONE);
|
||||
|
||||
unStarRepository.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
RepositoryActions.unStarRepository(getContext());
|
||||
dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else if(tinyDb.getInt("repositoryStarStatus") == 404) {
|
||||
|
||||
unStarRepository.setVisibility(View.GONE);
|
||||
|
||||
starRepository.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
RepositoryActions.starRepository(getContext());
|
||||
dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.ClipData;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@@ -97,7 +98,7 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment {
|
||||
String issueUrl = instanceUrlWithProtocol + "/" + repoFullName + "/issues/" + tinyDB.getString("issueNumber");
|
||||
|
||||
// copy to clipboard
|
||||
ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(android.content.Context.CLIPBOARD_SERVICE);
|
||||
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(getContext()).getSystemService(android.content.Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("issueUrl", issueUrl);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user