mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2024-12-16 15:48:13 +08:00
Add private icon in repo detail toolbar, switch to if by gradle lint (#892)
Hide repoTypeToolbar by default. Merge branch 'master' into add-repo-status-icon Add private icon in repo detail toolbar, switch to if by gradle lint Co-authored-by: opyale <opyale@noreply.codeberg.org> Co-authored-by: 6543 <6543@noreply.codeberg.org> Co-authored-by: M M Arif <mmarif@swatian.com> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/892 Reviewed-by: opyale <opyale@noreply.codeberg.org> Co-Authored-By: M M Arif <mmarif@noreply.codeberg.org> Co-Committed-By: M M Arif <mmarif@noreply.codeberg.org>
This commit is contained in:
parent
8104889bf6
commit
69a5f00771
@ -17,6 +17,7 @@ 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.appcompat.app.AlertDialog;
|
||||
@ -93,6 +94,14 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
|
||||
TextView toolbarTitle = findViewById(R.id.toolbar_title);
|
||||
ImageView repoTypeToolbar = findViewById(R.id.repoTypeToolbar);
|
||||
|
||||
if(tinyDB.getString("repoType").equalsIgnoreCase("private")) {
|
||||
repoTypeToolbar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else {
|
||||
repoTypeToolbar.setVisibility(View.GONE);
|
||||
}
|
||||
toolbarTitle.setText(repositoryName);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
@ -267,46 +276,49 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
||||
|
||||
int id = item.getItemId();
|
||||
|
||||
switch(id) {
|
||||
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
|
||||
case R.id.repoMenu:
|
||||
BottomSheetRepoFragment bottomSheet = new BottomSheetRepoFragment();
|
||||
bottomSheet.show(getSupportFragmentManager(), "repoBottomSheet");
|
||||
return true;
|
||||
|
||||
case R.id.filter:
|
||||
BottomSheetIssuesFilterFragment filterBottomSheet = new BottomSheetIssuesFilterFragment();
|
||||
filterBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuBottomSheet");
|
||||
return true;
|
||||
|
||||
case R.id.filterPr:
|
||||
BottomSheetPullRequestFilterFragment filterPrBottomSheet = new BottomSheetPullRequestFilterFragment();
|
||||
filterPrBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuPrBottomSheet");
|
||||
return true;
|
||||
|
||||
case R.id.filterMilestone:
|
||||
BottomSheetMilestonesFilterFragment filterMilestoneBottomSheet = new BottomSheetMilestonesFilterFragment();
|
||||
filterMilestoneBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuMilestoneBottomSheet");
|
||||
return true;
|
||||
|
||||
case R.id.switchBranches:
|
||||
chooseBranch();
|
||||
return true;
|
||||
|
||||
case R.id.branchCommits:
|
||||
Intent intent = new Intent(ctx, CommitsActivity.class);
|
||||
intent.putExtra("branchName", tinyDB.getString("repoBranch"));
|
||||
ctx.startActivity(intent);
|
||||
return true;
|
||||
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
if(id == android.R.id.home) {
|
||||
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
else if(id == R.id.repoMenu) {
|
||||
|
||||
BottomSheetRepoFragment bottomSheet = new BottomSheetRepoFragment();
|
||||
bottomSheet.show(getSupportFragmentManager(), "repoBottomSheet");
|
||||
return true;
|
||||
}
|
||||
else if(id == R.id.filter) {
|
||||
|
||||
BottomSheetIssuesFilterFragment filterBottomSheet = new BottomSheetIssuesFilterFragment();
|
||||
filterBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuBottomSheet");
|
||||
return true;
|
||||
}
|
||||
else if(id == R.id.filterPr) {
|
||||
|
||||
BottomSheetPullRequestFilterFragment filterPrBottomSheet = new BottomSheetPullRequestFilterFragment();
|
||||
filterPrBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuPrBottomSheet");
|
||||
return true;
|
||||
}
|
||||
else if(id == R.id.filterMilestone) {
|
||||
|
||||
BottomSheetMilestonesFilterFragment filterMilestoneBottomSheet = new BottomSheetMilestonesFilterFragment();
|
||||
filterMilestoneBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuMilestoneBottomSheet");
|
||||
return true;
|
||||
}
|
||||
else if(id == R.id.switchBranches) {
|
||||
|
||||
chooseBranch();
|
||||
return true;
|
||||
}
|
||||
else if(id == R.id.branchCommits) {
|
||||
|
||||
Intent intent = new Intent(ctx, CommitsActivity.class);
|
||||
intent.putExtra("branchName", tinyDB.getString("repoBranch"));
|
||||
ctx.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,17 @@
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/primaryBackgroundColor">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/repoTypeToolbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/generalImgContentText"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:src="@drawable/ic_lock"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
Loading…
Reference in New Issue
Block a user