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] Endless scrolling
- [X] Pull to refresh - [X] Pull to refresh
- [X] Very Basic Torrent playback - [X] Very Basic Torrent playback
- [X] Change Server
# TODO
- [ ] Video Playback via WebRTC - [ ] Video Playback via WebRTC
- [ ] Pick Server
- [ ] Login - [ ] Login
- [ ] Like/dislike video - [ ] Like/dislike video
- [ ] Comment video - [ ] Comment video
- [ ] Lots more missing at this point...
# TODO
- [ ] Unit Tests - [ ] Unit Tests
- [ ] App Icon and assets - [ ] 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.github.TorrentStream:TorrentStreamServer-Android:1.0.1"
// implementation 'com.devbrackets.android:exomedia:4.1.0' // implementation 'com.devbrackets.android:exomedia:4.1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:support-v4:27.1.0' implementation 'com.android.support:support-v4:27.1.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1' 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); inflater.inflate(R.menu.menu_main, menu);
// Set an icon in the ActionBar // 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( menu.findItem(R.id.action_settings).setIcon(
new IconDrawable(this, FontAwesomeIcons.fa_cog) new IconDrawable(this, FontAwesomeIcons.fa_cog)
.colorRes(R.color.cardview_light_background) .colorRes(R.color.cardview_light_background)
@ -162,6 +167,11 @@ public class VideoListActivity extends AppCompatActivity {
switch (item.getItemId()) { switch (item.getItemId()) {
// action with ID action_refresh was selected // 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: case R.id.action_settings:
// Toast.makeText(this, "Login Selected", Toast.LENGTH_SHORT).show(); // Toast.makeText(this, "Login Selected", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, SettingsActivity.class); 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.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.format.DateUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -19,6 +16,7 @@ import net.schueller.peertube.R;
import net.schueller.peertube.activity.TorrentVideoPlayActivity; import net.schueller.peertube.activity.TorrentVideoPlayActivity;
import net.schueller.peertube.helper.APIUrlHelper; import net.schueller.peertube.helper.APIUrlHelper;
import net.schueller.peertube.helper.MetaDataHelper; import net.schueller.peertube.helper.MetaDataHelper;
import net.schueller.peertube.model.Avatar;
import net.schueller.peertube.model.Video; import net.schueller.peertube.model.Video;
import java.util.ArrayList; import java.util.ArrayList;
@ -55,6 +53,16 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
.load(apiBaseURL + videoList.get(position).getPreviewPath()) .load(apiBaseURL + videoList.get(position).getPreviewPath())
.into(holder.thumb); .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()); holder.name.setText(videoList.get(position).getName());
// set age and view count // set age and view count
@ -67,8 +75,8 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
// set owner // set owner
holder.videoOwner.setText( holder.videoOwner.setText(
MetaDataHelper.getOwnerString(videoList.get(position).getAccountName(), MetaDataHelper.getOwnerString(videoList.get(position).getAccount().getName(),
videoList.get(position).getServerHost(), videoList.get(position).getAccount().getHost(),
context context
) )
); );
@ -103,13 +111,14 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
class VideoViewHolder extends RecyclerView.ViewHolder { class VideoViewHolder extends RecyclerView.ViewHolder {
TextView name, videoMeta, videoOwner; TextView name, videoMeta, videoOwner;
ImageView thumb; ImageView thumb, avatar;
View mView; View mView;
VideoViewHolder(View itemView) { VideoViewHolder(View itemView) {
super(itemView); super(itemView);
name = itemView.findViewById(R.id.name); name = itemView.findViewById(R.id.name);
thumb = itemView.findViewById(R.id.thumb); thumb = itemView.findViewById(R.id.thumb);
avatar = itemView.findViewById(R.id.avatar);
videoMeta = itemView.findViewById(R.id.videoMeta); videoMeta = itemView.findViewById(R.id.videoMeta);
videoOwner = itemView.findViewById(R.id.videoOwner); videoOwner = itemView.findViewById(R.id.videoOwner);
mView = itemView; 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 String languageLabel;
private Boolean nsfw; private Boolean nsfw;
private String description; private String description;
private String serverHost;
private Boolean isLocal; private Boolean isLocal;
private String accountName;
private Integer duration; private Integer duration;
private Integer views; private Integer views;
private Integer likes; private Integer likes;
@ -133,14 +131,6 @@ public class Video {
this.description = description; this.description = description;
} }
public String getServerHost() {
return serverHost;
}
public void setServerHost(String serverHost) {
this.serverHost = serverHost;
}
public Boolean getLocal() { public Boolean getLocal() {
return isLocal; return isLocal;
} }
@ -149,14 +139,6 @@ public class Video {
isLocal = local; isLocal = local;
} }
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public Integer getDuration() { public Integer getDuration() {
return duration; 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"?> <?xml version="1.0" encoding="utf-8"?><!-- START*** Root Container *** -->
<!-- START*** Root Container *** -->
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
card_view:cardCornerRadius="6dp" card_view:cardCornerRadius="0dp"
card_view:cardElevation="3dp" card_view:cardElevation="0dp"
card_view:cardUseCompatPadding="true"> card_view:cardUseCompatPadding="true">
<LinearLayout <RelativeLayout
android:id="@+id/linearLayout" android:id="@+id/linearLayout"
android:padding="8dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
android:padding="12dp">
<ImageView <ImageView
android:id="@+id/thumb" android:id="@+id/thumb"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/video_row_video_thumbnail"
android:scaleType="fitXY" 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 <TextView
android:layout_marginStart="75dp"
android:id="@+id/videoMeta" android:id="@+id/videoMeta"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" 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 <TextView
android:layout_marginStart="75dp"
android:id="@+id/videoOwner" android:id="@+id/videoOwner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" 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> </android.support.v7.widget.CardView>

View File

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

View File

@ -20,6 +20,7 @@
</string> </string>
<!-- Action bar --> <!-- Action bar -->
<string name="action_bar_title_search">Search</string>
<string name="action_bar_title_settings">Settings</string> <string name="action_bar_title_settings">Settings</string>
<!-- Bottom navigation bar --> <!-- Bottom navigation bar -->
@ -29,6 +30,8 @@
<string name="bottom_nav_title_account">Account</string> <string name="bottom_nav_title_account">Account</string>
<!-- Strings related to Settings --> <!-- 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_default_api_base_url" formatted="false">https://troll.tv</string>
<string name="pref_title_peertube_server">PeerTube Server</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_views">\u0020Views</string>
<string name="meta_data_owner_seperator">\@</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> </resources>