Hide new branch when current is selected (#451)
Hide is best approach here Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/451 Reviewed-by: opyale <opyale@noreply.gitea.io> Reviewed-by: 6543 <6543@noreply.gitea.io>
This commit is contained in:
parent
195bfc8fe2
commit
9d182821d2
@ -13,6 +13,7 @@ import android.widget.Button;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
@ -76,6 +77,8 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
newFileContent = findViewById(R.id.newFileContent);
|
newFileContent = findViewById(R.id.newFileContent);
|
||||||
newFileBranchName = findViewById(R.id.newFileBranchName);
|
newFileBranchName = findViewById(R.id.newFileBranchName);
|
||||||
newFileCommitMessage = findViewById(R.id.newFileCommitMessage);
|
newFileCommitMessage = findViewById(R.id.newFileCommitMessage);
|
||||||
|
TextView branchNameId = findViewById(R.id.branchNameId);
|
||||||
|
TextView branchNameHintText = findViewById(R.id.branchNameHintText);
|
||||||
|
|
||||||
newFileName.requestFocus();
|
newFileName.requestFocus();
|
||||||
assert imm != null;
|
assert imm != null;
|
||||||
@ -99,13 +102,18 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
View arg1, int arg2, long arg3)
|
View arg1, int arg2, long arg3)
|
||||||
{
|
{
|
||||||
Branches bModelValue = (Branches) newFileBranchesSpinner.getSelectedItem();
|
Branches bModelValue = (Branches) newFileBranchesSpinner.getSelectedItem();
|
||||||
Log.i("bModelSelected", bModelValue.toString());
|
|
||||||
|
|
||||||
if(bModelValue.toString().equals("No branch")) {
|
if(bModelValue.toString().equals("No branch")) {
|
||||||
newFileBranchName.setEnabled(true);
|
newFileBranchName.setEnabled(true);
|
||||||
|
newFileBranchName.setVisibility(View.VISIBLE);
|
||||||
|
branchNameId.setVisibility(View.VISIBLE);
|
||||||
|
branchNameHintText.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newFileBranchName.setEnabled(false);
|
newFileBranchName.setEnabled(false);
|
||||||
|
newFileBranchName.setVisibility(View.GONE);
|
||||||
|
branchNameId.setVisibility(View.GONE);
|
||||||
|
branchNameHintText.setVisibility(View.GONE);
|
||||||
newFileBranchName.setText("");
|
newFileBranchName.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,11 +140,7 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createFileListener = new View.OnClickListener() {
|
private View.OnClickListener createFileListener = v -> processNewFile();
|
||||||
public void onClick(View v) {
|
|
||||||
processNewFile();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void processNewFile() {
|
private void processNewFile() {
|
||||||
|
|
||||||
@ -314,12 +318,7 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
onClickListener = view -> finish();
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
@ -155,6 +155,7 @@
|
|||||||
android:gravity="end" />
|
android:gravity="end" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/branchNameId"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/newFileBranchTintCopy"
|
android:text="@string/newFileBranchTintCopy"
|
||||||
@ -178,6 +179,7 @@
|
|||||||
android:inputType="textCapSentences|text" />
|
android:inputType="textCapSentences|text" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/branchNameHintText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/newFileNewBranchMessage"
|
android:text="@string/newFileNewBranchMessage"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user