2
0

Initial work on an Android master password app.

This commit is contained in:
Maarten Billemont 2014-08-21 00:26:47 -04:00
parent a831e15b3e
commit adc79d331b
62 changed files with 218 additions and 40 deletions

View File

@ -2,11 +2,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lyndir.lhunath.masterpassword" android:versionCode="1" android:versionName="GIT-SNAPSHOT"> package="com.lyndir.lhunath.masterpassword" android:versionCode="1" android:versionName="GIT-SNAPSHOT">
<uses-sdk android:minSdkVersion="8" <uses-sdk android:minSdkVersion="11"
android:targetSdkVersion="16" /> android:targetSdkVersion="16" />
<application android:icon="@drawable/icon" android:label="@string/app_name"> <application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloAndroidActivity"> <activity android:name=".UsersActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />

View File

@ -0,0 +1,8 @@
/*___Generated_by_IDEA___*/
package com.lyndir.lhunath.masterpassword;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}

View File

@ -0,0 +1,7 @@
/*___Generated_by_IDEA___*/
package com.lyndir.lhunath.masterpassword;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}

View File

@ -0,0 +1,7 @@
/*___Generated_by_IDEA___*/
package com.lyndir.lhunath.masterpassword;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}

View File

@ -44,6 +44,12 @@
<version>GIT-SNAPSHOT</version> <version>GIT-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.jakewharton</groupId>
<artifactId>butterknife</artifactId>
<version>5.1.2</version>
</dependency>
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size
android:width="20dp"
android:height="20dp" />
</shape>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fillViewport="true">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<View
android:layout_width="match_parent"
android:layout_height="0dp" />
<LinearLayout
android:id="@+id/users"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:divider="@drawable/divider20"
android:showDividers="middle" />
<View
android:layout_width="match_parent"
android:layout_height="0dp" />
</LinearLayout>
</HorizontalScrollView>
</FrameLayout>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/userName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/avatar0"
android:drawablePadding="8dp"
android:text="Maarten Billemont" />

View File

@ -2,4 +2,5 @@
<resources> <resources>
<string name="hello">Hello masterpassword-android!</string> <string name="hello">Hello masterpassword-android!</string>
<string name="app_name">masterpassword-android</string> <string name="app_name">masterpassword-android</string>
<string name="avatar">User Avatar</string>
</resources> </resources>

View File

@ -1,25 +0,0 @@
package com.lyndir.lhunath.masterpassword;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class HelloAndroidActivity extends Activity {
private static String TAG = "masterpassword-android";
/**
* Called when the activity is first created.
* @param savedInstanceState If the activity is being re-initialized after
* previously being shut down then this Bundle contains the data it most
* recently supplied in onSaveInstanceState(Bundle). <b>Note: Otherwise it is null.</b>
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "onCreate");
setContentView(R.layout.main);
}
}

View File

@ -0,0 +1,34 @@
package com.lyndir.lhunath.masterpassword;
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import butterknife.ButterKnife;
import butterknife.InjectView;
import com.lyndir.lhunath.masterpassword.model.Avatar;
import com.lyndir.lhunath.masterpassword.model.User;
import com.lyndir.lhunath.masterpassword.view.AvatarView;
public class UsersActivity extends Activity {
@InjectView(R.id.users)
LinearLayout users;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_users );
ButterKnife.inject( this );
}
@Override
protected void onResume() {
super.onResume();
AvatarView avatarView = new AvatarView( this );
avatarView.setUser( new User( "Maarten Billemont", Avatar.EIGHT ) );
users.addView( avatarView );
}
}

View File

@ -0,0 +1,39 @@
package com.lyndir.lhunath.masterpassword.model;
import com.lyndir.lhunath.masterpassword.R;
/**
* @author lhunath, 2014-08-20
*/
public enum Avatar {
ZERO( R.drawable.avatar0 ),
ONE( R.drawable.avatar1 ),
TWO( R.drawable.avatar2 ),
THREE( R.drawable.avatar3 ),
FOUR( R.drawable.avatar4 ),
FIVE( R.drawable.avatar5 ),
SIX( R.drawable.avatar6 ),
SEVEN( R.drawable.avatar7 ),
EIGHT( R.drawable.avatar8 ),
NINE( R.drawable.avatar9 ),
TEN( R.drawable.avatar10 ),
ELEVEN( R.drawable.avatar11 ),
TWELVE( R.drawable.avatar12 ),
THIRTEEN( R.drawable.avatar13 ),
FOURTEEN( R.drawable.avatar14 ),
FIFTEEN( R.drawable.avatar15 ),
SIXTEEN( R.drawable.avatar16 ),
SEVENTEEN( R.drawable.avatar17 ),
EIGHTEEN( R.drawable.avatar18 );
private final int imageResource;
Avatar(final int imageResource) {
this.imageResource = imageResource;
}
public int getImageResource() {
return imageResource;
}
}

View File

@ -0,0 +1,23 @@
package com.lyndir.lhunath.masterpassword.model;
/**
* @author lhunath, 2014-08-20
*/
public class User {
private String name;
private Avatar avatar;
public User(final String name, final Avatar avatar) {
this.name = name;
this.avatar = avatar;
}
public String getName() {
return name;
}
public Avatar getAvatar() {
return avatar;
}
}

View File

@ -0,0 +1,30 @@
package com.lyndir.lhunath.masterpassword.view;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import butterknife.ButterKnife;
import com.lyndir.lhunath.masterpassword.R;
import com.lyndir.lhunath.masterpassword.model.User;
/**
* @author lhunath, 2014-08-20
*/
public class AvatarView extends FrameLayout {
private final TextView userName;
public AvatarView(final Context context) {
super( context );
addView( userName = (TextView) LayoutInflater.from( context ).inflate( R.layout.view_user_avatar, this, false ) );
}
public void setUser(User user) {
userName.setText( user.getName() );
userName.setCompoundDrawables( null, getResources().getDrawable( user.getAvatar().getImageResource() ), null, null );
}
}

View File

@ -22,9 +22,17 @@
<module>masterpassword-algorithm</module> <module>masterpassword-algorithm</module>
<module>masterpassword-cli</module> <module>masterpassword-cli</module>
<module>masterpassword-gui</module> <module>masterpassword-gui</module>
<!--module>masterpassword-android</module-->
</modules> </modules>
<profiles>
<profile>
<id>mod:android</id>
<modules>
<module>masterpassword-android</module>
</modules>
</profile>
</profiles>
<!-- REMOTE ARTIFACT REPOSITORIES --> <!-- REMOTE ARTIFACT REPOSITORIES -->
<repositories> <repositories>
<repository> <repository>