Android Open Source - anti-piracy-android-app Launch Screen Activity






From Project

Back to project page anti-piracy-android-app.

License

The source code is released under:

Apache License

If you think the Android project anti-piracy-android-app 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 mil.nga.giat.asam;
/*from www. j a v  a2s  .co  m*/
import mil.nga.giat.asam.map.AllAsamsMapActivity;
import mil.nga.giat.asam.map.SubregionMapActivity;
import mil.nga.giat.asam.util.AsamConstants;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;

public class LaunchScreenActivity extends ActionBarActivity {
    
    private View.OnClickListener mAllAsamsListener;
    private View.OnClickListener mSubregionsListener;
    private View.OnClickListener mTextQueryListener;
    private View.OnClickListener mSettingsListener;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.launch_screen);
        
        GridView mainGrid = (GridView)findViewById(R.id.launch_screen_grid_view_ui);
        mainGrid.setAdapter(new ImageAdapter(this));
        
        mAllAsamsListener = new View.OnClickListener() {
            
            @Override
            public void onClick(View view) {
                allAsamsButtonClicked(view);
            }
        };
        
        mSubregionsListener = new View.OnClickListener() {
            
            @Override
            public void onClick(View view) {
                subregionsButtonClicked(view);
            }
        };
        
        mTextQueryListener = new View.OnClickListener() {
            
            @Override
            public void onClick(View view) {
                textQueryButtonClicked(view);
            }
        };
        
        mSettingsListener = new View.OnClickListener() {
            
            @Override
            public void onClick(View view) {
                settingsButtonClicked(view);
            }
        };
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.launch_screen_menu, menu);
        return super.onCreateOptionsMenu(menu);
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {        
        int itemId = item.getItemId();
        if (itemId == R.id.launch_screen_menu_information_ui) {
            Intent intent = new Intent(this, InfoActivity.class);
            startActivity(intent);
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
    
    public void allAsamsButtonClicked(View view) {
        Intent intent = new Intent(this, AllAsamsMapActivity.class);
        startActivity(intent);
    }
    
    public void subregionsButtonClicked(View view) {
        Intent intent = new Intent(this, SubregionMapActivity.class);
        intent.putExtra(AsamConstants.SUBREGION_MAP_EXPECTING_RESULT_CODE_KEY, false);
        startActivity(intent);
    }
    
    public void textQueryButtonClicked(View view) {
        Intent intent = new Intent(this, TextQueryActivity.class);
        startActivity(intent);
    }
    
    public void settingsButtonClicked(View view) {
        Intent intent = new Intent(this, PreferencesActivity.class);
        startActivity(intent);
    }
    
    private class ImageAdapter extends BaseAdapter {

        private static final int NUM_BUTTONS = 4;
        private static final int ALL_ASAMS_BUTTON_POSITION = 0;
        private static final int SUBREGIONS_BUTTON_POSITION = 1;
        private static final int TEXT_QUERY_BUTTON_POSITION = 2;
        private static final int SETTINGS_BUTTON_POSITION = 3;
        private Context mContext;

        ImageAdapter(Context context) {
            mContext = context;
        }

        @Override
        public int getCount() {
            return NUM_BUTTONS;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View view = getLayoutInflater().inflate(R.layout.launch_screen_button, null);
            TextView labelUI = (TextView)view.findViewById(R.id.launch_screen_button_icon_label_ui);
            ImageView iconUI = (ImageView)view.findViewById(R.id.launch_screen_button_icon_ui);
            switch (position) {
                case ALL_ASAMS_BUTTON_POSITION:
                    labelUI.setText(mContext.getString(R.string.launch_screen_all_asams_label_text));
                    iconUI.setContentDescription(mContext.getString(R.string.launch_screen_all_asams_label_text));
                    iconUI.setImageResource(R.drawable.ic_mapview);
                    iconUI.setOnClickListener(mAllAsamsListener);
                    break;

                case SUBREGIONS_BUTTON_POSITION:
                    labelUI.setText(mContext.getString(R.string.launch_screen_subregions_label_text));
                    iconUI.setContentDescription(mContext.getString(R.string.launch_screen_subregions_label_text));
                    iconUI.setImageResource(R.drawable.ic_subregion);
                    iconUI.setOnClickListener(mSubregionsListener);
                    break;

                case TEXT_QUERY_BUTTON_POSITION:
                    labelUI.setText(mContext.getString(R.string.launch_screen_text_query_label_text));
                    iconUI.setContentDescription(mContext.getString(R.string.launch_screen_text_query_label_text));
                    iconUI.setImageResource(R.drawable.ic_query);
                    iconUI.setOnClickListener(mTextQueryListener);
                    break;

                case SETTINGS_BUTTON_POSITION:
                    labelUI.setText(mContext.getString(R.string.launch_screen_settings_label_text));
                    iconUI.setContentDescription(mContext.getString(R.string.launch_screen_settings_label_text));
                    iconUI.setImageResource(R.drawable.ic_settings);
                    iconUI.setOnClickListener(mSettingsListener);
                    break;
            }
            return view;
        }

        @Override
        public Object getItem(int position) {
            return null;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }
    }
}




Java Source Code List

mil.nga.giat.asam.AsamListActivity.java
mil.nga.giat.asam.AsamListFragment.java
mil.nga.giat.asam.AsamListReportTabletActivity.java
mil.nga.giat.asam.AsamReportActivity.java
mil.nga.giat.asam.AsamReportFragment.java
mil.nga.giat.asam.Asam.java
mil.nga.giat.asam.DisclaimerActivity.java
mil.nga.giat.asam.DisclaimerDialogFragment.java
mil.nga.giat.asam.InfoActivity.java
mil.nga.giat.asam.InfoDialogFragment.java
mil.nga.giat.asam.InfoFragment.java
mil.nga.giat.asam.LaunchScreenActivity.java
mil.nga.giat.asam.LegalActivity.java
mil.nga.giat.asam.LegalDetailsActivity.java
mil.nga.giat.asam.LegalDetailsFragment.java
mil.nga.giat.asam.LegalFragment.java
mil.nga.giat.asam.LegalTabletActivity.java
mil.nga.giat.asam.MainActivity.java
mil.nga.giat.asam.PreferencesActivity.java
mil.nga.giat.asam.PreferencesDialogFragment.java
mil.nga.giat.asam.SortAsamListDialogFragment.java
mil.nga.giat.asam.TextQueryActivity.java
mil.nga.giat.asam.TextQueryDialogFragment.java
mil.nga.giat.asam.connectivity.NetworkChangeReceiver.java
mil.nga.giat.asam.connectivity.OfflineBannerFragment.java
mil.nga.giat.asam.db.AsamDbHelper.java
mil.nga.giat.asam.jackson.deserializer.Deserializer.java
mil.nga.giat.asam.jackson.deserializer.FeatureDeserializer.java
mil.nga.giat.asam.jackson.deserializer.GeometryDeserializer.java
mil.nga.giat.asam.map.AllAsamsMapActivity.java
mil.nga.giat.asam.map.AllAsamsMapTabletActivity.java
mil.nga.giat.asam.map.BackgroundTileProvider.java
mil.nga.giat.asam.map.OfflineMap.java
mil.nga.giat.asam.map.SingleAsamMapActivity.java
mil.nga.giat.asam.map.SubregionMapActivity.java
mil.nga.giat.asam.model.AsamBean.java
mil.nga.giat.asam.model.AsamJsonParser.java
mil.nga.giat.asam.model.AsamMapClusterBean.java
mil.nga.giat.asam.model.LegalBean.java
mil.nga.giat.asam.model.SubregionBean.java
mil.nga.giat.asam.model.SubregionTextParser.java
mil.nga.giat.asam.model.TextQueryParametersBean.java
mil.nga.giat.asam.net.AsamWebService.java
mil.nga.giat.asam.util.AsamConstants.java
mil.nga.giat.asam.util.AsamListContainer.java
mil.nga.giat.asam.util.AsamLog.java
mil.nga.giat.asam.util.AsamUtils.java
mil.nga.giat.asam.util.CurrentSubregionHelper.java
mil.nga.giat.asam.util.ManifestMetaData.java
mil.nga.giat.asam.util.SyncTime.java
mil.nga.giat.asam.widget.AsamArrayAdapter.java