Skip to content

Commit

Permalink
Merge branch 'beta' of github.com:amahi/android into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
csoni111 committed Sep 5, 2017
2 parents bd31a3b + 4435b2a commit 4e515c8
Show file tree
Hide file tree
Showing 72 changed files with 4,082 additions and 326 deletions.
24 changes: 24 additions & 0 deletions DEBUG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Debugging

Sometimes you may need to debug with some special purpose server. To do that, add a file like this

src/main/assets/customServers.json

with details of the custom server(s) you need, like this:

```
[
{
"name": "Test Server 1",
"session_token": "12345678901234567",
"local_address": "http://192.168.0.11:4563",
"remote_address": "http://192.168.12.22:4563"
},
{
"name": "Test Server 2",
"session_token": "12345678901234567",
"local_address": "http://192.168.0.11:4563",
"remote_address": "http://192.168.12.22:4563"
}
]
```
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ android {
buildConfigField "String", "API_URL_PROXY", formatStringField(apiProperties["url.proxy"])
buildConfigField "String", "API_CLIENT_ID", formatStringField(apiProperties["client.id"])
buildConfigField "String", "API_CLIENT_SECRET", formatStringField(apiProperties["client.secret"])
buildConfigField "String", "CHROMECAST_APP_ID", formatStringField(apiProperties["chromecast.app.id"])

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -99,6 +100,7 @@ def formatStringField(field) {

dependencies {
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
Expand All @@ -116,6 +118,8 @@ dependencies {
compile "com.android.support:preference-v7:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:customtabs:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:leanback-v17:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:mediarouter-v7:${SUPPORT_LIBRARY_VERSION}"
compile 'com.google.android.gms:play-services-cast-framework:11.0.2'
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
transitive = true;
}
Expand All @@ -130,6 +134,7 @@ dependencies {
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'
compile 'org.videolan:libvlc:2.1.1'
compile 'pub.devrel:easypermissions:0.4.2'
testCompile 'org.robolectric:robolectric:3.1.2'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:shadows-multidex:3.0'
Expand Down
1 change: 1 addition & 0 deletions fakeApi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ url.amahi=https://amahi.org
url.proxy=https://amahi.org
client.id=1234567890
client.secret=abcdefghijklmnopqrstuvwxyz
chromecast.app.id=CC1AD845
50 changes: 48 additions & 2 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.amahi.anywhere"
android:installLocation="auto">

Expand Down Expand Up @@ -47,6 +46,10 @@

<permission android:name="android.permission.MEDIA_CONTENT_CONTROL" />

<uses-feature
android:name="android.hardware.camera"
android:required="false"/>

<uses-feature
android:name="android.software.leanback"
android:required="false" />
Expand All @@ -63,6 +66,16 @@
android:theme="@style/Theme.Amahi"
android:banner="@drawable/tv_banner">

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="org.amahi.anywhere.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"/>
</provider>

<activity
android:name=".tv.activity.MainTVActivity"
android:theme="@style/Theme.Leanback.Browse">
Expand Down Expand Up @@ -100,9 +113,19 @@
<activity
android:name=".activity.ServerFileVideoActivity"
android:theme="@style/Theme.Amahi.Fullscreen"/>
<activity
android:name=".activity.ExpandedControlsActivity"
android:theme="@style/Theme.CastVideosDark"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity
android:name=".activity.NativeVideoActivity"
android:theme="@style/Theme.Amahi.Fullscreen"/>
android:theme="@style/Theme.Amahi.Fullscreen"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMode"/>
<activity android:name=".activity.ServerFileWebActivity"/>
<activity
android:name=".activity.SettingsActivity"
Expand Down Expand Up @@ -134,6 +157,7 @@
</intent-filter>
</service>
<service android:name=".service.VideoService"/>
<service android:name=".service.UploadService"/>

<receiver android:name=".receiver.AudioReceiver">
<intent-filter>
Expand All @@ -153,6 +177,24 @@
</intent-filter>
</receiver>

<receiver
android:name=".receiver.CameraReceiver"
android:enabled="true">
<intent-filter>
<!--<action android:name="com.android.camera.NEW_PICTURE" />-->
<action android:name="android.hardware.action.NEW_PICTURE" />
<data android:mimeType="image/*" />
</intent-filter>
</receiver>

<service
android:name=".job.PhotosContentJob"
android:permission="android.permission.BIND_JOB_SERVICE" />

<service
android:name=".job.NetConnectivityJob"
android:permission="android.permission.BIND_JOB_SERVICE" />

<meta-data
android:name="com.crashlytics.ApiKey"
android:value="d7b65346d3cf0028328f006bff447501d70f8996"/>
Expand All @@ -178,6 +220,10 @@

<activity android:name=".tv.activity.TvPlaybackAudioActivity"
android:theme="@style/Theme.Leanback"/>

<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="org.amahi.anywhere.util.CastOptionsProvider" />
</application>

</manifest>
1 change: 1 addition & 0 deletions src/main/assets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
customServers.json
28 changes: 26 additions & 2 deletions src/main/java/org/amahi/anywhere/AmahiApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@

import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.StrictMode;
import android.support.annotation.RequiresApi;

import com.crashlytics.android.Crashlytics;

import org.amahi.anywhere.job.NetConnectivityJob;
import org.amahi.anywhere.job.PhotosContentJob;

import dagger.ObjectGraph;
import io.fabric.sdk.android.Fabric;
import timber.log.Timber;
Expand All @@ -49,9 +54,13 @@ public void onCreate() {
setUpDetecting();

setUpInjections();
}

private void setUpLogging() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
setUpJobs();
}
}

private void setUpLogging() {
if (isDebugging()) {
Timber.plant(new Timber.DebugTree());
}
Expand Down Expand Up @@ -80,4 +89,19 @@ private void setUpInjections() {
public void inject(Object injectionsConsumer) {
injector.inject(injectionsConsumer);
}

public static class JobIds {
public static final int PHOTOS_CONTENT_JOB = 125;
public static final int NET_CONNECTIVITY_JOB = 126;
}

@RequiresApi(api = Build.VERSION_CODES.N)
private void setUpJobs() {
if (!PhotosContentJob.isScheduled(this)) {
PhotosContentJob.scheduleJob(this);
}
if (!NetConnectivityJob.isScheduled(this)) {
NetConnectivityJob.scheduleJob(this);
}
}
}
6 changes: 6 additions & 0 deletions src/main/java/org/amahi/anywhere/AmahiModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@
import org.amahi.anywhere.fragment.ServerFilesFragment;
import org.amahi.anywhere.fragment.ServerSharesFragment;
import org.amahi.anywhere.fragment.SettingsFragment;
import org.amahi.anywhere.fragment.UploadSettingsFragment;
import org.amahi.anywhere.server.ApiModule;
import org.amahi.anywhere.service.AudioService;
import org.amahi.anywhere.service.UploadService;
import org.amahi.anywhere.service.VideoService;
import org.amahi.anywhere.tv.activity.TVWebViewActivity;
import org.amahi.anywhere.tv.activity.TvPlaybackAudioActivity;
import org.amahi.anywhere.tv.activity.TvPlaybackVideoActivity;
import org.amahi.anywhere.tv.fragment.MainTVFragment;
import org.amahi.anywhere.tv.fragment.ServerFileTvFragment;
import org.amahi.anywhere.util.UploadManager;
import org.amahi.anywhere.tv.fragment.TvPlaybackAudioFragment;
import org.amahi.anywhere.tv.fragment.TvPlaybackVideoFragment;

Expand Down Expand Up @@ -79,11 +82,14 @@
ServerFileImageFragment.class,
ServerFileDownloadingFragment.class,
SettingsFragment.class,
UploadSettingsFragment.class,
AudioService.class,
VideoService.class,
MainTVFragment.class,
TVWebViewActivity.class,
ServerFileTvFragment.class,
UploadService.class,
UploadManager.class,
TvPlaybackVideoFragment.class,
TvPlaybackVideoActivity.class,
TvPlaybackAudioActivity.class,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.amahi.anywhere.activity;

import android.view.Menu;

import com.google.android.gms.cast.framework.CastButtonFactory;
import com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity;

import org.amahi.anywhere.R;

public class ExpandedControlsActivity extends ExpandedControllerActivity {

@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.action_bar_expanded_controller, menu);
CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.media_route_menu_item);
return true;
}
}
Loading

0 comments on commit 4e515c8

Please sign in to comment.