138 lines
4.1 KiB
Java
138 lines
4.1 KiB
Java
/**
|
|
* Nextcloud Android client application
|
|
*
|
|
* @author Andy Scherzinger
|
|
* Copyright (C) 2017 Andy Scherzinger
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
package com.owncloud.android.ui.activity;
|
|
|
|
import android.os.Bundle;
|
|
import android.support.v7.widget.RecyclerView;
|
|
import android.view.MenuItem;
|
|
import android.view.View;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.ProgressBar;
|
|
import android.widget.TextView;
|
|
|
|
import com.owncloud.android.R;
|
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
|
|
|
import butterknife.BindString;
|
|
import butterknife.BindView;
|
|
import butterknife.ButterKnife;
|
|
import butterknife.Unbinder;
|
|
|
|
/**
|
|
* Activity displaying all server side stored activity items.
|
|
*/
|
|
public class NotificationsActivity extends FileActivity {
|
|
|
|
private static final String TAG = NotificationsActivity.class.getSimpleName();
|
|
|
|
@BindView(R.id.empty_list_view)
|
|
public LinearLayout emptyContentContainer;
|
|
|
|
@BindView(R.id.empty_list_view_text)
|
|
public TextView emptyContentMessage;
|
|
|
|
@BindView(R.id.empty_list_view_headline)
|
|
public TextView emptyContentHeadline;
|
|
|
|
@BindView(R.id.empty_list_icon)
|
|
public ImageView emptyContentIcon;
|
|
|
|
@BindView(R.id.empty_list_progress)
|
|
public ProgressBar emptyContentProgressBar;
|
|
|
|
@BindView(android.R.id.list)
|
|
public RecyclerView recyclerView;
|
|
|
|
@BindString(R.string.notifications_no_results_headline)
|
|
public String noResultsHeadline;
|
|
|
|
@BindString(R.string.notifications_no_results_message)
|
|
public String noResultsMessage;
|
|
|
|
private Unbinder unbinder;
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
Log_OC.v(TAG, "onCreate() start");
|
|
super.onCreate(savedInstanceState);
|
|
|
|
setContentView(R.layout.notifications_layout);
|
|
unbinder = ButterKnife.bind(this);
|
|
|
|
// setup toolbar
|
|
setupToolbar();
|
|
|
|
// setup drawer
|
|
setupDrawer(R.id.nav_notifications);
|
|
getSupportActionBar().setTitle(getString(R.string.drawer_item_notifications));
|
|
|
|
setupContent();
|
|
}
|
|
|
|
/**
|
|
* sets up the UI elements and loads all activity items.
|
|
*/
|
|
private void setupContent() {
|
|
emptyContentIcon.setImageResource(R.drawable.ic_notification_light_grey);
|
|
setEmptyContent(noResultsHeadline,noResultsMessage);
|
|
|
|
// TODO add all (recycler) view relevant code + data loading + adapter etc.
|
|
}
|
|
|
|
@Override
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
boolean retval;
|
|
|
|
switch (item.getItemId()) {
|
|
case android.R.id.home:
|
|
if (isDrawerOpen()) {
|
|
closeDrawer();
|
|
} else {
|
|
openDrawer();
|
|
}
|
|
|
|
default:
|
|
retval = super.onOptionsItemSelected(item);
|
|
}
|
|
|
|
return retval;
|
|
}
|
|
|
|
private void setLoadingMessage() {
|
|
emptyContentHeadline.setText(R.string.file_list_loading);
|
|
emptyContentMessage.setText("");
|
|
|
|
emptyContentIcon.setVisibility(View.GONE);
|
|
emptyContentProgressBar.setVisibility(View.VISIBLE);
|
|
}
|
|
|
|
private void setEmptyContent(String headline, String message) {
|
|
if (emptyContentContainer != null && emptyContentMessage != null) {
|
|
emptyContentHeadline.setText(headline);
|
|
emptyContentMessage.setText(message);
|
|
|
|
emptyContentProgressBar.setVisibility(View.GONE);
|
|
emptyContentIcon.setVisibility(View.VISIBLE);
|
|
}
|
|
}
|
|
}
|