Android Open Source - BCC Add B C C






From Project

Back to project page BCC.

License

The source code is released under:

MIT License

If you think the Android project BCC 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 com.bcc;
/*from  w  ww  . j a v  a2s.  c om*/
import java.util.ArrayList;
import java.util.List;

import com.bcc.util.BCCUtil;
import com.bcc.util.adaptor.ManageListAdaptor;
import com.itwizard.mezzofanti.Mezzofanti;
import com.sdsu.bcc.BCCConstants;
import com.sdsu.bcc.database.data.FilesInformation;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class AddBCC extends Activity implements Button.OnClickListener, BCCConstants {
  private static String TAG = "AddBCC";
  
  private Button importFromCamera;
  private Button importFromImage;
  private Button manageContacts;
  private List<String> fileType = new ArrayList<String> ();
  private List<FilesInformation> fileInfos = new ArrayList<FilesInformation>();
  
  @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.addbcc);
    
    fileType.add("bmp");
    fileType.add("png");
    fileType.add("jpg");
    fileType.add("jpeg");
    
    importFromCamera = (Button)findViewById(R.id.captureImage);
    importFromCamera.setOnClickListener(this);
    
    importFromImage = (Button)findViewById(R.id.importImage);
    importFromImage.setOnClickListener(this);
    
    manageContacts = (Button)findViewById(R.id.manageContacts);
    manageContacts.setOnClickListener(this);
  }
  
  @Override
  public void onResume() {
    try {
      fileInfos = BCCUtil.buildFileList(TAG,fileType,IMAGE_PATH);
    } catch (NameNotFoundException e) {
      e.printStackTrace();
    }
    super.onResume();
  }
  
  @Override
  public void onConfigurationChanged(Configuration newConfig) {
    // do nothing when keyboard open
    super.onConfigurationChanged(newConfig);
  }
  
  @Override
  public void onClick(View v) {
    if(v == importFromCamera) {
      Intent myIntent = new Intent(v.getContext(), Mezzofanti.class);
      startActivityForResult(myIntent, 0);
    } else if(v == importFromImage)  {
      populateImportImage();
    } else if(v == manageContacts) {
      Intent myIntent = new Intent(v.getContext(), AddBCCManage.class);
      startActivityForResult(myIntent, 0);
    }
  }
  
  private void populateImportImage() {
    ManageListAdaptor arrayAdapter = new ManageListAdaptor(this,fileInfos);
    arrayAdapter.setFileNameColor("#000000");
    arrayAdapter.setCreationDateColor("#0001C1");
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.import_contacts);
        builder.setAdapter(arrayAdapter, new DialogInterface.OnClickListener(){

      @Override
      public void onClick(DialogInterface dialog, int which) {
        Toast.makeText(getApplicationContext(), fileInfos.get(which).getFileName(), Toast.LENGTH_SHORT).show();
        Intent ocrResult = new Intent(getApplicationContext(), OCRResult.class);
        Bundle bun = new Bundle();
        bun.putBoolean("performOCR", true);
        bun.putString("filePath", fileInfos.get(which).getFilePath());
        ocrResult.putExtras(bun);
        startActivityForResult(ocrResult,0);
        return;
      }
            
        });
        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
          @Override
            public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
            }
        });
        builder.create().show();
  }
}




Java Source Code List

com.bcc.AddBCCManage.java
com.bcc.AddBCC.java
com.bcc.BCCActivity.java
com.bcc.ImportExportBCC.java
com.bcc.ImportExportManage.java
com.bcc.OCRResult.java
com.bcc.SetPrefs.java
com.bcc.util.BCCUtil.java
com.bcc.util.Facade.java
com.bcc.util.adaptor.ManageBCCListAdaptor.java
com.bcc.util.adaptor.ManageListAdaptor.java
com.itwizard.mezzofanti.AssetsManager.java
com.itwizard.mezzofanti.CameraManager.java
com.itwizard.mezzofanti.CaptureLayout.java
com.itwizard.mezzofanti.CustomImageButton.java
com.itwizard.mezzofanti.DownloadManager.java
com.itwizard.mezzofanti.InstallActivity.java
com.itwizard.mezzofanti.Mezzofanti.java
com.itwizard.mezzofanti.OCR.java
com.itwizard.mezzofanti.OnScreenHint.java
com.sdsu.bcc.BCCConstants.java
com.sdsu.bcc.database.DatabaseImpl.java
com.sdsu.bcc.database.DatabaseOperation.java
com.sdsu.bcc.database.data.CardInformation.java
com.sdsu.bcc.database.data.CategoryInformation.java
com.sdsu.bcc.database.data.ContactInformation.java
com.sdsu.bcc.database.data.FilesInformation.java
com.sdsu.bcc.database.data.ImageInformation.java
com.sdsu.bcc.database.impl.BCCDataStore.java
com.sdsu.bcc.database.impl.CategoryDataStore.java
com.sdsu.bcc.database.impl.ContactDataStore.java
com.sdsu.bcc.database.impl.FilesDataStore.java
com.sdsu.bcc.database.impl.ImageDataStore.java
com.sdsu.bcc.file.FileDataStoreFactory.java
com.sdsu.bcc.file.FileDataStoreOperations.java
com.sdsu.bcc.file.impl.CSVDataStore.java