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.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
@ -93,6 +94,14 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
|
||||||
TextView toolbarTitle = findViewById(R.id.toolbar_title);
|
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);
|
toolbarTitle.setText(repositoryName);
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
@ -267,47 +276,50 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
|
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
switch(id) {
|
if(id == android.R.id.home) {
|
||||||
|
|
||||||
case android.R.id.home:
|
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
else if(id == R.id.repoMenu) {
|
||||||
|
|
||||||
case R.id.repoMenu:
|
|
||||||
BottomSheetRepoFragment bottomSheet = new BottomSheetRepoFragment();
|
BottomSheetRepoFragment bottomSheet = new BottomSheetRepoFragment();
|
||||||
bottomSheet.show(getSupportFragmentManager(), "repoBottomSheet");
|
bottomSheet.show(getSupportFragmentManager(), "repoBottomSheet");
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
else if(id == R.id.filter) {
|
||||||
|
|
||||||
case R.id.filter:
|
|
||||||
BottomSheetIssuesFilterFragment filterBottomSheet = new BottomSheetIssuesFilterFragment();
|
BottomSheetIssuesFilterFragment filterBottomSheet = new BottomSheetIssuesFilterFragment();
|
||||||
filterBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuBottomSheet");
|
filterBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuBottomSheet");
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
else if(id == R.id.filterPr) {
|
||||||
|
|
||||||
case R.id.filterPr:
|
|
||||||
BottomSheetPullRequestFilterFragment filterPrBottomSheet = new BottomSheetPullRequestFilterFragment();
|
BottomSheetPullRequestFilterFragment filterPrBottomSheet = new BottomSheetPullRequestFilterFragment();
|
||||||
filterPrBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuPrBottomSheet");
|
filterPrBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuPrBottomSheet");
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
else if(id == R.id.filterMilestone) {
|
||||||
|
|
||||||
case R.id.filterMilestone:
|
|
||||||
BottomSheetMilestonesFilterFragment filterMilestoneBottomSheet = new BottomSheetMilestonesFilterFragment();
|
BottomSheetMilestonesFilterFragment filterMilestoneBottomSheet = new BottomSheetMilestonesFilterFragment();
|
||||||
filterMilestoneBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuMilestoneBottomSheet");
|
filterMilestoneBottomSheet.show(getSupportFragmentManager(), "repoFilterMenuMilestoneBottomSheet");
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
else if(id == R.id.switchBranches) {
|
||||||
|
|
||||||
case R.id.switchBranches:
|
|
||||||
chooseBranch();
|
chooseBranch();
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
else if(id == R.id.branchCommits) {
|
||||||
|
|
||||||
case R.id.branchCommits:
|
|
||||||
Intent intent = new Intent(ctx, CommitsActivity.class);
|
Intent intent = new Intent(ctx, CommitsActivity.class);
|
||||||
intent.putExtra("branchName", tinyDB.getString("repoBranch"));
|
intent.putExtra("branchName", tinyDB.getString("repoBranch"));
|
||||||
ctx.startActivity(intent);
|
ctx.startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,6 +23,17 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="?attr/primaryBackgroundColor">
|
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
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user