diff --git a/app/build.gradle b/app/build.gradle index eabe325f..1ef8a25b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,6 +10,7 @@ buildscript { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' +apply plugin: 'kotlin-kapt' apply plugin: 'io.fabric' repositories { @@ -23,8 +24,8 @@ android { applicationId 'com.stevenschoen.putionew' minSdkVersion 19 targetSdkVersion 25 - versionCode 108 - versionName '4.0.6' + versionCode 109 + versionName '4.0.7' multiDexEnabled true } buildTypes { @@ -82,6 +83,8 @@ dependencies { compile 'com.tbruyelle.rxpermissions:rxpermissions:0.9.1@aar' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.aurelhubert:ahbottomnavigation:2.0.2' + compile 'nz.bradcampbell:paperparcel:2.0.0-beta1' + kapt 'nz.bradcampbell:paperparcel-compiler:2.0.0-beta1' } repositories { mavenCentral() diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3ecafbbf..47b74781 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -66,7 +66,7 @@ android:name=".files.FileFinishedActivity" android:theme="@style/Putio.Dialog"/> > downloadIds = new ArrayList<>(files.length); for (PutioFile file : files) { if (file.isFolder()) { - long[] folder = new long[]{file.id}; - downloadIds.add(downloadZipWithoutUrl(activity, folder, file.name)); + long[] folder = new long[]{file.getId()}; + downloadIds.add(downloadZipWithoutUrl(activity, folder, file.getName())); } else { - downloadIds.add(downloadFileWithoutUrl(activity, file.id, file.name)); + downloadIds.add(downloadFileWithoutUrl(activity, file.getId(), file.getName())); } } @@ -304,7 +298,7 @@ public void stream(Context context, PutioFile file, String url, List subtitles; } - public InputStream getDefaultSubtitleData(long id) throws SocketTimeoutException { - URL url = null; - try { - url = new URL(baseUrl + "/files/" + id + "/subtitles/default" + tokenWithStuff + "&format=webvtt"); - HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); - connection.setConnectTimeout(8000); - - return connection.getInputStream(); - } catch (MalformedURLException e1) { - e1.printStackTrace(); - } catch (SocketTimeoutException e) { - throw new SocketTimeoutException(); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - public void copyDownloadLink(final Context context, PutioFile file) { - String url = baseUrl + "/files/" + file.id + "/download" + tokenWithStuff; + String url = baseUrl + "files/" + file.getId() + "/download" + tokenWithStuff; copy(context, "Download link", url); Toast.makeText(context, context.getString(R.string.readytopaste), Toast.LENGTH_SHORT).show(); @@ -413,7 +389,7 @@ public void copyDownloadLink(final Context context, PutioFile file) { public void copyZipDownloadLink(Context context, PutioFile... files) { long[] fileIds = new long[files.length]; for (int i = 0; i < files.length; i++) { - fileIds[i] = files[i].id; + fileIds[i] = files[i].getId(); } String url = getZipDownloadUrl(fileIds); copy(context, "Download link", url); @@ -443,12 +419,12 @@ public static String resolveRedirect(String url) throws IOException { } public String getFileDownloadUrl(long id) { - return baseUrl + "/files/" + id + "/download" + tokenWithStuff; + return baseUrl + "files/" + id + "/download" + tokenWithStuff; } public String getZipDownloadUrl(long... ids) { String idsString = longsToString(ids); - return baseUrl + "/files/zip?file_ids=" + idsString + tokenWithStuff.replace("?", "&"); // TODO hacky + return baseUrl + "files/zip?file_ids=" + idsString + tokenWithStuff.replace("?", "&"); // TODO hacky } public static boolean idIsDownloaded(long id) { diff --git a/app/src/main/java/com/stevenschoen/putionew/cast/BaseCastActivity.kt b/app/src/main/java/com/stevenschoen/putionew/cast/BaseCastActivity.kt index 4814129b..192826e5 100644 --- a/app/src/main/java/com/stevenschoen/putionew/cast/BaseCastActivity.kt +++ b/app/src/main/java/com/stevenschoen/putionew/cast/BaseCastActivity.kt @@ -80,6 +80,7 @@ abstract class BaseCastActivity : AppCompatActivity(), PutioApplication.CastCall setMediaTracks(subtitles.orEmpty().mapIndexed { i, sub -> MediaTrack.Builder(i.toLong(), MediaTrack.TYPE_TEXT) .setContentId(sub.getUrl(PutioSubtitle.FORMAT_WEBVTT, file.id, utils.tokenWithStuff)) + .setContentType("text/vtt") .setSubtype(MediaTrack.SUBTYPE_SUBTITLES) .setName(sub.name) .setLanguage(sub.language) diff --git a/app/src/main/java/com/stevenschoen/putionew/files/DestinationFolderActivity.kt b/app/src/main/java/com/stevenschoen/putionew/files/DestinationFolderActivity.kt index 1b85592e..bbfe05b8 100644 --- a/app/src/main/java/com/stevenschoen/putionew/files/DestinationFolderActivity.kt +++ b/app/src/main/java/com/stevenschoen/putionew/files/DestinationFolderActivity.kt @@ -9,10 +9,6 @@ import com.stevenschoen.putionew.R class DestinationFolderActivity : AppCompatActivity() { - companion object { - val RESULT_EXTRA_FOLDER = "folder" - } - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -28,7 +24,7 @@ class DestinationFolderActivity : AppCompatActivity() { val toolbarView = findViewById(R.id.destination_toolbar) as Toolbar setSupportActionBar(toolbarView) - toolbarView.setNavigationIcon(R.drawable.ic_toolbarnav_close) + toolbarView.setNavigationIcon(R.drawable.ic_toolbar_nav_close_black) toolbarView.setNavigationOnClickListener { finish() } findViewById(R.id.destination_cancel).setOnClickListener { @@ -51,4 +47,8 @@ class DestinationFolderActivity : AppCompatActivity() { super.onBackPressed() } } + + companion object { + val RESULT_EXTRA_FOLDER = "folder" + } } \ No newline at end of file diff --git a/app/src/main/java/com/stevenschoen/putionew/files/FileDetailsFragment.kt b/app/src/main/java/com/stevenschoen/putionew/files/FileDetailsFragment.kt index 430e730d..0340963c 100644 --- a/app/src/main/java/com/stevenschoen/putionew/files/FileDetailsFragment.kt +++ b/app/src/main/java/com/stevenschoen/putionew/files/FileDetailsFragment.kt @@ -165,7 +165,7 @@ class FileDetailsFragment : RxFragment() { val infoSize = holderInfo.findViewById(R.id.holder_fileinfo_size) val textSize = infoSize.findViewById(R.id.text_fileinfo_size) as TextView - textSize.text = PutioUtils.humanReadableByteCount(file.size, false) + textSize.text = PutioUtils.humanReadableByteCount(file.size!!, false) val infoCrc32 = holderInfo.findViewById(R.id.holder_fileinfo_crc32) val textCrc32 = infoCrc32.findViewById(R.id.text_fileinfo_crc32) as TextView @@ -181,7 +181,7 @@ class FileDetailsFragment : RxFragment() { if (mp4Status == PutioMp4Status.Status.Completed) { mp4 = checkBoxMp4Available.isChecked } - } else if (file.isMp4Available) { + } else if (file.isMp4Available!!) { mp4 = checkBoxMp4Available.isChecked } } @@ -331,7 +331,7 @@ class FileDetailsFragment : RxFragment() { infoMp4Already.visibility = View.GONE infoMp4Available.visibility = View.GONE infoMp4Converting.visibility = View.VISIBLE - infoMp4ConvertingText.text = getString(R.string.converting_mp4) + " (${status.percentDone}%)" + infoMp4ConvertingText.text = "${getString(R.string.converting_mp4)} (${status.percentDone}%)" infoMp4NotAvailable.visibility = View.GONE } PutioMp4Status.Status.Completed -> { diff --git a/app/src/main/java/com/stevenschoen/putionew/files/FileListAdapter.kt b/app/src/main/java/com/stevenschoen/putionew/files/FileListAdapter.kt index 2563df30..5dcf7bf8 100644 --- a/app/src/main/java/com/stevenschoen/putionew/files/FileListAdapter.kt +++ b/app/src/main/java/com/stevenschoen/putionew/files/FileListAdapter.kt @@ -1,6 +1,7 @@ package com.stevenschoen.putionew.files import android.support.v7.widget.RecyclerView +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -60,18 +61,20 @@ class FileListAdapter(private val data: List, } override fun onBindViewHolder(holder: FileHolder, position: Int) { - if (holder.root is Checkable) { - (holder.root as Checkable).isChecked = isPositionChecked(position) + if (holder.itemView is Checkable) { + holder.itemView.isChecked = isPositionChecked(position) } val file = data[position] holder.textName.text = file.name - holder.textDescription.text = PutioUtils.humanReadableByteCount(file.size, false) - if (file.icon != null && !file.icon.isEmpty()) { - if (file.icon.endsWith("folder.png")) { - Picasso.with(holder.iconImg.context).load(R.drawable.ic_putio_folder).into(holder.iconImg) - } else { + holder.textDescription.text = PutioUtils.humanReadableByteCount(file.size!!, false) + Log.d("addtransfer_pick_destination", "${file.name} isFolder: ${file.isFolder}") + if (file.isFolder) { + Picasso.with(holder.iconImg.context).cancelRequest(holder.iconImg) + holder.iconImg.setImageResource(R.drawable.ic_putio_folder_accent) + } else { + if (!file.icon.isNullOrEmpty()) { Picasso.with(holder.iconImg.context).load(file.icon).into(holder.iconImg) } } @@ -171,17 +174,17 @@ class FileListAdapter(private val data: List, fun onItemsCheckedChanged() } - inner class FileHolder(var root: View) : RecyclerView.ViewHolder(root) { - val textName = root.findViewById(R.id.text_file_name) as TextView - val textDescription = root.findViewById(R.id.text_file_description) as TextView - val iconImg = root.findViewById(R.id.icon_file_img) as ImageView - val iconAccessed = root.findViewById(R.id.icon_file_accessed) as ImageView + inner class FileHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + val textName = itemView.findViewById(R.id.text_file_name) as TextView + val textDescription = itemView.findViewById(R.id.text_file_description) as TextView + val iconImg = itemView.findViewById(R.id.icon_file_img) as ImageView + val iconAccessed = itemView.findViewById(R.id.icon_file_accessed) as ImageView init { - root.setOnClickListener { + itemView.setOnClickListener { onFileClicked.invoke(data[adapterPosition], this) } - root.setOnLongClickListener { + itemView.setOnLongClickListener { onFileLongClicked.invoke(data[adapterPosition], this) true } diff --git a/app/src/main/java/com/stevenschoen/putionew/files/FolderFragment.kt b/app/src/main/java/com/stevenschoen/putionew/files/FolderFragment.kt index 242b38a7..751aefec 100644 --- a/app/src/main/java/com/stevenschoen/putionew/files/FolderFragment.kt +++ b/app/src/main/java/com/stevenschoen/putionew/files/FolderFragment.kt @@ -19,36 +19,6 @@ import rx.android.schedulers.AndroidSchedulers class FolderFragment : FileListFragment() { - companion object { - const val EXTRA_FOLDER = "folder" - const val EXTRA_PAD_FOR_FAB = "padforfab" - const val EXTRA_SHOW_SEARCH = "show_search" - const val EXTRA_SHOW_CREATEFOLDER = "show_createfolder" - - const val REQUEST_CHOOSE_MOVE_DESTINATION = 1 - - const val FRAGTAG_SELECTION = "selection" - const val FRAGTAG_RENAME = "rename" - const val FRAGTAG_DOWNLOAD_INDIVIDUALORZIP = "dl_indivorzip" - const val FRAGTAG_DELETE = "delete" - const val FRAGTAG_CREATE_FOLDER = "create_folder" - - fun newInstance(context: Context, folder: PutioFile, - canSelect: Boolean, - padForFab: Boolean, showSearch: Boolean, showCreateFolder: Boolean): FolderFragment { - if (!folder.isFolder) { - throw IllegalStateException("FolderFragment created on a file, not a folder: ${folder.name} (ID ${folder.id})") - } - val args = Bundle() - args.putParcelable(EXTRA_FOLDER, folder) - args.putBoolean(EXTRA_PAD_FOR_FAB, padForFab) - args.putBoolean(EXTRA_SHOW_SEARCH, showSearch) - args.putBoolean(EXTRA_SHOW_CREATEFOLDER, showCreateFolder) - return addArguments(Fragment.instantiate(context, FolderFragment::class.java.name, args) as FolderFragment, - canSelect) - } - } - val folder by lazy { arguments.getParcelable(EXTRA_FOLDER) } val padForFab by lazy { arguments.getBoolean(EXTRA_PAD_FOR_FAB) } val showSearch by lazy { arguments.getBoolean(EXTRA_SHOW_SEARCH) } @@ -196,4 +166,34 @@ class FolderFragment : FileListFragment() { override fun isRefreshing(): Boolean { return folderLoader!!.isRefreshing() } + + companion object { + const val EXTRA_FOLDER = "folder" + const val EXTRA_PAD_FOR_FAB = "padforfab" + const val EXTRA_SHOW_SEARCH = "show_search" + const val EXTRA_SHOW_CREATEFOLDER = "show_createfolder" + + const val REQUEST_CHOOSE_MOVE_DESTINATION = 1 + + const val FRAGTAG_SELECTION = "selection" + const val FRAGTAG_RENAME = "rename" + const val FRAGTAG_DOWNLOAD_INDIVIDUALORZIP = "dl_indivorzip" + const val FRAGTAG_DELETE = "delete" + const val FRAGTAG_CREATE_FOLDER = "create_folder" + + fun newInstance(context: Context, folder: PutioFile, + canSelect: Boolean, + padForFab: Boolean, showSearch: Boolean, showCreateFolder: Boolean): FolderFragment { + if (!folder.isFolder) { + throw IllegalStateException("FolderFragment created on a file, not a folder: ${folder.name} (ID ${folder.id})") + } + val args = Bundle() + args.putParcelable(EXTRA_FOLDER, folder) + args.putBoolean(EXTRA_PAD_FOR_FAB, padForFab) + args.putBoolean(EXTRA_SHOW_SEARCH, showSearch) + args.putBoolean(EXTRA_SHOW_CREATEFOLDER, showCreateFolder) + return addArguments(Fragment.instantiate(context, FolderFragment::class.java.name, args) as FolderFragment, + canSelect) + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/stevenschoen/putionew/files/SearchLoader.kt b/app/src/main/java/com/stevenschoen/putionew/files/SearchLoader.kt index 09be532f..8797696f 100644 --- a/app/src/main/java/com/stevenschoen/putionew/files/SearchLoader.kt +++ b/app/src/main/java/com/stevenschoen/putionew/files/SearchLoader.kt @@ -27,7 +27,7 @@ class SearchLoader(context: Context, private val parentFolder: PutioFile, val qu searchSubject.onNext(response.files) }, { error -> searchSubscription = null - Log.d("asdf", "error: $error") + Log.d("addtransfer_pick_destination", "error: $error") }) } diff --git a/app/src/main/java/com/stevenschoen/putionew/model/files/PutioFile.java b/app/src/main/java/com/stevenschoen/putionew/model/files/PutioFile.java deleted file mode 100644 index 1a55d752..00000000 --- a/app/src/main/java/com/stevenschoen/putionew/model/files/PutioFile.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.stevenschoen.putionew.model.files; - -import android.content.res.Resources; -import android.os.Parcel; -import android.os.Parcelable; - -import com.stevenschoen.putionew.PutioUtils; -import com.stevenschoen.putionew.R; - -public class PutioFile implements Parcelable { - public boolean isShared; - public String name; - public String icon; - public String screenshot; - public String createdAt; - public String firstAccessedAt; - public long parentId; - public boolean isMp4Available; - public String contentType; - public long id; - public long size; - public String crc32; - - public PutioFile() { } - - public boolean isFolder() { - return contentType.equals("application/x-directory"); - } - - public boolean isMedia() { - for (int i = 0; i < PutioUtils.streamingMediaTypes.length; i++) { - if (contentType.startsWith(PutioUtils.streamingMediaTypes[i])) { - return true; - } - } - return false; - } - - public boolean isVideo() { - return contentType.startsWith("video"); - } - - public boolean isMp4() { - return contentType.equals("video/mp4"); - } - - public boolean isAccessed() { - return (firstAccessedAt != null && !firstAccessedAt.isEmpty()); - } - - public String getStreamUrl(PutioUtils utils, boolean mp4) { - String base = PutioUtils.baseUrl + "/files/" + id; - String streamOrStreamMp4; - if (mp4) { - streamOrStreamMp4 = "/mp4/stream"; - } else { - streamOrStreamMp4 = "/stream"; - } - - return base + streamOrStreamMp4 + utils.tokenWithStuff; - } - - public static PutioFile makeRootFolder(Resources resources) { - PutioFile root = new PutioFile(); - root.id = 0; - root.contentType = "application/x-directory"; - root.name = resources.getString(R.string.files); - - return root; - } - - @Override - public int describeContents() { - return 0; - } - - public PutioFile(Parcel in) { - readFromParcel(in); - } - - private void readFromParcel(Parcel in) { - this.isShared = (Boolean) in.readValue(ClassLoader.getSystemClassLoader()); - this.name = in.readString(); - this.icon = in.readString(); - this.screenshot = in.readString(); - this.createdAt = in.readString(); - this.firstAccessedAt = in.readString(); - this.parentId = in.readLong(); - this.isMp4Available = (Boolean) in.readValue(ClassLoader.getSystemClassLoader()); - this.contentType = in.readString(); - this.id = in.readLong(); - this.size = in.readLong(); - this.crc32 = in.readString(); - } - - @Override - public void writeToParcel(Parcel out, int flags) { - out.writeValue(this.isShared); - out.writeString(this.name); - out.writeString(this.icon); - out.writeString(this.screenshot); - out.writeString(this.createdAt); - out.writeString(this.firstAccessedAt); - out.writeLong(this.parentId); - out.writeValue(this.isMp4Available); - out.writeString(this.contentType); - out.writeLong(this.id); - out.writeLong(this.size); - out.writeString(this.crc32); - } - - public static final Creator CREATOR = new Creator() { - public PutioFile createFromParcel(Parcel in) { - return new PutioFile(in); - } - - public PutioFile[] newArray(int size) { - return new PutioFile[size]; - } - }; - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - PutioFile putioFile = (PutioFile) o; - - if (id != putioFile.id) return false; - if (isMp4Available != putioFile.isMp4Available) return false; - if (isShared != putioFile.isShared) return false; - if (parentId != putioFile.parentId) return false; - if (size != putioFile.size) return false; - if (contentType != null ? !contentType.equals(putioFile.contentType) : putioFile.contentType != null) - return false; - if (createdAt != null ? !createdAt.equals(putioFile.createdAt) : putioFile.createdAt != null) return false; - if (firstAccessedAt != null ? !firstAccessedAt.equals(putioFile.firstAccessedAt) : putioFile.firstAccessedAt != null) - return false; - if (icon != null ? !icon.equals(putioFile.icon) : putioFile.icon != null) return false; - if (name != null ? !name.equals(putioFile.name) : putioFile.name != null) return false; - if (screenshot != null ? !screenshot.equals(putioFile.screenshot) : putioFile.screenshot != null) return false; - if (crc32 != null ? !crc32.equals(putioFile.crc32) : putioFile.crc32 != null) return false; - - return true; - } - - @Override - public int hashCode() { - int result = (isShared ? 1 : 0); - result = 31 * result + (name != null ? name.hashCode() : 0); - result = 31 * result + (icon != null ? icon.hashCode() : 0); - result = 31 * result + (screenshot != null ? screenshot.hashCode() : 0); - result = 31 * result + (createdAt != null ? createdAt.hashCode() : 0); - result = 31 * result + (firstAccessedAt != null ? firstAccessedAt.hashCode() : 0); - result = 31 * result + (int) (parentId ^ (parentId >>> 32)); - result = 31 * result + (isMp4Available ? 1 : 0); - result = 31 * result + (contentType != null ? contentType.hashCode() : 0); - result = 31 * result + (int) (id ^ (id >>> 32)); - result = 31 * result + (int) (size ^ (size >>> 32)); - result = 31 * result + (crc32 != null ? crc32.hashCode() : 0); - return result; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/stevenschoen/putionew/model/files/PutioFile.kt b/app/src/main/java/com/stevenschoen/putionew/model/files/PutioFile.kt new file mode 100644 index 00000000..11f0f284 --- /dev/null +++ b/app/src/main/java/com/stevenschoen/putionew/model/files/PutioFile.kt @@ -0,0 +1,80 @@ +package com.stevenschoen.putionew.model.files + +import android.content.res.Resources +import android.os.Parcel +import android.os.Parcelable + +import com.stevenschoen.putionew.PutioUtils +import com.stevenschoen.putionew.R + +import paperparcel.PaperParcel + +@PaperParcel +data class PutioFile( + val name: String, + val id: Long, + val isShared: Boolean? = false, + val icon: String? = null, + val screenshot: String? = null, + val createdAt: String? = null, + val firstAccessedAt: String? = null, + val parentId: Long? = null, + val isMp4Available: Boolean? = null, + val contentType: String, + val size: Long? = null, + val crc32: String? = null) + : Parcelable { + + val isFolder: Boolean + get() = (contentType == CONTENT_TYPE_FOLDER) + + val isMedia: Boolean + get() { + for (i in PutioUtils.streamingMediaTypes.indices) { + if (contentType.startsWith(PutioUtils.streamingMediaTypes[i])) { + return true + } + } + return false + } + + val isVideo: Boolean + get() = (contentType.startsWith("video")) + + val isMp4: Boolean + get() = (contentType == "video/mp4") + + val isAccessed: Boolean + get() = (!firstAccessedAt.isNullOrEmpty()) + + fun getStreamUrl(utils: PutioUtils, mp4: Boolean): String { + val base = PutioUtils.baseUrl + "files/" + id + val streamOrStreamMp4: String + if (mp4) { + streamOrStreamMp4 = "/mp4/stream" + } else { + streamOrStreamMp4 = "/stream" + } + + return base + streamOrStreamMp4 + utils.tokenWithStuff + } + + override fun writeToParcel(dest: Parcel, flags: Int) { + PaperParcelPutioFile.writeToParcel(this, dest, flags) + } + + override fun describeContents() = 0 + + companion object { + const val CONTENT_TYPE_FOLDER = "application/x-directory" + + fun makeRootFolder(resources: Resources): PutioFile { + return PutioFile( + id = 0, + name = resources.getString(R.string.files), + contentType = CONTENT_TYPE_FOLDER) + } + + @JvmField val CREATOR = PaperParcelPutioFile.CREATOR + } +} \ No newline at end of file diff --git a/app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferActivity.kt b/app/src/main/java/com/stevenschoen/putionew/transfers/add/AddTransferActivity.kt similarity index 86% rename from app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferActivity.kt rename to app/src/main/java/com/stevenschoen/putionew/transfers/add/AddTransferActivity.kt index 6e5f4c32..835c79de 100644 --- a/app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferActivity.kt +++ b/app/src/main/java/com/stevenschoen/putionew/transfers/add/AddTransferActivity.kt @@ -1,4 +1,4 @@ -package com.stevenschoen.putionew.transfers +package com.stevenschoen.putionew.transfers.add import android.app.NotificationManager import android.app.PendingIntent @@ -18,6 +18,7 @@ import com.stevenschoen.putionew.PutioUtils import com.stevenschoen.putionew.R import com.stevenschoen.putionew.model.PutioUploadInterface import com.stevenschoen.putionew.model.files.PutioFile +import com.stevenschoen.putionew.transfers.TransfersActivity import okhttp3.MediaType import okhttp3.MultipartBody import okhttp3.RequestBody @@ -27,21 +28,10 @@ import java.io.IOException class AddTransferActivity : AppCompatActivity() { - companion object { - const val EXTRA_DESTINATION_FOLDER = "dest_folder" + var prechosenDestinationFolder: PutioFile? = null - const val FRAGTAG_ADDTRANSFER_PICKTYPE = "add_type" - const val FRAGTAG_ADDTRANSFER_FILE = "file" - const val FRAGTAG_ADDTRANSFER_LINK = "link" - } - - val destinationFolder by lazy { - if (intent.hasExtra(EXTRA_DESTINATION_FOLDER)) { - intent.getParcelableExtra(EXTRA_DESTINATION_FOLDER) - } else { - PutioFile.makeRootFolder(resources) - } - } + val hasPrechosenDestinationFolder: Boolean + get() = (intent.extras?.containsKey(EXTRA_PRECHOSEN_DESTINATION_FOLDER)) ?: false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -52,6 +42,11 @@ class AddTransferActivity : AppCompatActivity() { return } + + if (intent.hasExtra(EXTRA_PRECHOSEN_DESTINATION_FOLDER)) { + prechosenDestinationFolder = intent.extras.getParcelable(EXTRA_PRECHOSEN_DESTINATION_FOLDER) + } + if (intent != null) { if (intent.action != null) { if (intent.action == Intent.ACTION_VIEW) { @@ -82,7 +77,7 @@ class AddTransferActivity : AppCompatActivity() { fun showPickTypeFragmentIfNotShowing() { if (supportFragmentManager.findFragmentByTag(FRAGTAG_ADDTRANSFER_PICKTYPE) == null) { - val pickTypeFragment = Fragment.instantiate(this, AddTransferPickTypeFragment::class.java.name) as AddTransferPickTypeFragment + val pickTypeFragment = Fragment.instantiate(this, PickTypeFragment::class.java.name) as PickTypeFragment val transaction = supportFragmentManager.beginTransaction() transaction.addToBackStack("pick") pickTypeFragment.show(transaction, FRAGTAG_ADDTRANSFER_PICKTYPE) @@ -91,7 +86,7 @@ class AddTransferActivity : AppCompatActivity() { fun showLinkFragmentIfNotShowing(link: String? = null) { if (supportFragmentManager.findFragmentByTag(FRAGTAG_ADDTRANSFER_LINK) == null) { - val fileFragment = AddTransferUrlFragment.newInstance(this@AddTransferActivity, link) + val fileFragment = FromUrlFragment.newInstance(this@AddTransferActivity, link) val transaction = supportFragmentManager.beginTransaction() transaction.addToBackStack("url") fileFragment.show(transaction, FRAGTAG_ADDTRANSFER_LINK) @@ -100,7 +95,7 @@ class AddTransferActivity : AppCompatActivity() { fun showFileFragmentIfNotShowing(torrentUri: Uri? = null) { if (supportFragmentManager.findFragmentByTag(FRAGTAG_ADDTRANSFER_FILE) == null) { - val fileFragment = AddTransferFileFragment.newInstance(this@AddTransferActivity, torrentUri) + val fileFragment = FromFileFragment.newInstance(this@AddTransferActivity, torrentUri) val transaction = supportFragmentManager.beginTransaction() transaction.addToBackStack("file") fileFragment.show(transaction, FRAGTAG_ADDTRANSFER_FILE) @@ -165,6 +160,11 @@ class AddTransferActivity : AppCompatActivity() { }) } + fun getDestinationFolder(fileOrUrlFragment: BaseFragment?): PutioFile { + prechosenDestinationFolder?.let { return it } + return fileOrUrlFragment!!.destinationPickerFragment!!.destination + } + inner class UploadNotif { private val notifManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager @@ -249,8 +249,8 @@ class AddTransferActivity : AppCompatActivity() { super.onAttachFragment(fragment) when (fragment.tag) { FRAGTAG_ADDTRANSFER_PICKTYPE -> { - fragment as AddTransferPickTypeFragment - fragment.callbacks = object : AddTransferPickTypeFragment.Callbacks { + fragment as PickTypeFragment + fragment.callbacks = object : PickTypeFragment.Callbacks { override fun onLinkSelected() { showLinkFragmentIfNotShowing() } @@ -260,23 +260,31 @@ class AddTransferActivity : AppCompatActivity() { } } FRAGTAG_ADDTRANSFER_LINK -> { - fragment as AddTransferUrlFragment - fragment.callbacks = object : AddTransferUrlFragment.Callbacks { + fragment as FromUrlFragment + fragment.callbacks = object : FromUrlFragment.Callbacks { override fun onLinkSelected(link: String, extract: Boolean) { - uploadTransferUrl(link, destinationFolder.id, extract) + uploadTransferUrl(link, getDestinationFolder(fragment).id, extract) finish() } } } FRAGTAG_ADDTRANSFER_FILE -> { - fragment as AddTransferFileFragment - fragment.callbacks = object : AddTransferFileFragment.Callbacks { + fragment as FromFileFragment + fragment.callbacks = object : FromFileFragment.Callbacks { override fun onFileSelected(torrentUri: Uri) { - uploadTransferFile(torrentUri, destinationFolder.id) + uploadTransferFile(torrentUri, getDestinationFolder(fragment).id) finish() } } } } } + + companion object { + const val EXTRA_PRECHOSEN_DESTINATION_FOLDER = "init_dest_folder" + + const val FRAGTAG_ADDTRANSFER_PICKTYPE = "add_type" + const val FRAGTAG_ADDTRANSFER_FILE = "file" + const val FRAGTAG_ADDTRANSFER_LINK = "link" + } } \ No newline at end of file diff --git a/app/src/main/java/com/stevenschoen/putionew/transfers/add/BaseFragment.kt b/app/src/main/java/com/stevenschoen/putionew/transfers/add/BaseFragment.kt new file mode 100644 index 00000000..3c78853d --- /dev/null +++ b/app/src/main/java/com/stevenschoen/putionew/transfers/add/BaseFragment.kt @@ -0,0 +1,33 @@ +package com.stevenschoen.putionew.transfers.add + +import android.os.Bundle +import android.support.v4.app.Fragment +import android.support.v7.app.AppCompatDialogFragment +import android.view.View + +abstract class BaseFragment(val destinationPickerContainerId: Int) : AppCompatDialogFragment() { + + val destinationPickerFragment: DestinationPickerFragment? + get() = childFragmentManager.findFragmentByTag(FRAGTAG_DESTINATION_PICKER) as DestinationPickerFragment? + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + val addTransferActivity = activity as AddTransferActivity + if (!addTransferActivity.hasPrechosenDestinationFolder) { + if (childFragmentManager.findFragmentByTag(FRAGTAG_DESTINATION_PICKER) == null) { + val fragment = Fragment.instantiate(addTransferActivity, DestinationPickerFragment::class.java.name) + childFragmentManager.beginTransaction() + .add(destinationPickerContainerId, fragment, FRAGTAG_DESTINATION_PICKER) + .commitNow() + } + } else { + val holderView = view.findViewById(destinationPickerContainerId) + holderView.visibility = View.GONE + } + } + + companion object { + const val FRAGTAG_DESTINATION_PICKER = "dest_picker" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/stevenschoen/putionew/transfers/add/DestinationPickerFragment.kt b/app/src/main/java/com/stevenschoen/putionew/transfers/add/DestinationPickerFragment.kt new file mode 100644 index 00000000..3e03f843 --- /dev/null +++ b/app/src/main/java/com/stevenschoen/putionew/transfers/add/DestinationPickerFragment.kt @@ -0,0 +1,75 @@ +package com.stevenschoen.putionew.transfers.add + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import android.support.v4.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.TextView +import com.stevenschoen.putionew.R +import com.stevenschoen.putionew.files.DestinationFolderActivity +import com.stevenschoen.putionew.model.files.PutioFile +import rx.android.schedulers.AndroidSchedulers +import rx.subjects.BehaviorSubject + +class DestinationPickerFragment : Fragment() { + + private lateinit var destinationSubject: BehaviorSubject + + val destination: PutioFile + get() = destinationSubject.value + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + val defaultDestination: PutioFile = + if (savedInstanceState != null && savedInstanceState.containsKey(STATE_DESTINATION)) { + savedInstanceState.getParcelable(STATE_DESTINATION) + } else { + PutioFile.makeRootFolder(resources) + } + destinationSubject = BehaviorSubject.create(defaultDestination) + } + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { + val view = inflater.inflate(R.layout.addtransfer_pick_destination, container, false) + + view.setOnClickListener { + startActivityForResult(Intent(context, DestinationFolderActivity::class.java), REQUEST_PICK_NEW_DESTINATION) + } + + val folderNameView = view.findViewById(R.id.addtransfer_pick_destination_name) as TextView + + fun updateFolderNameView(newDestination: PutioFile) { + folderNameView.text = newDestination.name + } + + destinationSubject + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(::updateFolderNameView) + + return view + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) { + super.onActivityResult(requestCode, resultCode, data) + + if (resultCode == Activity.RESULT_OK) { + destinationSubject.onNext(data.extras.getParcelable(DestinationFolderActivity.RESULT_EXTRA_FOLDER)) + } + } + + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + + outState.putParcelable(STATE_DESTINATION, destinationSubject.value) + } + + companion object { + const val REQUEST_PICK_NEW_DESTINATION = 1 + + const val STATE_DESTINATION = "dest" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferFileFragment.kt b/app/src/main/java/com/stevenschoen/putionew/transfers/add/FromFileFragment.kt similarity index 92% rename from app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferFileFragment.kt rename to app/src/main/java/com/stevenschoen/putionew/transfers/add/FromFileFragment.kt index feb3ec83..a9f03c00 100644 --- a/app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferFileFragment.kt +++ b/app/src/main/java/com/stevenschoen/putionew/transfers/add/FromFileFragment.kt @@ -1,13 +1,11 @@ -package com.stevenschoen.putionew.transfers +package com.stevenschoen.putionew.transfers.add import android.app.Dialog import android.content.Context import android.content.Intent import android.net.Uri import android.os.Bundle -import android.support.v4.app.DialogFragment import android.support.v4.app.Fragment -import android.support.v7.app.AppCompatDialogFragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -18,23 +16,7 @@ import com.stevenschoen.putionew.R import rx.android.schedulers.AndroidSchedulers import rx.subjects.BehaviorSubject -class AddTransferFileFragment : AppCompatDialogFragment() { - - companion object { - val STATE_TORRENT_URI = "uri" - val STATE_DID_FIRST_REQUEST = "did_first" - - val EXTRA_PRECHOSEN_TORRENT_URI = "uri" - - val REQUEST_CHOOSE_FILE = 1 - - fun newInstance(context: Context, preChosenTorrentUri: Uri?): AddTransferFileFragment { - val args = Bundle() - preChosenTorrentUri?.let { args.putParcelable(EXTRA_PRECHOSEN_TORRENT_URI, it) } - - return Fragment.instantiate(context, AddTransferFileFragment::class.java.name, args) as AddTransferFileFragment - } - } +class FromFileFragment : BaseFragment(R.id.addtransfer_file_destination_holder) { var callbacks: Callbacks? = null @@ -44,8 +26,6 @@ class AddTransferFileFragment : AppCompatDialogFragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setStyle(DialogFragment.STYLE_NO_TITLE, theme) - if (savedInstanceState != null) { if (savedInstanceState.containsKey(STATE_TORRENT_URI)) { didFirstRequest = true @@ -161,4 +141,20 @@ class AddTransferFileFragment : AppCompatDialogFragment() { interface Callbacks { fun onFileSelected(torrentUri: Uri) } + + companion object { + val STATE_TORRENT_URI = "uri" + val STATE_DID_FIRST_REQUEST = "did_first" + + val EXTRA_PRECHOSEN_TORRENT_URI = "uri" + + val REQUEST_CHOOSE_FILE = 1 + + fun newInstance(context: Context, preChosenTorrentUri: Uri?): FromFileFragment { + val args = Bundle() + preChosenTorrentUri?.let { args.putParcelable(EXTRA_PRECHOSEN_TORRENT_URI, it) } + + return Fragment.instantiate(context, FromFileFragment::class.java.name, args) as FromFileFragment + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferUrlFragment.kt b/app/src/main/java/com/stevenschoen/putionew/transfers/add/FromUrlFragment.kt similarity index 88% rename from app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferUrlFragment.kt rename to app/src/main/java/com/stevenschoen/putionew/transfers/add/FromUrlFragment.kt index d86afd0a..03720942 100644 --- a/app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferUrlFragment.kt +++ b/app/src/main/java/com/stevenschoen/putionew/transfers/add/FromUrlFragment.kt @@ -1,11 +1,9 @@ -package com.stevenschoen.putionew.transfers +package com.stevenschoen.putionew.transfers.add import android.app.Dialog import android.content.Context import android.os.Bundle -import android.support.v4.app.DialogFragment import android.support.v4.app.Fragment -import android.support.v7.app.AppCompatDialogFragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -16,18 +14,7 @@ import com.stevenschoen.putionew.R import rx.android.schedulers.AndroidSchedulers import rx.subjects.BehaviorSubject -class AddTransferUrlFragment : AppCompatDialogFragment() { - - companion object { - val EXTRA_PRECHOSEN_LINK = "link" - - fun newInstance(context: Context, preChosenLink: String?): AddTransferUrlFragment { - val args = Bundle() - preChosenLink?.let { args.putString(EXTRA_PRECHOSEN_LINK, it) } - - return Fragment.instantiate(context, AddTransferUrlFragment::class.java.name, args) as AddTransferUrlFragment - } - } +class FromUrlFragment : BaseFragment(R.id.addtransfer_link_destination_holder) { var callbacks: Callbacks? = null @@ -36,8 +23,6 @@ class AddTransferUrlFragment : AppCompatDialogFragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setStyle(DialogFragment.STYLE_NO_TITLE, theme) - if (savedInstanceState != null) { } else { @@ -99,4 +84,15 @@ class AddTransferUrlFragment : AppCompatDialogFragment() { interface Callbacks { fun onLinkSelected(link: String, extract: Boolean) } + + companion object { + val EXTRA_PRECHOSEN_LINK = "link" + + fun newInstance(context: Context, preChosenLink: String?): FromUrlFragment { + val args = Bundle() + preChosenLink?.let { args.putString(EXTRA_PRECHOSEN_LINK, it) } + + return Fragment.instantiate(context, FromUrlFragment::class.java.name, args) as FromUrlFragment + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferPickTypeFragment.kt b/app/src/main/java/com/stevenschoen/putionew/transfers/add/PickTypeFragment.kt similarity index 88% rename from app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferPickTypeFragment.kt rename to app/src/main/java/com/stevenschoen/putionew/transfers/add/PickTypeFragment.kt index 62f3e00b..78209400 100644 --- a/app/src/main/java/com/stevenschoen/putionew/transfers/AddTransferPickTypeFragment.kt +++ b/app/src/main/java/com/stevenschoen/putionew/transfers/add/PickTypeFragment.kt @@ -1,4 +1,4 @@ -package com.stevenschoen.putionew.transfers +package com.stevenschoen.putionew.transfers.add import android.os.Bundle import android.view.LayoutInflater @@ -7,7 +7,7 @@ import android.view.ViewGroup import com.stevenschoen.putionew.AutoExpandingBottomSheetDialogFragment import com.stevenschoen.putionew.R -class AddTransferPickTypeFragment : AutoExpandingBottomSheetDialogFragment() { +class PickTypeFragment : AutoExpandingBottomSheetDialogFragment() { var callbacks: Callbacks? = null diff --git a/app/src/main/java/com/stevenschoen/putionew/tv/TvGridFragment.java b/app/src/main/java/com/stevenschoen/putionew/tv/TvGridFragment.java index 33280553..a5d8f36a 100644 --- a/app/src/main/java/com/stevenschoen/putionew/tv/TvGridFragment.java +++ b/app/src/main/java/com/stevenschoen/putionew/tv/TvGridFragment.java @@ -70,7 +70,7 @@ public void onItemClicked(Presenter.ViewHolder viewHolder, Object o, RowPresente } private void loadFolder(PutioFile folder) { - mCurrentFolderId = folder.id; + mCurrentFolderId = folder.getId(); loadFiles(); } @@ -116,7 +116,7 @@ public boolean isRootFolder() { } public void goBack() { - mCurrentFolderId = mCurrentFolder.parentId; + mCurrentFolderId = mCurrentFolder.getParentId(); loadFiles(); } } diff --git a/app/src/main/java/com/stevenschoen/putionew/tv/TvPlaybackOverlayFragment.java b/app/src/main/java/com/stevenschoen/putionew/tv/TvPlaybackOverlayFragment.java index e1f52a47..dd2d8aa2 100644 --- a/app/src/main/java/com/stevenschoen/putionew/tv/TvPlaybackOverlayFragment.java +++ b/app/src/main/java/com/stevenschoen/putionew/tv/TvPlaybackOverlayFragment.java @@ -239,11 +239,10 @@ private void notifyChanged(Action action) { private void updatePlaybackRow() { if (mPlaybackControlsRow.getItem() != null) { PutioFile item = (PutioFile) mPlaybackControlsRow.getItem(); - item.name = mFile.name; } if (SHOW_IMAGE) { mPlaybackControlsRowTarget = new PicassoPlaybackControlsRowTarget(mPlaybackControlsRow); - updateVideoImage(URI.create(mFile.screenshot)); + updateVideoImage(URI.create(mFile.getScreenshot())); } mRowsAdapter.notifyArrayItemRangeChanged(0, 1); mPlaybackControlsRow.setTotalTime(getDuration()); @@ -346,8 +345,8 @@ static class DescriptionPresenter extends AbstractDetailsDescriptionPresenter { @Override protected void onBindDescription(ViewHolder viewHolder, Object item) { PutioFile file = (PutioFile) item; - viewHolder.getTitle().setText(file.name); - viewHolder.getSubtitle().setText(PutioUtils.humanReadableByteCount(file.size, false)); + viewHolder.getTitle().setText(file.getName()); + viewHolder.getSubtitle().setText(PutioUtils.humanReadableByteCount(file.getSize(), false)); } } diff --git a/app/src/main/java/com/stevenschoen/putionew/tv/TvPutioFileCardPresenter.java b/app/src/main/java/com/stevenschoen/putionew/tv/TvPutioFileCardPresenter.java index 904f7396..4315cf51 100644 --- a/app/src/main/java/com/stevenschoen/putionew/tv/TvPutioFileCardPresenter.java +++ b/app/src/main/java/com/stevenschoen/putionew/tv/TvPutioFileCardPresenter.java @@ -52,16 +52,16 @@ public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) { PutioFile file = (PutioFile) item; ImageCardView cardView = (ImageCardView) viewHolder.view; - cardView.setTitleText(file.name); + cardView.setTitleText(file.getName()); //cardView.setContentText(PutioUtils.humanReadableByteCount(file.size, false)); cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT); ImageView mainImageView = cardView.getMainImageView(); if (file.isFolder()) { cardView.setMainImageScaleType(ImageView.ScaleType.CENTER_INSIDE); - Picasso.with(mContext).load(R.drawable.ic_putio_folder).into(mainImageView); + Picasso.with(mContext).load(R.drawable.ic_putio_folder_accent).into(mainImageView); } else { cardView.setMainImageScaleType(ImageView.ScaleType.CENTER_CROP); - Picasso.with(mContext).load(file.screenshot).into(mainImageView); + Picasso.with(mContext).load(file.getScreenshot()).into(mainImageView); } if (file.isAccessed()) { diff --git a/app/src/main/res/drawable-hdpi/ic_putio_folder.png b/app/src/main/res/drawable-hdpi/ic_putio_folder.png deleted file mode 100644 index 4b804265..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_putio_folder.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_putio_folder.png b/app/src/main/res/drawable-mdpi/ic_putio_folder.png deleted file mode 100644 index 3d2be2c7..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_putio_folder.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_putio_folder.png b/app/src/main/res/drawable-xhdpi/ic_putio_folder.png deleted file mode 100644 index ea00502d..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_putio_folder.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_putio_folder.png b/app/src/main/res/drawable-xxhdpi/ic_putio_folder.png deleted file mode 100644 index 2b09242a..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_putio_folder.png and /dev/null differ diff --git a/app/src/main/res/drawable/addtransfer_file.xml b/app/src/main/res/drawable/addtransfer_file.xml deleted file mode 100644 index f60b5270..00000000 --- a/app/src/main/res/drawable/addtransfer_file.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/addtransfer_file_16.xml b/app/src/main/res/drawable/addtransfer_file_16.xml new file mode 100644 index 00000000..19ef56ca --- /dev/null +++ b/app/src/main/res/drawable/addtransfer_file_16.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/addtransfer_file_24.xml b/app/src/main/res/drawable/addtransfer_file_24.xml new file mode 100644 index 00000000..3998bf34 --- /dev/null +++ b/app/src/main/res/drawable/addtransfer_file_24.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/addtransfer_link.xml b/app/src/main/res/drawable/addtransfer_link_16.xml similarity index 100% rename from app/src/main/res/drawable/addtransfer_link.xml rename to app/src/main/res/drawable/addtransfer_link_16.xml diff --git a/app/src/main/res/drawable/ic_putio_folder_accent.xml b/app/src/main/res/drawable/ic_putio_folder_accent.xml new file mode 100644 index 00000000..bffeab8e --- /dev/null +++ b/app/src/main/res/drawable/ic_putio_folder_accent.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/ic_putio_folder_black.xml b/app/src/main/res/drawable/ic_putio_folder_black.xml new file mode 100644 index 00000000..6e2f1b06 --- /dev/null +++ b/app/src/main/res/drawable/ic_putio_folder_black.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/ic_toolbarnav_close.xml b/app/src/main/res/drawable/ic_toolbarnav_close.xml deleted file mode 100644 index 81d6dbf7..00000000 --- a/app/src/main/res/drawable/ic_toolbarnav_close.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/putio_clickable_round.xml b/app/src/main/res/drawable/putio_clickable_round.xml deleted file mode 100644 index 931d8e16..00000000 --- a/app/src/main/res/drawable/putio_clickable_round.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/putio_clickable_rounded.xml b/app/src/main/res/drawable/putio_clickable_rounded.xml deleted file mode 100644 index fbc97ab2..00000000 --- a/app/src/main/res/drawable/putio_clickable_rounded.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/putio_clickable_rounded_dark.xml b/app/src/main/res/drawable/putio_clickable_rounded_dark.xml deleted file mode 100644 index 0de844e9..00000000 --- a/app/src/main/res/drawable/putio_clickable_rounded_dark.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/addtransfer_file.xml b/app/src/main/res/layout/addtransfer_file.xml index 495862a7..6edb3950 100644 --- a/app/src/main/res/layout/addtransfer_file.xml +++ b/app/src/main/res/layout/addtransfer_file.xml @@ -15,12 +15,12 @@ android:layout_toStartOf="@+id/addtransfer_file_clear" android:background="?selectableItemBackground" android:drawablePadding="16dp" - android:drawableStart="@drawable/addtransfer_file" + android:drawableStart="@drawable/addtransfer_file_24" android:ellipsize="middle" android:fontFamily="sans-serif-condensed" android:gravity="center_vertical" android:maxLines="2" - android:paddingStart="24dp" + android:paddingStart="16dp" android:textAppearance="@style/TextAppearance.AppCompat" android:textSize="18sp" tools:text="file name.torrent"/> @@ -52,10 +52,19 @@ android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="@color/putio_lightred"/> - + + @@ -9,6 +10,7 @@ android:id="@+id/addtransfer_link_url" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_alignParentTop="true" android:layout_marginEnd="56dp" android:layout_marginStart="24dp" android:layout_marginTop="8dp" @@ -37,14 +39,23 @@ android:layout_height="wrap_content" android:layout_below="@id/addtransfer_link_url" android:layout_marginBottom="8dp" - android:layout_marginStart="24dp" + android:layout_marginStart="20dp" android:layout_marginTop="12dp" android:text="@string/extractwhenfinished"/> - + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/addtransfer_picktype.xml b/app/src/main/res/layout/addtransfer_picktype.xml index ed932cbb..dc5b05e9 100644 --- a/app/src/main/res/layout/addtransfer_picktype.xml +++ b/app/src/main/res/layout/addtransfer_picktype.xml @@ -21,7 +21,7 @@ android:layout_height="wrap_content" android:background="?selectableItemBackground" android:drawablePadding="24dp" - android:drawableStart="@drawable/addtransfer_link" + android:drawableStart="@drawable/addtransfer_link_16" android:drawableTint="?android:textColorPrimary" android:gravity="start|center_vertical" android:paddingStart="24dp" @@ -34,7 +34,7 @@ android:layout_height="wrap_content" android:background="?selectableItemBackground" android:drawablePadding="24dp" - android:drawableStart="@drawable/addtransfer_file" + android:drawableStart="@drawable/addtransfer_file_16" android:drawableTint="?android:textColorPrimary" android:gravity="start|center_vertical" android:paddingStart="24dp" diff --git a/app/src/main/res/layout/dialog_confirmchanges.xml b/app/src/main/res/layout/dialog_confirmchanges.xml index 7de6e2e1..0573ab53 100644 --- a/app/src/main/res/layout/dialog_confirmchanges.xml +++ b/app/src/main/res/layout/dialog_confirmchanges.xml @@ -21,7 +21,7 @@