1. Trang chủ
  2. » Công Nghệ Thông Tin

NGÀNH LẬP TRÌNH MÁY TÍNH (LẬP TRÌNH MOBILE)

148 182 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 148
Dung lượng 2,51 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

ViewPagerAdapter adapter = new ViewPagerAdaptergetSupportFragmentManager; adapter.addFragmentnew Trangchu, "Trang chủ"; adapter.addFragmentnew Diadiem, "Địa điểm"; adapter.addFragme

Trang 2

1 P HÂN TÍCH

1.1 HIỆN TRẠNG

Ngành du lịch Việt Nam đang càng ngày càng phát triển, lượng khách trong và ngoài nước càng ngày càng tăng Du lịch Việt Nam càng ngày càng được biết đến nhiều hơn trên thế giới, nhiều điểm đến trong nước được bình chọn là địa điểm yêu thích của du khách quốc tế.Du lịch đang cần ngày được sự quan tâm của toàn

xã hội

Bên cạnh đó đối với những người du lịch họ đều có một nỗi lo và sự bất ổn mà

ai cũng phải suy nghĩ, đau đầu khi trải nghiệm tại một điểm đến mới mà mình chưa

từng đến đó là đi đâu, ở đâu, ăn gì, và di chuyển như thế nào

Dù bạn là dân phượt chuyên nghiệp hay chỉ mới đi du lịch lần đầu, ai cũng muốn chuyến hành trình của mình diễn ra thật suôn sẻ Với sự hỗ trợ của Smartphone, các tín đồ du lịch sẻ thoải mái bay nhảy mà không lo suy nghĩ rằng mình sẽ đi đâu,

ở đâu, ăn gì, và di chuyển bằng phương tiện gì v.v

Nếu như các bạn chỉ biết đến GoogleMap, thì hãy đến với chúng tôi.Chúng tôi,

sẽ mang lại cho bạn một trải nghiệm chân thực nhất, một trải nghiệm hoàn chỉnh nhất, và một trải nghiệm đáng nhớ nhất Chúng tôi sẽ hướng dẫn cho bạn cụ thể

về chuyến du lịch của bạn và đánh đuổi những âu lo, những suy nghĩ đau đầu để bạn có thể có một chuyến du lịch tuyệt vời

Hãy đến với chúng tôi Du Lịch Bụi luôn chào đón các bạn

1.2 YÊU CẦU HỆ THỐNG

- Có kết nối Internet, GPS

- Hệ điều hành Android 4.2 trở lên

Trang 3

Hình 1 User Case

Trang 5

2.2 THIẾT KẾ CSDL

Bảng User:

Email Char Đăng nhập,đổi mk,tạo tk

Matkhau Char Đăng nhập,đổi mk,tạo tk

Hình 3-4 CSDL User

Trang 8

Bảng địa điểm đi chơi:

Trang 9

Bảng địa điểm ăn uống:

Trang 10

2.3 THIẾT KẾ GIAO DIỆN

- Giao diện Login :

Hình 13 Giao diện đăng nhập

Trang 15

- Giao diện Trang chủ

Hình 14 Giao diện trang chủ

Trang 26

- Giao diện Địa điểm

Hình 15 Giao diện địa điểm

Trang 34

- Giao diện Khách sạn

Hình 16 Giao diện khách sạn

Trang 39

- Giao diện Taxi

Hình 17 Giao diện Taxo

Trang 43

$sql = "CREATE TABLE $Table_Name (

id INT AUTO_INCREMENT PRIMARY KEY,

Trang 44

$this -> Table_Name = $Table_Name;

$this -> MatKhau = $MatKhau;

$this -> NgaySinh = $NgaySinh;

}

}

$mangUser = array();

while ($row = mysqli_fetch_assoc($data) ) {

array_push($mangUser, new User(

$row['id'],

$row['HoVaTen'],

Trang 45

$this -> Id = $id;

$this -> TenDiaDiem = $TenDiaDiem;

$this -> DiaChi = $DiaChi;

$this -> ThongTin = $ThongTin;

$this -> X = $x;

$this -> Y = $y;

Trang 46

$this -> HinhAnh = $hinhanh;

$this -> HinhAnh1 = $hinhanh1;

$this -> HinhAnh2 = $hinhanh2;

$this -> HinhAnh3 = $hinhanh3;

$this -> HinhAnh4 = $hinhanh4;

$this -> ThoiGian = $thoigian;

while ($row = mysqli_fetch_assoc($data)) {

array_push($mangDiaDiem, new DaNang($row['id'],

Trang 47

$this -> Id = $id;

$this -> TenKhachSan = $TenKhachSan;

$this -> DiaChi = $DiaChi;

$this -> SoSao = $SoSao;

$this -> GiaTien = $x;

$this -> X = $GiaTien;

$this -> Y = $y;

$this -> HinhAnh = $HinhAnh;

$this -> HinhAnh1 = $HinhAnh1;

$this -> HinhAnh2 = $HinhAnh2;

$this -> HinhAnh3 = $HinhAnh3;

Trang 48

$this -> HinhAnh4 = $HinhAnh4;

$this -> ThongTin = $ThongTin;

}

}

$mangKhachSan = array();

while ($row = mysqli_fetch_assoc($data)) {

array_push($mangKhachSan, new DaNang($row['id'],

Trang 49

while ($row = mysqli_fetch_assoc($data)) {

array_push($mangTaxi, new DaNang($row['id'],

Trang 50

3.1.2 Model class - Các lớp mô tả dữ liệu

Trang 51

Taxi_Model

3.1.3 DAO Class - Các lớp truy xuất dữ liệu

GetData_DiaDiemAnUong

GetData_DiaDiemDiChoi

Trang 52

GetData_DiaDiemDiChoiTrongNgay

GetData_KhachSan

Trang 53

GetData_Taxi

GetData_User

Trang 55

private Dialog dialog;

private int[] tabIcons = {

R.drawable.ic_home_black_24dp,

R.drawable.diaiem,

R.drawable.khachsan,

Trang 56

tabLayout = (TabLayout) findViewById(R.id.tabs);

viewPager = (ViewPager) findViewById(R.id.viewpager);

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

setSupportActionBar(toolbar);

setupViewPager(viewPager);

tabLayout.setupWithViewPager(viewPager);

setupTabIcons();

Drawable drawable = getResources().getDrawable(R.drawable.iconphu);

Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();

Drawable newdrawable = new BitmapDrawable(getResources(),

Trang 57

ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());

adapter.addFragment(new Trangchu(), "Trang chủ");

adapter.addFragment(new Diadiem(), "Địa điểm");

adapter.addFragment(new Khachsan(), "Khách sạn");

adapter.addFragment(new Taxi(), "Taxi");

adapter.addFragment(new Taikhoan(), "Tài khoản");

class ViewPagerAdapter extends FragmentPagerAdapter {

private final List<Fragment> mFragmentList = new ArrayList<>();

private final List<String> mFragmentTitleList = new ArrayList<>();

public ViewPagerAdapter(FragmentManager manager) {

Trang 59

dialog.show();

} else if (item.getItemId() == R.id.dangxuat) {

final AlertDialog.Builder Dialog = new AlertDialog.Builder(this);

Dialog.setMessage("Bạn có muốn đăng xuất không ?");

Dialog.setPositiveButton("Đăng xuất", new DialogInterface.OnClickListener() {

@Override

public void onClick(DialogInterface dialogInterface, int position) {

Intent i = new Intent(MainActivity.this, Login.class);

Trang 62

import static com.example.hungparos123.duan1_android.DiaDiem.Diadiem.URL_GETDATA_DICHOI_HN; import static

com.example.hungparos123.duan1_android.DiaDiem.Diadiem.URL_GETDATA_DULICH_TRONGNGAY; import static com.example.hungparos123.duan1_android.DiaDiem.Diadiem.diadiemAnUongDN;

import static com.example.hungparos123.duan1_android.DiaDiem.Diadiem.diadiemAnUongHCM; import static com.example.hungparos123.duan1_android.DiaDiem.Diadiem.diadiemAnUongHN;

import static com.example.hungparos123.duan1_android.DiaDiem.Diadiem.diadiemdichoiDN;

import static com.example.hungparos123.duan1_android.DiaDiem.Diadiem.diadiemdichoiHCM;

import static com.example.hungparos123.duan1_android.DiaDiem.Diadiem.diadiemdichoiHN;

import static com.example.hungparos123.duan1_android.DiaDiem.Diadiem.dulichTrongNgay;

import static com.example.hungparos123.duan1_android.KhachSan.Khachsan.KhachSanDNList;

import static com.example.hungparos123.duan1_android.KhachSan.Khachsan.KhachSanHCMList; import static com.example.hungparos123.duan1_android.KhachSan.Khachsan.KhachSanHNList;

import static com.example.hungparos123.duan1_android.KhachSan.Khachsan.URL_KHACHSAN_DN; import static com.example.hungparos123.duan1_android.KhachSan.Khachsan.URL_KHACHSAN_HCM; import static com.example.hungparos123.duan1_android.KhachSan.Khachsan.URL_KHACHSAN_HN; import static com.example.hungparos123.duan1_android.Taxi.Taxi.TaxiDNList;

import static com.example.hungparos123.duan1_android.Taxi.Taxi.TaxiHCMList;

import static com.example.hungparos123.duan1_android.Taxi.Taxi.TaxiHNList;

import static com.example.hungparos123.duan1_android.Taxi.Taxi.URL_DATA_TAXI_DN;

import static com.example.hungparos123.duan1_android.Taxi.Taxi.URL_DATA_TAXI_HCM;

import static com.example.hungparos123.duan1_android.Taxi.Taxi.URL_DATA_TAXI_HN;

Trang 63

String

urlgetJsonmonan="https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId="+I DMONAN+"&key="+API_KEY+"&maxResults=50";

String

urlgetJsonkhachsan="https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=" +IDKHACHSAN+"&key="+API_KEY+"&maxResults=50";

Trang 64

TextView textView1 = (TextView) view.findViewById(R.id.textView2);

TextView textView3 = (TextView) view.findViewById(R.id.textView7);

TextView textView4 = (TextView) view.findViewById(R.id.textView8);

textView1.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_chevron_left_black_24dp, 0, R.drawable.ic_keyboard_arrow_right_black_24dp, 0);

textView4.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_chevron_left_black_24dp, 0, R.drawable.ic_keyboard_arrow_right_black_24dp, 0);

textView3.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_chevron_left_black_24dp, 0, R.drawable.ic_keyboard_arrow_right_black_24dp, 0);

lvVideo.setOnItemClickListener(new AdapterView.OnItemClickListener() {

Trang 65

@Override

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

Intent intent=new Intent(getActivity(),Chhuyenmanhinh.class);

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

Intent intent=new Intent(getActivity(),Chhuyenmanhinh.class);

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

Intent intent=new Intent(getActivity(),Chhuyenmanhinh.class);

Trang 67

public boolean onTouch(View v, MotionEvent event)

Trang 68

int action = event.getAction();

Trang 69

String url[]=new String[]{

"https://100khuyenmai.net/wp-content/uploads/2016/05/advertising1463540313.png", "https://www.offers.vn/wp-content/uploads/2018/04/dat-khach-san-vntrip.jpg",

binh.jpg"

Trang 70

final RequestQueue requestQueue=Volley.newRequestQueue(getActivity());

JsonObjectRequest jsonObjectRequest=new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {

for (int i = 0; i < jsonItems.length(); i++) {

JSONObject jsonItem = jsonItems.getJSONObject(i);

JSONObject jsonSnipper = (JSONObject) jsonItem.get("snippet");

title = jsonSnipper.getString("title");

JSONObject jsonThumbai = jsonSnipper.getJSONObject("thumbnails");

JSONObject jsonMedium = jsonThumbai.getJSONObject("medium");

Trang 71

public void onErrorResponse(VolleyError error) {

Toast.makeText(getActivity(), "Lỗi!", Toast.LENGTH_SHORT).show();

private void GetJson3(String url){

final RequestQueue requestQueue=Volley.newRequestQueue(getActivity());

JsonObjectRequest jsonObjectRequest=new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {

for (int i = 0; i < jsonItems.length(); i++) {

JSONObject jsonItem = jsonItems.getJSONObject(i);

Trang 72

JSONObject jsonSnipper = (JSONObject) jsonItem.get("snippet");

title = jsonSnipper.getString("title");

JSONObject jsonThumbai = jsonSnipper.getJSONObject("thumbnails");

JSONObject jsonMedium = jsonThumbai.getJSONObject("medium");

public void onErrorResponse(VolleyError error) {

Toast.makeText(getActivity(), "Lỗi!", Toast.LENGTH_SHORT).show();

Trang 73

final RequestQueue requestQueue=Volley.newRequestQueue(getActivity());

JsonObjectRequest jsonObjectRequest=new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {

for (int i = 0; i < jsonItems.length(); i++) {

JSONObject jsonItem = jsonItems.getJSONObject(i);

JSONObject jsonSnipper = (JSONObject) jsonItem.get("snippet");

title = jsonSnipper.getString("title");

JSONObject jsonThumbai = jsonSnipper.getJSONObject("thumbnails");

JSONObject jsonMedium = jsonThumbai.getJSONObject("medium");

Trang 74

}

},

new Response.ErrorListener() {

@Override

public void onErrorResponse(VolleyError error) {

Toast.makeText(getActivity(), "Lỗi!", Toast.LENGTH_SHORT).show();

public void onClick(View view) {

Intent intent=new Intent(getActivity(),Tintucdulich.class);

Trang 75

Intent intent=new Intent(getActivity(),Amthuc.class);

Trang 76

public class Taxi extends Fragment {

String[] khuVucList = {"Đà Nẵng", "Hồ Chí Minh", "Hà Nội"};

Spinner spnKhuVuc;

RecyclerView recyclerView;

TaxiAdapter adapter;

public static ArrayList<taxi> TaxiDNList = new ArrayList<>();

public static ArrayList<taxi> TaxiHNList = new ArrayList<>();

public static ArrayList<taxi> TaxiHCMList = new ArrayList<>();

taxi taxi = new taxi();

public static String URL_DATA_TAXI_HCM ="http://192.168.1.4/taxi/getDataHCM.php";

Trang 77

public static String URL_DATA_TAXI_DN ="http://192.168.1.4/taxi/getDataDN.php";

public static String URL_DATA_TAXI_HN ="http://192.168.1.4/taxi/getDataHN.php";

Trang 78

final RequestQueue requestQueue = Volley.newRequestQueue(getContext());

JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, url, null, new Response.Listener<JSONArray>() {

@Override

Trang 79

//Nếu đúng thì thực hiện Response này

public void onResponse(JSONArray response) {

for (int i = 0; i < response.length(); i++) {

try {

JSONObject object = response.getJSONObject(i);//lấy đối tượng trong JSon

taxi = new taxi(object.getInt("Id"),

//Nếu sai thì thực hiện Error này

public void onErrorResponse(VolleyError error) {

Toast.makeText(getContext(), "" + error.toString(), Toast.LENGTH_SHORT).show();

}

}

Trang 80

import com.example.hungparos123.duan1_android.MainActivity;

import com.example.hungparos123.duan1_android.R;

import com.example.hungparos123.duan1_android.TaiKhoan.Login;

Trang 81

import com.example.hungparos123.duan1_android.Taxi.Oject.taxi;

import com.example.hungparos123.duan1_android.Taxi.Taxi;

import com.squareup.picasso.Picasso;

import java.util.ArrayList;

public class TaxiAdapter extends RecyclerView.Adapter<TaxiAdapter.ViewHolder> {

public TaxiAdapter(ArrayList<taxi> list, Taxi context, RecyclerView recyclerView) {

Trang 82

LayoutInflater inflater = LayoutInflater.from(parent.getContext());

View view = inflater.inflate(R.layout.dong_taxi, parent, false);

return new ViewHolder(view);

Trang 83

public void OnClick(final int i) {

final AlertDialog.Builder Dialog = new AlertDialog.Builder(context.getContext());

Dialog.setMessage("Thực hiện cuộc gọi ?");

Dialog.setPositiveButton("Có", new DialogInterface.OnClickListener() {

@Override

public void onClick(DialogInterface dialogInterface, int position) {

Intent intent = new Intent();

Trang 84

public class ViewHolder extends RecyclerView.ViewHolder {

Trang 85

import

com.example.hungparos123.duan1_android.TaiKhoan.Adapter.TaiKhoanAdapter.TaiKhoanAdapter; import com.example.hungparos123.duan1_android.TaiKhoan.Oject.User;

/**

* A simple {@link Fragment} subclass

*/

Trang 90

import java.util.TimerTask;

public class Login extends AppCompatActivity {

EditText edUserName, edPassword;

public static String matkhau, email, sdt, ngaysinh, hovaten;

EditText edtTen, edtSdt, edtEmail, edtNgaySinh, edtMatKhau;

Button btnTaoTaiKhoan, btnXacNhan;

String JSonArray;

CheckBox checkBox2;

String JSonLogIn = null;

String strUser, strPass;

public static String URL_GetData = "http://192.168.1.4/user/getData.php";

public static String URL_TAOTAIKHOAN = "http://192.168.1.4/user/CreateTable.php";

ArrayList<String> TaiKhoanList = new ArrayList<>();

Ngày đăng: 01/01/2019, 14:19

TỪ KHÓA LIÊN QUAN

w