-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 4a0c21c.
- Loading branch information
Showing
3 changed files
with
63 additions
and
8 deletions.
There are no files selected for viewing
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
57 changes: 57 additions & 0 deletions
57
...secuso/privacyfriendlycodescanner/qrscanner/ui/activities/generator/TelEnterActivity.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,57 @@ | ||
package com.secuso.privacyfriendlycodescanner.qrscanner.ui.activities.generator; | ||
|
||
import android.content.Intent; | ||
import android.database.Cursor; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import android.provider.ContactsContract; | ||
import android.text.InputFilter; | ||
import android.view.View; | ||
import android.widget.EditText; | ||
import android.widget.Toast; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.constraintlayout.widget.ConstraintLayout; | ||
|
||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton; | ||
import com.secuso.privacyfriendlycodescanner.qrscanner.R; | ||
import com.secuso.privacyfriendlycodescanner.qrscanner.generator.Contents; | ||
import com.secuso.privacyfriendlycodescanner.qrscanner.ui.helpers.GeneratorKeyboardListener; | ||
|
||
public class TelEnterActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_tel_enter); | ||
|
||
final EditText qrResult = (EditText) findViewById(R.id.editPhone); | ||
|
||
int maxLength = 75; | ||
qrResult.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)}); | ||
|
||
ExtendedFloatingActionButton generate = (ExtendedFloatingActionButton) findViewById(R.id.btnGenerate); | ||
|
||
ConstraintLayout rootView = (ConstraintLayout) findViewById(R.id.rootView); | ||
GeneratorKeyboardListener listener = new GeneratorKeyboardListener(rootView, generate, R.id.btnGenerate, getApplicationContext().getResources().getDisplayMetrics().densityDpi); | ||
rootView.getViewTreeObserver().addOnGlobalLayoutListener(listener); | ||
|
||
generate.setOnClickListener(new View.OnClickListener() { | ||
String result; | ||
|
||
@Override | ||
public void onClick(View v) { | ||
result = qrResult.getText().toString(); | ||
if (result.isEmpty()) { | ||
Toast.makeText(TelEnterActivity.this, R.string.activity_enter_toast_missing_data, Toast.LENGTH_SHORT).show(); | ||
return; | ||
} | ||
Intent i = new Intent(TelEnterActivity.this, QrGeneratorDisplayActivity.class); | ||
i.putExtra("gn", result); | ||
i.putExtra("type", Contents.Type.PHONE); | ||
startActivity(i); | ||
} | ||
|
||
}); | ||
} | ||
} |