Added material intro screen including icons

This commit is contained in:
Michael Schättgen 2016-09-29 12:31:55 +02:00
parent ed829d004b
commit 9112c16235
23 changed files with 128 additions and 32 deletions

View file

@ -25,6 +25,7 @@ dependencies {
compile 'com.android.support:appcompat-v7:24.1.1' compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.github.nisrulz:recyclerviewhelper:24.1.1' compile 'com.github.nisrulz:recyclerviewhelper:24.1.1'
compile 'com.android.support:design:24.1.1' compile 'com.android.support:design:24.1.1'
compile 'agency.tango.android:material-intro-screen:0.0.3'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'me.dm7.barcodescanner:zxing:1.9' compile 'me.dm7.barcodescanner:zxing:1.9'
compile 'com.android.support:cardview-v7:24.1.1' compile 'com.android.support:cardview-v7:24.1.1'

View file

@ -6,7 +6,7 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/icon"
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
@ -22,9 +22,15 @@
</activity> </activity>
<activity android:name=".ScannerActivity"> <activity android:name=".ScannerActivity">
</activity> </activity>
<activity android:name=".AddProfileActivity" <activity
android:name=".AddProfileActivity"
android:theme="@style/AppTheme.TransparentActionBar"> android:theme="@style/AppTheme.TransparentActionBar">
</activity> </activity>
<activity
android:name=".IntroActivity"
android:label="@string/title_activity_intro"
android:theme="@style/Theme.Intro">
</activity>
</application> </application>
</manifest> </manifest>

View file

@ -0,0 +1,56 @@
package me.impy.aegis;
import android.Manifest;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Toast;
import agency.tango.materialintroscreen.MaterialIntroActivity;
import agency.tango.materialintroscreen.MessageButtonBehaviour;
import agency.tango.materialintroscreen.SlideFragmentBuilder;
public class IntroActivity extends MaterialIntroActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addSlide(new SlideFragmentBuilder()
.backgroundColor(R.color.colorPrimary)
.buttonsColor(R.color.colorAccent)
.image(R.drawable.intro_shield)
.title("Welcome")
.description("Aegis is a brand new open source(!) authenticator app which generates tokens for your accounts.")
.build());
addSlide(new SlideFragmentBuilder()
.backgroundColor(R.color.colorAccent)
.buttonsColor(R.color.colorPrimary)
.neededPermissions(new String[]{Manifest.permission.CAMERA})
.image(R.drawable.intro_scanner)
.title("Permissions")
.description("Aegis needs permission to your camera in order to function properly. This is needed to scan QR codes.")
.build(),
new MessageButtonBehaviour(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
}, "Permission granted"));
}
@Override
public void onFinish() {
super.onFinish();
SharedPreferences prefs = this.getSharedPreferences("me.impy.aegis", Context.MODE_PRIVATE);
prefs.edit().putBoolean("passedIntro", true).apply();
}
}

View file

@ -4,6 +4,7 @@ import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
@ -42,6 +43,14 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
SharedPreferences prefs = this.getSharedPreferences("me.impy.aegis", Context.MODE_PRIVATE);
if(!prefs.getBoolean("passedIntro", false))
{
Intent intro = new Intent(this, IntroActivity.class);
startActivity(intro);
}
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
@ -109,35 +118,6 @@ public class MainActivity extends AppCompatActivity {
Intent intent = new Intent(this, AddProfileActivity.class); Intent intent = new Intent(this, AddProfileActivity.class);
intent.putExtra("KeyProfile", keyProfile); intent.putExtra("KeyProfile", keyProfile);
startActivityForResult(intent, ADD_KEYINFO); startActivityForResult(intent, ADD_KEYINFO);
/* 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();
try {
database.addKey(keyProfile);
} catch (Exception e) {
e.printStackTrace();
}
}
})
.show();*/
//TODO: do something with the result. //TODO: do something with the result.
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="me.impy.aegis.IntroActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_intro"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email"/>
</android.support.design.widget.CoordinatorLayout>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_intro"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="me.impy.aegis.IntroActivity"
tools:showIn="@layout/activity_intro">
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View file

@ -1,4 +1,5 @@
<resources> <resources>
<string name="app_name">Aegis</string> <string name="app_name">Aegis</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="title_activity_intro">IntroActivity</string>
</resources> </resources>