Private
Public Access
1
0

Flesh out some starter classes that form some core parts.

This commit is contained in:
Kevin Whitaker
2015-11-17 23:02:21 -05:00
parent 43aaea40c2
commit d70f63924a
69 changed files with 63 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.+'
compile 'com.android.support:design:23.0.+'
compile 'com.heinrichreimersoftware:material-drawer:2.2.0' //Apache 2.0
compile 'io.realm:realm-android:0.84.1' //Apache 2.0 + RCBL
compile 'com.squareup.picasso:picasso:2.5.2' //Apache 2.0

View File

@@ -6,9 +6,10 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".MagnatuneCompainionApplication"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity android:name=".BrowseActivity" >
<activity android:name=".BrowseActivity" android:label="Magnatune Companion" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@@ -1,8 +1,14 @@
package com.magnatune.eyecreate.companionformagnatune;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import com.heinrichreimersoftware.materialdrawer.DrawerActivity;
import com.heinrichreimersoftware.materialdrawer.structure.DrawerItem;
import com.heinrichreimersoftware.materialdrawer.structure.DrawerProfile;
import com.magnatune.eyecreate.companionformagnatune.login.MagnatuneAccountManager;
public class BrowseActivity extends DrawerActivity {
@@ -10,5 +16,10 @@ public class BrowseActivity extends DrawerActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_browse);
addProfile(new DrawerProfile()
.setName(MagnatuneAccountManager.getMagnatuneName())
.setDescription(MagnatuneAccountManager.isLoggedIn()?getString(R.string.click_to_logout):getString(R.string.click_to_login))
.setRoundedAvatar((BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.ic_account_white_48dp))
.setBackground(new ColorDrawable(ContextCompat.getColor(this, R.color.primary))));
}
}

View File

@@ -0,0 +1,18 @@
package com.magnatune.eyecreate.companionformagnatune;
import android.app.Application;
public class MagnatuneCompainionApplication extends Application {
private static MagnatuneCompainionApplication instance;
@Override
public void onCreate() {
super.onCreate();
instance = this;
}
public static Application getApplication() {
return instance;
}
}

View File

@@ -0,0 +1,22 @@
package com.magnatune.eyecreate.companionformagnatune.login;
import android.content.Context;
import com.magnatune.eyecreate.companionformagnatune.MagnatuneCompainionApplication;
import com.magnatune.eyecreate.companionformagnatune.R;
public class MagnatuneAccountManager {
private static final String SECURE_STORAGE = "securestorage";
private static final String SP_KEY_USERNAME = "username";
private static final String SP_KEY_PASSWORD = "password";
public static String getMagnatuneName() {
ObscuredSharedPreferences securedPrefs = ObscuredSharedPreferences.getPrefs(MagnatuneCompainionApplication.getApplication(), SECURE_STORAGE, Context.MODE_PRIVATE);
return securedPrefs.getString(SP_KEY_USERNAME,MagnatuneCompainionApplication.getApplication().getString(R.string.anon_user));
}
public static boolean isLoggedIn() {
return false;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 877 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#246E9A</color>
</resources>

View File

@@ -1,3 +1,6 @@
<resources>
<string name="app_name">Companion for Magnatune</string>
<string name="click_to_login">Click to Login</string>
<string name="click_to_logout">Click to Logout</string>
<string name="anon_user">Anonymous</string>
</resources>

View File

@@ -3,7 +3,7 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#246E9A</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">#1C5679</item>
<item name="colorAccent">#EDDFCE</item>
<item name="actionBarStyle">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>

View File

@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.+'
classpath 'com.android.tools.build:gradle:1.5.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files