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:
M M Arif 2020-04-28 02:08:12 +00:00 committed by 6543
parent 195bfc8fe2
commit 9d182821d2
2 changed files with 13 additions and 12 deletions

View File

@ -13,6 +13,7 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.google.gson.JsonElement;
import org.mian.gitnex.R;
@ -76,6 +77,8 @@ public class CreateFileActivity extends BaseActivity {
newFileContent = findViewById(R.id.newFileContent);
newFileBranchName = findViewById(R.id.newFileBranchName);
newFileCommitMessage = findViewById(R.id.newFileCommitMessage);
TextView branchNameId = findViewById(R.id.branchNameId);
TextView branchNameHintText = findViewById(R.id.branchNameHintText);
newFileName.requestFocus();
assert imm != null;
@ -99,13 +102,18 @@ public class CreateFileActivity extends BaseActivity {
View arg1, int arg2, long arg3)
{
Branches bModelValue = (Branches) newFileBranchesSpinner.getSelectedItem();
Log.i("bModelSelected", bModelValue.toString());
if(bModelValue.toString().equals("No branch")) {
newFileBranchName.setEnabled(true);
newFileBranchName.setVisibility(View.VISIBLE);
branchNameId.setVisibility(View.VISIBLE);
branchNameHintText.setVisibility(View.VISIBLE);
}
else {
newFileBranchName.setEnabled(false);
newFileBranchName.setVisibility(View.GONE);
branchNameId.setVisibility(View.GONE);
branchNameHintText.setVisibility(View.GONE);
newFileBranchName.setText("");
}
@ -132,11 +140,7 @@ public class CreateFileActivity extends BaseActivity {
}
private View.OnClickListener createFileListener = new View.OnClickListener() {
public void onClick(View v) {
processNewFile();
}
};
private View.OnClickListener createFileListener = v -> processNewFile();
private void processNewFile() {
@ -314,12 +318,7 @@ public class CreateFileActivity extends BaseActivity {
}
private void initCloseListener() {
onClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
};
onClickListener = view -> finish();
}
private void disableProcessButton() {

View File

@ -155,6 +155,7 @@
android:gravity="end" />
<TextView
android:id="@+id/branchNameId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/newFileBranchTintCopy"
@ -178,6 +179,7 @@
android:inputType="textCapSentences|text" />
<TextView
android:id="@+id/branchNameHintText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/newFileNewBranchMessage"