• Home
  • Outdoor Adventure
    • Hiking
    • Backpacking
    • Camping
    • Caving
  • Travel
  • Life Style
    • Diploma Life
    • Degree Life
    • Work and Part Time
  • Code Test and Project
  • FYP

Jack Hau Story

facebook twitter instagram


Display a dialog on booking detail activity while the users click on the cancel booking. In detail, if the booking is confirmed by professional the cancel booking status within 24 hours charged 20%; if out of 24 hours charged 30%; else the booking are pending not charged.
Share
Tweet
Pin
Share
No comments


the photo taking function with camera or selecting pictures from library. In general, once the users click on the add photo, a dialog should be sliding in from bottom of the screen. Lastly, I created a Cloudinary account to upload an image to the cloud

Firstly, added permissions camera and wrote an external storage into manifest file. Secondly, created a custom bottom dialog. OnActivityResult is very important as we can get image Uri after taking pictures or selecting pictures
Share
Tweet
Pin
Share
No comments


Once the users click on nearby location the result should get the current longitude and latitude. Moreover, alert dialog needs to be prompted out when the user does not turn on the GPS.

I added permission on Android Mainifest in order to retrieve the current location. Also, I appended LocationListener into the project as well.

Sample code getLocation:

     public Location getLocation() {
         try {
             locationManager = (LocationManager) mContext
                     .getSystemService(LOCATION_SERVICE); 

             // getting GPS status
             isGPSEnabled = locationManager
                     .isProviderEnabled(LocationManager.GPS_PROVIDER);

             // getting network status
             isNetworkEnabled = locationManager
                     .isProviderEnabled(LocationManager.NETWORK_PROVIDER);

             if (!isGPSEnabled && !isNetworkEnabled) {
                 showSettingsAlert();
                 // no network provider is enabled
             } else {
                 this.canGetLocation = true;
                 // First get location from Network Provider
                 if (isNetworkEnabled) {
                     if (Build.VERSION.SDK_INT >= 23 &&
                            ContextCompat.checkSelfPermission(mContext, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
                             ContextCompat.checkSelfPermission(mContext, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                     }
                    locationManager.requestLocationUpdates(
                            LocationManager.NETWORK_PROVIDER,
                            0,
                            0, this);
                     Log.d("Network", "Network");
                     if (locationManager != null) {
                         location = locationManager
                                 .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
                         if (location != null) {
                             latitude = location.getLatitude();
                             longitude = location.getLongitude();
                         }
                     }
                 }
                 // if GPS Enabled get lat/long using GPS Services
                 if (isGPSEnabled) {
                     if (location == null) {
                         locationManager.requestLocationUpdates(
                                 LocationManager.GPS_PROVIDER,
                                0,
                                0, this);
                         Log.d("GPS Enabled", "GPS Enabled");
                         if (locationManager != null) {
                             location = locationManager
                                     .getLastKnownLocation(LocationManager.GPS_PROVIDER);
                             if (location != null) {
                                 latitude = location.getLatitude();
                                 longitude = location.getLongitude();
                             }
                         }
                     }
                 } 
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
         return location;
     }
Share
Tweet
Pin
Share
No comments
Adding the slide image
use online library multiviewpager to make slide image.

Following the method I had implemented, I found out a problem of retrieving picture from database as the existing approach was manually stored into array before this was being displayed in the picture

Sample code :

public static SlideImageFragment create(List<SlideImage> imageList, int position) {
        SlideImageFragment fragment = new SlideImageFragment();
        fragment.position = position;
        fragment.imageList = imageList;
        return fragment;
    }
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        SlideImage slideImage = imageList.get(position);

        View rootView = inflater.inflate(R.layout.sliding_image_layout, container, false);
        imageView = (ImageView) rootView.findViewById(R.id.sliding_image);
        Picasso.with(context).load(slideImage.getImg_url()).placeholder(R.mipmap.ic_launcher).centerCrop().fit().into(imageView);

        rootView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Gson gson = new Gson();
                String myJson = gson.toJson(imageList);

                Intent intent = new Intent(context, ZoomablePhotoGalleryActivity.class);
                intent.putExtra("portfolioList", myJson);
                intent.putExtra("position", String.valueOf(position));
                context.startActivity(intent);
                context.overridePendingTransition(R.anim.enter, R.anim.exit);
            }
        });
        return rootView;
    }
Share
Tweet
Pin
Share
No comments


Facebook Login on Android App

Facebook login feature. Be specific, once the users have successful log on, the application should get the user profile picture, ID and name

Once the users click on the Facebook login button, the authentication is done via the referenced Facebook SDK library. To successfully run the Facebook Login, I have to add in Android development key hash to my Facebook developer profile. Facebook uses the key hash to authenticate interactions between the app and the Facebook app. To generate key hash I had installed openSSL then go to command line to get the key hash from the keystore

Following the Facebook developer guideline, there was the key hash discrepancy problem while logging into the Facebook. To generate key hash again, I had installed openSSL then went to command line to get the key hash from the keystore
Share
Tweet
Pin
Share
No comments


The creation of slide navigation call “hamburger” feature for my upcoming Android project. Firstly, the home activity contains tab layout with fragment. Secondly, Gridview in a fragment needs to be created in tab1 somehow the image cannot be scrolled smoothly

The reason to using fragment is to merge multiple fragments in a single activity, build a multi-pane UI, and reuse a fragment in multiple activities

To improve the loading speed of images scrolling, I were suggested to use holder and Picasso to load image faster as it allows hassle-free image loading in my application.

ListView itself has its own scrolling functionality and the main thing is Scrollview can host only one direct child. The result I have ListView in ScrollView does not display all items. In order to solve this issue, ListView was inserted into Linear layout
Share
Tweet
Pin
Share
No comments
Newer Posts
Older Posts

About me



Jack is a programmer, hiker who loves to take challages. Programming can be hard, but no pain no gain. Beside that, Jack like to use cooking for stress relief. “Cooking is a great destresser because it serves as a creative outlet”. During cooking the chef have to well handle of food ingredients. “Cooking is like giving birth because you are mixing things together to create something new and wonderful.”

Labels

Backpacking Camping car Caving Code Test and Project Degree Life Diploma Life Event FYP Hiking Mountain Internship MMU Cyberjaya MMU Melaka Outdoor Adventure Part Time and Work Penang Singapora Thailand Trip and Travel

recent posts

Follow Us

Blog Archive

  • ►  2018 (2)
    • ►  May (1)
    • ►  January (1)
  • ►  2017 (8)
    • ►  August (2)
    • ►  July (1)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ▼  2016 (22)
    • ►  December (3)
    • ►  November (1)
    • ►  October (2)
    • ►  September (3)
    • ►  July (1)
    • ►  May (2)
    • ▼  April (6)
      • Task 8 : Create Cancel Booking Dialog
      • Task 7 : Create Taking Picture Android App
      • Task 6 : Getting Current Long and Latitude on Near...
      • Task 5 : Add-on Slide Image
      • Task 4 : Create Facebook Login Button Android App
      • Task 3 : Create Navigation with Tab Fragment on An...
    • ►  March (2)
    • ►  February (1)
    • ►  January (1)
  • ►  2015 (3)
    • ►  December (1)
    • ►  September (2)
  • ►  2014 (19)
    • ►  October (1)
    • ►  September (2)
    • ►  July (4)
    • ►  June (5)
    • ►  April (2)
    • ►  March (3)
    • ►  January (2)
  • ►  2013 (10)
    • ►  December (2)
    • ►  November (1)
    • ►  October (1)
    • ►  September (1)
    • ►  August (3)
    • ►  June (2)
  • ►  2012 (4)
    • ►  September (1)
    • ►  June (2)
    • ►  February (1)
  • ►  2011 (2)
    • ►  December (1)
    • ►  August (1)
Powered by Blogger.