Android Open Source - ImageLayout Home Activity






From Project

Back to project page ImageLayout.

License

The source code is released under:

Apache License

If you think the Android project ImageLayout 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) 2013 Manuel Peinado/*w  ww. j  a va  2s.  c o m*/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.manuelpeinado.imagelayout.demo;

import java.util.Arrays;
import java.util.List;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * This activity serves as the launcher for the different samples
 */
public class HomeActivity extends ListActivity {
    private List<ActivityInfo> activitiesInfo = Arrays.asList(
            new ActivityInfo(BasicUsageActivity.class, R.string.activity_title_basic_usage),
            new ActivityInfo(AddChildrenProgrammaticallyActivity.class, R.string.activity_title_add_children_programmatically),
            new ActivityInfo(FitAttributeActivity.class, R.string.activity_title_fit_attribute),
            new ActivityInfo(HorizontalScrollViewActivity.class, R.string.activity_title_horizontal_scroll_view),
            new ActivityInfo(ChangeImageDynamicallyActivity.class, R.string.activity_title_change_image_dynamically));
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        String[] titles = getActivityTitles();
        setListAdapter(new ArrayAdapter<String>(
                this, android.R.layout.simple_list_item_1, android.R.id.text1, titles));
    }
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        Class<? extends Activity> class_ = activitiesInfo.get(position).activityClass;
        Intent intent = new Intent(this, class_);
        startActivity(intent);
    }

    private String[] getActivityTitles() {
        String[] result = new String[activitiesInfo.size()];
        int i = 0;
        for (ActivityInfo info : activitiesInfo) {
            result[i++] = getString(info.titleResourceId);
        }
        return result;
    }
}




Java Source Code List

com.manuelpeinado.imagelayout.ImageFitter.java
com.manuelpeinado.imagelayout.ImageLayout.java
com.manuelpeinado.imagelayout.demo.ActivityInfo.java
com.manuelpeinado.imagelayout.demo.AddChildrenProgrammaticallyActivity.java
com.manuelpeinado.imagelayout.demo.BasicUsageActivity.java
com.manuelpeinado.imagelayout.demo.ChangeImageDynamicallyActivity.java
com.manuelpeinado.imagelayout.demo.FitAttributeActivity.java
com.manuelpeinado.imagelayout.demo.HomeActivity.java
com.manuelpeinado.imagelayout.demo.HorizontalScrollViewActivity.java