Commit 3ab8267f authored by Alfansyah Fadlian's avatar Alfansyah Fadlian

Register State

parent 937a02d8
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
......
......@@ -23,7 +23,7 @@
<activity
android:name=".ListTransactions"
android:label="@string/title_activity_list_transactions"
android:theme="@style/AppTheme.appbar.NoActionBar"></activity>
android:theme="@style/AppTheme.appbar"></activity>
<activity android:name=".RegisterActivity" />
<activity
android:name=".BottomSheets"
......
......@@ -12,15 +12,24 @@ import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.LifecycleOwner;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textfield.TextInputEditText;
import com.yono.messeripos.api.client.Client;
import com.yono.messeripos.api.service.UsersService;
import com.yono.messeripos.models.MainViewModels;
import com.yono.messeripos.models.UsersModels;
import com.yono.messeripos.response.DataResponse;
import com.yono.messeripos.utils.Utils;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class RegisterState extends BottomSheetDialogFragment {
private static final String TAG = "RegisterState";
......@@ -78,9 +87,12 @@ public class RegisterState extends BottomSheetDialogFragment {
Log.d(TAG, "onCreateDialog: " + sheetBehavior2.getState());
// loginButton.setOnClickListener(view1 -> {
// if (sheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) loginAuth(view1);
// });
registerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mainViewModels.postRegis(new UsersModels(username.getText().toString(),email.getText().toString(),password.getText().toString(),repassword.getText().toString()));
}
});
// close btn is clicked
closeBtn.setOnClickListener(view12 -> {
......@@ -91,5 +103,21 @@ public class RegisterState extends BottomSheetDialogFragment {
return sheetDialog2;
}
private void registerUser(View view){
// Client client = new Client();
// UsersService usersService = client.Client(UsersService.class);
// usersService.postRegister(new UsersModels(username.getText().toString(),email.getText().toString(),password.getText().toString(),repassword.getText().toString()).enqueue(new Callback<DataResponse<UsersModels>>() {
// @Override
// public void onResponse(Call<DataResponse<UsersModels>> call, Response<DataResponse<UsersModels>> response) {
//
// }
//
// @Override
// public void onFailure(Call<DataResponse<UsersModels>> call, Throwable t) {
//
// }
// });
}
}
......@@ -151,12 +151,13 @@ public class MainViewModels extends ViewModel {
return usersLogin;
}
public MutableLiveData<DataResponse<UsersModels>> checkRegis(UsersModels usersModels){
usersRegister = new MutableLiveData<>();
public MutableLiveData<DataResponse<UsersModels>> postRegis(UsersModels usersModels) {
usersRegister= new MutableLiveData<>();
CreateRegister(usersModels);
return usersRegister;
return usersRegister;
}
private void PeriksaLogin(UsersModels usersModels) {
UsersService usersService = client.Client(UsersService.class);
......
......@@ -12,17 +12,23 @@ public class UsersModels {
@SerializedName("password")
private String passwordUsers;
public UsersModels(String usernameUsers,String passwordUsers) {
@SerializedName("password_confirmation")
private String passwordConfirmationUsers;
public UsersModels(String usernameUsers, String passwordUsers) {
this.usernameUsers = usernameUsers;
this.passwordUsers = passwordUsers;
}
public UsersModels(String usernameUsers, String emailUsers, String passwordUsers) {
public UsersModels(String usernameUsers, String emailUsers, String passwordUsers,String passwordConfirmationUsers) {
this.usernameUsers = usernameUsers;
this.emailUsers = emailUsers;
this.passwordUsers = passwordUsers;
this.passwordConfirmationUsers = passwordConfirmationUsers;
}
public String getEmailUsers() {
return emailUsers;
}
......@@ -46,4 +52,12 @@ public class UsersModels {
public void setPasswordUsers(String passwordUsers) {
this.passwordUsers = passwordUsers;
}
public String getPasswordConfirmationUsers() {
return passwordConfirmationUsers;
}
public void setPasswordConfirmationUsers(String passwordConfirmationUsers) {
this.passwordConfirmationUsers = passwordConfirmationUsers;
}
}
......@@ -46,9 +46,9 @@ public class PlaceholderFragment extends Fragment {
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_main, container, false);
View root = inflater.inflate(R.layout.fragment_list_transactions, container, false);
final TextView textView = root.findViewById(R.id.section_label);
pageViewModel.getText().observe(this, new Observer<String>() {
pageViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment