-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from VladimirJevtic95/master
Contact barcode edit
- Loading branch information
Showing
24 changed files
with
474 additions
and
38 deletions.
There are no files selected for viewing
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
app/src/main/java/androidmads/example/GenDataActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package androidmads.example; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
public class GenDataActivity extends AppCompatActivity { | ||
|
||
EditText editTextName, editTextAddress, editTextPhone, editTextAddressMail, editTextNotes, editTextOrganization, editTextURL; | ||
Button btnGenerate; | ||
|
||
private static final String TAG = "MainActivity"; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_gen_data); | ||
|
||
editTextName = findViewById(R.id.editTextName); | ||
editTextAddress = findViewById(R.id.editTextAddress); | ||
editTextPhone = findViewById(R.id.editTextPhone); | ||
editTextAddressMail = findViewById(R.id.editTextAddressMail); | ||
btnGenerate = findViewById(R.id.btnGenerate); | ||
editTextNotes = findViewById(R.id.editTextNotes); | ||
editTextOrganization = findViewById(R.id.editTextOrganization); | ||
editTextURL = findViewById(R.id.editTextURL); | ||
|
||
btnGenerate.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
|
||
//keys in bundle correspond to the fields in the ContactsContract.class | ||
Intent intent = new Intent(getApplicationContext(), GenQRActivity.class); | ||
Bundle bundle = new Bundle(); | ||
bundle.putString("name", editTextName.getText().toString()); | ||
bundle.putString("postal", editTextAddress.getText().toString()); | ||
bundle.putString("phone", editTextPhone.getText().toString()); | ||
bundle.putString("email", editTextAddressMail.getText().toString()); | ||
bundle.putString("notes", editTextNotes.getText().toString()); | ||
bundle.putString("company", editTextOrganization.getText().toString()); | ||
bundle.putString("data", editTextURL.getText().toString()); | ||
intent.putExtras(bundle); | ||
startActivity(intent); | ||
} | ||
}); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package androidmads.example; | ||
|
||
import android.graphics.Bitmap; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.widget.ImageView; | ||
import android.widget.Toast; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import androidmads.library.qrgenearator.QRGContents; | ||
import androidmads.library.qrgenearator.QRGEncoder; | ||
|
||
public class GenQRActivity extends AppCompatActivity { | ||
|
||
ImageView imageQR; | ||
Bitmap bitmap; | ||
private static final String TAG = "QRActivity"; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_gen_q_r); | ||
|
||
imageQR = findViewById(R.id.imageQR); | ||
|
||
final Bundle bundle = getIntent().getExtras(); | ||
// String name = bundle.getString("name"); | ||
// String address = bundle.getString("postal"); | ||
// String phone = bundle.getString("phone"); | ||
// String email = bundle.getString("email"); | ||
// String notes = bundle.getString("notes"); | ||
// String organization = bundle.getString("company"); | ||
// String url = bundle.getString("data"); | ||
// Toast.makeText(this, name + address + phone, Toast.LENGTH_SHORT).show(); | ||
|
||
|
||
//setting the data as null and bundle of data from the previous activity because of the type of the QR | ||
QRGEncoder qrgEncoder = new QRGEncoder(null, bundle, QRGContents.Type.CONTACT, 500); | ||
try { | ||
// Getting QR-Code as Bitmap | ||
bitmap = qrgEncoder.getBitmap(); | ||
// Setting Bitmap to ImageView | ||
imageQR.setImageBitmap(bitmap); | ||
} catch (Exception e) { | ||
Log.v(TAG, e.toString()); | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.