Flesh out some starter classes that form some core parts.
@@ -22,7 +22,7 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
testCompile 'junit:junit:4.12'
|
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 'com.heinrichreimersoftware:material-drawer:2.2.0' //Apache 2.0
|
||||||
compile 'io.realm:realm-android:0.84.1' //Apache 2.0 + RCBL
|
compile 'io.realm:realm-android:0.84.1' //Apache 2.0 + RCBL
|
||||||
compile 'com.squareup.picasso:picasso:2.5.2' //Apache 2.0
|
compile 'com.squareup.picasso:picasso:2.5.2' //Apache 2.0
|
||||||
|
|||||||
@@ -6,9 +6,10 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
android:name=".MagnatuneCompainionApplication"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/AppTheme" >
|
||||||
<activity android:name=".BrowseActivity" >
|
<activity android:name=".BrowseActivity" android:label="Magnatune Companion" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
package com.magnatune.eyecreate.companionformagnatune;
|
package com.magnatune.eyecreate.companionformagnatune;
|
||||||
|
|
||||||
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
|
||||||
import com.heinrichreimersoftware.materialdrawer.DrawerActivity;
|
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 {
|
public class BrowseActivity extends DrawerActivity {
|
||||||
|
|
||||||
@@ -10,5 +16,10 @@ public class BrowseActivity extends DrawerActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_browse);
|
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))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
app/src/main/res/drawable-hdpi/ic_account_black_18dp.png
Normal file
|
After Width: | Height: | Size: 339 B |
BIN
app/src/main/res/drawable-hdpi/ic_account_black_24dp.png
Normal file
|
After Width: | Height: | Size: 353 B |
BIN
app/src/main/res/drawable-hdpi/ic_account_black_36dp.png
Normal file
|
After Width: | Height: | Size: 480 B |
BIN
app/src/main/res/drawable-hdpi/ic_account_black_48dp.png
Normal file
|
After Width: | Height: | Size: 622 B |
BIN
app/src/main/res/drawable-hdpi/ic_account_grey600_18dp.png
Normal file
|
After Width: | Height: | Size: 457 B |
BIN
app/src/main/res/drawable-hdpi/ic_account_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 539 B |
BIN
app/src/main/res/drawable-hdpi/ic_account_grey600_36dp.png
Normal file
|
After Width: | Height: | Size: 699 B |
BIN
app/src/main/res/drawable-hdpi/ic_account_grey600_48dp.png
Normal file
|
After Width: | Height: | Size: 972 B |
BIN
app/src/main/res/drawable-hdpi/ic_account_white_18dp.png
Normal file
|
After Width: | Height: | Size: 359 B |
BIN
app/src/main/res/drawable-hdpi/ic_account_white_24dp.png
Normal file
|
After Width: | Height: | Size: 390 B |
BIN
app/src/main/res/drawable-hdpi/ic_account_white_36dp.png
Normal file
|
After Width: | Height: | Size: 529 B |
BIN
app/src/main/res/drawable-hdpi/ic_account_white_48dp.png
Normal file
|
After Width: | Height: | Size: 708 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_black_18dp.png
Normal file
|
After Width: | Height: | Size: 241 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_black_24dp.png
Normal file
|
After Width: | Height: | Size: 280 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_black_36dp.png
Normal file
|
After Width: | Height: | Size: 353 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_black_48dp.png
Normal file
|
After Width: | Height: | Size: 444 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_grey600_18dp.png
Normal file
|
After Width: | Height: | Size: 328 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 394 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_grey600_36dp.png
Normal file
|
After Width: | Height: | Size: 539 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_grey600_48dp.png
Normal file
|
After Width: | Height: | Size: 656 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_white_18dp.png
Normal file
|
After Width: | Height: | Size: 253 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_white_24dp.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_white_36dp.png
Normal file
|
After Width: | Height: | Size: 390 B |
BIN
app/src/main/res/drawable-mdpi/ic_account_white_48dp.png
Normal file
|
After Width: | Height: | Size: 483 B |
BIN
app/src/main/res/drawable-xhdpi/ic_account_black_18dp.png
Normal file
|
After Width: | Height: | Size: 353 B |
BIN
app/src/main/res/drawable-xhdpi/ic_account_black_24dp.png
Normal file
|
After Width: | Height: | Size: 444 B |
BIN
app/src/main/res/drawable-xhdpi/ic_account_black_36dp.png
Normal file
|
After Width: | Height: | Size: 622 B |
BIN
app/src/main/res/drawable-xhdpi/ic_account_black_48dp.png
Normal file
|
After Width: | Height: | Size: 810 B |
BIN
app/src/main/res/drawable-xhdpi/ic_account_grey600_18dp.png
Normal file
|
After Width: | Height: | Size: 539 B |
BIN
app/src/main/res/drawable-xhdpi/ic_account_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 656 B |
BIN
app/src/main/res/drawable-xhdpi/ic_account_grey600_36dp.png
Normal file
|
After Width: | Height: | Size: 972 B |
BIN
app/src/main/res/drawable-xhdpi/ic_account_grey600_48dp.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_account_white_18dp.png
Normal file
|
After Width: | Height: | Size: 390 B |
BIN
app/src/main/res/drawable-xhdpi/ic_account_white_24dp.png
Normal file
|
After Width: | Height: | Size: 483 B |
BIN
app/src/main/res/drawable-xhdpi/ic_account_white_36dp.png
Normal file
|
After Width: | Height: | Size: 708 B |
BIN
app/src/main/res/drawable-xhdpi/ic_account_white_48dp.png
Normal file
|
After Width: | Height: | Size: 924 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_black_18dp.png
Normal file
|
After Width: | Height: | Size: 480 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_black_24dp.png
Normal file
|
After Width: | Height: | Size: 622 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_black_36dp.png
Normal file
|
After Width: | Height: | Size: 877 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_black_48dp.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_grey600_18dp.png
Normal file
|
After Width: | Height: | Size: 699 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 972 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_grey600_36dp.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_grey600_48dp.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_white_18dp.png
Normal file
|
After Width: | Height: | Size: 529 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_white_24dp.png
Normal file
|
After Width: | Height: | Size: 708 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_white_36dp.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_account_white_48dp.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_black_18dp.png
Normal file
|
After Width: | Height: | Size: 622 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_black_24dp.png
Normal file
|
After Width: | Height: | Size: 810 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_black_36dp.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_black_48dp.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_grey600_18dp.png
Normal file
|
After Width: | Height: | Size: 972 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_grey600_36dp.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_grey600_48dp.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_white_18dp.png
Normal file
|
After Width: | Height: | Size: 708 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_white_24dp.png
Normal file
|
After Width: | Height: | Size: 924 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_white_36dp.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_account_white_48dp.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
4
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="primary">#246E9A</color>
|
||||||
|
</resources>
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Companion for Magnatune</string>
|
<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>
|
</resources>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="colorPrimary">#246E9A</item>
|
<item name="colorPrimary">@color/primary</item>
|
||||||
<item name="colorPrimaryDark">#1C5679</item>
|
<item name="colorPrimaryDark">#1C5679</item>
|
||||||
<item name="colorAccent">#EDDFCE</item>
|
<item name="colorAccent">#EDDFCE</item>
|
||||||
<item name="actionBarStyle">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
|
<item name="actionBarStyle">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
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
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|||||||