profile, models, check
This commit is contained in:
parent
75398e0b2f
commit
67b3e27d6a
@ -12,6 +12,9 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AppMobile"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".ProfileActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".RegistrationActivity"
|
||||
android:exported="false" />
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.example.appmobile;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
@ -8,29 +9,36 @@ import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.example.appmobile.models.User;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private EditText Email, Password;
|
||||
private Button Enter, SignUp, ForgotPassword;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
Email = findViewById(R.id.logEmail);
|
||||
Password = findViewById(R.id.logPassword);
|
||||
Enter = findViewById(R.id.buttonEnter);
|
||||
SignUp = findViewById(R.id.buttonSignUp);
|
||||
ForgotPassword = findViewById(R.id.buttonForgotPassword);
|
||||
setContentView(R.layout.activity_main);;
|
||||
}
|
||||
|
||||
public void onEnter(View v){
|
||||
if(Email.getText().toString().equals("qw@qw") && Password.getText().toString().equals("qw")){
|
||||
String Email = ((EditText) findViewById(R.id.logEmail)).getText().toString(),
|
||||
Password = ((EditText) findViewById(R.id.logPassword)).getText().toString();
|
||||
|
||||
if(Email.equals(User.email) && Password.equals(User.password)){
|
||||
Intent intent = new Intent(this, TasksActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
else{
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("ERROR!!")
|
||||
.setMessage("Неверная почта или пароль " + Email + " " + User.email + " " + Password + " " + User.password)
|
||||
.setCancelable(true)
|
||||
.setPositiveButton("Ok", (dialog, which) -> {
|
||||
dialog.cancel();
|
||||
});
|
||||
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
public void toRegistration(View v){
|
||||
|
@ -1,18 +1,35 @@
|
||||
package com.example.appmobile;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
public class NavigationFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_navigation, container, false);
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_navigation, container, false);
|
||||
|
||||
ImageButton todo = v.findViewById(R.id.btn_todo);
|
||||
todo.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(getActivity(), TasksActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
ImageButton user = v.findViewById(R.id.btn_user);
|
||||
user.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(getActivity(), ProfileActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
return v;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.example.appmobile;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
public class ProfileActivity extends AppCompatActivity {
|
||||
|
||||
private ImageButton btn_todo, btn_idea, btn_user;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_profile);
|
||||
|
||||
NavigationFragment navBar = new NavigationFragment();
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.nav_bar_user, navBar);
|
||||
ft.commit();
|
||||
}
|
||||
}
|
@ -1,10 +1,20 @@
|
||||
package com.example.appmobile;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.appmobile.models.User;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class RegistrationActivity extends AppCompatActivity {
|
||||
|
||||
@ -15,6 +25,30 @@ public class RegistrationActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
public void onReg(View v){
|
||||
TextView name = findViewById(R.id.regName);
|
||||
TextView email = findViewById(R.id.regEmail);
|
||||
TextView password = findViewById(R.id.regPassword);
|
||||
TextView password2 = findViewById(R.id.regConfirmPassword);
|
||||
|
||||
if(!password.getText().toString().equals(password2.getText().toString())){
|
||||
//Toast.makeText(this, "Пароли не одинаковые", Toast.LENGTH_LONG).show();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("ERROR!!")
|
||||
.setMessage("Пароли не одинаковые")
|
||||
.setCancelable(true)
|
||||
.setPositiveButton("Ok", (dialog, which) -> {
|
||||
dialog.cancel();
|
||||
});
|
||||
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
return;
|
||||
}
|
||||
|
||||
User.name = name.getText().toString();
|
||||
User.email = email.getText().toString();
|
||||
User.password = password.getText().toString();
|
||||
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package com.example.appmobile.models;
|
||||
|
||||
public class Task {
|
||||
private String name;
|
||||
private String description;
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.example.appmobile.models;
|
||||
|
||||
public class User {
|
||||
public static String name = "user";
|
||||
public static String email = "qw@qw";
|
||||
public static String password = "qw";
|
||||
}
|
69
AppMobile/app/src/main/res/layout/activity_profile.xml
Normal file
69
AppMobile/app/src/main/res/layout/activity_profile.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/main_green"
|
||||
tools:context=".ProfileActivity">
|
||||
|
||||
<View
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="7dp"
|
||||
android:background="@color/main_pink"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/profile"
|
||||
android:textSize="34sp"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/nav_bar_user"
|
||||
android:layout_width="409dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line2"
|
||||
app:layout_constraintVertical_bias="1.0">
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="175dp"
|
||||
android:layout_height="119dp"
|
||||
|
||||
android:layout_marginTop="24dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line2"
|
||||
app:srcCompat="@drawable/user" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginBottom="44dp"
|
||||
android:backgroundTint="@color/main_pink"
|
||||
android:text="@string/del_profile"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/nav_bar_user"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.495"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -17,32 +17,32 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/view2">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton"
|
||||
android:contentDescription="@string/todo"
|
||||
android:id="@+id/btn_todo"
|
||||
android:layout_width="251dp"
|
||||
android:layout_height="65dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:contentDescription="@string/todo"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/todo" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton2"
|
||||
android:contentDescription="@string/idea"
|
||||
android:id="@+id/btn_idea"
|
||||
android:layout_width="251dp"
|
||||
android:layout_height="65dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:contentDescription="@string/idea"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/idea" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton3"
|
||||
android:contentDescription="@string/user"
|
||||
android:id="@+id/btn_user"
|
||||
android:layout_width="251dp"
|
||||
android:layout_height="65dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:contentDescription="@string/user"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/user" />
|
||||
</LinearLayout>
|
||||
|
@ -2,6 +2,7 @@
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="purple_500">#FF6208EE</color>
|
||||
|
||||
<color name="main_pink">#ff7e92</color>
|
||||
<color name="main_green">#bbf39b</color>
|
||||
|
@ -34,4 +34,7 @@
|
||||
|
||||
<string name="open">OPEN</string>
|
||||
<string name="closed">CLOSED</string>
|
||||
|
||||
<string name="profile">PROFILE</string>
|
||||
<string name="del_profile">DELETE PROFILE</string>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user