azou.note.Wordcloud.java Source code

Java tutorial

Introduction

Here is the source code for azou.note.Wordcloud.java

Source

/*  
 * <azou-notes is a note taking app that gives some stats of the users usage and a wordcloud>
Copyright (C) 2013 Anthony ou
     
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
     
This program 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 General Public License for more details.
     
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */
package azou.note;

import java.util.*;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;

/*
 * this class is for making word cloud
 * but it doesnt work. I Thought it would take the same role as stats so
 * i made it inherit from the class stat to reuse some code.
 */
public class Wordcloud extends Stats {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.wordcloud);
    }

    @Override
    public void printstats() {
        refresh();

        int textviewID = 0x7f0a0007;
        int i = 0;
        for (Map.Entry e : indwords.entrySet()) {
            if (i++ > 100)
                break;
            TextView tv = (TextView) this.findViewById(textviewID);
            tv.setText((CharSequence) e.getKey());
            tv.setTextSize(10 * (Integer) e.getValue());
            ++textviewID;
        }
    }
}