Android Open Source - innovativeproject-meetingdataexchange Display Q R






From Project

Back to project page innovativeproject-meetingdataexchange.

License

The source code is released under:

MIT License

If you think the Android project innovativeproject-meetingdataexchange 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.TrololoCompany.meetingdataexchange;
//from  w  ww  .  jav a 2s.c om
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Point;
import android.os.Bundle;
import android.view.Display;
import android.view.Menu;
import android.widget.ImageView;
import android.widget.TextView;

import com.TrololoCompany.meetingdataexchangedataBase.MeetingEntity;
import com.TrololoCompany.meetingdataexchangedataBase.ServerEntity;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;

public class DisplayQR extends Activity {

  private ServerEntity server;
  private MeetingEntity meeting;
  private ImageView imageView;
  @Override
  protected void onCreate(Bundle savedInstanceState)
  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display_qr);
    Intent intent=getIntent();
    server=(ServerEntity)
            intent.getSerializableExtra("com.TrololoCompany.meetingdataexchange.server");
    meeting=(MeetingEntity)
        intent.getSerializableExtra("com.TrololoCompany.meetingdataexchange.meeting");
    
     imageView = (ImageView) findViewById(R.id.qrCode);
     String text="mde;"+
            server.getAddress()+";"+
            meeting.getServerMeetingID()+";"+
            meeting.getCode();
     initTextView();
     create_QRCode(text);
   
      
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.display_qr, menu);
    return true;
  }
  private void initTextView()
  {
    TextView textViewServer=(TextView) findViewById(R.id.qrCode_server);
    TextView textViewmeeting=(TextView) findViewById(R.id.qrCode_meeting_id);
    TextView textViewAccessCode=(TextView) findViewById(R.id.qtCOde_meeting_access_code);
    textViewServer.setText("Serwer "+server.getAddress());
    textViewmeeting.setText("Identyfikator spotkania "+meeting.getServerMeetingID()+"");
    textViewAccessCode.setText("Kod dostepu "+meeting.getCode() );
  }
  private void create_QRCode(String input)
  {
    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    int width = size.x;
    int height = size.y;

   QRCodeWriter qr= new QRCodeWriter();
   BitMatrix result;
   Bitmap photo;
   try {
    result=qr.encode(input,BarcodeFormat.QR_CODE, width, height);
    photo=encodeAsBitmap(result);
    imageView.setImageBitmap(photo);
  } catch (WriterException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  }
  static Bitmap encodeAsBitmap(BitMatrix result) throws WriterException
            {
     int width = result.getWidth();
      int height = result.getHeight();
      int[] pixels = new int[width * height];
      // All are 0, or black, by default
      for (int y = 0; y < height; y++) {
        int offset = y * width;
        for (int x = 0; x < width; x++) {
          pixels[offset + x] = result.get(x, y) ? Color.BLACK : Color.WHITE;
        }
      }

      Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
      bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
      return bitmap;
    }


}




Java Source Code List

Dialogs.ServerOptionsLoggedIn.java
Dialogs.ServerOptionsLoggedOut.java
asynctasks.HttpGetListMeetings.java
asynctasks.HttpGetPersonalData.java
asynctasks.HttpGetServerName.java
asynctasks.HttpPostNewMeeting.java
asynctasks.HttpPostRequestLogInAlreadyExistsUser.java
asynctasks.HttpPostRequestLogInFirstTime.java
asynctasks.HttpPostRequestLogIn.java
asynctasks.HttpPostSignUp.java
asynctasks.HttpPutSendFile.java
asynctasks.RefreshMeetingProgress.java
com.TrololoCompany.meetingdataexchangeAdapters.FileAdapter.java
com.TrololoCompany.meetingdataexchangeAdapters.MeetingAdapter.java
com.TrololoCompany.meetingdataexchangeAdapters.ServerAdapter.java
com.TrololoCompany.meetingdataexchange.AddNewMeetingActivity.java
com.TrololoCompany.meetingdataexchange.AddServerActivityFail.java
com.TrololoCompany.meetingdataexchange.AddServerActivitySuccess.java
com.TrololoCompany.meetingdataexchange.AddServerActivity.java
com.TrololoCompany.meetingdataexchange.DisplayQR.java
com.TrololoCompany.meetingdataexchange.LogInActivity.java
com.TrololoCompany.meetingdataexchange.MainActivity.java
com.TrololoCompany.meetingdataexchange.MeetingDetails.java
com.TrololoCompany.meetingdataexchange.ServerList.java
com.TrololoCompany.meetingdataexchange.ServerManageActivity.java
com.TrololoCompany.meetingdataexchangeServices.MeetingDetailsRefresh.java
com.TrololoCompany.meetingdataexchangeServices.MeetingServerCommunication.java
com.TrololoCompany.meetingdataexchangeServices.ServiceHandlers.java
com.TrololoCompany.meetingdataexchange.SignUpActivity.java
com.TrololoCompany.meetingdataexchange.util.SystemUiHiderBase.java
com.TrololoCompany.meetingdataexchange.util.SystemUiHiderHoneycomb.java
com.TrololoCompany.meetingdataexchange.util.SystemUiHider.java
com.TrololoCompany.meetingdataexchangedataBase.CommentEntity.java
com.TrololoCompany.meetingdataexchangedataBase.DataBaseHelper.java
com.TrololoCompany.meetingdataexchangedataBase.FileEntity.java
com.TrololoCompany.meetingdataexchangedataBase.MeetingEntity.java
com.TrololoCompany.meetingdataexchangedataBase.ServerEntity.java
controllers.Accounts.java
controllers.FilesManagement.java
controllers.GeneralStuff.java
controllers.Mailing.java
controllers.Meetings.java
dataBase.CommentEntity.java
dataBase.DataBaseHelper.java
dataBase.FileEntity.java
dataBase.MeetingEntity.java
dataBase.MettingEntity.java
dataBase.ServerEntity.java
dataBase.Server.java
fileMaintenance.FileMaintenance.java
lists.MeetingList.java
lists.ServerList.java
meeting_options.FireMissilesDialogFragment.java
meeting_options.MeetDetOnPageListener.java
meeting_options.MeetDetTabListener.java
meeting_options.MeetingAddItems.java
meeting_options.MeetingDescription.java
meeting_options.MeetingProgressUIRefresh.java
meeting_options.MeetingProgress.java
meeting_options.MeetingTabPagerAdapter.java
meeting_options.MyOnPageChangeListener.java
meeting_options.MyTabListener.java
meeting_options.RefreshMeetingProgressListView.java
meeting_options.TabsPagerAdapter.java
models.DbSingleton.java
models.DefaultSchema.java
models.Keys.java
models.Tables.java
models.tables.Comment.java
models.tables.File.java
models.tables.Meeting.java
models.tables.Meetinguser.java
models.tables.Session.java
models.tables.SqliteSequence.java
models.tables.User.java
models.tables.records.CommentRecord.java
models.tables.records.FileRecord.java
models.tables.records.MeetingRecord.java
models.tables.records.MeetinguserRecord.java
models.tables.records.SessionRecord.java
models.tables.records.SqliteSequenceRecord.java
models.tables.records.UserRecord.java
serverCommunicator.CheckIsServerExists.java
serverCommunicator.CommentsHelper.java
serverCommunicator.CommunicationHelper.java
serverCommunicator.Communication.java
serverCommunicator.FileHelper.java
serverCommunicator.FileListRefreshService.java
serverCommunicator.GetMeetingListHelper.java
serverCommunicator.GetPersonalDataHelper.java
serverCommunicator.HttpGetRequest.java
serverCommunicator.HttpPostRequest.java
serverCommunicator.LogInHelper.java
serverCommunicator.MeetingHelper.java
serverCommunicator.NewMeetingHelper.java
serverCommunicator.RegistrationHelper.java
tools.MD5Checksum.java