Skip to content

Commit

Permalink
Now requires Android 4.0 (API 14) or higher, legacy code removed
Browse files Browse the repository at this point in the history
Removed GB layouts/layout detection.
Removed Roboto font assets.
Removed AppCompat (mostly) and NineOldAndroids.
  • Loading branch information
DSteve595 committed Jun 30, 2014
1 parent 77fc68f commit 1cb0fc4
Show file tree
Hide file tree
Showing 59 changed files with 342 additions and 803 deletions.
7 changes: 7 additions & 0 deletions Put.io.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
Expand Down
4 changes: 3 additions & 1 deletion app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,17 @@
<orderEntry type="library" exported="" name="appcompat-v7-19.1.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
<orderEntry type="library" exported="" name="okio-1.0.0" level="project" />
<orderEntry type="library" exported="" name="mediarouter-v7-19.1.0" level="project" />
<orderEntry type="library" exported="" name="commons-io-2.4" level="project" />
<orderEntry type="library" exported="" name="picasso-2.3.2" level="project" />
<orderEntry type="library" exported="" name="support-v13-19.1.0" level="project" />
<orderEntry type="library" exported="" name="httpmime-4.3.4" level="project" />
<orderEntry type="library" exported="" name="retrofit-1.6.0" level="project" />
<orderEntry type="library" exported="" name="eventbus-2.2.1" level="project" />
<orderEntry type="library" exported="" name="mediarouter-0.1.2" level="project" />
<orderEntry type="library" exported="" name="play-services-4.4.52" level="project" />
<orderEntry type="library" exported="" name="httpcore-4.3.2" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.0.0" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="module" module-name="aFileChooser" exported="" />
<orderEntry type="module" module-name="CastCompanionLibrary-android" exported="" />
</component>
Expand Down
31 changes: 15 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,38 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
classpath 'com.android.tools.build:gradle:0.12.+'
}
}

apply plugin: 'android'
apply plugin: 'com.android.application'

repositories {
mavenCentral()
maven {
url "https://repo.commonsware.com.s3.amazonaws.com"
}
}

android {
compileSdkVersion 19
buildToolsVersion '19.1.0'

buildToolsVersion '20.0.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 60
versionName '2.0.0-beta2'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

defaultConfig {
minSdkVersion 10
targetSdkVersion 19
versionCode 59
versionName "2.0.0-beta1"
}

buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}

packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
Expand All @@ -49,13 +48,13 @@ android {
}

dependencies {
compile 'com.android.support:support-v4:+'
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:support-v13:19.+'
compile 'com.google.android.gms:play-services:4.4.+'
compile 'commons-io:commons-io:2.4'
compile 'org.apache.httpcomponents:httpmime:4.3.+'
compile 'org.apache.httpcomponents:httpcore:4.3.+'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.commonsware.cwac:mediarouter:0.1.+'
compile 'com.astuetz:pagerslidingtabstrip:1.0.+'
compile 'com.squareup.retrofit:retrofit:1.6.0'
compile 'com.path:android-priority-jobqueue:1.1.2'
Expand Down
Binary file removed app/src/main/assets/Roboto-Bold.ttf
Binary file not shown.
Binary file removed app/src/main/assets/Roboto-Light.ttf
Binary file not shown.
Binary file removed app/src/main/assets/Roboto-Thin.ttf
Binary file not shown.
4 changes: 0 additions & 4 deletions app/src/main/java/com/stevenschoen/putionew/PutioUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.graphics.Typeface;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
Expand Down Expand Up @@ -156,14 +155,11 @@ public Dialog confirmChangesDialog(Context context, String filename) {
}

public static Dialog PutioDialog(Context context, String title, int contentViewId) {
Typeface robotoLight = Typeface.createFromAsset(context.getAssets(), "Roboto-Light.ttf");

Dialog dialog = new Dialog(context, R.style.Putio_Dialog);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentViewId);
TextView textTitle = (TextView) dialog.findViewById(R.id.dialog_title);
textTitle.setText(title);
textTitle.setTypeface(robotoLight);

return dialog;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
package com.stevenschoen.putionew;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;

import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.AnimatorListenerAdapter;
import com.nineoldandroids.animation.ValueAnimator;
import com.nineoldandroids.view.ViewHelper;

import static com.nineoldandroids.view.ViewPropertyAnimator.animate;

public class SwipeDismissTouchListener implements View.OnTouchListener {
// Cached ViewConfiguration and system-wide constant values
private int mSlop;
Expand Down Expand Up @@ -107,7 +103,7 @@ public boolean onTouch(View view, MotionEvent motionEvent) {
}
if (dismiss) {
// dismiss
animate(mView)
mView.animate()
.translationX(dismissRight ? mViewWidth : -mViewWidth)
.alpha(0)
.setDuration(mAnimationTime)
Expand All @@ -120,7 +116,7 @@ public void onAnimationEnd(Animator animation) {
});
} else {
// cancel
animate(mView)
mView.animate()
.translationX(0)
.alpha(1)
.setDuration(mAnimationTime)
Expand Down Expand Up @@ -153,9 +149,9 @@ public void onAnimationEnd(Animator animation) {

if (mSwiping) {
mTranslationX = deltaX;
ViewHelper.setTranslationX(mView, deltaX);
mView.setTranslationX(deltaX);
// TODO: use an ease-out interpolator or such
ViewHelper.setAlpha(mView, Math.max(0f, Math.min(1f,
mView.setAlpha(Math.max(0f, Math.min(1f,
1f - 2f * Math.abs(deltaX) / mViewWidth)));
return true;
}
Expand All @@ -180,8 +176,8 @@ private void performDismiss() {
public void onAnimationEnd(Animator animation) {
mCallback.onDismiss(mView, mToken);
// Reset view presentation
ViewHelper.setAlpha(mView, 1f);
ViewHelper.setTranslationX(mView, 0);
mView.setAlpha(1f);
mView.setTranslationX(0);
lp.height = originalHeight;
mView.setLayoutParams(lp);
}
Expand Down
18 changes: 8 additions & 10 deletions app/src/main/java/com/stevenschoen/putionew/TransfersAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import android.widget.ProgressBar;
import android.widget.TextView;

import com.nineoldandroids.view.ViewHelper;

import java.util.List;

public class TransfersAdapter extends ArrayAdapter<PutioTransferLayout> {
Expand Down Expand Up @@ -79,8 +77,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
holder.speedHolder.setVisibility(View.VISIBLE);
holder.textPercent.setText(percentString + "%");
holder.greenBar.setBackgroundColor(Color.parseColor("#2000FF00"));
ViewHelper.setPivotX(holder.greenBar, 0);
ViewHelper.setScaleX(holder.greenBar, 1f);
holder.greenBar.setPivotX(0);
holder.greenBar.setScaleX(1f);
holder.textPercent.setTextColor(context.getResources().getColor(R.color.putio_green));
} else if (data.get(position).status.equals("SEEDING")) {
holder.imgStatusIcon.setImageResource(R.drawable.ic_transfer_done);
Expand All @@ -90,8 +88,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
holder.speedHolder.setVisibility(View.VISIBLE);
holder.textPercent.setText(percentString + "%");
holder.greenBar.setBackgroundColor(Color.parseColor("#2000FF00"));
ViewHelper.setPivotX(holder.greenBar, 0);
ViewHelper.setScaleX(holder.greenBar, 1f);
holder.greenBar.setPivotX(0);
holder.greenBar.setScaleX(1f);
holder.textPercent.setTextColor(context.getResources().getColor(R.color.putio_green));
} else if (data.get(position).status.equals("ERROR")) {
holder.imgStatusIcon.setImageResource(R.drawable.ic_transfer_failed);
Expand All @@ -102,8 +100,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
holder.speedHolder.setVisibility(View.GONE);
holder.textPercent.setText(":(");
holder.greenBar.setBackgroundColor(context.getResources().getColor(R.color.putio_error));
ViewHelper.setPivotX(holder.greenBar, 0);
ViewHelper.setScaleX(holder.greenBar, 1f);
holder.greenBar.setPivotX(0);
holder.greenBar.setScaleX(1f);
holder.textPercent.setTextColor(Color.RED);
} else {
holder.imgStatusIcon.setVisibility(View.INVISIBLE);
Expand All @@ -112,8 +110,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
holder.speedHolder.setVisibility(View.VISIBLE);
holder.textPercent.setText(percentString + "%");
holder.greenBar.setBackgroundColor(Color.parseColor("#2000FF00"));
ViewHelper.setPivotX(holder.greenBar, 0);
ViewHelper.setScaleX(holder.greenBar, (float) data.get(position).percentDone / 100);
holder.greenBar.setPivotX(0);
holder.greenBar.setScaleX((float) data.get(position).percentDone / 100);
holder.textPercent.setTextColor(Color.BLACK);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
Expand Down Expand Up @@ -81,8 +80,6 @@ public void onCreate(Bundle savedInstanceState) {
}

TextView textTitle = (TextView) findViewById(R.id.dialog_title);
Typeface robotoLight = Typeface.createFromAsset(getAssets(), "Roboto-Light.ttf");
textTitle.setTypeface(robotoLight);
textTitle.setText(getString(R.string.addtransferstitle));

Button addButton = (Button) findViewById(R.id.button_addtransfer_add);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
package com.stevenschoen.putionew.activities;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.MediaRouteActionProvider;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;

import com.commonsware.cwac.mediarouter.MediaRouteActionProvider;
import com.google.android.gms.cast.MediaInfo;
import com.google.android.gms.cast.MediaMetadata;
import com.google.android.gms.common.images.WebImage;
Expand All @@ -30,14 +28,13 @@
import org.json.JSONException;
import org.json.JSONObject;

public class BaseCastActivity extends ActionBarActivity implements CastService.CastCallbacks {
public abstract class BaseCastActivity extends Activity implements CastService.CastCallbacks {

private CastService castService;
private MiniController castBar;

private boolean resumed = false;

@SuppressLint("InlinedApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -53,7 +50,7 @@ public boolean onCreateOptionsMenu(Menu menu) {

MenuItem buttonMediaRoute = menu.findItem(R.id.menu_cast);
MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider)
MenuItemCompat.getActionProvider(buttonMediaRoute);
buttonMediaRoute.getActionProvider();
if (castService != null) {
mediaRouteActionProvider.setRouteSelector(castService.getMediaRouteSelector());
}
Expand All @@ -62,10 +59,9 @@ public boolean onCreateOptionsMenu(Menu menu) {
}

protected void initCast() {
supportInvalidateOptionsMenu();
invalidateOptionsMenu();
castBar = (MiniController) findViewById(R.id.castbar_holder);
if (castBar != null && castService != null) {
castService.videoCastManager.setContext(this);
castService.videoCastManager.addMiniController(castBar);
}

Expand Down Expand Up @@ -146,8 +142,8 @@ public void load(PutioFileData file, String url, PutioUtils utils) {
MediaMetadata metaData = new MediaMetadata(file.contentType.contains("video") ?
MediaMetadata.MEDIA_TYPE_MOVIE : MediaMetadata.MEDIA_TYPE_MUSIC_TRACK);
metaData.putString(MediaMetadata.KEY_TITLE, FilenameUtils.removeExtension(file.name));
metaData.addImage(new WebImage(Uri.parse(file.icon)));
metaData.addImage(new WebImage(Uri.parse(file.screenshot)));
if (file.icon != null) metaData.addImage(new WebImage(Uri.parse(file.icon)));
if (file.screenshot != null) metaData.addImage(new WebImage(Uri.parse(file.screenshot)));

String subtitleUrl = PutioUtils.baseUrl + "files/" + file.id + "/subtitles/default" +
utils.tokenWithStuff + "&format=webvtt";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.stevenschoen.putionew.activities;

import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.MenuItem;

import com.stevenschoen.putionew.R;
Expand All @@ -17,14 +17,14 @@ public class FileDetailsActivity extends BaseCastActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setDisplayHomeAsUpEnabled(true);

PutioFileData fileData = (PutioFileData) getIntent().getExtras().getParcelable("fileData");

setContentView(R.layout.filedetailsphone);

if (savedInstanceState == null) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager
.beginTransaction();
Bundle fileDetailsBundle = new Bundle();
Expand All @@ -34,7 +34,7 @@ public void onCreate(Bundle savedInstanceState) {
fragmentTransaction.add(R.id.DetailsHolder, fileDetailsFragment);
fragmentTransaction.commit();
} else {
fileDetailsFragment = (FileDetails) getSupportFragmentManager().findFragmentById(R.id.DetailsHolder);
fileDetailsFragment = (FileDetails) getFragmentManager().findFragmentById(R.id.DetailsHolder);
}

setTitle(fileData.name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.stevenschoen.putionew.activities;

import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
Expand All @@ -20,10 +19,7 @@ public void onCreate(Bundle savedInstanceState) {
this.setTheme(R.style.Putio_Dialog);
setContentView(R.layout.filefinished);

Typeface robotoLight = Typeface.createFromAsset(getAssets(), "Roboto-Light.ttf");

TextView textTitle = (TextView) findViewById(R.id.dialog_title);
textTitle.setTypeface(robotoLight);

TextView textBody = (TextView) findViewById(R.id.text_downloadfinished_body);
textBody.setText(String.format(getString(R.string.downloadfinishedbody), getIntent().getExtras().getString("filename")));
Expand Down
Loading

0 comments on commit 1cb0fc4

Please sign in to comment.