Skip to content

Commit

Permalink
Update File Details, fix MP4 conversion, remove more old crap
Browse files Browse the repository at this point in the history
  • Loading branch information
DSteve595 committed Jul 2, 2016
1 parent c5b521b commit 1bb1ea4
Show file tree
Hide file tree
Showing 26 changed files with 1,148 additions and 1,293 deletions.
8 changes: 3 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId 'com.stevenschoen.putionew'
minSdkVersion 19
targetSdkVersion 24
versionCode 97
versionName '3.1.7'
versionCode 98
versionName '4.0-beta1'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
Expand Down Expand Up @@ -55,11 +55,9 @@ dependencies {
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.path:android-priority-jobqueue:1.1.2'
compile 'com.tbruyelle.rxpermissions:rxpermissions:0.7.0@aar'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.aurelhubert:ahbottomnavigation:1.3.0'
compile 'com.aurelhubert:ahbottomnavigation:1.3.1'
}
repositories {
mavenCentral()
Expand Down
8 changes: 0 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@
android:value=".activities.Putio"/>
</activity>
<activity android:name=".activities.Login"/>
<activity
android:name=".activities.FileDetailsActivity"
android:parentActivityName=".activities.Putio"
android:theme="@style/Theme.Putio.FileDetails">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.Putio"/>
</activity>
<activity
android:name=".activities.Preferences"
android:parentActivityName=".activities.Putio">
Expand Down
21 changes: 0 additions & 21 deletions app/src/main/java/com/stevenschoen/putionew/PutioUtils.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.stevenschoen.putionew;

import android.Manifest;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Dialog;
import android.app.DownloadManager;
Expand All @@ -28,22 +27,17 @@
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.MimeTypeMap;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.path.android.jobqueue.JobManager;
import com.squareup.picasso.Transformation;
import com.stevenschoen.putionew.model.PutioRestInterface;
import com.stevenschoen.putionew.model.files.PutioFile;
Expand All @@ -65,7 +59,6 @@

import javax.net.ssl.HttpsURLConnection;

import de.greenrobot.event.EventBus;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
Expand All @@ -76,7 +69,6 @@
import retrofit2.converter.gson.GsonConverterFactory;
import rx.Observable;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.FuncN;
import rx.schedulers.Schedulers;
Expand All @@ -94,8 +86,6 @@ public class PutioUtils {
// public static final String CAST_APPLICATION_ID = "2B3BFF06"; // Put.io's

private PutioRestInterface putioRestInterface;
private JobManager jobManager;
private EventBus eventBus;

public String token;
public String tokenWithStuff;
Expand All @@ -114,9 +104,6 @@ public PutioUtils(Context context) throws NoTokenException {
this.tokenWithStuff = "?oauth_token=" + token;

this.putioRestInterface = makePutioRestInterface(baseUrl).create(PutioRestInterface.class);

this.jobManager = new JobManager(context);
this.eventBus = new EventBus();
}

public Retrofit makePutioRestInterface(String baseUrl) {
Expand Down Expand Up @@ -153,14 +140,6 @@ public PutioRestInterface getRestInterface() {
return putioRestInterface;
}

public JobManager getJobManager() {
return jobManager;
}

public EventBus getEventBus() {
return eventBus;
}

public class NoTokenException extends Exception { }

public Dialog confirmChangesDialog(Context context, String filename) {
Expand Down
107 changes: 107 additions & 0 deletions app/src/main/java/com/stevenschoen/putionew/ScrimUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* Copyright 2014 Google Inc.
*
* 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 com.stevenschoen.putionew;

import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.PaintDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RectShape;
import android.util.LruCache;
import android.view.Gravity;

/**
* Utility methods for creating prettier gradient scrims.
*/
public class ScrimUtil {

private static final LruCache<Integer, Drawable> cubicGradientScrimCache = new LruCache<>(10);

private ScrimUtil() {
}

/**
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(int baseColor, int numStops, int gravity) {

// Generate a cache key by hashing together the inputs, based on the method described in the Effective Java book
int cacheKeyHash = baseColor;
cacheKeyHash = 31 * cacheKeyHash + numStops;
cacheKeyHash = 31 * cacheKeyHash + gravity;

Drawable cachedGradient = cubicGradientScrimCache.get(cacheKeyHash);
if (cachedGradient != null) {
return cachedGradient;
}

numStops = Math.max(numStops, 2);

PaintDrawable paintDrawable = new PaintDrawable();
paintDrawable.setShape(new RectShape());

final int[] stopColors = new int[numStops];

int red = Color.red(baseColor);
int green = Color.green(baseColor);
int blue = Color.blue(baseColor);
int alpha = Color.alpha(baseColor);

for (int i = 0; i < numStops; i++) {
float x = i * 1f / (numStops - 1);
float opacity = constrain(0, 1, (float) Math.pow(x, 3));
stopColors[i] = Color.argb((int) (alpha * opacity), red, green, blue);
}

final float x0, x1, y0, y1;
switch (gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
case Gravity.START: x0 = 1; x1 = 0; break;
case Gravity.END: x0 = 0; x1 = 1; break;
default: x0 = 0; x1 = 0; break;
}
switch (gravity & Gravity.VERTICAL_GRAVITY_MASK) {
case Gravity.TOP: y0 = 1; y1 = 0; break;
case Gravity.BOTTOM: y0 = 0; y1 = 1; break;
default: y0 = 0; y1 = 0; break;
}

paintDrawable.setShaderFactory(new ShapeDrawable.ShaderFactory() {
@Override
public Shader resize(int width, int height) {
LinearGradient linearGradient = new LinearGradient(
width * x0,
height * y0,
width * x1,
height * y1,
stopColors, null,
Shader.TileMode.CLAMP);
return linearGradient;
}
});

cubicGradientScrimCache.put(cacheKeyHash, paintDrawable);
return paintDrawable;
}

public static float constrain(float min, float max, float v) {
return Math.max(min, Math.min(max, v));
}
}

This file was deleted.

Loading

0 comments on commit 1bb1ea4

Please sign in to comment.