Skip to content

Commit

Permalink
Fix MP4s not being used, Files pager bugs, deleting in file details, …
Browse files Browse the repository at this point in the history
…and screenshot previews
  • Loading branch information
DSteve595 committed Nov 26, 2016
1 parent ba91700 commit c01a3a0
Show file tree
Hide file tree
Showing 21 changed files with 320 additions and 230 deletions.
6 changes: 3 additions & 3 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 25
versionCode 103
versionName '4.0.1'
versionCode 104
versionName '4.0.2'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
Expand Down Expand Up @@ -55,7 +55,7 @@ dependencies {
compile 'com.tbruyelle.rxpermissions:rxpermissions:0.9.0@aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.aurelhubert:ahbottomnavigation:2.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta2'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
}
repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
android:name=".activities.FileFinished"
android:theme="@style/Putio.Dialog"/>
<activity
android:name=".NewAddTransferActivity"
android:name=".transfers.AddTransferActivity"
android:excludeFromRecents="true"
android:label="@string/add_transfer"
android:taskAffinity="com.stevenschoen.putionew.addtransfertask"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/stevenschoen/putionew/ApiKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

public class ApiKey {
// Remove the surrounding comments after adding your key.
private static final String API_KEY = "FWV0N7ES";
private static final String CLIENT_ID = "83";
private static final String API_KEY /* = "API_KEY_HERE */;
private static final String CLIENT_ID /* = "CLIENT_ID_HERE */;

private ApiKey() {}

Expand Down
23 changes: 12 additions & 11 deletions app/src/main/java/com/stevenschoen/putionew/PutioActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
import com.stevenschoen.putionew.activities.BaseCastActivity;
import com.stevenschoen.putionew.activities.Login;
import com.stevenschoen.putionew.activities.Preferences;
import com.stevenschoen.putionew.files.NewFilesFragment;
import com.stevenschoen.putionew.files.FilesFragment;
import com.stevenschoen.putionew.fragments.Account;
import com.stevenschoen.putionew.model.files.PutioFile;
import com.stevenschoen.putionew.model.transfers.PutioTransfer;
import com.stevenschoen.putionew.transfers.AddTransferActivity;
import com.stevenschoen.putionew.transfers.Transfers;
import com.stevenschoen.putionew.tv.TvActivity;

Expand Down Expand Up @@ -159,7 +160,7 @@ private void init(Bundle savedInstanceState) {

if (savedInstanceState == null) {
Account accountFragment = (Account) Fragment.instantiate(this, Account.class.getName());
NewFilesFragment filesFragment = NewFilesFragment.Companion.newInstance(this, null);
FilesFragment filesFragment = FilesFragment.Companion.newInstance(this, null);
Transfers transfersFragment = (Transfers) Fragment.instantiate(this, Transfers.class.getName());
getSupportFragmentManager().beginTransaction()
.add(R.id.main_content_holder, accountFragment, FRAGTAG_ACCOUNT)
Expand Down Expand Up @@ -193,9 +194,9 @@ public void onClick(View v) {
if (bottomNavView.getCurrentItem() == TAB_FILES) {
destinationFolder = getFilesFragment().getCurrentPage().getFile();
}
Intent addTransferIntent = new Intent(PutioActivity.this, NewAddTransferActivity.class);
Intent addTransferIntent = new Intent(PutioActivity.this, AddTransferActivity.class);
if (destinationFolder != null) {
addTransferIntent.putExtra(NewAddTransferActivity.EXTRA_DESTINATION_FOLDER, destinationFolder);
addTransferIntent.putExtra(AddTransferActivity.EXTRA_DESTINATION_FOLDER, destinationFolder);
}
startActivity(addTransferIntent);
}
Expand All @@ -209,7 +210,7 @@ public void onAttachFragment(Fragment fragment) {
if (fragment.getTag() != null) {
switch (fragment.getTag()) {
case FRAGTAG_FILES:
((NewFilesFragment) fragment).setCallbacks(new NewFilesFragment.Callbacks() {
((FilesFragment) fragment).setCallbacks(new FilesFragment.Callbacks() {
@Override
public void onSelectionStarted() {
if (init) {
Expand Down Expand Up @@ -281,15 +282,15 @@ private boolean shouldShowAddTransferFab() {
switch (bottomNavView.getCurrentItem()) {
case TAB_ACCOUNT: return false;
case TAB_FILES: {
NewFilesFragment filesFragment = getFilesFragment();
FilesFragment filesFragment = getFilesFragment();
if (filesFragment.isSelecting()) {
return false;
} else {
NewFilesFragment.Page currentPage = filesFragment.getCurrentPage();
FilesFragment.Page currentPage = filesFragment.getCurrentPage();
if (currentPage == null) {
return true;
} else {
if (currentPage.getType() == NewFilesFragment.Page.Type.Search) {
if (currentPage.getType() == FilesFragment.Page.Type.Search) {
return false;
} else {
if (currentPage.getFile().isFolder()) {
Expand Down Expand Up @@ -351,8 +352,8 @@ private Account getAccountFragment() {
return (Account) getSupportFragmentManager().findFragmentByTag(FRAGTAG_ACCOUNT);
}

private NewFilesFragment getFilesFragment() {
return (NewFilesFragment) getSupportFragmentManager().findFragmentByTag(FRAGTAG_FILES);
private FilesFragment getFilesFragment() {
return (FilesFragment) getSupportFragmentManager().findFragmentByTag(FRAGTAG_FILES);
}

private Transfers getTransfersFragment() {
Expand All @@ -378,7 +379,7 @@ public void onReceive(Context context, Intent intent) {
@Override
public void onBackPressed() {
if (bottomNavView.getCurrentItem() == TAB_FILES) {
if (!getFilesFragment().goBack()) {
if (!getFilesFragment().goBack(true)) {
super.onBackPressed();
}
} else {
Expand Down
16 changes: 16 additions & 0 deletions app/src/main/java/com/stevenschoen/putionew/UniqueLoaderIds.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.stevenschoen.putionew

import com.stevenschoen.putionew.files.FileScreenshotLoader
import com.stevenschoen.putionew.files.FolderLoader
import com.stevenschoen.putionew.files.Mp4StatusLoader
import com.stevenschoen.putionew.files.SearchLoader

fun getUniqueLoaderId(loaderClass: Class<out PutioBaseLoader>): Int {
return when (loaderClass) {
FolderLoader::class.java -> 1
SearchLoader::class.java -> 2
Mp4StatusLoader::class.java -> 3
FileScreenshotLoader::class.java -> 4
else -> throw RuntimeException()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class DestinationFolderActivity : AppCompatActivity() {
fun getFragment() = supportFragmentManager.findFragmentById(R.id.destination_activity_root) as DestinationFolderFragment?

override fun onBackPressed() {
if (!getFragment()!!.goBack()) {
if (!getFragment()!!.goBack(true)) {
super.onBackPressed()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.stevenschoen.putionew.files

class DestinationFolderDialogFragment : NewFilesFragment() {
class DestinationFolderDialogFragment : FilesFragment() {
override val canSelect = false
override val showSearch = false
override val showCreateFolder = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.stevenschoen.putionew.files

class DestinationFolderFragment : NewFilesFragment() {
class DestinationFolderFragment : FilesFragment() {
override val canSelect = false
override val choosingFolder = true
override val showSearch = false
Expand Down
Loading

0 comments on commit c01a3a0

Please sign in to comment.