Add change password fragment
This commit is contained in:
parent
a7a6a09c33
commit
512f70b151
205
app/src/main/java/tech/goda/studyck/ChpassFragment.java
Normal file
205
app/src/main/java/tech/goda/studyck/ChpassFragment.java
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
package tech.goda.studyck;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple {@link Fragment} subclass.
|
||||||
|
* Activities that contain this fragment must implement the
|
||||||
|
* {@link ChpassFragment.OnFragmentInteractionListener} interface
|
||||||
|
* to handle interaction events.
|
||||||
|
* Use the {@link ChpassFragment#newInstance} factory method to
|
||||||
|
* create an instance of this fragment.
|
||||||
|
*/
|
||||||
|
public class ChpassFragment extends Fragment {
|
||||||
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
|
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||||
|
private static final String ARG_PARAM1 = "param1";
|
||||||
|
private static final String ARG_PARAM2 = "param2";
|
||||||
|
|
||||||
|
// TODO: Rename and change types of parameters
|
||||||
|
private EditText account, oldPass, newPass, newPassConf, code;
|
||||||
|
private Button button;
|
||||||
|
Bundle bundle;
|
||||||
|
|
||||||
|
private OnFragmentInteractionListener mListener;
|
||||||
|
private ImageView imageView;
|
||||||
|
|
||||||
|
public ChpassFragment() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this factory method to create a new instance of
|
||||||
|
* this fragment using the provided parameters.
|
||||||
|
*
|
||||||
|
* @param param1 Parameter 1.
|
||||||
|
* @param param2 Parameter 2.
|
||||||
|
* @return A new instance of fragment ChpassFragment.
|
||||||
|
*/
|
||||||
|
// TODO: Rename and change types and number of parameters
|
||||||
|
public static ChpassFragment newInstance(String param1, String param2) {
|
||||||
|
ChpassFragment fragment = new ChpassFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString(ARG_PARAM1, param1);
|
||||||
|
args.putString(ARG_PARAM2, param2);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
View view = inflater.inflate(R.layout.fragment_chpass, container, false);
|
||||||
|
bundle = this.getArguments();
|
||||||
|
|
||||||
|
button = view.findViewById(R.id.button);
|
||||||
|
newPass = view.findViewById(R.id.passwordNew);
|
||||||
|
oldPass = view.findViewById(R.id.passwordOld);
|
||||||
|
account = view.findViewById(R.id.account);
|
||||||
|
code = view.findViewById(R.id.code);
|
||||||
|
newPassConf = view.findViewById(R.id.passwordConf);
|
||||||
|
imageView = view.findViewById(R.id.imageView);
|
||||||
|
|
||||||
|
try{
|
||||||
|
account.setText(bundle.getString("account"));
|
||||||
|
} catch(NullPointerException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
//Toast.makeText(getContext(), "Hello Toast", Toast.LENGTH_SHORT).show();
|
||||||
|
final Map<String, String> params = new HashMap<>();
|
||||||
|
params.put("username", account.getText().toString());
|
||||||
|
params.put("oldPassword", oldPass.getText().toString());
|
||||||
|
params.put("newPassword1", newPass.getText().toString());
|
||||||
|
params.put("newPassword2", newPassConf.getText().toString());
|
||||||
|
params.put("f_magiccode", code.getText().toString());
|
||||||
|
params.put("submitted", "變更"); // this field must have value to make system work
|
||||||
|
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
final String response = Network.httpsRequestPost(Network.CHANGE_PWD_SAVE, params); // Query this page to get the confirm code
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
String str = "";
|
||||||
|
Document doc = Jsoup.parse(response);
|
||||||
|
if(!doc.select(".msg_no").isEmpty()){
|
||||||
|
Element error = doc.selectFirst(".msg_no").selectFirst("p");
|
||||||
|
str = error.text();
|
||||||
|
}
|
||||||
|
else if(!doc.select(".msg_yes").isEmpty()){
|
||||||
|
Element success = doc.selectFirst(".msg_yes").selectFirst("p");
|
||||||
|
str = success.text();
|
||||||
|
// TODO: switch fragment here
|
||||||
|
/*Fragment fragment = new ChpassFragment();
|
||||||
|
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
|
||||||
|
ft.replace(R.id.content_frame, fragment);
|
||||||
|
ft.commit();*/
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
str = "驗證碼錯誤";
|
||||||
|
}
|
||||||
|
Toast.makeText(getContext(), str, Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
Log.e("TAG_INSIDE", response);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Network.httpsRequestPost(Network.CHANGE_PWD_URI, new HashMap<String, String>()); // Query this page to get the confirm code
|
||||||
|
final Drawable drawable = Network.getDrawable(Network.CHANGE_PWD_CODE);
|
||||||
|
Log.e("TAG", String.valueOf(drawable==null));
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Log.e("TAG_INSIDE", String.valueOf(drawable==null));
|
||||||
|
imageView.setImageDrawable(drawable);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}).start();
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Rename method, update argument and hook method into UI event
|
||||||
|
public void onButtonPressed(Uri uri) {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onFragmentInteraction(uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
/*if (context instanceof OnFragmentInteractionListener) {
|
||||||
|
mListener = (OnFragmentInteractionListener) context;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(context.toString()
|
||||||
|
+ " must implement OnFragmentInteractionListener");
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
mListener = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface must be implemented by activities that contain this
|
||||||
|
* fragment to allow an interaction in this fragment to be communicated
|
||||||
|
* to the activity and potentially other fragments contained in that
|
||||||
|
* activity.
|
||||||
|
* <p>
|
||||||
|
* See the Android Training lesson <a href=
|
||||||
|
* "http://developer.android.com/training/basics/fragments/communicating.html"
|
||||||
|
* >Communicating with Other Fragments</a> for more information.
|
||||||
|
*/
|
||||||
|
public interface OnFragmentInteractionListener {
|
||||||
|
// TODO: Update argument type and name
|
||||||
|
void onFragmentInteraction(Uri uri);
|
||||||
|
}
|
||||||
|
}
|
@ -18,6 +18,8 @@ import android.support.annotation.NonNull;
|
|||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v4.provider.DocumentFile;
|
import android.support.v4.provider.DocumentFile;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
@ -49,22 +51,25 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
private static final int PICK_FILE_REQUEST = 0;
|
private static final int PICK_FILE_REQUEST = 0;
|
||||||
private static final int LOGIN = 1;
|
private static final int LOGIN = 1;
|
||||||
TextView messageText;
|
/*TextView messageText;
|
||||||
Button uploadButton, choose;
|
Button uploadButton, choose;
|
||||||
EditText editFileName;
|
EditText editFileName;
|
||||||
ImageView imageView;
|
ImageView imageView;
|
||||||
|
|
||||||
String uploadServerUri = null;
|
String uploadServerUri = null;
|
||||||
InputStream in;
|
InputStream in;
|
||||||
String fileName;
|
Button button3;
|
||||||
|
String fileName;*/
|
||||||
String loginResponse;
|
String loginResponse;
|
||||||
/********** File Path *************/
|
/********** File Path *************/
|
||||||
String uploadFilePath = Environment.getExternalStorageDirectory().getPath() + "/test.png";
|
String uploadFilePath = Environment.getExternalStorageDirectory().getPath() + "/test.png";
|
||||||
Button button3;
|
|
||||||
|
|
||||||
KeyStoreHelper keyStoreHelper;
|
KeyStoreHelper keyStoreHelper;
|
||||||
SharedPreferencesHelper preferencesHelper;
|
SharedPreferencesHelper preferencesHelper;
|
||||||
private View header;
|
private View header;
|
||||||
|
private TextView navAccount;
|
||||||
|
private TextView navName;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -72,12 +77,12 @@ public class MainActivity extends AppCompatActivity
|
|||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
Log.e("Directory", uploadFilePath);
|
Log.e("Directory", uploadFilePath);
|
||||||
uploadButton = findViewById(R.id.uploadButton);
|
/*uploadButton = findViewById(R.id.uploadButton);
|
||||||
choose = findViewById(R.id.choose);
|
choose = findViewById(R.id.choose);
|
||||||
messageText = findViewById(R.id.messageText);
|
messageText = findViewById(R.id.messageText);
|
||||||
editFileName = findViewById(R.id.fileName);
|
editFileName = findViewById(R.id.fileName);
|
||||||
button3 = findViewById(R.id.button3);
|
button3 = findViewById(R.id.button3);
|
||||||
imageView = findViewById(R.id.imageView);
|
imageView = findViewById(R.id.imageView);*/
|
||||||
|
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
@ -101,7 +106,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
preferencesHelper = new SharedPreferencesHelper(getApplicationContext());
|
preferencesHelper = new SharedPreferencesHelper(getApplicationContext());
|
||||||
keyStoreHelper = new KeyStoreHelper(getApplicationContext(), preferencesHelper);
|
keyStoreHelper = new KeyStoreHelper(getApplicationContext(), preferencesHelper);
|
||||||
|
|
||||||
messageText.setText("Uploading file path : " + uploadFilePath);
|
/*messageText.setText("Uploading file path : " + uploadFilePath);
|
||||||
|
|
||||||
|
|
||||||
//uploadServerUri = "http://study.ck.tp.edu.tw/login_chk.asp";
|
//uploadServerUri = "http://study.ck.tp.edu.tw/login_chk.asp";
|
||||||
@ -147,7 +152,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
showFileChooser();
|
showFileChooser();
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
String encryptedText = preferencesHelper.getInput();
|
String encryptedText = preferencesHelper.getInput();
|
||||||
final String mEmail = preferencesHelper.getString(SharedPreferencesHelper.PREF_AC);
|
final String mEmail = preferencesHelper.getString(SharedPreferencesHelper.PREF_AC);
|
||||||
@ -199,12 +204,12 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
private void LoginSuccess(String account, String password) {
|
private void LoginSuccess(String account, String password) {
|
||||||
View layout = findViewById(android.R.id.content);
|
View layout = findViewById(android.R.id.content);
|
||||||
TextView navName = header.findViewById(R.id.userName);
|
navName = header.findViewById(R.id.userName);
|
||||||
TextView navAccount = header.findViewById(R.id.userAccount);
|
navAccount = header.findViewById(R.id.userAccount);
|
||||||
Toast.makeText(getApplicationContext(), "登入成功!!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), "登入成功!!", Toast.LENGTH_SHORT).show();
|
||||||
Document doc = Jsoup.parse(loginResponse);
|
Document doc = Jsoup.parse(loginResponse);
|
||||||
String name = doc.select("form > font").first().text();
|
String name = doc.select("form > font").first().text();
|
||||||
messageText.setText(name);
|
//messageText.setText(name);
|
||||||
name = name.substring(0, name.length()-2); // 扣除 "您好"
|
name = name.substring(0, name.length()-2); // 扣除 "您好"
|
||||||
navName.setText(name);
|
navName.setText(name);
|
||||||
navAccount.setText(account);
|
navAccount.setText(account);
|
||||||
@ -270,7 +275,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case PICK_FILE_REQUEST:
|
case PICK_FILE_REQUEST:
|
||||||
if (resultCode == RESULT_OK) {
|
/*if (resultCode == RESULT_OK) {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
//no data present
|
//no data present
|
||||||
return;
|
return;
|
||||||
@ -285,10 +290,10 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (isVirtualFile(selectedFileUri)) {
|
if (isVirtualFile(selectedFileUri)) {
|
||||||
Log.e("GetPath", "This is virtual file");
|
Log.e("GetPath", "This is virtual file");*/
|
||||||
in = getInputStreamForVirtualFile(selectedFileUri, "*/*");
|
//in = getInputStreamForVirtualFile(selectedFileUri, "*/*");
|
||||||
|
|
||||||
} else {
|
/*} else {
|
||||||
in = getContentResolver().openInputStream(selectedFileUri);
|
in = getContentResolver().openInputStream(selectedFileUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +302,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Log.e("GetPathError", e.toString());
|
Log.e("GetPathError", e.toString());
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
/*if(uploadFilePath != null && !uploadFilePath.equals("")){
|
/*if(uploadFilePath != null && !uploadFilePath.equals("")){
|
||||||
messageText.setText(uploadFilePath);
|
messageText.setText(uploadFilePath);
|
||||||
}else{
|
}else{
|
||||||
@ -361,12 +366,13 @@ public class MainActivity extends AppCompatActivity
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("StatementWithEmptyBody")
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onNavigationItemSelected(MenuItem item) {
|
public boolean onNavigationItemSelected(MenuItem item) {
|
||||||
// Handle navigation view item clicks here.
|
// Handle navigation view item clicks here.
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
Fragment fragment = null;
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
if (id == R.id.nav_file) {
|
if (id == R.id.nav_file) {
|
||||||
|
|
||||||
} else if (id == R.id.nav_site) {
|
} else if (id == R.id.nav_site) {
|
||||||
@ -380,23 +386,17 @@ public class MainActivity extends AppCompatActivity
|
|||||||
} else if (id == R.id.nav_info) {
|
} else if (id == R.id.nav_info) {
|
||||||
|
|
||||||
} else if (id == R.id.nav_passwd) {
|
} else if (id == R.id.nav_passwd) {
|
||||||
|
fragment = new ChpassFragment();
|
||||||
|
String account = navAccount.getText().toString();
|
||||||
|
bundle.putString("account", account);
|
||||||
|
}
|
||||||
|
setTitle(item.getTitle());
|
||||||
|
if (fragment != null) {
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
ft.replace(R.id.content_frame, fragment);
|
||||||
|
ft.commit();
|
||||||
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Network.httpsRequestPost(Network.CHANGE_PWD_URI, new HashMap<String, String>());
|
|
||||||
final Drawable drawable = Network.getDrawable("https://ldap.ck.tp.edu.tw/admin/code.php");
|
|
||||||
Log.e("TAG", String.valueOf(drawable==null));
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Log.e("TAG_INSIDE", String.valueOf(drawable==null));
|
|
||||||
imageView.setImageDrawable(drawable);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
Toast.makeText(getApplicationContext(), "你點選了!!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), "你點選了!!", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ public class Network {
|
|||||||
public static final String LOGIN_URI = "http://study.ck.tp.edu.tw/login_chk.asp";
|
public static final String LOGIN_URI = "http://study.ck.tp.edu.tw/login_chk.asp";
|
||||||
public static final String LOGOUT_URI = "http://study.ck.tp.edu.tw/logout.asp";
|
public static final String LOGOUT_URI = "http://study.ck.tp.edu.tw/logout.asp";
|
||||||
public static final String CHANGE_PWD_URI = "https://ldap.ck.tp.edu.tw/admin/chpass.php";
|
public static final String CHANGE_PWD_URI = "https://ldap.ck.tp.edu.tw/admin/chpass.php";
|
||||||
|
public static final String CHANGE_PWD_CODE = "https://ldap.ck.tp.edu.tw/admin/code.php";
|
||||||
|
public static final String CHANGE_PWD_SAVE = "https://ldap.ck.tp.edu.tw/admin/chpass_save.php";
|
||||||
|
|
||||||
public static String uploadFile(String sourceFileUri, InputStream in, String uploadFileName) {
|
public static String uploadFile(String sourceFileUri, InputStream in, String uploadFileName) {
|
||||||
|
|
||||||
|
@ -20,7 +20,11 @@
|
|||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
<include layout="@layout/content_main" />
|
<include
|
||||||
|
layout="@layout/content_main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="tech.goda.studyck.MainActivity">
|
tools:context="tech.goda.studyck.MainActivity">
|
||||||
|
|
||||||
<TextView
|
<!--TextView
|
||||||
android:id="@+id/messageText"
|
android:id="@+id/messageText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -84,21 +84,11 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent="0.5" />
|
app:layout_constraintGuide_percent="0.5" /-->
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/content_frame"
|
||||||
android:layout_width="200dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="52dp"
|
android:layout_height="wrap_content" />
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@mipmap/ic_launcher"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/button3" />
|
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
172
app/src/main/res/layout/fragment_chpass.xml
Normal file
172
app/src/main/res/layout/fragment_chpass.xml
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
<android.support.constraint.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"
|
||||||
|
tools:context="tech.goda.studyck.ChpassFragment">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- TODO: Update blank fragment layout -->
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<android.support.constraint.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="wrap_content"
|
||||||
|
tools:context="tech.goda.studyck.ChpassFragment">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:text="送出"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/L5" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="53dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/L4" />
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputLayout
|
||||||
|
android:id="@+id/L"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/account"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="帳號"
|
||||||
|
android:enabled="false"
|
||||||
|
android:singleLine="true" />
|
||||||
|
|
||||||
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputLayout
|
||||||
|
android:id="@+id/L2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/L">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/passwordOld"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="舊密碼"
|
||||||
|
android:imeActionId="6"
|
||||||
|
android:imeActionLabel="@string/action_sign_in_short"
|
||||||
|
android:imeOptions="actionUnspecified"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true" />
|
||||||
|
|
||||||
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputLayout
|
||||||
|
android:id="@+id/L3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/L2">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/passwordNew"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="新密碼"
|
||||||
|
android:imeActionId="6"
|
||||||
|
android:imeActionLabel="@string/action_sign_in_short"
|
||||||
|
android:imeOptions="actionUnspecified"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true" />
|
||||||
|
|
||||||
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputLayout
|
||||||
|
android:id="@+id/L4"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/L3">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/passwordConf"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="新密碼(再確認)"
|
||||||
|
android:imeActionId="6"
|
||||||
|
android:imeActionLabel="@string/action_sign_in_short"
|
||||||
|
android:imeOptions="actionUnspecified"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true" />
|
||||||
|
|
||||||
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputLayout
|
||||||
|
android:id="@+id/L5"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/imageView">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/code"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="驗證碼"
|
||||||
|
android:imeActionId="6"
|
||||||
|
android:imeActionLabel="@string/action_sign_in_short"
|
||||||
|
android:imeOptions="actionUnspecified"
|
||||||
|
android:inputType="text"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true" />
|
||||||
|
|
||||||
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
@ -3,24 +3,11 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:showIn="navigation_view">
|
tools:showIn="navigation_view">
|
||||||
|
|
||||||
<!--group android:checkableBehavior="single">
|
<group android:checkableBehavior="single">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_camera"
|
android:id="@+id/nav_home"
|
||||||
android:icon="@drawable/ic_menu_camera"
|
android:title="首頁" />
|
||||||
android:title="Import" />
|
</group>
|
||||||
<item
|
|
||||||
android:id="@+id/nav_gallery"
|
|
||||||
android:icon="@drawable/ic_menu_gallery"
|
|
||||||
android:title="Gallery" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/nav_slideshow"
|
|
||||||
android:icon="@drawable/ic_menu_slideshow"
|
|
||||||
android:title="Slideshow" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/nav_manage"
|
|
||||||
android:icon="@drawable/ic_menu_manage"
|
|
||||||
android:title="Tools" />
|
|
||||||
</group-->
|
|
||||||
|
|
||||||
<item android:title="檔案資源">
|
<item android:title="檔案資源">
|
||||||
<menu>
|
<menu>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user