Merge pull request #8 from sschueller/develop

Version 1.0.0.alpha2
This commit is contained in:
Stefan Schüller 2018-03-14 14:51:12 +01:00 committed by GitHub
commit edd7ef7fdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 111 additions and 49 deletions

View File

@ -17,15 +17,17 @@
- [X] Endless scrolling
- [X] Pull to refresh
- [X] Very Basic Torrent playback
- [X] Change Server
# TODO
- [ ] Video Playback via WebRTC
- [ ] Pick Server
- [ ] Login
- [ ] Like/dislike video
- [ ] Comment video
- [ ] Lots more missing at this point...
# TODO
- [ ] Unit Tests
- [ ] App Icon and assets
- [ ] Search
- [ ] Lots more missing at this point...

View File

@ -48,6 +48,8 @@ dependencies {
// implementation "com.github.TorrentStream:TorrentStreamServer-Android:1.0.1"
// implementation 'com.devbrackets.android:exomedia:4.1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:support-v4:27.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'

View File

@ -145,6 +145,11 @@ public class VideoListActivity extends AppCompatActivity {
inflater.inflate(R.menu.menu_main, menu);
// Set an icon in the ActionBar
menu.findItem(R.id.action_search).setIcon(
new IconDrawable(this, FontAwesomeIcons.fa_search)
.colorRes(R.color.cardview_light_background)
.actionBarSize());
menu.findItem(R.id.action_settings).setIcon(
new IconDrawable(this, FontAwesomeIcons.fa_cog)
.colorRes(R.color.cardview_light_background)
@ -162,6 +167,11 @@ public class VideoListActivity extends AppCompatActivity {
switch (item.getItemId()) {
// action with ID action_refresh was selected
case R.id.action_search:
// TODO: implement
Toast.makeText(this, "Search Selected", Toast.LENGTH_SHORT).show();
return false;
case R.id.action_settings:
// Toast.makeText(this, "Login Selected", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, SettingsActivity.class);

View File

@ -2,11 +2,8 @@ package net.schueller.peertube.adapter;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -19,6 +16,7 @@ import net.schueller.peertube.R;
import net.schueller.peertube.activity.TorrentVideoPlayActivity;
import net.schueller.peertube.helper.APIUrlHelper;
import net.schueller.peertube.helper.MetaDataHelper;
import net.schueller.peertube.model.Avatar;
import net.schueller.peertube.model.Video;
import java.util.ArrayList;
@ -55,6 +53,16 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
.load(apiBaseURL + videoList.get(position).getPreviewPath())
.into(holder.thumb);
Avatar avatar = videoList.get(position).getAccount().getAvatar();
if (avatar != null) {
String avatarPath = avatar.getPath();
Picasso.with(this.context)
.load(apiBaseURL + avatarPath)
.into(holder.avatar);
}
holder.name.setText(videoList.get(position).getName());
// set age and view count
@ -67,8 +75,8 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
// set owner
holder.videoOwner.setText(
MetaDataHelper.getOwnerString(videoList.get(position).getAccountName(),
videoList.get(position).getServerHost(),
MetaDataHelper.getOwnerString(videoList.get(position).getAccount().getName(),
videoList.get(position).getAccount().getHost(),
context
)
);
@ -103,13 +111,14 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
class VideoViewHolder extends RecyclerView.ViewHolder {
TextView name, videoMeta, videoOwner;
ImageView thumb;
ImageView thumb, avatar;
View mView;
VideoViewHolder(View itemView) {
super(itemView);
name = itemView.findViewById(R.id.name);
thumb = itemView.findViewById(R.id.thumb);
avatar = itemView.findViewById(R.id.avatar);
videoMeta = itemView.findViewById(R.id.videoMeta);
videoOwner = itemView.findViewById(R.id.videoOwner);
mView = itemView;

View File

@ -0,0 +1,16 @@
package net.schueller.peertube.model;
public class Config {
// TODO: implement remaining items
private String serverVersion;
public String getServerVersion() {
return serverVersion;
}
public void setServerVersion(String serverVersion) {
this.serverVersion = serverVersion;
}
}

View File

@ -16,9 +16,7 @@ public class Video {
private String languageLabel;
private Boolean nsfw;
private String description;
private String serverHost;
private Boolean isLocal;
private String accountName;
private Integer duration;
private Integer views;
private Integer likes;
@ -133,14 +131,6 @@ public class Video {
this.description = description;
}
public String getServerHost() {
return serverHost;
}
public void setServerHost(String serverHost) {
this.serverHost = serverHost;
}
public Boolean getLocal() {
return isLocal;
}
@ -149,14 +139,6 @@ public class Video {
isLocal = local;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public Integer getDuration() {
return duration;
}

View File

@ -0,0 +1,12 @@
package net.schueller.peertube.network;
import net.schueller.peertube.model.Config;
import retrofit2.Call;
import retrofit2.http.GET;
public interface GetConfigDataService {
@GET("config")
Call<Config> getConfigData();
}

View File

@ -1,50 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- START*** Root Container *** -->
<?xml version="1.0" encoding="utf-8"?><!-- START*** Root Container *** -->
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="6dp"
card_view:cardElevation="3dp"
card_view:cardCornerRadius="0dp"
card_view:cardElevation="0dp"
card_view:cardUseCompatPadding="true">
<LinearLayout
<RelativeLayout
android:id="@+id/linearLayout"
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:padding="12dp">
<ImageView
android:id="@+id/thumb"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/video_row_video_thumbnail"
android:scaleType="fitXY"
android:contentDescription="" />
<TextView
android:layout_marginStart="75dp"
android:id="@+id/name"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/avatar"
android:layout_width="60dp"
android:layout_height="60dp"
android:paddingTop="12dp"
android:paddingEnd="12dp"
android:contentDescription="@string/video_row_account_avatar"
android:layout_below="@id/thumb"
android:layout_alignParentStart="true"/>
<TextView
android:id="@+id/name"
android:paddingTop="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/thumb"
android:layout_toEndOf="@id/avatar"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Subhead" />
<TextView
android:layout_marginStart="75dp"
android:id="@+id/videoMeta"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
/>
android:layout_below="@id/name"
android:layout_toEndOf="@id/avatar"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
<TextView
android:layout_marginStart="75dp"
android:id="@+id/videoOwner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
/>
android:layout_below="@id/videoMeta"
android:layout_toEndOf="@id/avatar"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption" />
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>

View File

@ -4,6 +4,13 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context="activity.VideoListActivity">
<item
android:id="@+id/action_search"
android:orderInCategory="300"
android:title="@string/action_bar_title_search"
app:showAsAction="always" />
<item
android:id="@+id/action_settings"
android:orderInCategory="300"

View File

@ -20,6 +20,7 @@
</string>
<!-- Action bar -->
<string name="action_bar_title_search">Search</string>
<string name="action_bar_title_settings">Settings</string>
<!-- Bottom navigation bar -->
@ -29,6 +30,8 @@
<string name="bottom_nav_title_account">Account</string>
<!-- Strings related to Settings -->
<string name="peertube_required_server_version">1.0.0-alpha.7</string>
<string name="pref_default_api_base_url" formatted="false">https://troll.tv</string>
<string name="pref_title_peertube_server">PeerTube Server</string>
@ -38,4 +41,9 @@
<string name="meta_data_views">\u0020Views</string>
<string name="meta_data_owner_seperator">\@</string>
<string name="video_row_video_thumbnail">Video Thumbnail</string>
<string name="video_row_account_avatar">Account Avatar</string>
</resources>