co.dilaver.quoter.fragments.AboutMeFragment.java Source code

Java tutorial

Introduction

Here is the source code for co.dilaver.quoter.fragments.AboutMeFragment.java

Source

/*
 * Copyright 2016 Mehmet Dilaverolu
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package co.dilaver.quoter.fragments;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import co.dilaver.quoter.R;

public class AboutMeFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_about_me, container, false);

        TextView mail = (TextView) view.findViewById(R.id.tvEmail);
        TextView twitter = (TextView) view.findViewById(R.id.tvTwitter);
        TextView facebook = (TextView) view.findViewById(R.id.tvFacebook);
        TextView linkedIn = (TextView) view.findViewById(R.id.tvLinkedIn);

        mail.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
                emailIntent.setData(Uri.parse("mailto: mdilaveroglu@gmail.com"));
                startActivity(emailIntent);
            }
        });
        twitter.setMovementMethod(LinkMovementMethod.getInstance());
        facebook.setMovementMethod(LinkMovementMethod.getInstance());
        linkedIn.setMovementMethod(LinkMovementMethod.getInstance());

        return view;
    }

}