Merged original_master into PhotonQyv-Baseline
|
@ -7,8 +7,8 @@ android {
|
|||
applicationId "fr.gouv.etalab.mastodon"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 25
|
||||
versionCode 52
|
||||
versionName "1.4.9-beta-4"
|
||||
versionCode 53
|
||||
versionName "1.4.9-beta-5"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.content.SharedPreferences;
|
|||
import android.graphics.Paint;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
|
@ -95,7 +96,9 @@ public class LoginActivity extends AppCompatActivity {
|
|||
final Button connectionButton = (Button) findViewById(R.id.login_button);
|
||||
login_instance = (AutoCompleteTextView) findViewById(R.id.login_instance);
|
||||
|
||||
|
||||
if( theme == Helper.THEME_LIGHT) {
|
||||
connectionButton.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.white));
|
||||
}
|
||||
login_instance.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
|
|
@ -36,9 +36,11 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.util.Patterns;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.support.design.widget.NavigationView;
|
||||
|
@ -47,7 +49,6 @@ import android.support.v4.widget.DrawerLayout;
|
|||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ImageView;
|
||||
|
@ -107,7 +108,6 @@ import static fr.gouv.etalab.mastodon.helper.Helper.NOTIFICATION_INTENT;
|
|||
import static fr.gouv.etalab.mastodon.helper.Helper.PREF_KEY_ID;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.changeUser;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.loadPPInActionBar;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.menuAccounts;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.unCheckAllMenuItems;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.updateHeaderAccountInfo;
|
||||
|
@ -121,7 +121,6 @@ public class MainActivity extends AppCompatActivity
|
|||
private HashMap<String, String> tagTile = new HashMap<>();
|
||||
private HashMap<String, Integer> tagItem = new HashMap<>();
|
||||
private TextView toolbarTitle;
|
||||
private ImageView pp_actionBar;
|
||||
private SearchView toolbar_search;
|
||||
private ImageLoader imageLoader;
|
||||
private DisplayImageOptions options;
|
||||
|
@ -140,6 +139,7 @@ public class MainActivity extends AppCompatActivity
|
|||
public static int countNewNotifications = 0;
|
||||
private String userIdService;
|
||||
private Intent streamingIntent;
|
||||
public static boolean broadCastRegistred = false;
|
||||
|
||||
public MainActivity() {
|
||||
}
|
||||
|
@ -189,7 +189,11 @@ public class MainActivity extends AppCompatActivity
|
|||
};
|
||||
streamingIntent = new Intent(this, StreamingService.class);
|
||||
startService(streamingIntent);
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(receive_data, new IntentFilter(Helper.RECEIVE_DATA));
|
||||
|
||||
if( !broadCastRegistred) {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(receive_data, new IntentFilter(Helper.RECEIVE_DATA));
|
||||
broadCastRegistred = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -219,7 +223,6 @@ public class MainActivity extends AppCompatActivity
|
|||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
toolbarTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
|
||||
pp_actionBar = (ImageView) toolbar.findViewById(R.id.pp_actionBar);
|
||||
toolbar_search = (SearchView) toolbar.findViewById(R.id.toolbar_search);
|
||||
tabLayout = (TabLayout) findViewById(R.id.tabLayout);
|
||||
TabLayout.Tab tabHome = tabLayout.newTab();
|
||||
|
@ -291,34 +294,9 @@ public class MainActivity extends AppCompatActivity
|
|||
} else {
|
||||
stackBack.push(tab.getPosition());
|
||||
}
|
||||
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
MenuItem item = null;
|
||||
String fragmentTag = null;
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
Helper.switchLayout(MainActivity.this);
|
||||
if( tab.getPosition() == 0) {
|
||||
item = navigationView.getMenu().findItem(R.id.nav_home);
|
||||
fragmentTag = "HOME_TIMELINE";
|
||||
}else if( tab.getPosition() == 1) {
|
||||
fragmentTag = "NOTIFICATIONS";
|
||||
item = navigationView.getMenu().findItem(R.id.nav_notification);
|
||||
}else if( tab.getPosition() == 2 && display_local) {
|
||||
fragmentTag = "LOCAL_TIMELINE";
|
||||
item = navigationView.getMenu().findItem(R.id.nav_local);
|
||||
}else if( tab.getPosition() == 2 && !display_local) {
|
||||
item = navigationView.getMenu().findItem(R.id.nav_global);
|
||||
fragmentTag = "PUBLIC_TIMELINE";
|
||||
}else if( tab.getPosition() == 3){
|
||||
item = navigationView.getMenu().findItem(R.id.nav_global);
|
||||
fragmentTag = "PUBLIC_TIMELINE";
|
||||
}
|
||||
if( item != null){
|
||||
toolbarTitle.setText(item.getTitle());
|
||||
populateTitleWithTag(fragmentTag, item.getTitle().toString(), item.getItemId());
|
||||
unCheckAllMenuItems(navigationView);
|
||||
item.setChecked(true);
|
||||
}
|
||||
if( tab.getPosition() != 1 )
|
||||
toot.setVisibility(View.VISIBLE);
|
||||
else
|
||||
|
@ -379,26 +357,25 @@ public class MainActivity extends AppCompatActivity
|
|||
toolbarTitle.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
|
||||
if( navigationView.getMenu().findItem(R.id.nav_favorites).isChecked()){
|
||||
if( navigationView.getMenu().findItem(R.id.nav_favorites) != null && navigationView.getMenu().findItem(R.id.nav_favorites).isChecked()){
|
||||
DisplayStatusFragment faveFrag = (DisplayStatusFragment) fragmentManager.findFragmentByTag("FAVOURITES");
|
||||
if (faveFrag != null && faveFrag.isVisible()) {
|
||||
faveFrag.scrollToTop();
|
||||
}
|
||||
} else if (navigationView.getMenu().findItem(R.id.nav_blocked).isChecked()) {
|
||||
} else if (navigationView.getMenu().findItem(R.id.nav_blocked) != null && navigationView.getMenu().findItem(R.id.nav_blocked).isChecked()) {
|
||||
DisplayAccountsFragment blockFrag = (DisplayAccountsFragment) fragmentManager.findFragmentByTag("BLOCKS");
|
||||
|
||||
if (blockFrag != null && blockFrag.isVisible()) {
|
||||
blockFrag.scrollToTop();
|
||||
}
|
||||
} else if (navigationView.getMenu().findItem(R.id.nav_muted).isChecked()) {
|
||||
} else if (navigationView.getMenu().findItem(R.id.nav_muted) != null && navigationView.getMenu().findItem(R.id.nav_muted).isChecked()) {
|
||||
DisplayAccountsFragment muteFrag = (DisplayAccountsFragment) fragmentManager.findFragmentByTag("MUTED");
|
||||
|
||||
if (muteFrag != null && muteFrag.isVisible()) {
|
||||
muteFrag.scrollToTop();
|
||||
}
|
||||
//Scroll to top when top bar is clicked (THEME_MENU only)
|
||||
} else if (Helper.THEME_MENU == sharedpreferences.getInt(Helper.SET_TABS, Helper.THEME_TABS)) {
|
||||
} else {
|
||||
int pos = tabLayout.getSelectedTabPosition();
|
||||
Fragment fragment = (Fragment) viewPager.getAdapter().instantiateItem(viewPager, pos);
|
||||
switch (pos) {
|
||||
|
@ -431,8 +408,17 @@ public class MainActivity extends AppCompatActivity
|
|||
startActivity(intent);
|
||||
toolbar_search.setQuery("", false);
|
||||
toolbar_search.setIconified(true);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.VISIBLE);
|
||||
if( main_app_container.getVisibility() == View.VISIBLE){
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
|
@ -446,8 +432,17 @@ public class MainActivity extends AppCompatActivity
|
|||
toolbar_search.setOnCloseListener(new SearchView.OnCloseListener() {
|
||||
@Override
|
||||
public boolean onClose() {
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.VISIBLE);
|
||||
if( main_app_container.getVisibility() == View.VISIBLE){
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
}
|
||||
//your code here
|
||||
return false;
|
||||
}
|
||||
|
@ -456,11 +451,20 @@ public class MainActivity extends AppCompatActivity
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
if( toolbar_search.isIconified()){
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.VISIBLE);
|
||||
if( main_app_container.getVisibility() == View.VISIBLE){
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
}
|
||||
}else {
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
pp_actionBar.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -480,14 +484,8 @@ public class MainActivity extends AppCompatActivity
|
|||
}
|
||||
});
|
||||
|
||||
final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
drawer.addDrawerListener(toggle);
|
||||
toggle.syncState();
|
||||
|
||||
|
||||
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
Account account = new AccountDAO(getApplicationContext(), db).getAccountByID(userId);
|
||||
|
||||
//Image loader configuration
|
||||
imageLoader = ImageLoader.getInstance();
|
||||
|
@ -503,13 +501,157 @@ public class MainActivity extends AppCompatActivity
|
|||
options = new DisplayImageOptions.Builder().displayer(new RoundedBitmapDisplayer(90)).cacheInMemory(false)
|
||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
|
||||
final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
|
||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
toggle.setDrawerIndicatorEnabled(false);
|
||||
ImageView iconbar = (ImageView) toolbar.findViewById(R.id.iconbar);
|
||||
iconbar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
drawer.openDrawer(Gravity.START);
|
||||
}
|
||||
});
|
||||
Helper.loadPictureIcon(MainActivity.this, account.getAvatar(),iconbar);
|
||||
headerLayout = navigationView.getHeaderView(0);
|
||||
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
Account account = new AccountDAO(getApplicationContext(), db).getAccountByID(userId);
|
||||
final ImageView menuMore = (ImageView) headerLayout.findViewById(R.id.header_option_menu);
|
||||
menuMore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
PopupMenu popup = new PopupMenu(MainActivity.this, menuMore);
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.main, popup.getMenu());
|
||||
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_logout:
|
||||
Helper.logout(getApplicationContext());
|
||||
Intent myIntent = new Intent(MainActivity.this, LoginActivity.class);
|
||||
startActivity(myIntent);
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_about:
|
||||
Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.action_privacy:
|
||||
intent = new Intent(getApplicationContext(), PrivacyActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.action_about_instance:
|
||||
intent = new Intent(getApplicationContext(), InstanceActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.action_cache:
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setTitle(R.string.cache_title);
|
||||
long sizeCache = Helper.cacheSize(getCacheDir());
|
||||
float cacheSize = 0;
|
||||
if( sizeCache > 0 ) {
|
||||
if (sizeCache > 0) {
|
||||
cacheSize = (float) sizeCache / 1000000.0f;
|
||||
}
|
||||
}
|
||||
final float finalCacheSize = cacheSize;
|
||||
builder.setMessage(getString(R.string.cache_message, String.format("%s %s", String.format(Locale.getDefault(), "%.2f", cacheSize), getString(R.string.cache_units))))
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// continue with delete
|
||||
try {
|
||||
String path = getCacheDir().getPath();
|
||||
File dir = new File(path);
|
||||
if (dir.isDirectory()) {
|
||||
Helper.deleteDir(dir);
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
Toast.makeText(MainActivity.this, getString(R.string.toast_cache_clear,String.format("%s %s", String.format(Locale.getDefault(), "%.2f", finalCacheSize), getString(R.string.cache_units))), Toast.LENGTH_LONG).show();
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
return true;
|
||||
case R.id.action_size:
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int textSize = sharedpreferences.getInt(Helper.SET_TEXT_SIZE,110);
|
||||
int iconSize = sharedpreferences.getInt(Helper.SET_ICON_SIZE,130);
|
||||
|
||||
builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setTitle(R.string.text_size);
|
||||
|
||||
@SuppressLint("InflateParams") View popup_quick_settings = getLayoutInflater().inflate( R.layout.popup_text_size, null );
|
||||
builder.setView(popup_quick_settings);
|
||||
|
||||
SeekBar set_text_size = (SeekBar) popup_quick_settings.findViewById(R.id.set_text_size);
|
||||
SeekBar set_icon_size = (SeekBar) popup_quick_settings.findViewById(R.id.set_icon_size);
|
||||
final TextView set_text_size_value = (TextView) popup_quick_settings.findViewById(R.id.set_text_size_value);
|
||||
final TextView set_icon_size_value = (TextView) popup_quick_settings.findViewById(R.id.set_icon_size_value);
|
||||
set_text_size_value.setText(String.format("%s%%",String.valueOf(textSize)));
|
||||
set_icon_size_value.setText(String.format("%s%%",String.valueOf(iconSize)));
|
||||
|
||||
set_text_size.setMax(20);
|
||||
set_icon_size.setMax(20);
|
||||
|
||||
set_text_size.setProgress(((textSize-80)/5));
|
||||
set_icon_size.setProgress(((iconSize-80)/5));
|
||||
|
||||
set_text_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
|
||||
int value = 80 + progress*5;
|
||||
set_text_size_value.setText(String.format("%s%%",String.valueOf(value)));
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_TEXT_SIZE, value);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
set_icon_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
int value = 80 + progress*5;
|
||||
set_icon_size_value.setText(String.format("%s%%",String.valueOf(value)));
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_ICON_SIZE, value);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
MainActivity.this.recreate();
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
updateHeaderAccountInfo(MainActivity.this, account, headerLayout, imageLoader, options);
|
||||
loadPPInActionBar(MainActivity.this, account.getAvatar());
|
||||
//Locked account can see follow request
|
||||
if (account.isLocked()) {
|
||||
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(true);
|
||||
|
@ -517,19 +659,15 @@ public class MainActivity extends AppCompatActivity
|
|||
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(false);
|
||||
}
|
||||
|
||||
LinearLayout owner_container = (LinearLayout) headerLayout.findViewById(R.id.owner_container);
|
||||
LinearLayout owner_container = (LinearLayout) headerLayout.findViewById(R.id.main_header_container);
|
||||
owner_container.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
menuAccounts(MainActivity.this);
|
||||
}
|
||||
});
|
||||
boolean matchingIntent = mamageNewIntent(getIntent());
|
||||
if (savedInstanceState == null && !matchingIntent) {
|
||||
navigationView.setCheckedItem(R.id.nav_home);
|
||||
navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0);
|
||||
toolbarTitle.setText(R.string.home_menu);
|
||||
}
|
||||
|
||||
|
||||
|
||||
boolean popupShown = sharedpreferences.getBoolean(Helper.SET_POPUP_PUSH, false);
|
||||
if(!popupShown){
|
||||
|
@ -614,9 +752,6 @@ public class MainActivity extends AppCompatActivity
|
|||
matchingIntent = true;
|
||||
}else if( extras.getInt(INTENT_ACTION) == CHANGE_USER_INTENT){
|
||||
unCheckAllMenuItems(navigationView);
|
||||
navigationView.setCheckedItem(R.id.nav_home);
|
||||
navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0);
|
||||
toolbarTitle.setText(R.string.home_menu);
|
||||
matchingIntent = true;
|
||||
}
|
||||
}else if( Intent.ACTION_SEND.equals(action) && type != null ) {
|
||||
|
@ -703,9 +838,11 @@ public class MainActivity extends AppCompatActivity
|
|||
super.onBackPressed();
|
||||
}
|
||||
}else {
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
Helper.switchLayout(MainActivity.this);
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
unCheckAllMenuItems(navigationView);
|
||||
toot.setVisibility(View.VISIBLE);
|
||||
|
@ -738,22 +875,8 @@ public class MainActivity extends AppCompatActivity
|
|||
changeDrawableColor(getApplicationContext(), R.drawable.ic_translate,R.color.white);
|
||||
}
|
||||
switch (viewPager.getCurrentItem()){
|
||||
case 0:
|
||||
toolbarTitle.setText(R.string.home_menu);
|
||||
navigationView.getMenu().findItem(R.id.nav_home).setChecked(true);
|
||||
break;
|
||||
case 1:
|
||||
toot.setVisibility(View.GONE);
|
||||
toolbarTitle.setText(R.string.notifications);
|
||||
navigationView.getMenu().findItem(R.id.nav_notification).setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
toolbarTitle.setText(R.string.local_menu);
|
||||
navigationView.getMenu().findItem(R.id.nav_local).setChecked(true);
|
||||
break;
|
||||
case 3:
|
||||
toolbarTitle.setText(R.string.global_menu);
|
||||
navigationView.getMenu().findItem(R.id.nav_global).setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -762,136 +885,6 @@ public class MainActivity extends AppCompatActivity
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if(id == R.id.action_logout) {
|
||||
Helper.logout(getApplicationContext());
|
||||
Intent myIntent = new Intent(MainActivity.this, LoginActivity.class);
|
||||
startActivity(myIntent);
|
||||
finish();
|
||||
return true;
|
||||
}else if(id == R.id.action_about){
|
||||
Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
|
||||
startActivity(intent);
|
||||
}else if(id == R.id.action_privacy){
|
||||
Intent intent = new Intent(getApplicationContext(), PrivacyActivity.class);
|
||||
startActivity(intent);
|
||||
}else if(id == R.id.action_about_instance){
|
||||
Intent intent = new Intent(getApplicationContext(), InstanceActivity.class);
|
||||
startActivity(intent);
|
||||
} else if( id == R.id.action_cache){ //Cache clear feature
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setTitle(R.string.cache_title);
|
||||
long sizeCache = Helper.cacheSize(getCacheDir());
|
||||
float cacheSize = 0;
|
||||
if( sizeCache > 0 ) {
|
||||
if (sizeCache > 0) {
|
||||
cacheSize = (float) sizeCache / 1000000.0f;
|
||||
}
|
||||
}
|
||||
final float finalCacheSize = cacheSize;
|
||||
builder.setMessage(getString(R.string.cache_message, String.format("%s %s", String.format(Locale.getDefault(), "%.2f", cacheSize), getString(R.string.cache_units))))
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// continue with delete
|
||||
try {
|
||||
String path = getCacheDir().getPath();
|
||||
File dir = new File(path);
|
||||
if (dir.isDirectory()) {
|
||||
Helper.deleteDir(dir);
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
Toast.makeText(MainActivity.this, getString(R.string.toast_cache_clear,String.format("%s %s", String.format(Locale.getDefault(), "%.2f", finalCacheSize), getString(R.string.cache_units))), Toast.LENGTH_LONG).show();
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
}else if( id == R.id.action_size){
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int textSize = sharedpreferences.getInt(Helper.SET_TEXT_SIZE,110);
|
||||
int iconSize = sharedpreferences.getInt(Helper.SET_ICON_SIZE,130);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setTitle(R.string.text_size);
|
||||
|
||||
@SuppressLint("InflateParams") View popup_quick_settings = getLayoutInflater().inflate( R.layout.popup_text_size, null );
|
||||
builder.setView(popup_quick_settings);
|
||||
|
||||
SeekBar set_text_size = (SeekBar) popup_quick_settings.findViewById(R.id.set_text_size);
|
||||
SeekBar set_icon_size = (SeekBar) popup_quick_settings.findViewById(R.id.set_icon_size);
|
||||
final TextView set_text_size_value = (TextView) popup_quick_settings.findViewById(R.id.set_text_size_value);
|
||||
final TextView set_icon_size_value = (TextView) popup_quick_settings.findViewById(R.id.set_icon_size_value);
|
||||
set_text_size_value.setText(String.format("%s%%",String.valueOf(textSize)));
|
||||
set_icon_size_value.setText(String.format("%s%%",String.valueOf(iconSize)));
|
||||
|
||||
set_text_size.setMax(20);
|
||||
set_icon_size.setMax(20);
|
||||
|
||||
set_text_size.setProgress(((textSize-80)/5));
|
||||
set_icon_size.setProgress(((iconSize-80)/5));
|
||||
|
||||
set_text_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
|
||||
int value = 80 + progress*5;
|
||||
set_text_size_value.setText(String.format("%s%%",String.valueOf(value)));
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_TEXT_SIZE, value);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
set_icon_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
int value = 80 + progress*5;
|
||||
set_icon_size_value.setText(String.format("%s%%",String.valueOf(value)));
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_ICON_SIZE, value);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
MainActivity.this.recreate();
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
|
@ -918,6 +911,7 @@ public class MainActivity extends AppCompatActivity
|
|||
if( streamingIntent != null)
|
||||
stopService(streamingIntent);
|
||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(receive_data);
|
||||
broadCastRegistred = false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("StatementWithEmptyBody")
|
||||
|
@ -935,33 +929,9 @@ public class MainActivity extends AppCompatActivity
|
|||
item.setChecked(true);
|
||||
//Remove the search bar
|
||||
if( !toolbar_search.isIconified() ) {
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.VISIBLE);
|
||||
toolbar_search.setIconified(true);
|
||||
}
|
||||
toolbarTitle.setText(item.getTitle());
|
||||
if (id == R.id.nav_home) {
|
||||
if( tabLayout.getSelectedTabPosition() != 0)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(0).select();
|
||||
return true;
|
||||
} else if( id == R.id.nav_notification){
|
||||
if( tabLayout.getSelectedTabPosition() != 1)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(1).select();
|
||||
return true;
|
||||
}else if (id == R.id.nav_local) {
|
||||
|
||||
if( tabLayout.getSelectedTabPosition() != 2)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(2).select();
|
||||
return true;
|
||||
} else if (id == R.id.nav_global) {
|
||||
if( tabLayout.getSelectedTabPosition() != 3)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(3).select();
|
||||
return true;
|
||||
}
|
||||
DisplayStatusFragment statusFragment;
|
||||
DisplayAccountsFragment accountsFragment;
|
||||
Bundle bundle = new Bundle();
|
||||
|
@ -971,6 +941,7 @@ public class MainActivity extends AppCompatActivity
|
|||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
if (id == R.id.nav_settings) {
|
||||
toot.setVisibility(View.GONE);
|
||||
TabLayoutSettingsFragment tabLayoutSettingsFragment= new TabLayoutSettingsFragment();
|
||||
|
@ -1102,7 +1073,7 @@ public class MainActivity extends AppCompatActivity
|
|||
//Remove the search bar
|
||||
if( !toolbar_search.isIconified() ) {
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbar_search.setIconified(true);
|
||||
}
|
||||
//Selection comes from another menu, no action to do
|
||||
|
|
|
@ -802,6 +802,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
|
||||
final DatePicker datePicker = (DatePicker) dialogView.findViewById(R.id.date_picker);
|
||||
final TimePicker timePicker = (TimePicker) dialogView.findViewById(R.id.time_picker);
|
||||
timePicker.setIs24HourView(true);
|
||||
Button date_time_cancel = (Button) dialogView.findViewById(R.id.date_time_cancel);
|
||||
final ImageButton date_time_previous = (ImageButton) dialogView.findViewById(R.id.date_time_previous);
|
||||
final ImageButton date_time_next = (ImageButton) dialogView.findViewById(R.id.date_time_next);
|
||||
|
@ -915,6 +916,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
Toast.makeText(getApplicationContext(), error.getError(),Toast.LENGTH_LONG).show();
|
||||
if( attachments.size() == 0 )
|
||||
toot_picture_container.setVisibility(View.GONE);
|
||||
toot_picture.setEnabled(true);
|
||||
return;
|
||||
}
|
||||
toot_picture_container.setVisibility(View.VISIBLE);
|
||||
|
@ -1348,7 +1350,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
toot_content.setText(toot_content.getText().toString().trim());
|
||||
if (toot_content.getText().toString().startsWith("@")) {
|
||||
//Put a "<trim>dot<space>" at the end of all mentioned account to force capitalization
|
||||
toot_content.append(". ");
|
||||
toot_content.append("\n");
|
||||
}
|
||||
toot_space_left.setText(String.valueOf(toot_content.length()));
|
||||
toot_content.setSelection(toot_content.getText().length()); //Put cursor at the end
|
||||
|
|
|
@ -196,8 +196,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
}
|
||||
max_id = apiResponse.getMax_id();
|
||||
List<Notification> notifications = apiResponse.getNotifications();
|
||||
//The initial call comes from a classic tab refresh
|
||||
flag_loading = (max_id == null );
|
||||
|
||||
if( !swiped && firstLoad && (notifications == null || notifications.size() == 0))
|
||||
textviewNoAction.setVisibility(View.VISIBLE);
|
||||
else
|
||||
|
@ -215,12 +214,20 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
MainActivity.countNewNotifications++;
|
||||
this.notifications.add(tmpNotification);
|
||||
}
|
||||
if( firstLoad) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + this.userId, notifications.get(0).getId());
|
||||
editor.apply();
|
||||
lastReadNotifications = notifications.get(0).getId();
|
||||
}
|
||||
notificationsListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
if( firstLoad )
|
||||
((MainActivity)context).updateNotifCounter();
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
firstLoad = false;
|
||||
//The initial call comes from a classic tab refresh
|
||||
flag_loading = (max_id == null );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -88,7 +88,6 @@ public class DisplayScheduledTootsFragment extends Fragment implements OnRetriev
|
|||
final PowerManager powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE);
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
//Battery saver is one and user never asked to stop showing the message
|
||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
changeDrawableColor(context, R.drawable.ic_action_warning, R.color.mastodonC4);
|
||||
changeDrawableColor(context, R.drawable.ic_cancel, R.color.mastodonC4);
|
||||
if( powerManager.isPowerSaveMode() && sharedpreferences.getBoolean(Helper.SHOW_BATTERY_SAVER_MESSAGE,true)){
|
||||
|
|
|
@ -77,6 +77,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
private String lastReadStatus;
|
||||
private String userId;
|
||||
public static ArrayList<Status> tempStatuses = new ArrayList<>();
|
||||
private int lastTotalItemCount = 0;
|
||||
|
||||
public DisplayStatusFragment(){
|
||||
}
|
||||
|
@ -119,7 +120,8 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
|
||||
behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
lastReadStatus = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, null);
|
||||
if( type == RetrieveFeedsAsyncTask.Type.HOME)
|
||||
lastReadStatus = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, null);
|
||||
lv_status = (ListView) rootView.findViewById(R.id.lv_status);
|
||||
mainLoader = (RelativeLayout) rootView.findViewById(R.id.loader);
|
||||
nextElementLoader = (RelativeLayout) rootView.findViewById(R.id.loading_next_status);
|
||||
|
@ -250,6 +252,8 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
}
|
||||
if( getActivity() != null && getActivity().getClass().isInstance(MainActivity.class))
|
||||
((MainActivity)context).updateHomeCounter();
|
||||
//Resets value for the counter but doesn't update it
|
||||
MainActivity.countNewStatus = 0;
|
||||
tempStatuses.clear();
|
||||
tempStatuses = new ArrayList<>();
|
||||
}
|
||||
|
@ -298,20 +302,38 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
lv_status.setAdapter(statusListAdapter);
|
||||
swiped = false;
|
||||
}
|
||||
|
||||
if( statuses != null && statuses.size() > 0) {
|
||||
ArrayList<String> knownId = new ArrayList<>();
|
||||
for(Status st: this.statuses){
|
||||
knownId.add(st.getId());
|
||||
}
|
||||
for(Status tmpStatus: statuses){
|
||||
if( type == RetrieveFeedsAsyncTask.Type.HOME && firstLoad && lastReadStatus != null && Long.parseLong(tmpStatus.getId()) > Long.parseLong(lastReadStatus)){
|
||||
tmpStatus.setNew(true);
|
||||
MainActivity.countNewStatus++;
|
||||
}else {
|
||||
tmpStatus.setNew(false);
|
||||
if( !knownId.contains(tmpStatus.getId())) {
|
||||
if( type == RetrieveFeedsAsyncTask.Type.HOME && firstLoad && lastReadStatus != null && Long.parseLong(tmpStatus.getId()) > Long.parseLong(lastReadStatus)){
|
||||
tmpStatus.setNew(true);
|
||||
MainActivity.countNewStatus++;
|
||||
}else {
|
||||
tmpStatus.setNew(false);
|
||||
}
|
||||
this.statuses.add(tmpStatus);
|
||||
}
|
||||
this.statuses.add(tmpStatus);
|
||||
}
|
||||
|
||||
if( firstLoad && type == RetrieveFeedsAsyncTask.Type.HOME) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, statuses.get(0).getId());
|
||||
editor.apply();
|
||||
lastReadStatus = statuses.get(0).getId();
|
||||
}
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
if( firstLoad && type == RetrieveFeedsAsyncTask.Type.HOME)
|
||||
//Display new value in counter
|
||||
try {
|
||||
((MainActivity) context).updateHomeCounter();
|
||||
}catch (Exception ignored){}
|
||||
}
|
||||
if( firstLoad && getActivity() != null && getActivity().getClass().isInstance(MainActivity.class))
|
||||
((MainActivity)context).updateHomeCounter();
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
firstLoad = false;
|
||||
|
||||
|
@ -336,7 +358,10 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
int top = (v == null) ? 0 : v.getTop();
|
||||
status.setReplies(new ArrayList<Status>());
|
||||
statuses.add(0,status);
|
||||
MainActivity.countNewStatus++;
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
if( !status.getAccount().getId().equals(userId))
|
||||
MainActivity.countNewStatus++;
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
lv_status.setSelectionFromTop(index, top);
|
||||
if (textviewNoAction.getVisibility() == View.VISIBLE)
|
||||
|
|
|
@ -418,35 +418,6 @@ public class SettingsFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
final Spinner tabs_layout_spinner = (Spinner) rootView.findViewById(R.id.tabs_layout_spinner);
|
||||
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(),
|
||||
R.array.settings_menu_tabs, android.R.layout.simple_spinner_item);
|
||||
tabs_layout_spinner.setAdapter(adapter);
|
||||
|
||||
int positionSpinner = (sharedpreferences.getInt(Helper.SET_TABS, Helper.THEME_TABS) - 1);
|
||||
tabs_layout_spinner.setSelection(positionSpinner);
|
||||
tabs_layout_spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
if( count > 0){
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_TABS, (position + 1));
|
||||
editor.apply();
|
||||
Helper.switchLayout(getActivity());
|
||||
getActivity().recreate();
|
||||
Intent intent = new Intent(context, MainActivity.class);
|
||||
intent.putExtra(INTENT_ACTION, CHANGE_THEME_INTENT);
|
||||
startActivity(intent);
|
||||
}else {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
final Spinner translation_layout_spinner = (Spinner) rootView.findViewById(R.id.translation_layout_spinner);
|
||||
ArrayAdapter<CharSequence> adapterTrans = ArrayAdapter.createFromResource(getActivity(),
|
||||
|
|
|
@ -18,13 +18,12 @@ package fr.gouv.etalab.mastodon.helper;
|
|||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.NotificationManager;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.app.DownloadManager;
|
||||
import android.app.PendingIntent;
|
||||
|
@ -66,7 +65,6 @@ import android.text.Spanned;
|
|||
import android.text.TextPaint;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -79,7 +77,6 @@ import android.webkit.MimeTypeMap;
|
|||
import android.webkit.URLUtil;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
|
@ -87,7 +84,6 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.loopj.android.http.BuildConfig;
|
||||
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
|
@ -99,17 +95,14 @@ import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
|
|||
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.InetAddress;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
@ -138,9 +131,10 @@ import fr.gouv.etalab.mastodon.asynctasks.RemoveAccountAsyncTask;
|
|||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Mention;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Notification;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Status;
|
||||
import fr.gouv.etalab.mastodon.client.PatchBaseImageDownloader;
|
||||
import fr.gouv.etalab.mastodon.fragments.DisplayNotificationsFragment;
|
||||
import fr.gouv.etalab.mastodon.fragments.DisplayStatusFragment;
|
||||
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
|
||||
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
||||
import mastodon.etalab.gouv.fr.mastodon.R;
|
||||
|
@ -160,7 +154,6 @@ public class Helper {
|
|||
@SuppressWarnings("unused")
|
||||
public static final String TAG = "mastodon_etalab";
|
||||
public static final String CLIENT_NAME_VALUE = "Mastalab";
|
||||
public static final String DEVELOPER_INSTANCE = "mastodon.etalab.gouv.fr";
|
||||
public static final String OAUTH_SCOPES = "read write follow";
|
||||
public static final String PREF_KEY_OAUTH_TOKEN = "oauth_token";
|
||||
public static final String PREF_KEY_ID = "userID";
|
||||
|
@ -205,7 +198,6 @@ public class Helper {
|
|||
public static final String SET_AUTO_STORE = "set_auto_store";
|
||||
public static final String SET_POPUP_PUSH = "set_popup_push";
|
||||
public static final String SET_NSFW_TIMEOUT = "set_nsfw_timeout";
|
||||
public static final String SET_TABS = "set_tabs";
|
||||
public static final String SET_MEDIA_URLS = "set_media_urls";
|
||||
public static final String SET_TEXT_SIZE = "set_text_size";
|
||||
public static final String SET_ICON_SIZE = "set_icon_size";
|
||||
|
@ -219,9 +211,6 @@ public class Helper {
|
|||
public static final int ATTACHMENT_ASK = 3;
|
||||
public static final int THEME_LIGHT = 1;
|
||||
public static final int THEME_DARK = 2;
|
||||
public static final int THEME_TABS = 1;
|
||||
public static final int THEME_MENU = 2;
|
||||
public static final int THEME_MENU_TABS = 3;
|
||||
|
||||
public static final int LED_COLOUR = 0;
|
||||
|
||||
|
@ -931,6 +920,7 @@ public class Helper {
|
|||
*/
|
||||
public static void changeUser(Activity activity, String userID, boolean checkItem) {
|
||||
|
||||
|
||||
final NavigationView navigationView = (NavigationView) activity.findViewById(R.id.nav_view);
|
||||
navigationView.getMenu().clear();
|
||||
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
||||
|
@ -946,6 +936,18 @@ public class Helper {
|
|||
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(false);
|
||||
}
|
||||
SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
String oldUserId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
//User wont' be the same, temp values are cleared
|
||||
if( oldUserId != null && !oldUserId.equals(userID)){
|
||||
if( DisplayStatusFragment.tempStatuses != null) {
|
||||
DisplayStatusFragment.tempStatuses.clear();
|
||||
DisplayStatusFragment.tempStatuses = new ArrayList<>();
|
||||
}
|
||||
if( DisplayNotificationsFragment.tempNotifications != null) {
|
||||
DisplayNotificationsFragment.tempNotifications.clear();
|
||||
DisplayNotificationsFragment.tempNotifications = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, account.getToken());
|
||||
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
||||
|
@ -959,12 +961,26 @@ public class Helper {
|
|||
}
|
||||
|
||||
|
||||
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap,int roundPixelSize) {
|
||||
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(output);
|
||||
final Paint paint = new Paint();
|
||||
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
|
||||
final RectF rectF = new RectF(rect);
|
||||
final float roundPx = roundPixelSize;
|
||||
paint.setAntiAlias(true);
|
||||
canvas.drawRoundRect(rectF,roundPx,roundPx, paint);
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
||||
canvas.drawBitmap(bitmap, rect, rect, paint);
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the profile picture in the current action bar
|
||||
* Load the profile picture at the place of hamburger icon
|
||||
* @param activity Activity The current activity
|
||||
* @param url String the url of the profile picture
|
||||
*/
|
||||
public static void loadPPInActionBar(final Activity activity, String url){
|
||||
public static void loadPictureIcon(final Activity activity, String url, final ImageView imageView){
|
||||
ImageLoader imageLoader;
|
||||
DisplayImageOptions options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
|
@ -973,24 +989,13 @@ public class Helper {
|
|||
url = "https://" + Helper.getLiveInstance(activity) + url;
|
||||
}
|
||||
imageLoader.loadImage(url, options, new SimpleImageLoadingListener(){
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Override
|
||||
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
||||
super.onLoadingComplete(imageUri, view, loadedImage);
|
||||
|
||||
Drawable ppDrawable;
|
||||
Toolbar toolBar = (Toolbar) activity.findViewById(R.id.toolbar);
|
||||
if( toolBar != null){
|
||||
ppDrawable = new BitmapDrawable(activity.getResources(), Bitmap.createScaledBitmap(loadedImage, (int) convertDpToPixel(25, activity), (int) convertDpToPixel(25, activity), true));
|
||||
toolBar.findViewById(R.id.pp_actionBar).setBackgroundDrawable(ppDrawable);
|
||||
}else{
|
||||
ActionBar supportActionBar = ((TootActivity) activity).getSupportActionBar();
|
||||
if( supportActionBar != null){
|
||||
ppDrawable = new BitmapDrawable(activity.getResources(), Bitmap.createScaledBitmap(loadedImage, (int) convertDpToPixel(20, activity), (int) convertDpToPixel(20, activity), true));
|
||||
supportActionBar.setIcon(ppDrawable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Resources res = activity.getResources();
|
||||
BitmapDrawable icon = new BitmapDrawable(res, getRoundedCornerBitmap(loadedImage, 150));
|
||||
imageView.setImageDrawable(icon);
|
||||
}
|
||||
@Override
|
||||
public void onLoadingFailed(java.lang.String imageUri, android.view.View view, FailReason failReason){
|
||||
|
@ -998,6 +1003,7 @@ public class Helper {
|
|||
}});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the header with the new selected account
|
||||
* @param activity Activity
|
||||
|
@ -1011,9 +1017,6 @@ public class Helper {
|
|||
|
||||
TextView username = (TextView) headerLayout.findViewById(R.id.username);
|
||||
TextView displayedName = (TextView) headerLayout.findViewById(R.id.displayedName);
|
||||
TextView ownerStatus = (TextView) headerLayout.findViewById(R.id.owner_status);
|
||||
TextView ownerFollowing = (TextView) headerLayout.findViewById(R.id.owner_following);
|
||||
TextView ownerFollowers = (TextView) headerLayout.findViewById(R.id.owner_followers);
|
||||
ImageView header_edit_profile = (ImageView) headerLayout.findViewById(R.id.header_edit_profile);
|
||||
header_edit_profile.setOnClickListener(null);
|
||||
if( account == null ) {
|
||||
|
@ -1023,9 +1026,6 @@ public class Helper {
|
|||
activity.startActivity(myIntent);
|
||||
activity.finish(); //User is logged out to get a new token
|
||||
}else {
|
||||
ownerStatus.setText(String.valueOf(account.getStatuses_count()));
|
||||
ownerFollowers.setText(String.valueOf(account.getFollowers_count()));
|
||||
ownerFollowing.setText(String.valueOf(account.getFollowing_count()));
|
||||
username.setText(String.format("@%s",account.getUsername()));
|
||||
displayedName.setText(account.getDisplay_name());
|
||||
String url = account.getAvatar();
|
||||
|
@ -1542,22 +1542,9 @@ public class Helper {
|
|||
*/
|
||||
public static void switchLayout(Activity activity){
|
||||
//Check if the class calling the method is an instance of MainActivity
|
||||
boolean isTablet = activity.getResources().getBoolean(R.bool.isTablet);
|
||||
final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int timelineLayout = sharedpreferences.getInt(Helper.SET_TABS, Helper.THEME_TABS);
|
||||
final NavigationView navigationView = (NavigationView) activity.findViewById(R.id.nav_view);
|
||||
|
||||
android.support.design.widget.TabLayout tableLayout = (android.support.design.widget.TabLayout) activity.findViewById(R.id.tabLayout);
|
||||
LinearLayout toolbar_search_container = (LinearLayout) activity.findViewById(R.id.toolbar_search_container);
|
||||
ViewGroup.LayoutParams params = toolbar_search_container.getLayoutParams();
|
||||
int heightSearchdp, heightSearchdpAlone;
|
||||
if( !isTablet){
|
||||
heightSearchdp = 40;
|
||||
heightSearchdpAlone = 60;
|
||||
}else {
|
||||
heightSearchdp = 40;
|
||||
heightSearchdpAlone = 60;
|
||||
}
|
||||
String userID = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
Account account = new AccountDAO(activity,db).getAccountByID(userID);
|
||||
|
@ -1570,37 +1557,7 @@ public class Helper {
|
|||
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(false);
|
||||
}
|
||||
}
|
||||
if( navigationView.getMenu().findItem(R.id.nav_home) != null){
|
||||
switch (timelineLayout){
|
||||
case Helper.THEME_TABS:
|
||||
navigationView.getMenu().findItem(R.id.nav_home).setVisible(false);
|
||||
navigationView.getMenu().findItem(R.id.nav_local).setVisible(false);
|
||||
navigationView.getMenu().findItem(R.id.nav_global).setVisible(false);
|
||||
navigationView.getMenu().findItem(R.id.nav_notification).setVisible(false);
|
||||
params.height = (int) Helper.convertDpToPixel(heightSearchdp, activity);
|
||||
toolbar_search_container.setLayoutParams(params);
|
||||
tableLayout.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case Helper.THEME_MENU:
|
||||
navigationView.getMenu().findItem(R.id.nav_home).setVisible(true);
|
||||
navigationView.getMenu().findItem(R.id.nav_local).setVisible(true);
|
||||
navigationView.getMenu().findItem(R.id.nav_global).setVisible(true);
|
||||
navigationView.getMenu().findItem(R.id.nav_notification).setVisible(true);
|
||||
params.height = (int) Helper.convertDpToPixel(heightSearchdpAlone, activity);;
|
||||
toolbar_search_container.setLayoutParams(params);
|
||||
tableLayout.setVisibility(View.GONE);
|
||||
break;
|
||||
case Helper.THEME_MENU_TABS:
|
||||
navigationView.getMenu().findItem(R.id.nav_home).setVisible(true);
|
||||
navigationView.getMenu().findItem(R.id.nav_local).setVisible(true);
|
||||
navigationView.getMenu().findItem(R.id.nav_global).setVisible(true);
|
||||
navigationView.getMenu().findItem(R.id.nav_notification).setVisible(true);
|
||||
params.height = (int) Helper.convertDpToPixel(heightSearchdp, activity);
|
||||
toolbar_search_container.setLayoutParams(params);
|
||||
tableLayout.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
tableLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1637,7 +1594,7 @@ public class Helper {
|
|||
paint.setStrokeWidth(12);
|
||||
paint.setTextSize(30);
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
|
||||
canvas.drawText("Via #Mastalab", view.getWidth()-230, view.getHeight() - 35, paint);
|
||||
canvas.drawText("Via #Mastalab", view.getWidth()-230, view.getHeight() - 5, paint);
|
||||
|
||||
if( new_element != null)
|
||||
new_element.setVisibility(new_element_v);
|
||||
|
|
After Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 353 B |
After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 112 B |
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 247 B |
After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 439 B |
After Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 646 B |
After Width: | Height: | Size: 315 B |
Before Width: | Height: | Size: 416 B After Width: | Height: | Size: 1.5 KiB |
|
@ -15,179 +15,185 @@
|
|||
You should have received a copy of the GNU General Public License along with Mastalab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<!-- About app name -->
|
||||
<TextView
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="22sp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/app_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- About version -->
|
||||
<TextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/about_version"
|
||||
android:textSize="18sp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- About developer -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|center_horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:clickable="true"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp"
|
||||
android:text="@string/about_developer"
|
||||
android:textColor="@color/mastodonC4"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<fr.gouv.etalab.mastodon.helper.ExpandableHeightListView
|
||||
android:id="@+id/lv_developers"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|center_horizontal"
|
||||
android:layout_marginLeft="150dp"
|
||||
android:layout_marginRight="150dp"
|
||||
android:divider="@null"
|
||||
android:scrollbars="none"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_thanks_dev"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|center_horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp"
|
||||
android:text="@string/thanks_text_dev"
|
||||
android:textColor="@color/mastodonC4"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<fr.gouv.etalab.mastodon.helper.ExpandableHeightListView
|
||||
android:id="@+id/lv_contributors"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|center_horizontal"
|
||||
android:layout_marginLeft="150dp"
|
||||
android:layout_marginRight="150dp"
|
||||
android:divider="@null"
|
||||
android:scrollbars="none"/>
|
||||
|
||||
<!-- About license -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<!-- About app name -->
|
||||
<TextView
|
||||
android:text="@string/about_license"
|
||||
android:textSize="18sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/about_license"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about_license_action"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- About license -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="18sp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/about_code"
|
||||
android:textSize="16sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/about_code"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about_code_action"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<!-- About The Kinrar's API -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:textSize="18sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:layout_width="200dp"
|
||||
android:text="@string/about_thekinrar"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/about_thekinrar"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about_thekinrar_action"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- About translation -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="18sp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/about_yandex"
|
||||
android:textSize="16sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/about_translation"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about_yandex_action"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/thanks_text"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="22sp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/app_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- About version -->
|
||||
<TextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/about_version"
|
||||
android:textSize="18sp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- About developer -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|center_horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:clickable="true"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp"
|
||||
android:text="@string/about_developer"
|
||||
android:textColor="@color/mastodonC4"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<fr.gouv.etalab.mastodon.helper.ExpandableHeightListView
|
||||
android:id="@+id/lv_developers"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|center_horizontal"
|
||||
android:layout_marginLeft="150dp"
|
||||
android:layout_marginRight="150dp"
|
||||
android:divider="@null"
|
||||
android:scrollbars="none"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_thanks_dev"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|center_horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp"
|
||||
android:text="@string/thanks_text_dev"
|
||||
android:textColor="@color/mastodonC4"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<fr.gouv.etalab.mastodon.helper.ExpandableHeightListView
|
||||
android:id="@+id/lv_contributors"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|center_horizontal"
|
||||
android:layout_marginLeft="150dp"
|
||||
android:layout_marginRight="150dp"
|
||||
android:divider="@null"
|
||||
android:scrollbars="none"/>
|
||||
|
||||
<!-- About license -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/about_license"
|
||||
android:textSize="18sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/about_license"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about_license_action"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- About license -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="18sp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/about_code"
|
||||
android:textSize="16sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/about_code"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about_code_action"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<!-- About The Kinrar's API -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:textSize="18sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:layout_width="200dp"
|
||||
android:text="@string/about_thekinrar"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/about_thekinrar"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about_thekinrar_action"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- About translation -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="18sp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/about_yandex"
|
||||
android:textSize="16sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/about_translation"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about_yandex_action"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/thanks_text"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -1,82 +0,0 @@
|
|||
<?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>.
|
||||
-->
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<!-- Listview status -->
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/swipeContainer"
|
||||
android:layout_height="match_parent">
|
||||
<ListView
|
||||
android:id="@+id/lv_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
android:divider="@null"
|
||||
>
|
||||
</ListView>
|
||||
</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/no_status"
|
||||
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>
|
|
@ -1,141 +0,0 @@
|
|||
<?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.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"
|
||||
tools:openDrawer="start">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="mastodon.etalab.gouv.fr.mastodon.fr.etalab.gouv.fr.mastodon.activities.MainActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
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="match_parent"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="?attr/popupOverlay">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/toolbar_search_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pp_actionBar"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:gravity="center_vertical"
|
||||
tools:ignore="ContentDescription"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toolbar_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<android.support.v7.widget.SearchView
|
||||
android:id="@+id/toolbar_search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@null"
|
||||
android:gravity="end"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.Toolbar>
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
app:tabGravity="fill"
|
||||
app:tabMaxWidth="0dp"
|
||||
app:tabSelectedTextColor="?attr/colorAccent"/>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
||||
|
||||
<!-- Framelayout to display Fragments -->
|
||||
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/viewpager"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="mastodon.etalab.gouv.fr.mastodon.fr.etalab.gouv.fr.mastodon.activities.MainActivity"
|
||||
>
|
||||
</android.support.v4.view.ViewPager>
|
||||
|
||||
<!-- Framelayout to display Fragments -->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/main_app_container"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="mastodon.etalab.gouv.fr.mastodon.fr.etalab.gouv.fr.mastodon.activities.MainActivity"
|
||||
>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/toot"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:srcCompat="@drawable/ic_action_edit" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<android.support.design.widget.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
app:headerLayout="@layout/nav_header_main"
|
||||
app:menu="@menu/activity_main_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
|
@ -1,64 +0,0 @@
|
|||
<?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>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<ListView
|
||||
android:id="@+id/lv_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
android:divider="@null"
|
||||
>
|
||||
</ListView>
|
||||
<RelativeLayout
|
||||
android:id="@+id/no_result"
|
||||
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/no_result"
|
||||
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>
|
||||
</LinearLayout>
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Framelayout to display Fragments -->
|
||||
<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:paddingTop="@dimen/activity_vertical_margin"
|
||||
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.ShowConversationActivity"
|
||||
>
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/swipeContainer"
|
||||
android:layout_height="match_parent">
|
||||
<ListView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/lv_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
android:divider="@null" />
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
<!-- Main Loader -->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/loader"
|
||||
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>
|
||||
</RelativeLayout>
|
|
@ -1,84 +0,0 @@
|
|||
<?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>.
|
||||
-->
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<!-- Listview Accounts -->
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/swipeContainer"
|
||||
android:layout_height="match_parent">
|
||||
<ListView
|
||||
android:id="@+id/lv_accounts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
android:divider="@null"
|
||||
>
|
||||
</ListView>
|
||||
</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:id="@+id/no_action_text"
|
||||
android:padding="10dp"
|
||||
android:gravity="center"
|
||||
android:textSize="25sp"
|
||||
android:layout_gravity="center"
|
||||
android:textStyle="italic|bold"
|
||||
android:typeface="serif"
|
||||
android:text="@string/no_accounts"
|
||||
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 accounts -->
|
||||
<RelativeLayout
|
||||
android:id="@+id/loading_next_accounts"
|
||||
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>
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
<?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>.
|
||||
-->
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<!-- Listview Notifications -->
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/swipeContainer"
|
||||
android:layout_height="match_parent">
|
||||
<ListView
|
||||
android:id="@+id/lv_notifications"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
android:divider="@null"
|
||||
>
|
||||
</ListView>
|
||||
</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/no_notifications"
|
||||
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 notifications -->
|
||||
<RelativeLayout
|
||||
android:id="@+id/loading_next_notifications"
|
||||
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>
|
||||
|
|
@ -289,26 +289,6 @@
|
|||
android:layout_height="wrap_content">
|
||||
</SeekBar>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- TABS Layout -->
|
||||
<LinearLayout
|
||||
android:id="@+id/tabs_layout_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settings_ui_layout"/>
|
||||
<Spinner
|
||||
android:id="@+id/tabs_layout_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
<?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>.
|
||||
-->
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<!-- Listview status -->
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/swipeContainer"
|
||||
android:layout_height="match_parent">
|
||||
<ListView
|
||||
android:id="@+id/lv_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
android:divider="@null" />
|
||||
</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/no_status"
|
||||
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>
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
<?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>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
<ImageView
|
||||
android:id="@+id/tab_icon"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp" />
|
||||
<TextView
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:id="@+id/tab_counter"
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"
|
||||
android:minWidth="30dp"
|
||||
android:minHeight="30dp"
|
||||
android:textColor="@color/mastodonC1"
|
||||
android:background="@drawable/shape_counter"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
|
@ -1,39 +0,0 @@
|
|||
<?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.design.widget.AppBarLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@null"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
app:tabGravity="fill"
|
||||
app:tabMaxWidth="0dp"
|
||||
/>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
|
@ -31,6 +31,7 @@
|
|||
tools:context="mastodon.etalab.gouv.fr.mastodon.fr.etalab.gouv.fr.mastodon.activities.MainActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay"
|
||||
|
@ -42,27 +43,35 @@
|
|||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
app:popupTheme="?attr/popupOverlay">
|
||||
<ImageView
|
||||
android:id="@+id/iconbar"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<LinearLayout
|
||||
android:id="@+id/toolbar_search_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:orientation="horizontal">
|
||||
<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_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:visibility="gone"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:id="@+id/toolbar_title" />
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
app:tabGravity="fill"
|
||||
app:tabMaxWidth="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabSelectedTextColor="?attr/colorAccent"
|
||||
/>
|
||||
<android.support.v7.widget.SearchView
|
||||
android:background="@null"
|
||||
android:id="@+id/toolbar_search"
|
||||
|
@ -72,12 +81,7 @@
|
|||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.Toolbar>
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
app:tabSelectedTextColor="?attr/colorAccent"
|
||||
/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
||||
|
@ -123,7 +127,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
android:fitsSystemWindows="false"
|
||||
app:headerLayout="@layout/nav_header_main"
|
||||
app:menu="@menu/activity_main_drawer" />
|
||||
|
||||
|
|
|
@ -289,26 +289,6 @@
|
|||
android:layout_height="wrap_content">
|
||||
</SeekBar>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- TABS Layout -->
|
||||
<LinearLayout
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:id="@+id/tabs_layout_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settings_ui_layout"/>
|
||||
<Spinner
|
||||
android:id="@+id/tabs_layout_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
android:layout_height="match_parent">
|
||||
<ListView
|
||||
android:id="@+id/lv_status"
|
||||
android:transcriptMode="normal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
|
|
|
@ -21,131 +21,75 @@
|
|||
android:layout_height="@dimen/nav_header_height"
|
||||
style="?attr/headerbg"
|
||||
android:id="@+id/main_header_container"
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/activity_horizontal_margin"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/profilePicture"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<ImageView
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/profilePicture"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<LinearLayout
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/owner_container"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/displayedName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
<ImageView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:id="@+id/owner_accounts"
|
||||
android:layout_width="30dp"
|
||||
android:src="@drawable/ic_arrow_drop_down"
|
||||
android:layout_height="30dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/username"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
android:src="@drawable/ic_action_edit"
|
||||
android:id="@+id/header_edit_profile"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:baselineAligned="false">
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="2dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/toots"
|
||||
android:textSize="12sp"
|
||||
android:maxLines="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:textSize="12sp"
|
||||
android:id="@+id/owner_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="2dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:textSize="12sp"
|
||||
android:maxLines="1"
|
||||
android:text="@string/following"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:textSize="12sp"
|
||||
android:id="@+id/owner_following"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:padding="2dp"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:maxLines="1"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/followers"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:textSize="12sp"
|
||||
android:id="@+id/owner_followers"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
tools:ignore="UselessLeaf" />
|
||||
<ImageView
|
||||
android:gravity="center_vertical|end"
|
||||
android:src="@drawable/ic_more_white"
|
||||
android:id="@+id/header_option_menu"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:src="@drawable/ic_action_edit"
|
||||
android:id="@+id/header_edit_profile"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<LinearLayout
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
<TextView
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:id="@+id/displayedName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
<ImageView
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:id="@+id/owner_accounts"
|
||||
android:layout_width="30dp"
|
||||
android:src="@drawable/ic_arrow_drop_down"
|
||||
android:layout_height="30dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:id="@+id/username"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -15,27 +15,30 @@
|
|||
You should have received a copy of the GNU General Public License along with Mastalab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical">
|
||||
<ImageView
|
||||
android:id="@+id/tab_icon"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:id="@+id/tab_counter"
|
||||
android:visibility="gone"
|
||||
android:paddingLeft="2dp"
|
||||
android:paddingRight="2dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:gravity="center"
|
||||
android:textSize="10sp"
|
||||
android:minWidth="20dp"
|
||||
android:minHeight="20dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/mastodonC1"
|
||||
android:background="@drawable/shape_counter"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/tab_icon"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</RelativeLayout>
|
|
@ -25,16 +25,15 @@
|
|||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabMaxWidth="0dp"
|
||||
app:tabMode="scrollable"
|
||||
app:tabGravity="fill"
|
||||
app:tabMaxWidth="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
|
@ -11,22 +11,6 @@
|
|||
android:id="@+id/menu_none"
|
||||
android:title=""
|
||||
android:visible="false"/>
|
||||
<item
|
||||
android:id="@+id/nav_home"
|
||||
android:icon="@drawable/ic_action_home"
|
||||
android:title="@string/home_menu" />
|
||||
<item
|
||||
android:id="@+id/nav_local"
|
||||
android:icon="@drawable/ic_action_users"
|
||||
android:title="@string/local_menu" />
|
||||
<item
|
||||
android:id="@+id/nav_global"
|
||||
android:icon="@drawable/ic_action_globe_menu"
|
||||
android:title="@string/global_menu" />
|
||||
<item
|
||||
android:id="@+id/nav_notification"
|
||||
android:icon="@drawable/ic_notifications"
|
||||
android:title="@string/notifications" />
|
||||
<item
|
||||
android:id="@+id/nav_scheduled"
|
||||
android:icon="@drawable/ic_schedule_black"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="activity_padding_header">10dp</dimen>
|
||||
<dimen name="nav_header_vertical_spacing">16dp</dimen>
|
||||
<dimen name="nav_header_height">160dp</dimen>
|
||||
<dimen name="nav_header_height">170dp</dimen>
|
||||
<dimen name="fab_margin">5dp</dimen>
|
||||
<dimen name="drawer_padding">2dp</dimen>
|
||||
<dimen name="toot_padding">20dp</dimen>
|
||||
|
|
|
@ -21,10 +21,10 @@ import android.content.SharedPreferences;
|
|||
import android.graphics.Paint;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -101,7 +101,9 @@ public class LoginActivity extends AppCompatActivity implements ProviderInstalle
|
|||
final Button connectionButton = (Button) findViewById(R.id.login_button);
|
||||
login_instance = (AutoCompleteTextView) findViewById(R.id.login_instance);
|
||||
|
||||
|
||||
if( theme == Helper.THEME_LIGHT) {
|
||||
connectionButton.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.white));
|
||||
}
|
||||
login_instance.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
|
|
@ -36,9 +36,11 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.util.Patterns;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.support.design.widget.NavigationView;
|
||||
|
@ -47,7 +49,6 @@ import android.support.v4.widget.DrawerLayout;
|
|||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ImageView;
|
||||
|
@ -109,7 +110,6 @@ import static fr.gouv.etalab.mastodon.helper.Helper.NOTIFICATION_INTENT;
|
|||
import static fr.gouv.etalab.mastodon.helper.Helper.PREF_KEY_ID;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.changeUser;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.loadPPInActionBar;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.menuAccounts;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.unCheckAllMenuItems;
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.updateHeaderAccountInfo;
|
||||
|
@ -123,7 +123,6 @@ public class MainActivity extends AppCompatActivity
|
|||
private HashMap<String, String> tagTile = new HashMap<>();
|
||||
private HashMap<String, Integer> tagItem = new HashMap<>();
|
||||
private TextView toolbarTitle;
|
||||
private ImageView pp_actionBar;
|
||||
private SearchView toolbar_search;
|
||||
private ImageLoader imageLoader;
|
||||
private DisplayImageOptions options;
|
||||
|
@ -143,6 +142,7 @@ public class MainActivity extends AppCompatActivity
|
|||
public static int countNewNotifications = 0;
|
||||
private String userIdService;
|
||||
private Intent streamingIntent;
|
||||
public static boolean broadCastRegistred = false;
|
||||
|
||||
public MainActivity() {
|
||||
}
|
||||
|
@ -192,8 +192,11 @@ public class MainActivity extends AppCompatActivity
|
|||
};
|
||||
streamingIntent = new Intent(this, StreamingService.class);
|
||||
startService(streamingIntent);
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(receive_data, new IntentFilter(Helper.RECEIVE_DATA));
|
||||
|
||||
if( !broadCastRegistred) {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(receive_data, new IntentFilter(Helper.RECEIVE_DATA));
|
||||
broadCastRegistred = true;
|
||||
}
|
||||
|
||||
ProviderInstaller.installIfNeededAsync(this, this);
|
||||
|
||||
|
@ -220,10 +223,9 @@ public class MainActivity extends AppCompatActivity
|
|||
Helper.canPin = false;
|
||||
Helper.fillMapEmoji(getApplicationContext());
|
||||
//Here, the user is authenticated
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
toolbarTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
|
||||
pp_actionBar = (ImageView) toolbar.findViewById(R.id.pp_actionBar);
|
||||
toolbar_search = (SearchView) toolbar.findViewById(R.id.toolbar_search);
|
||||
tabLayout = (TabLayout) findViewById(R.id.tabLayout);
|
||||
TabLayout.Tab tabHome = tabLayout.newTab();
|
||||
|
@ -295,34 +297,9 @@ public class MainActivity extends AppCompatActivity
|
|||
} else {
|
||||
stackBack.push(tab.getPosition());
|
||||
}
|
||||
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
MenuItem item = null;
|
||||
String fragmentTag = null;
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
Helper.switchLayout(MainActivity.this);
|
||||
if( tab.getPosition() == 0) {
|
||||
item = navigationView.getMenu().findItem(R.id.nav_home);
|
||||
fragmentTag = "HOME_TIMELINE";
|
||||
}else if( tab.getPosition() == 1) {
|
||||
fragmentTag = "NOTIFICATIONS";
|
||||
item = navigationView.getMenu().findItem(R.id.nav_notification);
|
||||
}else if( tab.getPosition() == 2 && display_local) {
|
||||
fragmentTag = "LOCAL_TIMELINE";
|
||||
item = navigationView.getMenu().findItem(R.id.nav_local);
|
||||
}else if( tab.getPosition() == 2 && !display_local) {
|
||||
item = navigationView.getMenu().findItem(R.id.nav_global);
|
||||
fragmentTag = "PUBLIC_TIMELINE";
|
||||
}else if( tab.getPosition() == 3){
|
||||
item = navigationView.getMenu().findItem(R.id.nav_global);
|
||||
fragmentTag = "PUBLIC_TIMELINE";
|
||||
}
|
||||
if( item != null){
|
||||
toolbarTitle.setText(item.getTitle());
|
||||
populateTitleWithTag(fragmentTag, item.getTitle().toString(), item.getItemId());
|
||||
unCheckAllMenuItems(navigationView);
|
||||
item.setChecked(true);
|
||||
}
|
||||
if( tab.getPosition() != 1 )
|
||||
toot.setVisibility(View.VISIBLE);
|
||||
else
|
||||
|
@ -383,26 +360,25 @@ public class MainActivity extends AppCompatActivity
|
|||
toolbarTitle.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
|
||||
if( navigationView.getMenu().findItem(R.id.nav_favorites).isChecked()){
|
||||
if( navigationView.getMenu().findItem(R.id.nav_favorites) != null && navigationView.getMenu().findItem(R.id.nav_favorites).isChecked()){
|
||||
DisplayStatusFragment faveFrag = (DisplayStatusFragment) fragmentManager.findFragmentByTag("FAVOURITES");
|
||||
if (faveFrag != null && faveFrag.isVisible()) {
|
||||
faveFrag.scrollToTop();
|
||||
}
|
||||
} else if (navigationView.getMenu().findItem(R.id.nav_blocked).isChecked()) {
|
||||
} else if (navigationView.getMenu().findItem(R.id.nav_blocked) != null && navigationView.getMenu().findItem(R.id.nav_blocked).isChecked()) {
|
||||
DisplayAccountsFragment blockFrag = (DisplayAccountsFragment) fragmentManager.findFragmentByTag("BLOCKS");
|
||||
|
||||
if (blockFrag != null && blockFrag.isVisible()) {
|
||||
blockFrag.scrollToTop();
|
||||
}
|
||||
} else if (navigationView.getMenu().findItem(R.id.nav_muted).isChecked()) {
|
||||
} else if (navigationView.getMenu().findItem(R.id.nav_muted) != null && navigationView.getMenu().findItem(R.id.nav_muted).isChecked()) {
|
||||
DisplayAccountsFragment muteFrag = (DisplayAccountsFragment) fragmentManager.findFragmentByTag("MUTED");
|
||||
|
||||
if (muteFrag != null && muteFrag.isVisible()) {
|
||||
muteFrag.scrollToTop();
|
||||
}
|
||||
//Scroll to top when top bar is clicked (THEME_MENU only)
|
||||
} else if (Helper.THEME_MENU == sharedpreferences.getInt(Helper.SET_TABS, Helper.THEME_TABS)) {
|
||||
} else {
|
||||
int pos = tabLayout.getSelectedTabPosition();
|
||||
Fragment fragment = (Fragment) viewPager.getAdapter().instantiateItem(viewPager, pos);
|
||||
switch (pos) {
|
||||
|
@ -435,8 +411,17 @@ public class MainActivity extends AppCompatActivity
|
|||
startActivity(intent);
|
||||
toolbar_search.setQuery("", false);
|
||||
toolbar_search.setIconified(true);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.VISIBLE);
|
||||
if( main_app_container.getVisibility() == View.VISIBLE){
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
|
@ -450,8 +435,17 @@ public class MainActivity extends AppCompatActivity
|
|||
toolbar_search.setOnCloseListener(new SearchView.OnCloseListener() {
|
||||
@Override
|
||||
public boolean onClose() {
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.VISIBLE);
|
||||
if( main_app_container.getVisibility() == View.VISIBLE){
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
}
|
||||
//your code here
|
||||
return false;
|
||||
}
|
||||
|
@ -460,11 +454,20 @@ public class MainActivity extends AppCompatActivity
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
if( toolbar_search.isIconified()){
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.VISIBLE);
|
||||
if( main_app_container.getVisibility() == View.VISIBLE){
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
}
|
||||
}else {
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
pp_actionBar.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -484,14 +487,8 @@ public class MainActivity extends AppCompatActivity
|
|||
}
|
||||
});
|
||||
|
||||
final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
drawer.addDrawerListener(toggle);
|
||||
toggle.syncState();
|
||||
|
||||
|
||||
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
Account account = new AccountDAO(getApplicationContext(), db).getAccountByID(userId);
|
||||
|
||||
//Image loader configuration
|
||||
imageLoader = ImageLoader.getInstance();
|
||||
|
@ -507,13 +504,157 @@ public class MainActivity extends AppCompatActivity
|
|||
options = new DisplayImageOptions.Builder().displayer(new RoundedBitmapDisplayer(90)).cacheInMemory(false)
|
||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
|
||||
final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
|
||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
toggle.setDrawerIndicatorEnabled(false);
|
||||
ImageView iconbar = (ImageView) toolbar.findViewById(R.id.iconbar);
|
||||
iconbar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
drawer.openDrawer(Gravity.START);
|
||||
}
|
||||
});
|
||||
Helper.loadPictureIcon(MainActivity.this, account.getAvatar(),iconbar);
|
||||
headerLayout = navigationView.getHeaderView(0);
|
||||
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
Account account = new AccountDAO(getApplicationContext(), db).getAccountByID(userId);
|
||||
final ImageView menuMore = (ImageView) headerLayout.findViewById(R.id.header_option_menu);
|
||||
menuMore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
PopupMenu popup = new PopupMenu(MainActivity.this, menuMore);
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.main, popup.getMenu());
|
||||
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_logout:
|
||||
Helper.logout(getApplicationContext());
|
||||
Intent myIntent = new Intent(MainActivity.this, LoginActivity.class);
|
||||
startActivity(myIntent);
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_about:
|
||||
Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.action_privacy:
|
||||
intent = new Intent(getApplicationContext(), PrivacyActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.action_about_instance:
|
||||
intent = new Intent(getApplicationContext(), InstanceActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.action_cache:
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setTitle(R.string.cache_title);
|
||||
long sizeCache = Helper.cacheSize(getCacheDir());
|
||||
float cacheSize = 0;
|
||||
if( sizeCache > 0 ) {
|
||||
if (sizeCache > 0) {
|
||||
cacheSize = (float) sizeCache / 1000000.0f;
|
||||
}
|
||||
}
|
||||
final float finalCacheSize = cacheSize;
|
||||
builder.setMessage(getString(R.string.cache_message, String.format("%s %s", String.format(Locale.getDefault(), "%.2f", cacheSize), getString(R.string.cache_units))))
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// continue with delete
|
||||
try {
|
||||
String path = getCacheDir().getPath();
|
||||
File dir = new File(path);
|
||||
if (dir.isDirectory()) {
|
||||
Helper.deleteDir(dir);
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
Toast.makeText(MainActivity.this, getString(R.string.toast_cache_clear,String.format("%s %s", String.format(Locale.getDefault(), "%.2f", finalCacheSize), getString(R.string.cache_units))), Toast.LENGTH_LONG).show();
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
return true;
|
||||
case R.id.action_size:
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int textSize = sharedpreferences.getInt(Helper.SET_TEXT_SIZE,110);
|
||||
int iconSize = sharedpreferences.getInt(Helper.SET_ICON_SIZE,130);
|
||||
|
||||
builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setTitle(R.string.text_size);
|
||||
|
||||
@SuppressLint("InflateParams") View popup_quick_settings = getLayoutInflater().inflate( R.layout.popup_text_size, null );
|
||||
builder.setView(popup_quick_settings);
|
||||
|
||||
SeekBar set_text_size = (SeekBar) popup_quick_settings.findViewById(R.id.set_text_size);
|
||||
SeekBar set_icon_size = (SeekBar) popup_quick_settings.findViewById(R.id.set_icon_size);
|
||||
final TextView set_text_size_value = (TextView) popup_quick_settings.findViewById(R.id.set_text_size_value);
|
||||
final TextView set_icon_size_value = (TextView) popup_quick_settings.findViewById(R.id.set_icon_size_value);
|
||||
set_text_size_value.setText(String.format("%s%%",String.valueOf(textSize)));
|
||||
set_icon_size_value.setText(String.format("%s%%",String.valueOf(iconSize)));
|
||||
|
||||
set_text_size.setMax(20);
|
||||
set_icon_size.setMax(20);
|
||||
|
||||
set_text_size.setProgress(((textSize-80)/5));
|
||||
set_icon_size.setProgress(((iconSize-80)/5));
|
||||
|
||||
set_text_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
|
||||
int value = 80 + progress*5;
|
||||
set_text_size_value.setText(String.format("%s%%",String.valueOf(value)));
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_TEXT_SIZE, value);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
set_icon_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
int value = 80 + progress*5;
|
||||
set_icon_size_value.setText(String.format("%s%%",String.valueOf(value)));
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_ICON_SIZE, value);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
MainActivity.this.recreate();
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
updateHeaderAccountInfo(MainActivity.this, account, headerLayout, imageLoader, options);
|
||||
loadPPInActionBar(MainActivity.this, account.getAvatar());
|
||||
//Locked account can see follow request
|
||||
if (account.isLocked()) {
|
||||
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(true);
|
||||
|
@ -521,19 +662,15 @@ public class MainActivity extends AppCompatActivity
|
|||
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(false);
|
||||
}
|
||||
|
||||
LinearLayout owner_container = (LinearLayout) headerLayout.findViewById(R.id.owner_container);
|
||||
LinearLayout owner_container = (LinearLayout) headerLayout.findViewById(R.id.main_header_container);
|
||||
owner_container.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
menuAccounts(MainActivity.this);
|
||||
}
|
||||
});
|
||||
boolean matchingIntent = mamageNewIntent(getIntent());
|
||||
if (savedInstanceState == null && !matchingIntent) {
|
||||
navigationView.setCheckedItem(R.id.nav_home);
|
||||
navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0);
|
||||
toolbarTitle.setText(R.string.home_menu);
|
||||
}
|
||||
|
||||
|
||||
|
||||
boolean popupShown = sharedpreferences.getBoolean(Helper.SET_POPUP_PUSH, false);
|
||||
if(!popupShown){
|
||||
|
@ -618,9 +755,6 @@ public class MainActivity extends AppCompatActivity
|
|||
matchingIntent = true;
|
||||
}else if( extras.getInt(INTENT_ACTION) == CHANGE_USER_INTENT){
|
||||
unCheckAllMenuItems(navigationView);
|
||||
navigationView.setCheckedItem(R.id.nav_home);
|
||||
navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0);
|
||||
toolbarTitle.setText(R.string.home_menu);
|
||||
matchingIntent = true;
|
||||
}
|
||||
}else if( Intent.ACTION_SEND.equals(action) && type != null ) {
|
||||
|
@ -707,9 +841,11 @@ public class MainActivity extends AppCompatActivity
|
|||
super.onBackPressed();
|
||||
}
|
||||
}else {
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
Helper.switchLayout(MainActivity.this);
|
||||
main_app_container.setVisibility(View.GONE);
|
||||
viewPager.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setVisibility(View.GONE);
|
||||
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
unCheckAllMenuItems(navigationView);
|
||||
toot.setVisibility(View.VISIBLE);
|
||||
|
@ -742,22 +878,8 @@ public class MainActivity extends AppCompatActivity
|
|||
changeDrawableColor(getApplicationContext(), R.drawable.ic_translate,R.color.white);
|
||||
}
|
||||
switch (viewPager.getCurrentItem()){
|
||||
case 0:
|
||||
toolbarTitle.setText(R.string.home_menu);
|
||||
navigationView.getMenu().findItem(R.id.nav_home).setChecked(true);
|
||||
break;
|
||||
case 1:
|
||||
toot.setVisibility(View.GONE);
|
||||
toolbarTitle.setText(R.string.notifications);
|
||||
navigationView.getMenu().findItem(R.id.nav_notification).setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
toolbarTitle.setText(R.string.local_menu);
|
||||
navigationView.getMenu().findItem(R.id.nav_local).setChecked(true);
|
||||
break;
|
||||
case 3:
|
||||
toolbarTitle.setText(R.string.global_menu);
|
||||
navigationView.getMenu().findItem(R.id.nav_global).setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -766,136 +888,6 @@ public class MainActivity extends AppCompatActivity
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if(id == R.id.action_logout) {
|
||||
Helper.logout(getApplicationContext());
|
||||
Intent myIntent = new Intent(MainActivity.this, LoginActivity.class);
|
||||
startActivity(myIntent);
|
||||
finish();
|
||||
return true;
|
||||
}else if(id == R.id.action_about){
|
||||
Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
|
||||
startActivity(intent);
|
||||
}else if(id == R.id.action_privacy){
|
||||
Intent intent = new Intent(getApplicationContext(), PrivacyActivity.class);
|
||||
startActivity(intent);
|
||||
}else if(id == R.id.action_about_instance){
|
||||
Intent intent = new Intent(getApplicationContext(), InstanceActivity.class);
|
||||
startActivity(intent);
|
||||
} else if( id == R.id.action_cache){ //Cache clear feature
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setTitle(R.string.cache_title);
|
||||
long sizeCache = Helper.cacheSize(getCacheDir());
|
||||
float cacheSize = 0;
|
||||
if( sizeCache > 0 ) {
|
||||
if (sizeCache > 0) {
|
||||
cacheSize = (float) sizeCache / 1000000.0f;
|
||||
}
|
||||
}
|
||||
final float finalCacheSize = cacheSize;
|
||||
builder.setMessage(getString(R.string.cache_message, String.format("%s %s", String.format(Locale.getDefault(), "%.2f", cacheSize), getString(R.string.cache_units))))
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// continue with delete
|
||||
try {
|
||||
String path = getCacheDir().getPath();
|
||||
File dir = new File(path);
|
||||
if (dir.isDirectory()) {
|
||||
Helper.deleteDir(dir);
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
Toast.makeText(MainActivity.this, getString(R.string.toast_cache_clear,String.format("%s %s", String.format(Locale.getDefault(), "%.2f", finalCacheSize), getString(R.string.cache_units))), Toast.LENGTH_LONG).show();
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
}else if( id == R.id.action_size){
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int textSize = sharedpreferences.getInt(Helper.SET_TEXT_SIZE,110);
|
||||
int iconSize = sharedpreferences.getInt(Helper.SET_ICON_SIZE,130);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setTitle(R.string.text_size);
|
||||
|
||||
@SuppressLint("InflateParams") View popup_quick_settings = getLayoutInflater().inflate( R.layout.popup_text_size, null );
|
||||
builder.setView(popup_quick_settings);
|
||||
|
||||
SeekBar set_text_size = (SeekBar) popup_quick_settings.findViewById(R.id.set_text_size);
|
||||
SeekBar set_icon_size = (SeekBar) popup_quick_settings.findViewById(R.id.set_icon_size);
|
||||
final TextView set_text_size_value = (TextView) popup_quick_settings.findViewById(R.id.set_text_size_value);
|
||||
final TextView set_icon_size_value = (TextView) popup_quick_settings.findViewById(R.id.set_icon_size_value);
|
||||
set_text_size_value.setText(String.format("%s%%",String.valueOf(textSize)));
|
||||
set_icon_size_value.setText(String.format("%s%%",String.valueOf(iconSize)));
|
||||
|
||||
set_text_size.setMax(20);
|
||||
set_icon_size.setMax(20);
|
||||
|
||||
set_text_size.setProgress(((textSize-80)/5));
|
||||
set_icon_size.setProgress(((iconSize-80)/5));
|
||||
|
||||
set_text_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
|
||||
int value = 80 + progress*5;
|
||||
set_text_size_value.setText(String.format("%s%%",String.valueOf(value)));
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_TEXT_SIZE, value);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
set_icon_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
int value = 80 + progress*5;
|
||||
set_icon_size_value.setText(String.format("%s%%",String.valueOf(value)));
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putInt(Helper.SET_ICON_SIZE, value);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
MainActivity.this.recreate();
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
|
@ -922,6 +914,7 @@ public class MainActivity extends AppCompatActivity
|
|||
if( streamingIntent != null)
|
||||
stopService(streamingIntent);
|
||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(receive_data);
|
||||
broadCastRegistred = false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("StatementWithEmptyBody")
|
||||
|
@ -939,33 +932,9 @@ public class MainActivity extends AppCompatActivity
|
|||
item.setChecked(true);
|
||||
//Remove the search bar
|
||||
if( !toolbar_search.isIconified() ) {
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.VISIBLE);
|
||||
toolbar_search.setIconified(true);
|
||||
}
|
||||
toolbarTitle.setText(item.getTitle());
|
||||
if (id == R.id.nav_home) {
|
||||
if( tabLayout.getSelectedTabPosition() != 0)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(0).select();
|
||||
return true;
|
||||
} else if( id == R.id.nav_notification){
|
||||
if( tabLayout.getSelectedTabPosition() != 1)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(1).select();
|
||||
return true;
|
||||
}else if (id == R.id.nav_local) {
|
||||
|
||||
if( tabLayout.getSelectedTabPosition() != 2)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(2).select();
|
||||
return true;
|
||||
} else if (id == R.id.nav_global) {
|
||||
if( tabLayout.getSelectedTabPosition() != 3)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(3).select();
|
||||
return true;
|
||||
}
|
||||
DisplayStatusFragment statusFragment;
|
||||
DisplayAccountsFragment accountsFragment;
|
||||
Bundle bundle = new Bundle();
|
||||
|
@ -975,6 +944,7 @@ public class MainActivity extends AppCompatActivity
|
|||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
if (id == R.id.nav_settings) {
|
||||
toot.setVisibility(View.GONE);
|
||||
TabLayoutSettingsFragment tabLayoutSettingsFragment= new TabLayoutSettingsFragment();
|
||||
|
@ -1153,7 +1123,7 @@ public class MainActivity extends AppCompatActivity
|
|||
//Remove the search bar
|
||||
if( !toolbar_search.isIconified() ) {
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.VISIBLE);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
toolbar_search.setIconified(true);
|
||||
}
|
||||
//Selection comes from another menu, no action to do
|
||||
|
|