Android Open Source - detect-me-android About Fragment






From Project

Back to project page detect-me-android.

License

The source code is released under:

MIT License

If you think the Android project detect-me-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.contexthub.detectme.fragments;
/*from   w  w w.  j a v  a2s. c  om*/
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.contexthub.detectme.BuildConfig;
import com.contexthub.detectme.R;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * Created by andy on 10/14/14.
 */
public class AboutFragment extends Fragment implements View.OnClickListener {

    @InjectView(R.id.version_info) TextView versionInfo;
    @InjectView(R.id.powered_by_contexthub) ImageView poweredByContextHub;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_about, container, false);
        ButterKnife.inject(this, view);
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(R.string.about);
        versionInfo.setText(getString(R.string.version_info, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
        poweredByContextHub.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse(getString(R.string.contexthub_url)));
        startActivity(intent);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                getFragmentManager().popBackStack();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }
}




Java Source Code List

com.contexthub.detectme.ApplicationTest.java
com.contexthub.detectme.DetectMeApp.java
com.contexthub.detectme.MainActivity.java
com.contexthub.detectme.fragments.AboutFragment.java
com.contexthub.detectme.fragments.BeaconListFragment.java
com.contexthub.detectme.fragments.EditBeaconFragment.java