Android Open Source - android-wearcamera Camera Fragment






From Project

Back to project page android-wearcamera.

License

The source code is released under:

GNU General Public License

If you think the Android project android-wearcamera 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 net.dheera.wearcamera;
// w  ww . j ava  2  s . c o  m
import android.app.Fragment;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

public class CameraFragment extends Fragment {
    private View.OnClickListener mOnClickListener;

    public ImageView cameraPreview = null;
    public ImageView cameraResult;
    public TextView cameraTime;

    public ImageView mImageView_tip;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View contentView = inflater.inflate(R.layout.camera, container, false);
        cameraPreview = (ImageView)contentView.findViewById(R.id.camera_preview);
        cameraTime = (TextView)contentView.findViewById(R.id.camera_time);
        cameraResult = (ImageView)contentView.findViewById(R.id.camera_result);
        cameraPreview.setOnClickListener(mOnClickListener);

        SharedPreferences preferences = getActivity().getPreferences(0);
        if (preferences.getBoolean("tip0_hide", false) == false) {
            mImageView_tip = (ImageView) contentView.findViewById(R.id.tip);
            mImageView_tip.setImageResource(R.drawable.tip_0);
            mImageView_tip.setVisibility(View.VISIBLE);
            mImageView_tip.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mImageView_tip.setVisibility(View.GONE);
                    SharedPreferences preferences = getActivity().getPreferences(0);
                    SharedPreferences.Editor editor = preferences.edit();
                    editor.putBoolean("tip0_hide", true);
                    editor.commit();
                }
            });
        }

        return contentView;
    }

    public void setOnClickListener(View.OnClickListener listener) {
        mOnClickListener = listener;
    }
}




Java Source Code List

net.dheera.wearcamera.ActionFragment.java
net.dheera.wearcamera.ApplicationTest.java
net.dheera.wearcamera.CameraFragment.java
net.dheera.wearcamera.DataLayerListenerService.java
net.dheera.wearcamera.DataLayerListenerService.java
net.dheera.wearcamera.MainActivity.java
net.dheera.wearcamera.MainActivity.java
net.dheera.wearcamera.MenuAdapter.java