Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fffa60e
Replaced two activities by two fragments and one activity.
bobrusha Jul 16, 2016
73ad9d6
Added drawer layout and fragment (about).
bobrusha Jul 16, 2016
60c8781
Added button for sending email to developers. Worked with drawer layo…
bobrusha Jul 18, 2016
2c94bff
Added button for sending email to developers.
bobrusha Jul 18, 2016
f520df9
Merge branch 'develop' of github.com:bobrusha/android-app into develop
bobrusha Jul 18, 2016
69292a3
updated files.
bobrusha Jul 18, 2016
15ecf29
Removed one option in navigation drawer.
bobrusha Jul 18, 2016
a96387e
Removed one option in navigation drawer.
bobrusha Jul 18, 2016
77e3475
Added toggle and drawer closing.
bobrusha Jul 18, 2016
785dc23
Deleted all logs.
bobrusha Jul 18, 2016
e15c9c4
Started working on new feature with earphones. Added starting yandex.…
bobrusha Jul 19, 2016
50687ae
Added notification for opening/downloading yandex apps then earphones…
bobrusha Jul 19, 2016
85898e8
Polished notification
bobrusha Jul 19, 2016
36bb52e
Removed logs.
bobrusha Jul 19, 2016
38d0c2b
Said mNo to Hungarian Notation.
bobrusha Jul 19, 2016
50c8aaf
Added preferences
bobrusha Jul 19, 2016
5d9b75b
Starting work with caching using db.
bobrusha Jul 20, 2016
ded2652
Alomost finished caching, needs polishing
bobrusha Jul 20, 2016
bf58474
Finished caching
bobrusha Jul 20, 2016
e99b3c3
Finished caching. Fixed snackbar
bobrusha Jul 20, 2016
61c827e
Removed />
bobrusha Jul 23, 2016
240d545
Removed tests
bobrusha Aug 2, 2016
98172f5
Refactored adapter and viewholder: added binding using ButterKnife an…
bobrusha Aug 2, 2016
5e71bac
Refactored fragments and activity using ButterKnife.
bobrusha Aug 2, 2016
f9dbaa7
Refactored artist model using AutoValue library. Refactored ArtistInf…
bobrusha Aug 3, 2016
549dddd
Make intent for sending email constant.
bobrusha Aug 3, 2016
6726075
Moved receiver into separate class, moved realtive to reciver method …
bobrusha Aug 3, 2016
2f2adc0
Minor improvement.
bobrusha Aug 3, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# built application files
*.apk
*.ap_
.gradle/
build/

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/
out/
target/

# Local configuration file (sdk path, etc)
local.properties

# Eclipse project files
.classpath
.project

# Idea IDE files
*.idea/
*.iml

*.DS_STORE

custom_env.gradle
3 changes: 3 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/build
/src/androidTest
/src/test
59 changes: 59 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {
compileSdkVersion 24
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.bobrusha.android.artists"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
signingConfigs {
release {
storeFile file('/Users/aleksandra/AndroidStudioProjects/Artists/app/my-release-key.keystore')
storePassword "qwerty"
keyAlias "mobilization"
keyPassword "qwerty"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}

repositories {
mavenCentral()
jcenter()
maven { url "https://clojars.org/repo/" }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:preference-v7:24.1.1'
compile 'com.android.support:preference-v14:24.1.1'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'

compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'

provided 'frankiesardo:auto-parcel:1.0.1'
apt 'frankiesardo:auto-parcel:1.0.3'

compile 'com.fasterxml.jackson.core:jackson-core:2.8.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.1'
}
Binary file added app/my-release-key.keystore
Binary file not shown.
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/aleksandra/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
10 changes: 2 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:name=".MyApplication"
android:versionCode="1"
android:versionName="1.0"
android:allowBackup="true"
Expand All @@ -14,21 +15,14 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:name=".ui.MainActivity"
android:label="@string/main_activity_title">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".ArtistDetailActivity"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.bobrusha.android.artists.MainActivity"/>
</activity>
</application>

</manifest>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.bobrusha.android.artists;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.support.v4.content.AsyncTaskLoader;

import com.bobrusha.android.artists.db.DBManager;
import com.bobrusha.android.artists.model.ArtistInfo;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
import java.util.List;
Expand All @@ -21,12 +23,8 @@
* @author Aleksandra Bobrova
*/
public class ArtistInfoLoader extends AsyncTaskLoader<List<ArtistInfo>> {
private static final String URL = "http://cache-default04f.cdn.yandex.net/download.cdn.yandex.net/mobilization-2016/artists.json";
private static final String URL = "http://download.cdn.yandex.net/mobilization-2016/artists.json";
private OkHttpClient client = new OkHttpClient();
private Gson mGson = new Gson();

private TypeToken<List<ArtistInfo>> artists = new TypeToken<List<ArtistInfo>>() {
};

public ArtistInfoLoader(Context context) {
super(context);
Expand Down Expand Up @@ -54,8 +52,15 @@ public List<ArtistInfo> loadInBackground() {
try {
response = client.newCall(request).execute();
ResponseBody responseBody = response.body();
List<ArtistInfo> artistInfoList = mGson.fromJson(responseBody.charStream(), artists.getType());

ObjectMapper objectMapper = new ObjectMapper();
List<ArtistInfo> artistInfoList = objectMapper.readValue(responseBody.charStream(), new TypeReference<List<ArtistInfo>>() {
});

responseBody.close();

SQLiteDatabase db = MyApplication.getDbHelper().getWritableDatabase();
DBManager.putArtists(db, artistInfoList);
return artistInfoList;
} catch (IOException e) {
e.printStackTrace();
Expand Down
20 changes: 0 additions & 20 deletions app/src/main/java/com/bobrusha/android/artists/BusProvider.java

This file was deleted.

45 changes: 45 additions & 0 deletions app/src/main/java/com/bobrusha/android/artists/CacheLoader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.bobrusha.android.artists;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.v4.content.AsyncTaskLoader;
import android.util.Log;

import com.bobrusha.android.artists.db.Contract;
import com.bobrusha.android.artists.db.DBManager;
import com.bobrusha.android.artists.model.ArtistInfo;
import com.bobrusha.android.artists.model.Cover;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
* Created by Aleksandra on 20/07/16.
*/
public class CacheLoader extends AsyncTaskLoader<List<ArtistInfo>> {

public CacheLoader(Context context) {
super(context);
}

@Override
protected void onStartLoading() {
super.onStartLoading();
forceLoad();
}

@Override
public List<ArtistInfo> loadInBackground() {
SQLiteDatabase db = MyApplication.getDbHelper().getReadableDatabase();
Cursor c = db.query(Contract.ArtistEntry.TABLE_NAME, null, null, null, null, null, null, null);
List<ArtistInfo> artists = new ArrayList<>();
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
artists.add(DBManager.getArtistFromCursor(c));
}
c.close();
return artists;
}

}
4 changes: 2 additions & 2 deletions app/src/main/java/com/bobrusha/android/artists/Constants.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.bobrusha.android.artists;

/**
*
* @author Aleksandra Bobrova
*/

Expand All @@ -10,6 +9,7 @@ public interface Constants {
String PACKAGE_NAME_PREFIX = "com.bobrusha.android.artists.";
String EXTRA_ARTIST = PACKAGE_NAME_PREFIX + "artist";

int ARTIST_INFO_LOADER_ID = 1;
int ARTIST_INFO_LOADER_ID = 10;
int CACHE_LOADER_ID = 20;

}
Loading