Skip to content

Commit

Permalink
Merge pull request #37 from StepicOrg/release/1.5
Browse files Browse the repository at this point in the history
Release/1.5
  • Loading branch information
KirillMakarov committed Mar 25, 2016
2 parents dc70bff + 94eb05c commit 086e85e
Show file tree
Hide file tree
Showing 189 changed files with 4,849 additions and 832 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ Thumbs.db
build/

#NDK
obj/
obj/

maka-vlc/
38 changes: 28 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "org.stepic.droid"
minSdkVersion 14
targetSdkVersion 23
versionCode 32
versionName "1.4"
versionCode 41
versionName "1.5.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Enabling multidex support.
multiDexEnabled true
Expand All @@ -25,6 +25,7 @@ android {
'proguard-rules.pro'
}
debug {
versionNameSuffix "DEV"
}
}

Expand All @@ -40,6 +41,26 @@ android {
main.java.srcDirs += 'src/main/kotlin'
}

splits {
abi {
enable true
reset()
include 'armeabi', 'armeabi-v7a', 'mips', 'x86' //select ABIs to build APKs for
universalApk true //generate an additional APK that contains all the ABIs
}
}

// map for the version code
project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'mips': 5, 'x86': 8]

android.applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) + android.defaultConfig.versionCode*10
}
}

packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
Expand All @@ -60,9 +81,6 @@ dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.code.gson:gson:2.4'


compile 'com.squareup.okhttp3:okhttp:3.1.2'
compile 'com.squareup.okhttp:okhttp-ws:2.7.4'
compile 'com.squareup.okio:okio:1.6.0'

compile 'de.hdodenhof:circleimageview:1.3.0'
Expand Down Expand Up @@ -108,15 +126,17 @@ dependencies {

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1' // or 1.3.1
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1' // or 1.3.1
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // or 1.3.1
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1' // or 1.3.1

compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"


compile files('libs/commons-logging-api-1.1.1.jar')
compile files('libs/jericho-html-3.4.jar')
compile files('libs/log4j-api-2.4.1.jar')
compile files('libs/slf4j-api-1.7.12.jar')

compile 'de.mrmaffen:vlc-android-sdk:3.0.0'
}

repositories {
Expand All @@ -130,6 +150,4 @@ buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}


}
11 changes: 10 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" android:maxSdkVersion="22" />


<application
android:largeHeap="true"
android:name="org.stepic.droid.base.MainApplication"
android:allowBackup="false"
android:icon="@drawable/stepic_logo"
Expand Down Expand Up @@ -81,7 +83,7 @@
android:name="org.stepic.droid.receivers.DownloadClickReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED" />
<action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED"/>
</intent-filter>
</receiver>

Expand Down Expand Up @@ -129,6 +131,13 @@
android:value=".view.activities.MainFeedActivity"/>
</activity>

<activity
android:hardwareAccelerated="false"
android:name=".view.activities.VideoActivity"
android:theme="@style/AppTheme.VideoPlayer"
android:configChanges="orientation|screenSize"
android:label="@string/video_title"/>


</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import com.yandex.metrica.YandexMetrica;

import org.stepic.droid.R;
import org.stepic.droid.concurrency.FromDbCoursesTask;
import org.stepic.droid.concurrency.ToDbCoursesTask;
import org.stepic.droid.concurrency.tasks.FromDbCoursesTask;
import org.stepic.droid.concurrency.tasks.ToDbCoursesTask;
import org.stepic.droid.events.courses.FailCoursesDownloadEvent;
import org.stepic.droid.events.courses.FailDropCourseEvent;
import org.stepic.droid.events.courses.FinishingGetCoursesFromDbEvent;
Expand Down Expand Up @@ -44,9 +44,8 @@
import retrofit.Retrofit;

public abstract class CoursesDatabaseFragmentBase extends CourseListFragmentBase {
protected FromDbCoursesTask mDbGetCoursesTask;
protected ToDbCoursesTask mDbSaveCoursesTask;

protected FromDbCoursesTask mDbFromCoursesTask;

public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Expand Down Expand Up @@ -82,19 +81,19 @@ protected void showCourses(List<Course> cachedCourses) {

private void saveDataToCache(List<Course> courses) {
mDbSaveCoursesTask = new ToDbCoursesTask(courses, getCourseType(), mCurrentPage);
mDbSaveCoursesTask.execute();
mDbSaveCoursesTask.executeOnExecutor(mThreadPoolExecutor);
}


public void getAndShowDataFromCache() {
mDbGetCoursesTask = new FromDbCoursesTask(getCourseType()) {
mDbFromCoursesTask = new FromDbCoursesTask(getCourseType()){
@Override
protected void onSuccess(List<Course> courses) {
super.onSuccess(courses);
bus.post(new GettingCoursesFromDbSuccessEvent(getCourseType(), courses));
}
};
mDbGetCoursesTask.execute();
mDbFromCoursesTask.executeOnExecutor(mThreadPoolExecutor);
}

@Subscribe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.stepic.droid.util.resolvers.CoursePropertyResolver;
import org.stepic.droid.util.resolvers.IStepResolver;

import java.util.concurrent.ThreadPoolExecutor;

import javax.inject.Inject;

import butterknife.ButterKnife;
Expand Down Expand Up @@ -49,6 +51,9 @@ public abstract class FragmentActivityBase extends AppCompatActivity {
@Inject
protected ILoginManager mLoginManager;

@Inject
protected ThreadPoolExecutor mThreadPoolExecutor;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -99,7 +104,7 @@ protected void onDestroy() {

protected void setFragment(@IdRes int res, Fragment fragment) {
android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(res, fragment);
fragmentTransaction.replace(res, fragment, fragment.getClass().toString());
fragmentTransaction.commit();
}
}
18 changes: 17 additions & 1 deletion app/src/main/java/org/stepic/droid/base/FragmentBase.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.stepic.droid.base;

import android.app.DownloadManager;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
Expand All @@ -10,8 +11,10 @@
import com.squareup.leakcanary.RefWatcher;
import com.squareup.otto.Bus;

import org.stepic.droid.core.AudioFocusHelper;
import org.stepic.droid.core.ILessonSessionManager;
import org.stepic.droid.core.ILocalProgressManager;
import org.stepic.droid.concurrency.IMainHandler;
import org.stepic.droid.core.IShell;
import org.stepic.droid.preferences.SharedPreferenceHelper;
import org.stepic.droid.preferences.UserPreferences;
Expand All @@ -22,13 +25,18 @@
import org.stepic.droid.util.resolvers.IStepResolver;
import org.stepic.droid.util.resolvers.IVideoResolver;

import java.util.concurrent.ThreadPoolExecutor;

import javax.inject.Inject;

import butterknife.ButterKnife;

public class FragmentBase extends Fragment {

protected String TAG = "StepicFragment";
// protected String TAG = "StepicFragment";

@Inject
public ThreadPoolExecutor mThreadPoolExecutor;

@Inject
public ILessonSessionManager mLessonManager;
Expand Down Expand Up @@ -69,6 +77,14 @@ public class FragmentBase extends Fragment {
@Inject
public IStepResolver mStepResolver;

@Inject
public IMainHandler mMainHandler;

@Inject
public AudioFocusHelper mAudioFocusHelper;

@Inject
public DownloadManager mSystemDownloadManager;

public FragmentBase() {
MainApplication.component(MainApplication.getAppContext()).inject(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.support.v4.app.Fragment
import org.stepic.droid.R

abstract class SingleFragmentActivity : FragmentActivityBase() {
protected abstract fun createFragment(): Fragment
protected abstract fun createFragment(): Fragment?
open fun getLayoutResId() = R.layout.activity_fragment

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.stepic.droid.concurrency

import android.os.Handler

abstract class HandlerBaseDelegate : IHandler {
override fun post(body: () -> Unit) = getHandler().post { body.invoke() }
abstract fun getHandler() : Handler
}
5 changes: 5 additions & 0 deletions app/src/main/java/org/stepic/droid/concurrency/IHandler.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.stepic.droid.concurrency

interface IHandler {
fun post(body : ()->Unit): Boolean
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package org.stepic.droid.concurrency

interface IMainHandler : IHandler
10 changes: 10 additions & 0 deletions app/src/main/java/org/stepic/droid/concurrency/MainHandlerImpl.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.stepic.droid.concurrency

import android.os.Handler
import org.stepic.droid.base.MainApplication

class MainHandlerImpl : HandlerBaseDelegate(), IMainHandler {
val mainHandler = Handler(MainApplication.getAppContext().mainLooper)

override fun getHandler() = mainHandler
}

This file was deleted.

56 changes: 0 additions & 56 deletions app/src/main/java/org/stepic/droid/concurrency/ToDbStepTask.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.stepic.droid.concurrency;
package org.stepic.droid.concurrency.tasks;

public class AsyncResultWrapper<T> {
private T result;
Expand Down
Loading

0 comments on commit 086e85e

Please sign in to comment.