From 029814e14efa444b41b42fac18d2e78aa7331dc2 Mon Sep 17 00:00:00 2001 From: lishoujun Date: Sat, 12 Jan 2019 20:40:32 +0800 Subject: [PATCH 1/7] add login values check. update Chinese translate. --- .../net/schueller/peertube/activity/LoginActivity.java | 9 +++++++++ app/src/main/res/values-zh-rCN/strings.xml | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java b/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java index 56fa0e4..853b117 100644 --- a/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java +++ b/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java @@ -103,6 +103,15 @@ public class LoginActivity extends CommonActivity { String email = mEmailView.getText().toString(); String password = mPasswordView.getText().toString(); + //check values + if (email.isEmpty()) { + Toast.makeText(LoginActivity.this, "Email/Username is empty", Toast.LENGTH_LONG).show(); + return; + } + if (password.isEmpty()) { + Toast.makeText(LoginActivity.this, "Password is empty", Toast.LENGTH_LONG).show(); + return; + } // make http call to login and save access tokens String apiBaseURL = APIUrlHelper.getUrlWithVersion(this); diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index d1ba83b..0fe712e 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1,6 +1,5 @@ - PeerTube 登录 登录 登录 @@ -16,8 +15,8 @@ PeerTube 服务器 显示NSFW 版本 - 邮箱 - 密码(可选) + 邮箱/用户名 + 密码 建议 搜索 正常 From 972684377295c3d0c3f91203226dd0eb39080437 Mon Sep 17 00:00:00 2001 From: Kemal Oktay Date: Tue, 15 Jan 2019 22:57:36 +0300 Subject: [PATCH 2/7] Turkish Translation added --- app/src/main/res/values-tr/strings.xml | 335 +++++++++++++++++++++++++ 1 file changed, 335 insertions(+) create mode 100644 app/src/main/res/values-tr/strings.xml diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml new file mode 100644 index 0000000..32e4b13 --- /dev/null +++ b/app/src/main/res/values-tr/strings.xml @@ -0,0 +1,335 @@ + + PeerTube + + İzleti Oynatma Etkinliği + Ayarlar + Oturum aç + + + Sunucu + E-posta / Kullanıcı adı + Şifre + Oturum aç/string> + Oturum aç + Bu e-posta adresi geçersiz + Bu şifre çok kısa + Bu şifre yanlış + Bu alan gereklidir + "E-posta tanımlamaları için Rehber izinleri gerekir." + + + + Arama + Ayarlar + Çıkış yap + + + Ev + Eğilimler + Abonelikler + Hesap + + + 1.0.0-alpha.7 + + https://troll.tv + PeerTube Sunucusu + + + + \u0020-\u0020 + \u0020Görüntüleme + \@ + + + İzleti Küçük Resmi + Hesap Resmi + + Ahlaksız İçerik + Ahlaksız içeriği göster + Dil süzgeci + Gösterilmesi gereken izleti dillerini seçin. Hiçbiri seçili değilse tüm izletileri tüm dillerde gösterecek. + URL İzleti Oynatma Etkinliği + Torrent İzleti Oynatıcı + Bir torrent akışı üzerinden izleti oynatma. Bu Depolama İzinlerini gerektirir. (Deneyseldir, kararlı değil!) + Lisans + \nGNU Affero Genel Kamu Lisansı v3.0\n\nPBu en güçlü copyleft lisansının izinleri, aynı lisans altında lisanslı bir eser kullanan daha büyük işleri içeren lisanslı eserlerin ve değişikliklerin eksiksiz kaynak kodunu kullanıma sunmakla yükümlüdür. Telif hakkı ve lisans bildirimleri korunmalıdır. Katkıda bulunanlar açık bir patent hakkı verir. Bir ağ üzerinden hizmet sağlamak için değiştirilmiş bir sürüm kullanıldığında, değiştirilmiş sürümün kaynak kodunun tamamı kullanılabilir duruma getirilmelidir. + Sürüm + PeerTube'da Ara + Search + Sonuç yok + Daha + Paylaş + PeerTube + Geçersiz bağlantı! + Karanlık Kipi + Karanlık kipin etkinleşmesi için uygulamayı yeniden başlatın. + Uygulama Teması + Temanın etkinleşmesi için uygulamayı yeniden başlatın. + + Abhazca + Afar + Afrikanca + Akan + Arnavutça + Amerikan İşaret Dili + Amharca + Arapça + Aragon + Ermenice + Assamese + Avarca + Aymara + Azerice + Bambara + Başkurtca + Baskca + Beyaz Rusça + Bengalce + Bislama Dili + Boşnakça + Brezilya İşaret Dili + Bretonca + İngiliz İşaret Dili + Bulgarca + Birmanyaca + Katalanca + Çemorro + Çeçence + Çince + Çin İşaret Dili + Çuvaşça + Kernevekçe + Korsikaca + Krice + Hırvatça + Çekçe + Çek İşaret Dili + Danimarkaca + Danimarka İşaret Dili + Maldivce + Flemenkçe + Dzongka + İngilizce + Esperanto + Estonca + Ewe + Faroece + Fijice + Fince + Fransızca + Fransız İşaret Dili + Pölce + Galiçyaca + Gandaca + Gürcüce + Almanca + Alman İşaret Dili + Guaranice + Guceratça + Haitice + Hausaca + İbranice + Hereroca + Hintçe + Hiri Motu + Macarca + İzlandaca + Igbo + Endonezce + İnuitçe + İnyupikçe + İrlandaca + Italyanca + Japonca + Japon İşaret Dili + Cava Dili + Grönland Dili + Kannada Dili + Kanuri Dili + Keşmirce + Kazakça + Kmerce + Kikuyu Dili + Ruandaca + Kırgızca + Klingon Dili + Komice + Kongoca + Korece + Kotava Dili + Kuanyama Dili + Kürtçe + Laoca + Latonca + Limburgca + Lingala Dili + Litvanca + Kumanca + Luba-Katanga Dili + Lüksemburgca + Makedonca + Malgaşça + Malay Dili + Malayalamca + Maltaca + Man Dili + Maorice + Marathi + Marşalca + Modern Yunanca (1453-) + Moğolca + Nauruca + Navahoca + Ndonga Dili + Nepalce + Kuzey Ndebele Dili + Kuzey Lapçaca + Norveççe + Norveççe Kitap Dili + Yeni Norveççe + Çevaca + Oksitanca + Ojibvaca + Oriya Dili + Oromca + Osetçe + Pakistan İşaret Dili + Pencapça + Farsça + Lehçe + Portekizce + Peştuca + Keçuvaca + Rumence + Romanşça + Rundice + Rusça + Rus İşaret Dili + Samoaca + Sango Dili + Sarduca + Suudi Arabistan İşaret Dili + İskoç Gal Dili + Sırpça + Sırp-Hırvatça + Shona + Sichuan Yi + Sintçe + Seylanca + Slovakça + Slovence + Somalice + Güney Afrika İşaret Dili + Güney Ndebele + Güney Sotho + İspanyolca + Sundaca + Svahili Dili + Svati Dili + İsveççe + İsveç İşaret Dili + Tagalogça + Tahiti Dili + Tacikçe + Tamilce + Tatarca + Teluguca + Tayca + Tibetçe + Tigrince + Tonga (Tonga Adaları) + Tsongaca + Tsvana Dili + Türkçe + Turkmence + Twi + Uygurca + Ukraynaca + Urduca + Özbekçe + Venda Dili + Vietnamca + Valonca + Galce + Batı Frizcesi + Wolof Dili + Xhosa Dili + Yadişçe + Yorubaca + Zhuangca + Zuluca + + Kırmızı + Pembe + Mor + Koyu Mor + Çivit + Mavi + Açık Mavi + Camgöbeği + Çamurcun + Yeşil + Açık Yeşil + Misket Limonu + Sarı + Kehribar + Turuncu + Koyu Turuncu + Kahverengi + Gri + Mavi gri + 0.5x + Normal + 1.5x + 2x + + {faw-play-circle} + {faw-cog} + {faw-check} + {faw-check} + {faw-expand} + {faw-compress} + {faw-ellipsis-v} + {faw-thumbs-up} + {faw-thumbs-down} + {faw-share} + {faw-download} + {faw-save} + + Arkaplanda Oynatma + Etkinleştirilirse, arka planda izleti oynatmaya devam eder. + Yerel + + Hesap + Rapor + Karaliste + Yazma izni olmadan video indirilemiyor + Değerlendirme Başarısız + Bu hizmeti kullanmak için giriş yapmalısınız. + + Paylaş + İndir + Gizlilik + Sınıf + Lisans + Dil + Etiketler + + Oynatma hızı + Kalite + + + pref_token_access + pref_token_refresh + pref_token_expiration + pref_token_type + pref_auth_username + pref_auth_password + none + like + dislike + + + + From 3cb21e13e59597203b7749ed6c194517a7f76506 Mon Sep 17 00:00:00 2001 From: Kemal Oktay Date: Tue, 15 Jan 2019 23:12:02 +0300 Subject: [PATCH 3/7] Incorrect translation correction --- app/src/main/res/values-tr/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 32e4b13..016054f 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -38,7 +38,7 @@ \u0020-\u0020 - \u0020Görüntüleme + \u0020 Görüntüleme \@ @@ -56,7 +56,7 @@ \nGNU Affero Genel Kamu Lisansı v3.0\n\nPBu en güçlü copyleft lisansının izinleri, aynı lisans altında lisanslı bir eser kullanan daha büyük işleri içeren lisanslı eserlerin ve değişikliklerin eksiksiz kaynak kodunu kullanıma sunmakla yükümlüdür. Telif hakkı ve lisans bildirimleri korunmalıdır. Katkıda bulunanlar açık bir patent hakkı verir. Bir ağ üzerinden hizmet sağlamak için değiştirilmiş bir sürüm kullanıldığında, değiştirilmiş sürümün kaynak kodunun tamamı kullanılabilir duruma getirilmelidir. Sürüm PeerTube'da Ara - Search + Arama Sonuç yok Daha Paylaş From 75b9b807c6f559ee072036e59a16a8db1b37e4b0 Mon Sep 17 00:00:00 2001 From: lishoujun Date: Sat, 19 Jan 2019 00:40:05 +0800 Subject: [PATCH 4/7] update gradle version suggested by as --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index a5a2fe0..ca7f116 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.3.0' // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ff36cf7..858830f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Nov 07 22:40:24 CET 2018 +#Fri Jan 18 22:53:14 CST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip From ce6a5a49b202bab1f41e9a4d0b465bc5c1783ad3 Mon Sep 17 00:00:00 2001 From: Digiwizkid Date: Sat, 19 Jan 2019 19:14:58 +0530 Subject: [PATCH 5/7] Fixed the closing issue --- app/src/main/res/values-tr/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 016054f..6ae759a 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -9,7 +9,7 @@ Sunucu E-posta / Kullanıcı adı Şifre - Oturum aç/string> + Oturum aç Oturum aç Bu e-posta adresi geçersiz Bu şifre çok kısa From a4864a71a87cca8e399011e01a786118231820ab Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Sun, 6 Jan 2019 15:22:14 +0100 Subject: [PATCH 6/7] Account details and account video list added --- app/src/main/AndroidManifest.xml | 4 +- .../peertube/activity/AccountActivity.java | 337 +++++++++++++----- .../peertube/activity/LoginActivity.java | 6 +- .../peertube/activity/MeActivity.java | 162 +++++++++ .../peertube/activity/VideoListActivity.java | 7 +- .../peertube/adapter/ChannelAdapter.java | 175 +++++++++ .../peertube/adapter/VideoAdapter.java | 25 +- .../schueller/peertube/model/ChannelList.java | 33 ++ .../peertube/network/GetUserService.java | 17 + .../peertube/network/GetVideoDataService.java | 10 + app/src/main/res/layout/activity_account.xml | 209 +++++++++-- app/src/main/res/layout/activity_me.xml | 48 +++ .../main/res/layout/activity_video_list.xml | 2 +- app/src/main/res/layout/row_account_about.xml | 104 ++++++ .../main/res/layout/row_account_channels.xml | 104 ++++++ app/src/main/res/layout/row_account_video.xml | 104 ++++++ app/src/main/res/menu/menu_bottom_account.xml | 21 ++ ..._bottom.xml => menu_bottom_video_list.xml} | 0 ...menu_top_user.xml => menu_top_account.xml} | 0 app/src/main/res/values/strings.xml | 12 +- 20 files changed, 1248 insertions(+), 132 deletions(-) create mode 100644 app/src/main/java/net/schueller/peertube/activity/MeActivity.java create mode 100644 app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java create mode 100644 app/src/main/java/net/schueller/peertube/model/ChannelList.java create mode 100644 app/src/main/res/layout/activity_me.xml create mode 100644 app/src/main/res/layout/row_account_about.xml create mode 100644 app/src/main/res/layout/row_account_channels.xml create mode 100644 app/src/main/res/layout/row_account_video.xml create mode 100644 app/src/main/res/menu/menu_bottom_account.xml rename app/src/main/res/menu/{menu_bottom.xml => menu_bottom_video_list.xml} (100%) rename app/src/main/res/menu/{menu_top_user.xml => menu_top_account.xml} (100%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index de4a1d2..073b0ba 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -52,10 +52,12 @@ - + videosLanguages; + + private ChannelAdapter channelAdapter; + private VideoAdapter videoAdapter; + + private RecyclerView recyclerViewVideos; + private RecyclerView recyclerViewChannels; + + private SwipeRefreshLayout swipeRefreshLayoutVideos; + private SwipeRefreshLayout swipeRefreshLayoutChannels; + private CoordinatorLayout aboutView; + //private TextView emptyView; + + private Boolean isLoadingVideos; + + private GetUserService userService; + + private String displayNameAndHost; @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.menu_top_user, menu); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); - // Set an icon in the ActionBar - menu.findItem(R.id.action_logout).setIcon( - new IconicsDrawable(this, FontAwesome.Icon.faw_sign_out_alt).actionBar()); + setContentView(R.layout.activity_account); - return true; - } + apiBaseURL = APIUrlHelper.getUrlWithVersion(this); + + userService = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetUserService.class); + + recyclerViewVideos = findViewById(R.id.account_video_recyclerView); + recyclerViewChannels = findViewById(R.id.account_channel_recyclerView); + + swipeRefreshLayoutVideos = findViewById(R.id.account_swipeRefreshLayout_videos); + swipeRefreshLayoutChannels = findViewById(R.id.account_swipeRefreshLayout_channels); + aboutView = findViewById(R.id.account_about); + + RecyclerView.LayoutManager layoutManagerVideos = new LinearLayoutManager(AccountActivity.this); + recyclerViewVideos.setLayoutManager(layoutManagerVideos); + + RecyclerView.LayoutManager layoutManagerVideosChannels = new LinearLayoutManager(AccountActivity.this); + recyclerViewChannels.setLayoutManager(layoutManagerVideosChannels); + + videoAdapter = new VideoAdapter(new ArrayList<>(), AccountActivity.this); + recyclerViewVideos.setAdapter(videoAdapter); + + channelAdapter = new ChannelAdapter(new ArrayList<>(), AccountActivity.this); + recyclerViewChannels.setAdapter(channelAdapter); - @Override - public boolean onOptionsItemSelected(MenuItem item) { + swipeRefreshLayoutVideos.setOnRefreshListener(() -> { + // Refresh items + if (!isLoadingVideos) { + videosCurrentStart = 0; + loadAccountVideos(displayNameAndHost); + } + }); - switch (item.getItemId()) { - // action with ID action_refresh was selected + // get video ID + Intent intent = getIntent(); + displayNameAndHost = intent.getStringExtra(VideoListActivity.EXTRA_ACCOUNTDISPLAYNAME); + Log.v(TAG, "click: " + displayNameAndHost); - case R.id.action_logout: - Session.getInstance().invalidate(); - Intent intent = new Intent(this, LoginActivity.class); - intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - this.startActivity(intent); - finish(); - return true; - default: - break; - } - return super.onOptionsItemSelected(item); + createBottomBarNavigation(); + + videosStart = 0; + videosCount = 25; + videosCurrentStart = 0; + videosFilter = ""; + videosSort = "-publishedAt"; + videosNsfw = ""; + + + // Attaching the layout to the toolbar object + Toolbar toolbar = findViewById(R.id.tool_bar_account); + // Setting toolbar as the ActionBar with setSupportActionBar() call + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setTitle(displayNameAndHost); + getSupportActionBar().setHomeAsUpIndicator( + new IconicsDrawable(this, FontAwesome.Icon.faw_chevron_left).actionBar() + ); + + loadAccountVideos(displayNameAndHost); + } @Override @@ -100,76 +159,178 @@ public class AccountActivity extends CommonActivity { return false; } - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + private void loadAccount(String ownerString) { - setContentView(R.layout.activity_account); + // get video details from api + Call call = userService.getAccount(ownerString); - // Attaching the layout to the toolbar object - Toolbar toolbar = findViewById(R.id.tool_bar_user); - // Setting toolbar as the ActionBar with setSupportActionBar() call - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - getSupportActionBar().setHomeAsUpIndicator( - new IconicsDrawable(this, FontAwesome.Icon.faw_chevron_left).actionBar() - ); - - - init(); - } - - private void init() { - // try to get user data - getUserData(); - } - - private boolean getUserData() { - - // TODO - - - String apiBaseURL = APIUrlHelper.getUrlWithVersion(this); - - GetUserService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetUserService.class); - - Call call = service.getMe(); - - call.enqueue(new Callback() { + call.enqueue(new Callback() { @Override - public void onResponse(@NonNull Call call, @NonNull Response response) { + public void onResponse(@NonNull Call call, @NonNull Response response) { + if (response.isSuccessful()) { + Account account = response.body(); - Me me = response.body(); + String owner = MetaDataHelper.getOwnerString(account.getName(), + account.getHost(), + AccountActivity.this + ); - TextView username = findViewById(R.id.account_username); - TextView email = findViewById(R.id.account_email); + // set view data + TextView ownerStringView = findViewById(R.id.account_owner_string); + ownerStringView.setText(owner); - username.setText(me.getUsername()); - email.setText(me.getEmail()); + TextView followers = findViewById(R.id.account_followers); + followers.setText(account.getFollowersCount().toString()); - Log.v(TAG, me.getEmail()); + TextView description = findViewById(R.id.account_description); + description.setText(account.getDescription()); + TextView joined = findViewById(R.id.account_joined); + joined.setText(account.getCreatedAt().toString()); + + + } else { + Toast.makeText(AccountActivity.this, getString(R.string.api_error), Toast.LENGTH_SHORT).show(); } } @Override - public void onFailure(Call call, Throwable t) { - + public void onFailure(@NonNull Call call, @NonNull Throwable t) { + Log.wtf(TAG, t.fillInStackTrace()); + Toast.makeText(AccountActivity.this, getString(R.string.api_error), Toast.LENGTH_SHORT).show(); } }); - return true; } - @Override - protected void onResume() { - super.onResume(); - init(); + private void loadAccountVideos(String displayNameAndHost) { + + isLoadingVideos = false; + + GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class); + Call call; + + call = service.getAccountVideosData(displayNameAndHost, videosStart, videosCount, videosSort); + + call.enqueue(new Callback() { + @Override + public void onResponse(@NonNull Call call, @NonNull Response response) { + + Log.v(TAG, response.toString()); + + if (response.isSuccessful()) { + if (videosCurrentStart == 0) { + videoAdapter.clearData(); + } + + if (response.body() != null) { + videoAdapter.setData(response.body().getVideoArrayList()); + } + + } else{ + Toast.makeText(AccountActivity.this, getString(R.string.api_error), Toast.LENGTH_SHORT).show(); + + } + + isLoadingVideos = false; + swipeRefreshLayoutVideos.setRefreshing(false); + } + + @Override + public void onFailure(@NonNull Call call, @NonNull Throwable t) { + Log.wtf("err", t.fillInStackTrace()); + Toast.makeText(AccountActivity.this, getString(R.string.api_error), Toast.LENGTH_SHORT).show(); + isLoadingVideos = false; + swipeRefreshLayoutVideos.setRefreshing(false); + } + }); + } + + private void loadAccountChannels(String displayNameAndHost) { + + // get video details from api + Call call = userService.getAccountChannels(displayNameAndHost); + + call.enqueue(new Callback() { + @Override + public void onResponse(@NonNull Call call, @NonNull Response response) { + + + if (response.isSuccessful()) { + ChannelList channelList = response.body(); + + + + } else { + Toast.makeText(AccountActivity.this, getString(R.string.api_error), Toast.LENGTH_SHORT).show(); + } + + + } + + @Override + public void onFailure(@NonNull Call call, @NonNull Throwable t) { + Log.wtf(TAG, t.fillInStackTrace()); + Toast.makeText(AccountActivity.this, getString(R.string.api_error), Toast.LENGTH_SHORT).show(); + } + }); + } + + + + private void createBottomBarNavigation() { + + // Get Bottom Navigation + BottomNavigationView navigation = findViewById(R.id.account_navigation); + + // Always show text label + navigation.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_LABELED); + + // Add Icon font + Menu navMenu = navigation.getMenu(); + navMenu.findItem(R.id.account_navigation_about).setIcon( + new IconicsDrawable(this, FontAwesome.Icon.faw_user)); + navMenu.findItem(R.id.account_navigation_channels).setIcon( + new IconicsDrawable(this, FontAwesome.Icon.faw_list)); + navMenu.findItem(R.id.account_navigation_videos).setIcon( + new IconicsDrawable(this, FontAwesome.Icon.faw_video)); + + // Click Listener + navigation.setOnNavigationItemSelectedListener(menuItem -> { + switch (menuItem.getItemId()) { + case R.id.account_navigation_about: + + swipeRefreshLayoutVideos.setVisibility(View.GONE); + swipeRefreshLayoutChannels.setVisibility(View.GONE); + aboutView.setVisibility(View.VISIBLE); + loadAccount(displayNameAndHost); + + return true; + case R.id.account_navigation_channels: + + swipeRefreshLayoutVideos.setVisibility(View.GONE); + swipeRefreshLayoutChannels.setVisibility(View.VISIBLE); + aboutView.setVisibility(View.GONE); + loadAccountChannels(displayNameAndHost); + + return true; + case R.id.account_navigation_videos: + + swipeRefreshLayoutVideos.setVisibility(View.VISIBLE); + swipeRefreshLayoutChannels.setVisibility(View.GONE); + aboutView.setVisibility(View.GONE); + loadAccountVideos(displayNameAndHost); + + return true; + + } + return false; + }); } } diff --git a/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java b/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java index 56fa0e4..d64c339 100644 --- a/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java +++ b/app/src/main/java/net/schueller/peertube/activity/LoginActivity.java @@ -40,15 +40,11 @@ import net.schueller.peertube.network.AuthenticationService; import net.schueller.peertube.network.RetrofitInstance; import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; -import static net.schueller.peertube.helper.Constants.DEFAULT_THEME; -import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY; - public class LoginActivity extends CommonActivity { private String TAG = "LoginActivity"; @@ -148,7 +144,7 @@ public class LoginActivity extends CommonActivity { Log.wtf(TAG, "Logged in"); - Intent intent = new Intent(context, AccountActivity.class); + Intent intent = new Intent(context, MeActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(intent); diff --git a/app/src/main/java/net/schueller/peertube/activity/MeActivity.java b/app/src/main/java/net/schueller/peertube/activity/MeActivity.java new file mode 100644 index 0000000..4153d74 --- /dev/null +++ b/app/src/main/java/net/schueller/peertube/activity/MeActivity.java @@ -0,0 +1,162 @@ +/* + * Copyright 2018 Stefan Schüller + * + * License: GPL-3.0+ + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.schueller.peertube.activity; + +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.widget.TextView; + +import com.mikepenz.fontawesome_typeface_library.FontAwesome; +import com.mikepenz.iconics.IconicsDrawable; + +import net.schueller.peertube.R; +import net.schueller.peertube.helper.APIUrlHelper; +import net.schueller.peertube.model.Me; +import net.schueller.peertube.network.GetUserService; +import net.schueller.peertube.network.RetrofitInstance; +import net.schueller.peertube.network.Session; + +import androidx.annotation.NonNull; +import androidx.appcompat.widget.Toolbar; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; + +public class MeActivity extends CommonActivity { + + + private static final String TAG = "MeActivity"; + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu_top_account, menu); + + // Set an icon in the ActionBar + menu.findItem(R.id.action_logout).setIcon( + new IconicsDrawable(this, FontAwesome.Icon.faw_sign_out_alt).actionBar()); + + return true; + } + + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + + switch (item.getItemId()) { + // action with ID action_refresh was selected + + case R.id.action_logout: + Session.getInstance().invalidate(); + Intent intent = new Intent(this, LoginActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + this.startActivity(intent); + finish(); + return true; + default: + break; + } + + return super.onOptionsItemSelected(item); + } + + @Override + public boolean onSupportNavigateUp() { + finish(); // close this activity as oppose to navigating up + + return false; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.activity_me); + + // Attaching the layout to the toolbar object + Toolbar toolbar = findViewById(R.id.tool_bar_me); + // Setting toolbar as the ActionBar with setSupportActionBar() call + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator( + new IconicsDrawable(this, FontAwesome.Icon.faw_chevron_left).actionBar() + ); + + + init(); + } + + private void init() { + // try to get user data + getUserData(); + } + + private boolean getUserData() { + + // TODO + + + String apiBaseURL = APIUrlHelper.getUrlWithVersion(this); + + GetUserService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetUserService.class); + + Call call = service.getMe(); + + call.enqueue(new Callback() { + @Override + public void onResponse(@NonNull Call call, @NonNull Response response) { + + if (response.isSuccessful()) { + + Me me = response.body(); + + TextView username = findViewById(R.id.account_username); + TextView email = findViewById(R.id.account_email); + + username.setText(me.getUsername()); + email.setText(me.getEmail()); + + Log.v(TAG, me.getEmail()); + + } + + + } + + @Override + public void onFailure(Call call, Throwable t) { + + } + }); + + return true; + } + + @Override + protected void onResume() { + super.onResume(); + + init(); + + } +} diff --git a/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java b/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java index 95a0f73..f69700a 100644 --- a/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java +++ b/app/src/main/java/net/schueller/peertube/activity/VideoListActivity.java @@ -70,7 +70,8 @@ public class VideoListActivity extends CommonActivity { private String TAG = "VideoListActivity"; - public static final String EXTRA_VIDEOID = "VIDEOID "; + public static final String EXTRA_VIDEOID = "VIDEOID"; + public static final String EXTRA_ACCOUNTDISPLAYNAME = "ACCOUNTDISPLAYNAMEANDHOST"; private VideoAdapter videoAdapter; private SwipeRefreshLayout swipeRefreshLayout; @@ -288,7 +289,7 @@ public class VideoListActivity extends CommonActivity { @Override public void onFailure(@NonNull Call call, @NonNull Throwable t) { Log.wtf("err", t.fillInStackTrace()); - Toast.makeText(VideoListActivity.this, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show(); + Toast.makeText(VideoListActivity.this, getString(R.string.api_error), Toast.LENGTH_SHORT).show(); isLoading = false; swipeRefreshLayout.setRefreshing(false); } @@ -427,7 +428,7 @@ public class VideoListActivity extends CommonActivity { Intent intent = new Intent(this, LoginActivity.class); this.startActivity(intent); } else { - Intent intent = new Intent(this, AccountActivity.class); + Intent intent = new Intent(this, MeActivity.class); this.startActivity(intent); } diff --git a/app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java b/app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java new file mode 100644 index 0000000..082256b --- /dev/null +++ b/app/src/main/java/net/schueller/peertube/adapter/ChannelAdapter.java @@ -0,0 +1,175 @@ +/* + * Copyright 2018 Stefan Schüller + * + * License: GPL-3.0+ + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package net.schueller.peertube.adapter; + +import android.content.Context; +import android.content.Intent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import com.mikepenz.iconics.Iconics; +import com.squareup.picasso.Picasso; + +import net.schueller.peertube.R; +import net.schueller.peertube.activity.VideoPlayActivity; +import net.schueller.peertube.helper.APIUrlHelper; +import net.schueller.peertube.helper.MetaDataHelper; +import net.schueller.peertube.intents.Intents; +import net.schueller.peertube.model.Avatar; +import net.schueller.peertube.model.Video; + +import java.util.ArrayList; + +import androidx.annotation.NonNull; +import androidx.appcompat.widget.PopupMenu; +import androidx.recyclerview.widget.RecyclerView; + +import static net.schueller.peertube.activity.VideoListActivity.EXTRA_VIDEOID; + +public class ChannelAdapter extends RecyclerView.Adapter { + + + private ArrayList From 2583175ecaf4e4c7f7b8ce8a15d639a6bf3ad86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Schu=CC=88ller?= Date: Sun, 20 Jan 2019 18:01:34 +0100 Subject: [PATCH 7/7] Version bump, string fix --- CHANGELOG.md | 4 ++++ app/build.gradle | 4 ++-- app/src/main/res/values-tr/strings.xml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f054d1b..ea2b717 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### Version 1.0.25 Tag: v1.0.25 (2019-01-20) + * Account overview page and videos list + * Turkish (tr) Translation added (@oktay454) + ### Version 1.0.24 Tag: v1.0.24 (2019-01-09) * Set video quality (@digiwizkid) * BN Strings update (@digiwizkid) diff --git a/app/build.gradle b/app/build.gradle index 6ef20cd..5b0ca7b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "net.schueller.peertube" minSdkVersion 21 targetSdkVersion 28 - versionCode 1024 - versionName "1.0.24" + versionCode 1025 + versionName "1.0.25" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ext { libVersions = [ diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 6ae759a..a4534ed 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -55,7 +55,7 @@ Lisans \nGNU Affero Genel Kamu Lisansı v3.0\n\nPBu en güçlü copyleft lisansının izinleri, aynı lisans altında lisanslı bir eser kullanan daha büyük işleri içeren lisanslı eserlerin ve değişikliklerin eksiksiz kaynak kodunu kullanıma sunmakla yükümlüdür. Telif hakkı ve lisans bildirimleri korunmalıdır. Katkıda bulunanlar açık bir patent hakkı verir. Bir ağ üzerinden hizmet sağlamak için değiştirilmiş bir sürüm kullanıldığında, değiştirilmiş sürümün kaynak kodunun tamamı kullanılabilir duruma getirilmelidir. Sürüm - PeerTube'da Ara + PeerTube\'da Ara Arama Sonuç yok Daha