Android Open Source - SoundScheduler About Activity






From Project

Back to project page SoundScheduler.

License

The source code is released under:

GNU General Public License

If you think the Android project SoundScheduler 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

/*
 * Sound Scheduler/*from  w w  w  .j  av  a 2s .c  o m*/
 * Copyright (C) 2013 Victor Kifer
 */

package com.victorkifer.SoundScheduler;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class AboutActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.about);

        ListView lv = (ListView) findViewById(R.id.lvAbout);

        List<Map<String, String>> data = new ArrayList<Map<String, String>>();

        PackageInfo pInfo = null;
        try {
            pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

        Map<String, String> datum = new HashMap<String, String>(2);
        datum.put("name", getString(R.string.app_name_label));
        datum.put("value", getString(R.string.app_name));
        data.add(datum);

        datum = new HashMap<String, String>(2);
        datum.put("name", getString(R.string.app_version_label));
        datum.put("value", pInfo.versionName);
        data.add(datum);

        datum = new HashMap<String, String>(2);
        datum.put("name", getString(R.string.app_developer_label));
        datum.put("value", "Victor Kifer");
        data.add(datum);

        datum = new HashMap<String, String>(2);
        datum.put("name", getString(R.string.app_license_label));
        datum.put("value", "GNU General Public License version 3");
        data.add(datum);

        SimpleAdapter adapter = new SimpleAdapter(this, data,
                android.R.layout.simple_list_item_2,
                new String[] {"name", "value" },
                new int[] {android.R.id.text1, android.R.id.text2 });

        lv.setAdapter(adapter);

        Button license = (Button) findViewById(R.id.btnLicense);

        license.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try {
                    BufferedReader reader = new BufferedReader(
                            new InputStreamReader(getAssets().open("LICENSE")), 8*1024);

                    StringBuilder license = new StringBuilder();
                    String line = reader.readLine();

                    while (line != null) {
                        license.append(line);
                        license.append("\n");
                        line = reader.readLine();
                    }

                    AlertDialog licenseDialog = new AlertDialog.Builder(AboutActivity.this).create();
                    licenseDialog.setTitle("Legal Notices");
                    licenseDialog.setMessage(license.toString());
                    licenseDialog.show();
                    TextView textView = (TextView) licenseDialog.findViewById(android.R.id.message);
                    textView.setTextSize(12);

                    reader.close();
                } catch (IOException e) {
                    Toast.makeText(AboutActivity.this, "No license text found", Toast.LENGTH_LONG);
                }
            }
        });
    }
}




Java Source Code List

com.victorkifer.SoundScheduler.AboutActivity.java
com.victorkifer.SoundScheduler.EditRuleActivity.java
com.victorkifer.SoundScheduler.MainActivity.java
com.victorkifer.SoundScheduler.adapters.RuleListAdapter.java
com.victorkifer.SoundScheduler.database.RulesDataSource.java
com.victorkifer.SoundScheduler.database.RulesDatabaseHelper.java
com.victorkifer.SoundScheduler.entities.Rule.java
com.victorkifer.SoundScheduler.listeners.RuleDeleteListener.java
com.victorkifer.SoundScheduler.listeners.RuleItemStateListener.java
com.victorkifer.SoundScheduler.managers.SoundManager.java
com.victorkifer.SoundScheduler.receivers.BootCompleteReceiver.java
com.victorkifer.SoundScheduler.receivers.TimeChangeReceiver.java