Adds activity & link service
|
@ -158,6 +158,11 @@
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
/>
|
/>
|
||||||
|
<activity android:name=".activities.OwnerStatusActivity"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
/>
|
||||||
<activity android:name=".activities.AboutActivity"
|
<activity android:name=".activities.AboutActivity"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
|
|
|
@ -1296,6 +1296,11 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
startActivity(remoteFollow);
|
startActivity(remoteFollow);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if( id == R.id.nav_archive) {
|
||||||
|
Intent myIntent = new Intent(BaseMainActivity.this, OwnerStatusActivity.class);
|
||||||
|
startActivity(myIntent);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
final NavigationView navigationView = findViewById(R.id.nav_view);
|
final NavigationView navigationView = findViewById(R.id.nav_view);
|
||||||
unCheckAllMenuItems(navigationView);
|
unCheckAllMenuItems(navigationView);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
|
|
|
@ -0,0 +1,268 @@
|
||||||
|
/* Copyright 2017 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of Mastalab
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Mastalab 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 Mastalab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
package fr.gouv.etalab.mastodon.activities;
|
||||||
|
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.widget.DividerItemDecoration;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.request.target.SimpleTarget;
|
||||||
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import fr.gouv.etalab.mastodon.R;
|
||||||
|
import fr.gouv.etalab.mastodon.asynctasks.RetrieveFeedsAsyncTask;
|
||||||
|
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||||
|
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||||
|
import fr.gouv.etalab.mastodon.client.Entities.Status;
|
||||||
|
import fr.gouv.etalab.mastodon.drawers.StatusListAdapter;
|
||||||
|
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||||
|
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface;
|
||||||
|
import fr.gouv.etalab.mastodon.services.BackupStatusInDataBaseService;
|
||||||
|
import fr.gouv.etalab.mastodon.services.BackupStatusService;
|
||||||
|
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
|
||||||
|
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Thomas on 17/02/2018.
|
||||||
|
* Show owner's toots
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeedsInterface {
|
||||||
|
|
||||||
|
|
||||||
|
private TextView toolbarTitle;
|
||||||
|
private RecyclerView lv_status;
|
||||||
|
private boolean isRefreshed;
|
||||||
|
private ImageView pp_actionBar;
|
||||||
|
private StatusListAdapter statusListAdapter;
|
||||||
|
private SharedPreferences sharedpreferences;
|
||||||
|
private String max_id;
|
||||||
|
private List<Status> statuses;
|
||||||
|
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
|
||||||
|
private boolean firstLoad;
|
||||||
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
|
private boolean swiped;
|
||||||
|
private boolean flag_loading;
|
||||||
|
LinearLayoutManager mLayoutManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
|
if( theme == Helper.THEME_LIGHT){
|
||||||
|
setTheme(R.style.AppTheme_NoActionBar);
|
||||||
|
}else {
|
||||||
|
setTheme(R.style.AppThemeDark_NoActionBar);
|
||||||
|
}
|
||||||
|
setContentView(R.layout.activity_ower_status);
|
||||||
|
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
if( actionBar != null ){
|
||||||
|
LayoutInflater inflater = (LayoutInflater) this.getSystemService(android.content.Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
assert inflater != null;
|
||||||
|
@SuppressLint("InflateParams") View view = inflater.inflate(R.layout.toot_action_bar, null);
|
||||||
|
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||||
|
|
||||||
|
ImageView close_toot = actionBar.getCustomView().findViewById(R.id.close_toot);
|
||||||
|
close_toot.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toolbarTitle = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||||
|
pp_actionBar = actionBar.getCustomView().findViewById(R.id.pp_actionBar);
|
||||||
|
toolbarTitle.setText(getString(R.string.owner_cached_toots));
|
||||||
|
}
|
||||||
|
statuses = new ArrayList<>();
|
||||||
|
lv_status = findViewById(R.id.lv_status);
|
||||||
|
mainLoader = findViewById(R.id.loader);
|
||||||
|
nextElementLoader = findViewById(R.id.loading_next_status);
|
||||||
|
textviewNoAction = findViewById(R.id.no_action);
|
||||||
|
mainLoader.setVisibility(View.VISIBLE);
|
||||||
|
nextElementLoader.setVisibility(View.GONE);
|
||||||
|
max_id = null;
|
||||||
|
flag_loading = true;
|
||||||
|
firstLoad = true;
|
||||||
|
swiped = false;
|
||||||
|
boolean isOnWifi = Helper.isOnWIFI(OwnerStatusActivity.this);
|
||||||
|
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
|
||||||
|
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||||
|
lv_status.addItemDecoration(new DividerItemDecoration(OwnerStatusActivity.this, DividerItemDecoration.VERTICAL));
|
||||||
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
|
statusListAdapter = new StatusListAdapter(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, userId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
|
||||||
|
lv_status.setAdapter(statusListAdapter);
|
||||||
|
mLayoutManager = new LinearLayoutManager(OwnerStatusActivity.this);
|
||||||
|
lv_status.setLayoutManager(mLayoutManager);
|
||||||
|
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(OwnerStatusActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
Account account = new AccountDAO(OwnerStatusActivity.this,db).getAccountByID(userId);
|
||||||
|
String url = account.getAvatar();
|
||||||
|
if( url.startsWith("/") ){
|
||||||
|
url = Helper.getLiveInstanceWithProtocol(OwnerStatusActivity.this) + account.getAvatar();
|
||||||
|
}
|
||||||
|
Glide.with(OwnerStatusActivity.this)
|
||||||
|
.asBitmap()
|
||||||
|
.load(url)
|
||||||
|
.into(new SimpleTarget<Bitmap>() {
|
||||||
|
@Override
|
||||||
|
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
||||||
|
BitmapDrawable ppDrawable = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(resource, (int) Helper.convertDpToPixel(25, OwnerStatusActivity.this), (int) Helper.convertDpToPixel(25, OwnerStatusActivity.this), true));
|
||||||
|
if( pp_actionBar != null){
|
||||||
|
pp_actionBar.setImageDrawable(ppDrawable);
|
||||||
|
} else if( getSupportActionBar() != null){
|
||||||
|
|
||||||
|
getSupportActionBar().setIcon(ppDrawable);
|
||||||
|
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
isRefreshed = false;
|
||||||
|
|
||||||
|
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
||||||
|
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
isRefreshed = true;
|
||||||
|
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy)
|
||||||
|
{
|
||||||
|
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
|
||||||
|
if(dy > 0){
|
||||||
|
int visibleItemCount = mLayoutManager.getChildCount();
|
||||||
|
int totalItemCount = mLayoutManager.getItemCount();
|
||||||
|
if(firstVisibleItem + visibleItemCount == totalItemCount ) {
|
||||||
|
if(!flag_loading ) {
|
||||||
|
flag_loading = true;
|
||||||
|
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, max_id, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
nextElementLoader.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nextElementLoader.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.option_owner_cache, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
case R.id.action_sync:
|
||||||
|
Intent backupIntent = new Intent(OwnerStatusActivity.this, BackupStatusInDataBaseService.class);
|
||||||
|
startService(backupIntent);
|
||||||
|
return true;
|
||||||
|
case R.id.action_filter:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRetrieveFeeds(APIResponse apiResponse) {
|
||||||
|
mainLoader.setVisibility(View.GONE);
|
||||||
|
nextElementLoader.setVisibility(View.GONE);
|
||||||
|
//Discards 404 - error which can often happen due to toots which have been deleted
|
||||||
|
if( apiResponse.getError() != null && apiResponse.getError().getStatusCode() != 404 ){
|
||||||
|
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
|
||||||
|
if( show_error_messages )
|
||||||
|
Toast.makeText(OwnerStatusActivity.this, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||||
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
swiped = false;
|
||||||
|
flag_loading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int previousPosition = this.statuses.size();
|
||||||
|
List<Status> statuses = apiResponse.getStatuses();
|
||||||
|
max_id = apiResponse.getMax_id();
|
||||||
|
flag_loading = (max_id == null );
|
||||||
|
if( !swiped && firstLoad && (statuses == null || statuses.size() == 0))
|
||||||
|
textviewNoAction.setVisibility(View.VISIBLE);
|
||||||
|
else
|
||||||
|
textviewNoAction.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
if( swiped ){
|
||||||
|
if (previousPosition > 0) {
|
||||||
|
for (int i = 0; i < previousPosition; i++) {
|
||||||
|
this.statuses.remove(0);
|
||||||
|
}
|
||||||
|
statusListAdapter.notifyItemRangeRemoved(0, previousPosition);
|
||||||
|
}
|
||||||
|
swiped = false;
|
||||||
|
}
|
||||||
|
if( statuses != null && statuses.size() > 0) {
|
||||||
|
this.statuses.addAll(statuses);
|
||||||
|
statusListAdapter.notifyItemRangeInserted(previousPosition, statuses.size());
|
||||||
|
}
|
||||||
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
firstLoad = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -58,7 +58,8 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
ONESTATUS,
|
ONESTATUS,
|
||||||
CONTEXT,
|
CONTEXT,
|
||||||
TAG,
|
TAG,
|
||||||
CACHE_BOOKMARKS
|
CACHE_BOOKMARKS,
|
||||||
|
CACHE_STATUS
|
||||||
}
|
}
|
||||||
|
|
||||||
public RetrieveFeedsAsyncTask(Context context, Type action, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
|
public RetrieveFeedsAsyncTask(Context context, Type action, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
|
||||||
|
@ -123,6 +124,20 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
List<fr.gouv.etalab.mastodon.client.Entities.Status> statuses = new StatusCacheDAO(contextReference.get(), db).getAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
|
List<fr.gouv.etalab.mastodon.client.Entities.Status> statuses = new StatusCacheDAO(contextReference.get(), db).getAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
|
||||||
apiResponse.setStatuses(statuses);
|
apiResponse.setStatuses(statuses);
|
||||||
break;
|
break;
|
||||||
|
case CACHE_STATUS:
|
||||||
|
apiResponse = new APIResponse();
|
||||||
|
db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
statuses = new StatusCacheDAO(contextReference.get(), db).getStatusFromID(StatusCacheDAO.ARCHIVE_CACHE, max_id);
|
||||||
|
if( statuses != null && statuses.size() > 0) {
|
||||||
|
apiResponse.setStatuses(statuses);
|
||||||
|
apiResponse.setMax_id(statuses.get(0).getId());
|
||||||
|
apiResponse.setSince_id(statuses.get(statuses.size() - 1).getId());
|
||||||
|
}else{
|
||||||
|
apiResponse.setStatuses(null);
|
||||||
|
apiResponse.setMax_id(null);
|
||||||
|
apiResponse.setSince_id(null);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case HASHTAG:
|
case HASHTAG:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,6 +160,25 @@ public class StatusCacheDAO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all cached Statuses in db depending of their cache type
|
||||||
|
* @return stored status List<StoredStatus>
|
||||||
|
*/
|
||||||
|
public List<Status> getStatusFromID(int cacheType, String max_id){
|
||||||
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
|
String instance = Helper.getLiveInstance(context);
|
||||||
|
try {
|
||||||
|
Cursor c;
|
||||||
|
if( max_id != null)
|
||||||
|
c = db.query(Sqlite.TABLE_STATUSES_CACHE, null, Sqlite.COL_CACHED_ACTION + " = '" + cacheType+ "' AND " + Sqlite.COL_INSTANCE + " = '" + instance+ "' AND " + Sqlite.COL_USER_ID + " = '" + userId+ "' AND " + Sqlite.COL_STATUS_ID + " < '" + max_id+ "'", null, null, null, Sqlite.COL_CREATED_AT + " DESC", "80");
|
||||||
|
else
|
||||||
|
c = db.query(Sqlite.TABLE_STATUSES_CACHE, null, Sqlite.COL_CACHED_ACTION + " = '" + cacheType+ "' AND " + Sqlite.COL_INSTANCE + " = '" + instance+ "' AND " + Sqlite.COL_USER_ID + " = '" + userId+ "'", null, null, null, Sqlite.COL_CREATED_AT + " DESC", "80");
|
||||||
|
return cursorToListStatuses(c);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last date of backup for a user depending of the type of cache
|
* Returns the last date of backup for a user depending of the type of cache
|
||||||
|
|
After Width: | Height: | Size: 251 B |
After Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 113 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 287 B |
After Width: | Height: | Size: 335 B |
After Width: | Height: | Size: 214 B |
After Width: | Height: | Size: 419 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 164 B |
After Width: | Height: | Size: 90 B |
After Width: | Height: | Size: 295 B |
After Width: | Height: | Size: 280 B |
After Width: | Height: | Size: 188 B |
After Width: | Height: | Size: 105 B |
After Width: | Height: | Size: 543 B |
After Width: | Height: | Size: 391 B |
After Width: | Height: | Size: 275 B |
After Width: | Height: | Size: 131 B |
After Width: | Height: | Size: 807 B |
After Width: | Height: | Size: 446 B |
After Width: | Height: | Size: 261 B |
After Width: | Height: | Size: 161 B |
After Width: | Height: | Size: 1.0 KiB |
|
@ -0,0 +1,100 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.v4.widget.DrawerLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
>
|
||||||
|
|
||||||
|
<android.support.design.widget.CoordinatorLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="fr.gouv.etalab.mastodon.activities.OwnerStatusActivity">
|
||||||
|
|
||||||
|
<android.support.design.widget.AppBarLayout
|
||||||
|
android:id="@+id/appBar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/AppTheme.AppBarOverlay"
|
||||||
|
>
|
||||||
|
<android.support.v7.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
|
android:theme="@style/AppThemeDark_NoActionBar"
|
||||||
|
app:popupTheme="?attr/popupOverlay"/>
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/main_app_container"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:paddingLeft="@dimen/fab_margin"
|
||||||
|
android:paddingRight="@dimen/fab_margin"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
|
tools:context="fr.gouv.etalab.mastodon.activities.OwnerStatusActivity"
|
||||||
|
>
|
||||||
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/swipeContainer"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/lv_status"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:scrollbars="none"
|
||||||
|
/>
|
||||||
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/no_action"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:padding="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="25sp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textStyle="italic|bold"
|
||||||
|
android:typeface="serif"
|
||||||
|
android:text="@string/owner_cached_toots_empty"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</RelativeLayout>
|
||||||
|
<!-- Main Loader -->
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/loader"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
>
|
||||||
|
<ProgressBar
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:indeterminate="true" />
|
||||||
|
</RelativeLayout>
|
||||||
|
<!-- Loader for next status -->
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/loading_next_status"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
|
android:gravity="bottom|center_horizontal"
|
||||||
|
android:layout_height="20dp">
|
||||||
|
<ProgressBar
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:indeterminate="true" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
|
|
||||||
|
</android.support.v4.widget.DrawerLayout>
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2017 Thomas Schneider
|
||||||
|
|
||||||
|
This file is a part of Mastalab
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Mastalab 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 Mastalab; if not,
|
||||||
|
see <http://www.gnu.org/licenses>.
|
||||||
|
-->
|
||||||
|
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:contentInsetLeft="0dp"
|
||||||
|
android:contentInsetStart="0dp"
|
||||||
|
app:contentInsetLeft="0dp"
|
||||||
|
app:contentInsetStart="0dp"
|
||||||
|
android:contentInsetRight="0dp"
|
||||||
|
android:contentInsetEnd="0dp"
|
||||||
|
app:contentInsetRight="0dp"
|
||||||
|
app:contentInsetEnd="0dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
app:popupTheme="?attr/popupOverlay"
|
||||||
|
tools:ignore="UnusedAttribute">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/close_toot"
|
||||||
|
android:src="@drawable/ic_close"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/pp_actionBar"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="?attr/actionBarTextColor"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:id="@+id/toolbar_title" />
|
||||||
|
|
||||||
|
</android.support.v7.widget.Toolbar>
|
|
@ -23,6 +23,10 @@
|
||||||
android:id="@+id/nav_drafts"
|
android:id="@+id/nav_drafts"
|
||||||
android:icon="@drawable/ic_save_white"
|
android:icon="@drawable/ic_save_white"
|
||||||
android:title="@string/drafts" />
|
android:title="@string/drafts" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_archive"
|
||||||
|
android:icon="@drawable/ic_archive"
|
||||||
|
android:title="@string/owner_cached_toots" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_bookmarks"
|
android:id="@+id/nav_bookmarks"
|
||||||
android:icon="@drawable/ic_bookmark"
|
android:icon="@drawable/ic_bookmark"
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_sync"
|
||||||
|
android:title="@string/action_sync"
|
||||||
|
android:icon="@drawable/ic_sync"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_filter"
|
||||||
|
android:title="@string/action_filter"
|
||||||
|
android:icon="@drawable/ic_filter_list"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
</menu>
|
|
@ -396,6 +396,12 @@
|
||||||
<string name="cache_units">Mb</string>
|
<string name="cache_units">Mb</string>
|
||||||
<string name="toast_cache_clear">Cache was cleared! %1$s were released</string>
|
<string name="toast_cache_clear">Cache was cleared! %1$s were released</string>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ACTIVITY CACHE -->
|
||||||
|
<string name="action_sync">Synchronize</string>
|
||||||
|
<string name="action_filter">Filter</string>
|
||||||
|
<string name="owner_cached_toots">Your toots</string>
|
||||||
|
<string name="owner_cached_toots_empty">No toots were found in database. Please, use the synchronize button from the menu to retrieve them.</string>
|
||||||
<!-- PRIVACY -->
|
<!-- PRIVACY -->
|
||||||
<string name="privacy_data_title">Recorded data</string>
|
<string name="privacy_data_title">Recorded data</string>
|
||||||
<string name="privacy_data">
|
<string name="privacy_data">
|
||||||
|
|