If you think the Android project caddisfly-app-camera 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
/*
* Copyright (C) TernUp Research Labs//www.java2s.com
*
* This file is part of Caddisfly
*
* Caddisfly is free software: you can redistribute it and modify it under the terms of
* the GNU Affero General Public License (AGPL) as published by the Free Software Foundation,
* either version 3 of the License or any later version.
*
* Caddisfly is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License included below for more details.
*
* The full license text can also be seen at <http://www.gnu.org/licenses/agpl.html>.
*/package com.ternup.caddisfly.fragment;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import com.ternup.caddisfly.R;
import com.ternup.caddisfly.app.Globals;
import com.ternup.caddisfly.app.MainApp;
publicclass AboutFragment extends DialogFragment {
public AboutFragment() {
}
publicstatic AboutFragment newInstance() {
returnnew AboutFragment();
}
/*
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_about, container, false);
getDialog().setTitle(R.string.about);
if (view != null) {
TextView productView = (TextView) view.findViewById(R.id.textVersion);
productView.setText(MainApp.getVersion(getActivity()));
ImageView organizationView = (ImageView) view.findViewById(R.id.organizationImage);
productView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
openWebBrowser(Globals.PRODUCT_WEBSITE);
}
});
organizationView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
openWebBrowser(Globals.ORG_WEBSITE);
}
});
}
if (((MainApp) getActivity().getApplicationContext()).CurrentTheme
== R.style.AppTheme_Dark) {
view.findViewById(R.id.layoutAboutCompany).setAlpha(0.5f);
}
return view;
}
*/
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
.setTitle(R.string.about)
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
publicvoid onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
}
);
LayoutInflater i = getActivity().getLayoutInflater();
View view = i.inflate(R.layout.fragment_about, null);
if (view != null) {
TextView productView = (TextView) view.findViewById(R.id.textVersion);
productView.setText(MainApp.getVersion(getActivity()));
ImageView organizationView = (ImageView) view.findViewById(R.id.organizationImage);
productView.setOnClickListener(new OnClickListener() {
@Override
publicvoid onClick(View v) {
openWebBrowser(Globals.PRODUCT_WEBSITE);
}
});
organizationView.setOnClickListener(new OnClickListener() {
@Override
publicvoid onClick(View v) {
openWebBrowser(Globals.ORG_WEBSITE);
}
});
}
if (((MainApp) getActivity().getApplicationContext()).CurrentTheme
== R.style.AppTheme_Dark) {
view.findViewById(R.id.layoutAboutCompany).setAlpha(0.5f);
}
builder.setView(view);
return builder.create();
}
@Override
publicvoid onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
assert getActivity() != null;
getActivity().setTitle(R.string.about);
}
/**
* Open a web Browser and navigate to given url
*
* @param url The url to navigate to
*/privatevoid openWebBrowser(String url) {
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
}