add-login

yuying
王宇洋 3 years ago
parent 926aa8f9fa
commit 385b58d879

@ -60,6 +60,17 @@
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Theme.ColorizeApplication.NoActionBar"></activity>
<activity
android:name="com.echo.colorizeit.ui.a_login_activity.LoginViewActivity"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Theme.ColorizeApplication.NoActionBar">
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
</activity>
<activity
android:name="com.echo.colorizeit.ui.a_camera_activity.CameraKitActivity"
android:exported="true"

@ -10,6 +10,7 @@ import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;
import com.echo.colorizeit.ui.a_login_activity.LoginViewActivity;
import com.etebarian.meowbottomnavigation.MeowBottomNavigation;
import com.echo.colorizeit.ImageUtil.PhotoLib;
import com.example.myapplication.R;
@ -31,6 +32,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import cn.leancloud.LCUser;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
@ -158,5 +160,19 @@ public class MainActivity extends AppCompatActivity {
}
}
@Override
public void onStart() {
super.onStart();
if (LCUser.currentUser() == null) {
Intent intent = new Intent(this, LoginViewActivity.class);
startActivity(intent);
}
else{
if(LCUser.currentUser().isAnonymous()){
Intent intent = new Intent(this, LoginViewActivity.class);
startActivity(intent);
}
}
}
}

@ -32,11 +32,18 @@ public class BaseActivity extends AppCompatActivity {
}
protected void showSnackbar(@NonNull String message) {
View view = this.findViewById(android.R.id.content);
if (view != null) {
Snackbar.make(view, message, Snackbar.LENGTH_SHORT).show();
} else {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}
BaseActivity _this = this;
runOnUiThread(new Runnable() {
@Override
public void run() {
View view = _this.findViewById(android.R.id.content);
if (view != null) {
Snackbar.make(view, message, Snackbar.LENGTH_SHORT).show();
} else {
Toast.makeText(_this, message, Toast.LENGTH_SHORT).show();
}
}
});
}
}

@ -0,0 +1,207 @@
package com.echo.colorizeit.ui.a_login_activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.Nullable;
import androidx.lifecycle.ViewModelProvider;
import com.echo.colorizeit.MainActivity;
import com.echo.colorizeit.ui.BaseActivity;
import com.example.myapplication.R;
import com.example.myapplication.databinding.LoginMainBinding;
import java.util.Calendar;
import java.util.regex.Pattern;
import cn.leancloud.LCUser;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
/**
* @Author: WangYuyang
* @Date: 2021/11/1-13:29
* @Project: My Application
* @Package: com.echo.colorizeit.ui.a_login_activity
* @Description:
**/
public class LoginViewActivity extends BaseActivity {
private LoginMainBinding binding;
private LoginViewModel model;
private LoginViewActivity _this = this;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = LoginMainBinding.inflate(getLayoutInflater());
model = new ViewModelProvider(this).get(LoginViewModel.class);
makeFullScreen();
setContentView(binding.getRoot());
Calendar c = Calendar.getInstance();
int h = c.get(Calendar.HOUR_OF_DAY);
System.out.println(h);
if(h >= 12 && h <=17 ){
binding.textView6.setText("Afternoon");
}
else if(h >= 18 || h <= 4){
binding.textView6.setText("Evening");
}
else{
binding.textView6.setText("Morning");
}
binding.signInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String username = binding.loginEmailInput.getText().toString();
String password = binding.loginPasswordInput.getText().toString();
if (!validateInput(username, password)) {
showSnackbar("Input is invalid, please check your input.");
return;
}
LCUser.logIn(username, password).subscribe(new Observer<LCUser>() {
public void onSubscribe(Disposable disposable) {
}
public void onNext(LCUser user) {
// 登录成功
LCUser.changeCurrentUser(user, true);
showSnackbar("Login success !");
Intent intent = new Intent(_this, MainActivity.class);
startActivity(intent);
}
public void onError(Throwable throwable) {
// 登录失败(可能是密码错误)
showSnackbar(throwable.getMessage());
}
public void onComplete() {
}
});
}
});
binding.loginEmailInput.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (Pattern.matches("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$", s.toString())) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
binding.loginPasswordInput.setTextColor(getColor(R.color.white));
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
binding.loginEmailInput.setTextColor(getColor(R.color.holo_red_dark));
}
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
binding.loginPasswordInput.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s.toString().length() >= 6) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
binding.loginPasswordInput.setTextColor(getColor(R.color.white));
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
binding.loginPasswordInput.setTextColor(getColor(R.color.holo_red_dark));
}
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
binding.signUpButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String username = binding.loginEmailInput.getText().toString();
String password = binding.loginPasswordInput.getText().toString();
if (!validateInput(username, password)) {
showSnackbar("Input is invalid, please check your input.");
return;
}
LCUser currentUser = new LCUser();
currentUser.setUsername(username);
currentUser.setPassword(password);
currentUser.signUpInBackground().subscribe(new Observer<LCUser>() {
public void onSubscribe(Disposable disposable) {
}
public void onNext(LCUser user) {
LCUser.changeCurrentUser(user, true);
showSnackbar("Login success !");
Intent intent = new Intent(_this, MainActivity.class);
startActivity(intent);
}
public void onError(Throwable throwable) {
// 注册失败(通常是因为用户名已被使用)
showSnackbar(throwable.getMessage());
}
public void onComplete() {
}
});
}
});
}
private Boolean validateInput(String username, String password) {
if (Pattern.matches("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$", username)) {
if (password.length() >= 6) {
return true;
}
}
return false;
}
public void makeFullScreen() {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}

@ -0,0 +1,13 @@
package com.echo.colorizeit.ui.a_login_activity;
import androidx.lifecycle.ViewModel;
/**
* @Author: WangYuyang
* @Date: 2021/11/1-13:29
* @Project: My Application
* @Package: com.echo.colorizeit.ui.a_login_activity
* @Description:
**/
public class LoginViewModel extends ViewModel {
}

@ -6,6 +6,7 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
@ -189,10 +190,34 @@ public class OpenScreenActivity extends BaseActivity {
}
private void gotoMainActivity() {
// new Handler().postDelayed(() -> {
// Animation animation = AnimationUtils.loadAnimation(this, R.anim.anim_open_screen_fadeout);
// animation.setAnimationListener(new Animation.AnimationListener() {
// @Override
// public void onAnimationStart(Animation animation) {
//
// }
//
// @Override
// public void onAnimationEnd(Animation animation) {
// binding.forground.setVisibility(View.VISIBLE);
// binding.OpenScreenImageVIew.setBackgroundColor(Color.BLACK);
// binding.background.setBackgroundColor(Color.BLACK);
// binding.openscreenBase.setBackgroundColor(Color.BLACK);
//
// }
//
// @Override
// public void onAnimationRepeat(Animation animation) {
//
// }
// });
// binding.forground.startAnimation(animation);
// }, 1000);
new Handler().postDelayed(() -> {
_this.startActivity(new Intent(_this, MainActivity.class));
_this.finish();
}, 1200);
}, 1500);
}
@Override

@ -6,8 +6,6 @@ import android.content.SharedPreferences;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.echo.colorizeit.Util;
import cn.leancloud.LCUser;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
@ -32,7 +30,7 @@ public class OpenScreenViewModel extends ViewModel {
}
public Boolean check_if_user_first_enter(Context context){
public Boolean check_if_user_first_enter(Context context) {
setting.setValue(context.getSharedPreferences("Config", Context.MODE_PRIVATE));
Is_user_first_enter_this_app.setValue(setting.getValue().getBoolean("FIRST", true));
return Is_user_first_enter_this_app.getValue();
@ -42,63 +40,90 @@ public class OpenScreenViewModel extends ViewModel {
public void mark_user_entered_this_app() {
setting.getValue().edit().putBoolean("FIRST", false).commit();
}
public void userAutologin(Context context) {
gotoMainActivity.postValue(true);
// LCUser currentUser = LCUser.getCurrentUser();
// if (currentUser != null) {
// // 跳到首页
// LCUser.changeCurrentUser(currentUser, true);
// gotoMainActivity.postValue(true);
// } else {
// // 显示注册或登录页面
//// LCUser.logInAnonymously().subscribe(new Observer<LCUser>() {
//// public void onSubscribe(Disposable disposable) {
//// }
////
//// public void onNext(LCUser user) {
//// // user 是新的匿名用户
//// LCUser.changeCurrentUser(user, true);
//// gotoMainActivity.postValue(true);
//// }
////
//// public void onError(Throwable throwable) {
//// }
////
//// public void onComplete() {
//// }
//// });
// }
//Login
LCUser user = new LCUser();
String UUID = Util.getUUID(context);
user.setUsername(UUID);
user.setPassword(UUID);
LCUser.logIn(UUID, UUID).subscribe(new Observer<LCUser>() {
public void onSubscribe(Disposable disposable) {
}
public void onNext(LCUser user) {
// 登录成功
LCUser.changeCurrentUser(user, true);
gotoMainActivity.postValue(true);
}
public void onError(Throwable throwable) {
// 登录失败(可能是密码错误)
user.signUpInBackground().subscribe(new Observer<LCUser>() {
public void onSubscribe(Disposable disposable) {
}
public void onNext(LCUser user) {
// 注册成功
System.out.println("注册成功。objectId" + user.getObjectId());
LCUser.changeCurrentUser(user, true);
gotoMainActivity.postValue(true);
}
public void onError(Throwable throwable) {
LCUser.logInAnonymously().subscribe(new Observer<LCUser>() {
public void onSubscribe(Disposable disposable) {
}
public void onNext(LCUser user) {
// user 是新的匿名用户
LCUser.changeCurrentUser(user, true);
gotoMainActivity.postValue(true);
}
public void onError(Throwable throwable) {
showAlterDialog.postValue(true);
}
public void onComplete() {
}
});
}
public void onComplete() {
}
});
}
public void onComplete() {
}
});
// LCUser user = new LCUser();
// String UUID = Util.getUUID(context);
// user.setUsername(UUID);
// user.setPassword(UUID);
// LCUser.logIn(UUID, UUID).subscribe(new Observer<LCUser>() {
// public void onSubscribe(Disposable disposable) {
// }
//
// public void onNext(LCUser user) {
// // 登录成功
// LCUser.changeCurrentUser(user, true);
// gotoMainActivity.postValue(true);
// }
//
// public void onError(Throwable throwable) {
// // 登录失败(可能是密码错误)
// user.signUpInBackground().subscribe(new Observer<LCUser>() {
// public void onSubscribe(Disposable disposable) {
// }
//
// public void onNext(LCUser user) {
// // 注册成功
// System.out.println("注册成功。objectId" + user.getObjectId());
// LCUser.changeCurrentUser(user, true);
// gotoMainActivity.postValue(true);
// }
//
// public void onError(Throwable throwable) {
// LCUser.logInAnonymously().subscribe(new Observer<LCUser>() {
// public void onSubscribe(Disposable disposable) {
// }
//
// public void onNext(LCUser user) {
// // user 是新的匿名用户
// LCUser.changeCurrentUser(user, true);
// gotoMainActivity.postValue(true);
// }
//
// public void onError(Throwable throwable) {
// showAlterDialog.postValue(true);
// }
//
// public void onComplete() {
// }
// });
// }
//
// public void onComplete() {
// }
// });
// }
//
// public void onComplete() {
// }
// });
}
public MutableLiveData<SharedPreferences> getSetting() {

@ -1,5 +1,6 @@
package com.echo.colorizeit.ui.f_gallery_view;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.transition.Fade;
@ -18,6 +19,7 @@ import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.echo.colorizeit.ImageUtil.rcImage;
import com.echo.colorizeit.Util;
import com.echo.colorizeit.ui.BaseFragment;
import com.echo.colorizeit.ui.a_login_activity.LoginViewActivity;
import com.example.myapplication.R;
import com.example.myapplication.databinding.FragmentClarityEnhancementBinding;
@ -25,6 +27,8 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import cn.leancloud.LCUser;
/**
* @author Wang Yuyang
@ -97,4 +101,12 @@ public class GalleryFragment extends BaseFragment {
super.onDestroyView();
binding = null;
}
@Override
public void onStart() {
super.onStart();
if (LCUser.currentUser() == null) {
Intent intent = new Intent(getActivity(), LoginViewActivity.class);
startActivity(intent);
}
}
}

@ -33,6 +33,7 @@ import com.echo.colorizeit.ImageUtil.thirdparty.GlideEngine;
import com.echo.colorizeit.Util;
import com.echo.colorizeit.ui.BaseFragment;
import com.echo.colorizeit.ui.a_image_upload_activity.ImageUploadViewActivity;
import com.echo.colorizeit.ui.a_login_activity.LoginViewActivity;
import com.echo.colorizeit.ui.v_others.ResizableImageView;
import com.echo.stinger_game.myganme.GameActivity;
import com.example.myapplication.R;
@ -48,6 +49,8 @@ import org.tensorflow.lite.support.image.TensorImage;
import java.util.List;
import cn.leancloud.LCUser;
/**
* @author Wang Yuyang
* @date 2021-09-22 13:52:43
@ -270,4 +273,13 @@ public class MainIndexPageFragment extends BaseFragment {
super.onDestroyView();
binding = null;
}
@Override
public void onStart() {
super.onStart();
if (LCUser.currentUser() == null) {
Intent intent = new Intent(getActivity(), LoginViewActivity.class);
startActivity(intent);
}
}
}

@ -1,5 +1,6 @@
package com.echo.colorizeit.ui.f_user_view;
import android.content.Intent;
import android.os.Bundle;
import android.transition.Fade;
import android.view.LayoutInflater;
@ -12,6 +13,7 @@ import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.echo.colorizeit.ui.a_login_activity.LoginViewActivity;
import com.example.myapplication.R;
import com.example.myapplication.databinding.FragmentUserBinding;
@ -26,6 +28,7 @@ import io.reactivex.disposables.Disposable;
public class UserFragment extends Fragment {
private UserFragmentViewModel model;
private FragmentUserBinding binding;
private UserFragment _this = this;
private View root;
public View onCreateView(@NonNull LayoutInflater inflater,
@ -70,17 +73,22 @@ public class UserFragment extends Fragment {
LCUser currentUser = LCUser.getCurrentUser();
currentUser.put("Balance", model.getBalance().getValue() + 5);
currentUser.saveInBackground().subscribe(new io.reactivex.Observer<LCObject>() {
public void onSubscribe(Disposable disposable) {}
public void onSubscribe(Disposable disposable) {
}
public void onNext(LCObject account) {
System.out.println("当前余额为:" + account.getDouble("Balance"));
model.setBalance(account.getDouble("Balance"));
Toast.makeText(getContext(), "New balance is: " + account.getDouble("Balance"), Toast.LENGTH_SHORT).show();
}
public void onError(Throwable throwable) {
Toast.makeText(getContext(), "Network Error", Toast.LENGTH_SHORT).show();
}
public void onComplete() {}
public void onComplete() {
}
});
}
});
@ -88,7 +96,7 @@ public class UserFragment extends Fragment {
@Override
public void onClick(View v) {
LCUser currentUser = LCUser.getCurrentUser();
if(model.getBalance().getValue() - 5 > 0) {
if (model.getBalance().getValue() - 5 >= 0) {
currentUser.put("Balance", model.getBalance().getValue() - 5);
currentUser.put("RemainingCount", model.getRemainingCount().getValue() + 5);
currentUser.saveInBackground().subscribe(new io.reactivex.Observer<LCObject>() {
@ -109,8 +117,7 @@ public class UserFragment extends Fragment {
public void onComplete() {
}
});
}
else{
} else {
Toast.makeText(getContext(), "No enough balance !", Toast.LENGTH_SHORT).show();
}
}
@ -119,7 +126,7 @@ public class UserFragment extends Fragment {
@Override
public void onClick(View v) {
LCUser currentUser = LCUser.getCurrentUser();
if(model.getBalance().getValue() - 10 > 0) {
if (model.getBalance().getValue() - 10 > 0) {
currentUser.put("Balance", model.getBalance().getValue() - 10);
currentUser.put("RemainingCount", model.getRemainingCount().getValue() + 10);
currentUser.saveInBackground().subscribe(new io.reactivex.Observer<LCObject>() {
@ -139,16 +146,72 @@ public class UserFragment extends Fragment {
public void onComplete() {
}
});
}
else{
} else {
Toast.makeText(getContext(), "No enough balance !", Toast.LENGTH_SHORT).show();
}
}
});
model.updateUserProfile();
if (LCUser.currentUser() == null) {
Intent intent = new Intent(getActivity(), LoginViewActivity.class);
startActivity(intent);
} else {
model.updateUserProfile();
}
binding.LoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), LoginViewActivity.class);
startActivity(intent);
}
});
if (LCUser.currentUser() != null)
if (LCUser.currentUser().isAnonymous()) {
binding.usernameText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), LoginViewActivity.class);
startActivity(intent);
}
});
binding.userAvatars.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), LoginViewActivity.class);
startActivity(intent);
}
});
}
if (LCUser.currentUser() != null) {
if (LCUser.currentUser().isAnonymous()) {
binding.logoutButton.setVisibility(View.GONE);
} else {
binding.logoutButton.setVisibility(View.VISIBLE);
}
}
binding.logoutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (LCUser.currentUser() != null) {
LCUser.logOut();
Intent intent = new Intent(getActivity(), LoginViewActivity.class);
startActivity(intent);
}
}
});
return root;
}
@Override
public void onStart() {
super.onStart();
if (LCUser.currentUser() == null) {
Intent intent = new Intent(getActivity(), LoginViewActivity.class);
startActivity(intent);
}
}
}

@ -24,11 +24,11 @@ public class UserFragmentViewModel extends ViewModel {
username = new MutableLiveData<>("Can't get username");
}
public MutableLiveData<String> getUsername(){
public MutableLiveData<String> getUsername() {
return username;
}
public void setUsername(String username){
public void setUsername(String username) {
this.username.postValue(username);
}
@ -55,7 +55,6 @@ public class UserFragmentViewModel extends ViewModel {
}
public void setRemainingCount(Integer remainingCount) {
this.remainingCount.postValue(remainingCount);
}
@ -63,10 +62,15 @@ public class UserFragmentViewModel extends ViewModel {
public void updateUserProfile() {
LCUser currentUser = LCUser.getCurrentUser();
currentUser.fetchInBackground().subscribe(new io.reactivex.Observer<LCObject>() {
public void onSubscribe(Disposable disposable) {}
public void onSubscribe(Disposable disposable) {
}
public void onNext(LCObject user) {
if (currentUser != null) {
setUsername(currentUser.getUsername());
if (currentUser.isAnonymous())
setUsername("Tap to Login");
else
setUsername(currentUser.getUsername());
setBalance(currentUser.getDouble("Balance"));
setProcessedCount(currentUser.getInt("ProcessedCount"));
setRemainingCount(currentUser.getInt("RemainingCount"));
@ -75,10 +79,13 @@ public class UserFragmentViewModel extends ViewModel {
}
}
public void onError(Throwable throwable) {}
public void onComplete() {}
});
public void onError(Throwable throwable) {
}
public void onComplete() {
}
});
}

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromAlpha="0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:toAlpha="1" />
</set>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="8dp" />
<solid android:color="@android:color/transparent"/>
<stroke android:color="#96ffffff"
android:width="2dp"/>
</shape>
</item>
</selector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#96ffffff"
android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
</vector>

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"
@ -7,9 +7,14 @@
tools:context="com.echo.colorizeit.MainActivity"
android:background="@color/white"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="match_parent"
android:layout_height="405dp">
android:layout_height="405dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
@ -17,13 +22,13 @@
android:background="@drawable/gradientbackground"
android:orientation="vertical">
<!-- <ImageView-->
<!-- android:id="@+id/userAvatars"-->
<!-- android:layout_width="150dp"-->
<!-- android:layout_height="150dp"-->
<!-- android:layout_gravity="center_horizontal"-->
<!-- android:layout_marginTop="45dp"-->
<!-- tools:srcCompat="@tools:sample/avatars[0]" />-->
<!-- <ImageView-->
<!-- android:id="@+id/userAvatars"-->
<!-- android:layout_width="150dp"-->
<!-- android:layout_height="150dp"-->
<!-- android:layout_gravity="center_horizontal"-->
<!-- android:layout_marginTop="45dp"-->
<!-- tools:srcCompat="@tools:sample/avatars[0]" />-->
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/userAvatars"
android:layout_width="match_parent"
@ -46,23 +51,27 @@
android:textColor="#fff"
android:textSize="21sp"
android:textStyle="bold" />
</LinearLayout>
<androidx.cardview.widget.CardView
android:layout_width="400dp"
android:layout_height="120dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="275dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_height="match_parent">
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/BalanceText"
@ -81,12 +90,13 @@
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_height="match_parent">
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/CountText"
@ -105,12 +115,13 @@
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_height="match_parent">
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/RemainingText"
@ -133,59 +144,32 @@
</androidx.cardview.widget.CardView>
</RelativeLayout>
<LinearLayout
android:layout_width="360dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="45dp"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="25dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:src="@drawable/ic_baseline_email_24" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="20dp"
android:text="Wiliam@gmail.com"
android:textStyle="bold" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout3"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/relativeLayout2">
<LinearLayout
android:layout_width="match_parent"
<Button
android:id="@+id/LoginButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:orientation="horizontal"
android:paddingLeft="25dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:src="@drawable/ic_baseline_phone_iphone_24" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="20dp"
android:text="+266 225 225"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_gravity="center_horizontal"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="84dp"
android:background="@drawable/buttonstyle"
android:text="Remaining +5 (5$)"
android:textAllCaps="false"
android:textColor="#fff"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/addRemaining10Button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/AddRemaining5Button"
@ -230,6 +214,21 @@
app:layout_constraintEnd_toEndOf="@+id/addRemaining10Button"
app:layout_constraintStart_toStartOf="@+id/addRemaining10Button"
app:layout_constraintTop_toBottomOf="@+id/addRemaining10Button" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<TextView
android:id="@+id/logout_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:fontFamily="@font/aclonica"
android:text="Logout"
android:textColor="#FFFFFF"
android:textSize="20sp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,189 @@
<?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">
<ImageView
android:id="@+id/backgraoundImage"
android:layout_width="0dp"
android:layout_height="0dp"
android:contentDescription="TODO"
android:src="@mipmap/good_morning_img"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@mipmap/good_morning_img" />
<com.airbnb.lottie.LottieAnimationView
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:lottie_autoPlay="true"
app:lottie_repeatCount="10000"
app:lottie_repeatMode="restart"
app:lottie_rawRes="@raw/underwater_ocean_fish_and_turtle"
></com.airbnb.lottie.LottieAnimationView>
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/aclonica"
android:text="Good "
android:textColor="#FFFFFF"
android:textSize="34sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/abril_fatface"
android:text="Morning"
android:textColor="#FAFAFA"
android:textSize="34sp" />
<View
android:id="@+id/view2"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="2dp"
android:background="#FDD835"
android:padding="2dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="16dp"
android:orientation="vertical"
android:paddingLeft="32dp"
android:paddingRight="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout">
<EditText
android:id="@+id/login_email_input"
style="@style/EditScreenTextInputLayoutStyle"
android:layout_width="match_parent"
android:layout_height="60dp"
android:drawableEnd="@drawable/ic_baseline_email_24"
android:drawablePadding="16dp"
android:fontFamily="sans-serif"
android:hint="Email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="16sp"
tools:ignore="SpeakableTextPresentCheck" />
<EditText
android:id="@+id/login_password_input"
style="@style/EditScreenTextInputLayoutStyle"
android:layout_width="match_parent"
android:layout_height="60dp"
android:drawableEnd="@drawable/ic_lock_white_24dp"
android:drawablePadding="16dp"
android:fontFamily="sans-serif"
android:hint="Password"
android:inputType="textPassword"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="16sp"
tools:ignore="SpeakableTextPresentCheck" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginBottom="8dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/signUpButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:background="@drawable/buttonshapewhitebg"
android:fontFamily="@font/aclonica"
android:text="Sign up"
android:textAllCaps="false"
android:textColor="#FFFFFFFF"
android:textSize="20sp"
android:textStyle="bold" />
<Button
android:id="@+id/signInButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:background="@drawable/buttonshapewhitebg"
android:fontFamily="@font/aclonica"
android:text="Sign in"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:text="Forgot Password?"
android:textAlignment="center"
android:textColor="#96ffffff"
android:textSize="16sp"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="casual"
android:text="Wish you have a great day !"
android:textColor="#FFFFFF"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="@+id/linearLayout"
app:layout_constraintStart_toStartOf="@+id/linearLayout"
app:layout_constraintTop_toBottomOf="@+id/linearLayout" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -2,11 +2,11 @@
<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:id="@+id/openscreen_base"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.echo.colorizeit.ui.a_open_screen_activity.OpenScreenActivity"
android:background="@color/black"
>
tools:context="com.echo.colorizeit.ui.a_open_screen_activity.OpenScreenActivity">
<View
@ -76,20 +76,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
<!-- <com.airbnb.lottie.LottieAnimationView-->
<!-- android:id="@+id/loading_view_open"-->
<!-- android:layout_width="150dp"-->
<!-- android:layout_height="150dp"-->
<!-- android:scaleType="centerCrop"-->
<!-- android:visibility="invisible"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/textView4"-->
<!-- app:layout_constraintVertical_bias="0.41000003"-->
<!-- app:lottie_autoPlay="true"-->
<!-- app:lottie_loop="true"-->
<!-- app:lottie_rawRes="@raw/loading_1" />-->
<!-- <com.airbnb.lottie.LottieAnimationView-->
<!-- android:id="@+id/loading_view_open"-->
<!-- android:layout_width="150dp"-->
<!-- android:layout_height="150dp"-->
<!-- android:scaleType="centerCrop"-->
<!-- android:visibility="invisible"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/textView4"-->
<!-- app:layout_constraintVertical_bias="0.41000003"-->
<!-- app:lottie_autoPlay="true"-->
<!-- app:lottie_loop="true"-->
<!-- app:lottie_rawRes="@raw/loading_1" />-->
<com.github.ybq.android.spinkit.SpinKitView
android:id="@+id/spin_kit"

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -22,4 +22,9 @@
<color name="colorBlackThirtyFivePercentAlpha">#59000000</color>
<color name="startblue">#4DD0E1</color>
<color name="endblue">#64B5F6</color>
<color name="textInputLayout">#96ffffff</color>
<color name="holo_green_dark">#ff669900</color>
<color name="holo_red_dark">#ffcc0000</color>
</resources>

@ -44,4 +44,13 @@
<item name="android:windowAllowEnterTransitionOverlap">false</item>
<item name="android:windowAllowReturnTransitionOverlap">false</item>
</style>
<style name="EditScreenTextInputLayoutStyle" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorControlNormal">@color/textInputLayout</item>
<item name="colorControlActivated">@color/textInputLayout</item>
<item name="colorControlHighlight">@color/textInputLayout</item>
<item name="colorAccent">@color/textInputLayout</item>
<item name="android:textColorHint">@color/textInputLayout</item>
</style>
</resources>

@ -68,6 +68,12 @@ public class MainActivity extends AppCompatActivity {
}
}
}).start();
// binding.gameButton2.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Intent intent = new Intent(_this, LoginViewActivity.class)
// }
// });
binding.ChooseImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

@ -38,6 +38,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ImageInformationButton" />
<Button
android:id="@+id/game_button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="104dp"
android:text="DEBUG_login"
android:textAllCaps="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ImageInformationButton" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"

Loading…
Cancel
Save