mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-16 06:53:01 +00:00
Added dialog and extend build.gradle
This commit is contained in:
parent
a8179865d6
commit
2628925779
6 changed files with 61 additions and 4 deletions
|
@ -21,8 +21,14 @@ android {
|
|||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.android.support:appcompat-v7:24.1.1'
|
||||
compile 'com.android.support:design:24.1.1'
|
||||
compile 'me.dm7.barcodescanner:zxing:1.9'
|
||||
compile 'com.android.support:cardview-v7:24.1.1'
|
||||
compile 'com.android.support:recyclerview-v7:24.1.1'
|
||||
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
|
||||
compile 'com.android.support:support-v4:24.1.1'
|
||||
compile 'com.android.support:recyclerview-v7:24.1.1'
|
||||
compile 'com.yarolegovich:lovely-dialog:1.0.4'
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package me.impy.aegis;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.inputmethodservice.Keyboard;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
|
@ -14,6 +15,10 @@ import android.view.Menu;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.yarolegovich.lovelydialog.LovelyCustomDialog;
|
||||
import com.yarolegovich.lovelydialog.LovelyTextInputDialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -64,7 +69,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
if (requestCode == GET_KEYINFO) {
|
||||
// Make sure the request was successful
|
||||
if (resultCode == RESULT_OK) {
|
||||
KeyProfile keyProfile = (KeyProfile)data.getSerializableExtra("KeyProfile");
|
||||
final KeyProfile keyProfile = (KeyProfile)data.getSerializableExtra("KeyProfile");
|
||||
|
||||
String otp;
|
||||
try {
|
||||
|
@ -75,8 +80,30 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
keyProfile.Code = otp;
|
||||
|
||||
new LovelyTextInputDialog(this, R.style.EditTextTintTheme)
|
||||
.setTopColorRes(R.color.colorHeaderSuccess)
|
||||
.setTitle("New profile added")
|
||||
.setMessage("How do you want to call it?")
|
||||
.setIcon(R.drawable.ic_check)
|
||||
.setInitialInput(keyProfile.Name)
|
||||
.setInputFilter("Nah, not possible man.", new LovelyTextInputDialog.TextFilter() {
|
||||
@Override
|
||||
public boolean check(String text) {
|
||||
return true;
|
||||
//return text.matches("\\w+");
|
||||
}
|
||||
})
|
||||
.setConfirmButton(android.R.string.ok, new LovelyTextInputDialog.OnTextInputConfirmListener() {
|
||||
@Override
|
||||
public void onTextInputConfirmed(String text) {
|
||||
keyProfile.Name = text;
|
||||
mKeyProfiles.add(keyProfile);
|
||||
mKeyProfileAdapter.notifyDataSetChanged();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
|
||||
//TODO: do something with the result.
|
||||
}
|
||||
}
|
||||
|
|
BIN
app/src/main/res/drawable/ic_check.png
Normal file
BIN
app/src/main/res/drawable/ic_check.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 306 B |
19
app/src/main/res/layout/dialog_new_profile.xml
Normal file
19
app/src/main/res/layout/dialog_new_profile.xml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingTop="16dp">
|
||||
|
||||
|
||||
<EditText
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPersonName"
|
||||
android:text="Name"
|
||||
android:ems="10"
|
||||
android:id="@+id/editText"
|
||||
android:layout_weight="0.96"/>
|
||||
</LinearLayout>
|
|
@ -3,4 +3,5 @@
|
|||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="colorHeaderSuccess">#12b600</color>
|
||||
</resources>
|
||||
|
|
|
@ -17,4 +17,8 @@
|
|||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
<style name="EditTextTintTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
|
||||
<!--<item name="colorAccent">@color/</item>-->
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue