Merged tom79/mastodon_etalab/master into original_master
This commit is contained in:
commit
ebbfb6ad68
Binary file not shown.
Binary file not shown.
|
@ -1,14 +1,14 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.3"
|
||||
compileSdkVersion 26
|
||||
buildToolsVersion "26.0.2"
|
||||
defaultConfig {
|
||||
applicationId "fr.gouv.etalab.mastodon"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 25
|
||||
versionCode 55
|
||||
versionName "1.4.9-beta-7"
|
||||
targetSdkVersion 26
|
||||
versionCode 56
|
||||
versionName "1.4.9-rc-1"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
@ -31,10 +31,10 @@ allprojects {
|
|||
}
|
||||
}
|
||||
dependencies {
|
||||
compile 'com.android.support:appcompat-v7:25.4.0'
|
||||
compile 'com.android.support:design:25.4.0'
|
||||
compile 'com.android.support:support-v4:25.4.0'
|
||||
compile 'com.android.support:cardview-v7:25.4.0'
|
||||
compile 'com.android.support:appcompat-v7:26.0.2'
|
||||
compile 'com.android.support:design:26.0.2'
|
||||
compile 'com.android.support:support-v4:26.0.2'
|
||||
compile 'com.android.support:cardview-v7:26.0.2'
|
||||
compile 'com.loopj.android:android-async-http:1.4.9'
|
||||
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
|
||||
compile 'com.evernote:android-job:1.1.11'
|
||||
|
|
|
@ -42,6 +42,7 @@ import android.support.v7.widget.SwitchCompat;
|
|||
import android.util.Patterns;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
|
@ -139,6 +140,7 @@ public class MainActivity extends AppCompatActivity
|
|||
private String userIdService;
|
||||
private Intent streamingIntent;
|
||||
public static String lastHomeId = null, lastNotificationId = null;
|
||||
boolean notif_follow, notif_add, notif_mention, notif_share;
|
||||
|
||||
public MainActivity() {
|
||||
}
|
||||
|
@ -224,6 +226,89 @@ public class MainActivity extends AppCompatActivity
|
|||
tabLayout.addTab(tabLocal);
|
||||
if( display_global)
|
||||
tabLayout.addTab(tabPublic);
|
||||
//Display filter for notification when long pressing the tab
|
||||
final LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0);
|
||||
tabStrip.getChildAt(1).setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
//Only shown if the tab has focus
|
||||
if( notificationsFragment != null && notificationsFragment.getUserVisibleHint()){
|
||||
PopupMenu popup = new PopupMenu(MainActivity.this, tabStrip.getChildAt(1));
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.option_filter_notifications, popup.getMenu());
|
||||
Menu menu = popup.getMenu();
|
||||
final MenuItem itemFavourite = menu.findItem(R.id.action_favorite);
|
||||
final MenuItem itemFollow = menu.findItem(R.id.action_follow);
|
||||
final MenuItem itemMention = menu.findItem(R.id.action_mention);
|
||||
final MenuItem itemBoost = menu.findItem(R.id.action_boost);
|
||||
notif_follow = sharedpreferences.getBoolean(Helper.SET_NOTIF_FOLLOW, true);
|
||||
notif_add = sharedpreferences.getBoolean(Helper.SET_NOTIF_ADD, true);
|
||||
notif_mention = sharedpreferences.getBoolean(Helper.SET_NOTIF_MENTION, true);
|
||||
notif_share = sharedpreferences.getBoolean(Helper.SET_NOTIF_SHARE, true);
|
||||
itemFavourite.setChecked(notif_add);
|
||||
itemFollow.setChecked(notif_follow);
|
||||
itemMention.setChecked(notif_mention);
|
||||
itemBoost.setChecked(notif_share);
|
||||
popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(PopupMenu menu) {
|
||||
if( notificationsFragment != null)
|
||||
notificationsFragment.refreshAll();
|
||||
}
|
||||
});
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
item.setActionView(new View(getApplicationContext()));
|
||||
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
||||
@Override
|
||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemActionCollapse(MenuItem item) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_favorite:
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
notif_add = !notif_add;
|
||||
editor.putBoolean(Helper.SET_NOTIF_ADD, notif_add);
|
||||
itemFavourite.setChecked(notif_add);
|
||||
editor.apply();
|
||||
break;
|
||||
case R.id.action_follow:
|
||||
editor = sharedpreferences.edit();
|
||||
notif_follow = !notif_follow;
|
||||
editor.putBoolean(Helper.SET_NOTIF_FOLLOW, notif_follow);
|
||||
itemFollow.setChecked(notif_follow);
|
||||
editor.apply();
|
||||
break;
|
||||
case R.id.action_mention:
|
||||
editor = sharedpreferences.edit();
|
||||
notif_mention = !notif_mention;
|
||||
editor.putBoolean(Helper.SET_NOTIF_MENTION, notif_mention);
|
||||
itemMention.setChecked(notif_mention);
|
||||
editor.apply();
|
||||
break;
|
||||
case R.id.action_boost:
|
||||
editor = sharedpreferences.edit();
|
||||
notif_share = !notif_share;
|
||||
editor.putBoolean(Helper.SET_NOTIF_SHARE, notif_share);
|
||||
itemBoost.setChecked(notif_share);
|
||||
editor.apply();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
viewPager = (ViewPager) findViewById(R.id.viewpager);
|
||||
int countPage = 2;
|
||||
|
@ -619,6 +704,17 @@ public class MainActivity extends AppCompatActivity
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
menuAccounts(MainActivity.this);
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -126,6 +126,15 @@ public class AboutActivity extends AppCompatActivity implements OnRetrieveRemote
|
|||
about_license.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.white));
|
||||
}
|
||||
|
||||
TextView about_website = (TextView) findViewById(R.id.about_website);
|
||||
about_website.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://tom79.bitbucket.io"));
|
||||
startActivity(browserIntent);
|
||||
}
|
||||
});
|
||||
|
||||
lv_contributors.setExpanded(true);
|
||||
lv_developers.setExpanded(true);
|
||||
accountSearchWebAdapterContributors = new AccountSearchDevAdapter(AboutActivity.this, contributors);
|
||||
|
|
|
@ -46,6 +46,7 @@ import android.text.Editable;
|
|||
import android.text.Html;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -148,7 +149,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
private Button toot_it;
|
||||
private AutoCompleteTextView toot_content;
|
||||
private EditText toot_cw_content;
|
||||
private LinearLayout toot_reply_content_container;
|
||||
private Status tootReply = null;
|
||||
private String tootMention = null;
|
||||
private String urlMention = null;
|
||||
|
@ -230,7 +230,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
int newInputType = toot_content.getInputType() & (toot_content.getInputType() ^ InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
|
||||
toot_content.setInputType(newInputType);
|
||||
toot_cw_content = (EditText) findViewById(R.id.toot_cw_content);
|
||||
toot_reply_content_container = (LinearLayout) findViewById(R.id.toot_reply_content_container);
|
||||
picture_scrollview = (HorizontalScrollView) findViewById(R.id.picture_scrollview);
|
||||
toot_sensitive = (CheckBox) findViewById(R.id.toot_sensitive);
|
||||
//search_small_container = (LinearLayout) findViewById(R.id.search_small_container);
|
||||
|
@ -713,6 +712,28 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_view_reply:
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(TootActivity.this);
|
||||
alert.setTitle(R.string.toot_reply_content_title);
|
||||
final TextView input = new TextView(TootActivity.this);
|
||||
//Set the padding
|
||||
input.setPadding(30, 30, 30, 30);
|
||||
alert.setView(input);
|
||||
String content = tootReply.getContent();
|
||||
if(tootReply.getReblog() != null)
|
||||
content = tootReply.getReblog().getContent();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
input.setText(Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY));
|
||||
else
|
||||
//noinspection deprecation
|
||||
input.setText(Html.fromHtml(content));
|
||||
alert.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
return true;
|
||||
case R.id.action_microphone:
|
||||
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
|
||||
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
|
||||
|
@ -905,6 +926,11 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
if( itemSchedule != null)
|
||||
itemSchedule.setVisible(false);
|
||||
}
|
||||
MenuItem itemViewReply = menu.findItem(R.id.action_view_reply);
|
||||
if( tootReply == null){
|
||||
if( itemViewReply != null)
|
||||
itemViewReply.setVisible(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1284,35 +1310,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
setTitle(R.string.toot_title_reply);
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
|
||||
|
||||
FloatingActionButton ic_show = (FloatingActionButton) findViewById(R.id.toot_show_reply);
|
||||
|
||||
ic_show.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(TootActivity.this);
|
||||
alert.setTitle(R.string.toot_reply_content_title);
|
||||
final TextView input = new TextView(TootActivity.this);
|
||||
//Set the padding
|
||||
input.setPadding(30, 30, 30, 30);
|
||||
alert.setView(input);
|
||||
String content = tootReply.getContent();
|
||||
if(tootReply.getReblog() != null)
|
||||
content = tootReply.getReblog().getContent();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
input.setText(Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY));
|
||||
else
|
||||
//noinspection deprecation
|
||||
input.setText(Html.fromHtml(content));
|
||||
alert.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
}
|
||||
});
|
||||
toot_reply_content_container.setVisibility(View.VISIBLE);
|
||||
switch (tootReply.getVisibility()){
|
||||
case "public":
|
||||
visibility = "public";
|
||||
|
|
|
@ -127,32 +127,7 @@ public class DraftsListAdapter extends BaseAdapter {
|
|||
}
|
||||
holder.draft_title.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
}
|
||||
holder.drafts_container.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.delete_all);
|
||||
builder.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogConfirm, int which) {
|
||||
new StatusStoredDAO(context, db).removeAllDrafts();
|
||||
storedStatuses = new ArrayList<>();
|
||||
draftsListAdapter.notifyDataSetChanged();
|
||||
dialogConfirm.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogConfirm, int which) {
|
||||
dialogConfirm.dismiss();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
holder.draft_date.setText(Helper.dateToString(context, draft.getCreation_date()));
|
||||
holder.draft_delete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -192,6 +167,32 @@ public class DraftsListAdapter extends BaseAdapter {
|
|||
context.startActivity(intentToot);
|
||||
}
|
||||
});
|
||||
holder.drafts_container.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.delete_all);
|
||||
builder.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogConfirm, int which) {
|
||||
new StatusStoredDAO(context, db).removeAllDrafts();
|
||||
storedStatuses = new ArrayList<>();
|
||||
draftsListAdapter.notifyDataSetChanged();
|
||||
dialogConfirm.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogConfirm, int which) {
|
||||
dialogConfirm.dismiss();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
|
|
@ -195,10 +195,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
//Update the id of the last notification retrieved
|
||||
|
||||
MainActivity.lastNotificationId = notifications.get(0).getId();
|
||||
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();
|
||||
updateNotificationLastId(sharedpreferences, this.userId, notifications.get(0).getId());
|
||||
}
|
||||
notificationsListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
@ -225,11 +222,8 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
return;
|
||||
//Store last notification id to avoid to notify for those that have been already seen
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
if (visible && notifications != null && notifications.size() > 0) {
|
||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + this.userId, notifications.get(0).getId());
|
||||
editor.apply();
|
||||
lastReadNotifications = notifications.get(0).getId();
|
||||
updateNotificationLastId(sharedpreferences, this.userId, notifications.get(0).getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,14 +233,23 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
//Store last toot id for home timeline to avoid to notify for those that have been already seen
|
||||
//Store last notification id to avoid to notify for those that have been already seen
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
if (notifications != null && notifications.size() > 0) {
|
||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + this.userId, notifications.get(0).getId());
|
||||
editor.apply();
|
||||
lastReadNotifications = notifications.get(0).getId();
|
||||
updateNotificationLastId(sharedpreferences, this.userId, notifications.get(0).getId());
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshAll(){
|
||||
if( context == null)
|
||||
return;
|
||||
max_id = null;
|
||||
notifications = new ArrayList<>();
|
||||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
swiped = true;
|
||||
MainActivity.countNewNotifications = 0;
|
||||
asyncTask = new RetrieveNotificationsAsyncTask(context, null, null, max_id, null, null, DisplayNotificationsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
|
||||
public void refresh(Notification notification){
|
||||
if( context == null)
|
||||
|
@ -285,4 +288,20 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
}catch (Exception ignored){}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Records the id of the notification only if its greater than the previous one.
|
||||
* @param sharedPreferences SharedPreferences
|
||||
* @param userId String current logged user
|
||||
* @param notificationId String current notification id to check
|
||||
*/
|
||||
private void updateNotificationLastId(SharedPreferences sharedPreferences, String userId, String notificationId){
|
||||
String lastNotif = sharedPreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + userId, null);
|
||||
if( lastNotif != null && notificationId != null && Long.parseLong(notificationId) > Long.parseLong(lastNotif)){
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + userId, notificationId);
|
||||
editor.apply();
|
||||
lastReadNotifications = notificationId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import android.widget.Button;
|
|||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
|
@ -69,6 +70,30 @@ public class SettingsNotificationsFragment extends Fragment {
|
|||
}else {
|
||||
style = R.style.Dialog;
|
||||
}
|
||||
|
||||
boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true);
|
||||
final SwitchCompat switchCompatNotify = (SwitchCompat) rootView.findViewById(R.id.set_notify);
|
||||
switchCompatNotify.setChecked(notify);
|
||||
final LinearLayout notification_settings = (LinearLayout) rootView.findViewById(R.id.notification_settings);
|
||||
if( notify)
|
||||
notification_settings.setVisibility(View.VISIBLE);
|
||||
else
|
||||
notification_settings.setVisibility(View.GONE);
|
||||
switchCompatNotify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
// Save the state here
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_NOTIFY, isChecked);
|
||||
editor.apply();
|
||||
if( isChecked)
|
||||
notification_settings.setVisibility(View.VISIBLE);
|
||||
else
|
||||
notification_settings.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
boolean notif_follow = sharedpreferences.getBoolean(Helper.SET_NOTIF_FOLLOW, true);
|
||||
boolean notif_add = sharedpreferences.getBoolean(Helper.SET_NOTIF_ADD, true);
|
||||
boolean notif_ask = sharedpreferences.getBoolean(Helper.SET_NOTIF_ASK, true);
|
||||
|
|
|
@ -223,6 +223,7 @@ public class Helper {
|
|||
public static final int TRANS_NONE = 2;
|
||||
|
||||
public static final String SET_TRANS_FORCED = "set_trans_forced";
|
||||
public static final String SET_NOTIFY = "set_notify";
|
||||
public static final String SET_NOTIF_FOLLOW = "set_notif_follow";
|
||||
public static final String SET_NOTIF_ADD = "set_notif_follow_add";
|
||||
public static final String SET_NOTIF_ASK = "set_notif_follow_ask";
|
||||
|
@ -1443,6 +1444,9 @@ public class Helper {
|
|||
*/
|
||||
public static boolean canNotify(Context context){
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true);
|
||||
if( !notify)
|
||||
return false;
|
||||
String dateIni = sharedpreferences.getString(Helper.SET_TIME_FROM, "07:00");
|
||||
String dateEnd = sharedpreferences.getString(Helper.SET_TIME_TO, "22:00");
|
||||
Calendar now = Calendar.getInstance();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
|
@ -67,6 +68,18 @@
|
|||
android:divider="@null"
|
||||
android:scrollbars="none"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_website"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:padding="10dp"
|
||||
android:autoLink="web"
|
||||
android:text="https://tom79.bitbucket.io/"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_thanks_dev"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
android:layout_height="match_parent"
|
||||
>
|
||||
<LinearLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -40,29 +39,6 @@
|
|||
android:hint="@string/toot_cw_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:id="@+id/toot_reply_content_container"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/toot_reply_content_title"
|
||||
android:text="@string/show_reply"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content" />
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/toot_show_reply"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
app:fabSize="mini"
|
||||
app:srcCompat="@drawable/ic_action_eye_open" />
|
||||
</LinearLayout>
|
||||
<AutoCompleteTextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/toot_content"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
|
@ -63,6 +64,18 @@
|
|||
android:scrollbars="none"
|
||||
android:divider="@null"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_website"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:padding="10dp"
|
||||
android:autoLink="web"
|
||||
android:text="https://tom79.bitbucket.io/"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:padding="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
|
@ -82,6 +95,9 @@
|
|||
android:scrollbars="none"
|
||||
android:divider="@null"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- About license -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
android:layout_height="match_parent"
|
||||
>
|
||||
<LinearLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -40,29 +39,6 @@
|
|||
android:hint="@string/toot_cw_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:id="@+id/toot_reply_content_container"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/toot_reply_content_title"
|
||||
android:text="@string/show_reply"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content" />
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/toot_show_reply"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
app:fabSize="mini"
|
||||
android:layout_margin="5dp"
|
||||
app:srcCompat="@drawable/ic_action_eye_open" />
|
||||
</LinearLayout>
|
||||
<AutoCompleteTextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/toot_content"
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -33,108 +34,6 @@
|
|||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<!-- NOTIFICATIONS SETTINGS -->
|
||||
<TextView
|
||||
android:text="@string/settings_title_notifications"
|
||||
style="?attr/shapeBorder"
|
||||
android:paddingBottom="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- Toots per page -->
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_follow"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/set_notif_follow"
|
||||
android:layout_height="wrap_content" />
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_follow_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/set_notif_follow_add"
|
||||
android:layout_height="wrap_content" />
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_follow_ask"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/set_notif_follow_ask"
|
||||
android:layout_height="wrap_content" />
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_follow_mention"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/set_notif_follow_mention"
|
||||
android:layout_height="wrap_content" />
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_follow_share"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/set_notif_follow_share"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- END NOTIFICATIONS SETTINGS -->
|
||||
|
||||
<!-- NOTIFICATION CONTENT NEW -->
|
||||
<TextView
|
||||
android:text="@string/set_title_news"
|
||||
style="?attr/shapeBorder"
|
||||
android:paddingBottom="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- New hometimeline content -->
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_hometimeline"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/set_notification_news"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/settings_title_hour"
|
||||
style="?attr/shapeBorder"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
style="?attr/shapeBorder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:text="@string/settings_time_from"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:focusableInTouchMode="false"
|
||||
android:id="@+id/settings_time_from"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/settings_time_to"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:focusableInTouchMode="false"
|
||||
android:id="@+id/settings_time_to"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<!-- MORE OPTIONS SETTINGS -->
|
||||
<TextView
|
||||
android:text="@string/settings_title_more_options"
|
||||
style="?attr/shapeBorder"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -144,9 +43,9 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_wifi_only"/>
|
||||
android:text="@string/set_notify"/>
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/set_wifi_only"
|
||||
android:id="@+id/set_notify"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
|
@ -154,43 +53,171 @@
|
|||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/notification_settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical">
|
||||
<!-- NOTIFICATIONS SETTINGS -->
|
||||
<TextView
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/settings_title_notifications"
|
||||
style="?attr/shapeBorder"
|
||||
android:paddingBottom="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- Toots per page -->
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_follow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_notif_silent"/>
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/set_silence"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:text="@string/set_notif_follow"
|
||||
android:layout_height="wrap_content" />
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_follow_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
android:text="@string/set_notif_follow_add"
|
||||
android:layout_height="wrap_content" />
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_follow_ask"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/set_notif_follow_ask"
|
||||
android:layout_height="wrap_content" />
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_follow_mention"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/set_notif_follow_mention"
|
||||
android:layout_height="wrap_content" />
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_follow_share"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/set_notif_follow_share"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- END NOTIFICATIONS SETTINGS -->
|
||||
|
||||
<!-- NOTIFICATION CONTENT NEW -->
|
||||
<TextView
|
||||
android:text="@string/set_title_news"
|
||||
style="?attr/shapeBorder"
|
||||
android:paddingBottom="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- New hometimeline content -->
|
||||
<CheckBox
|
||||
android:id="@+id/set_notif_hometimeline"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/set_notification_news"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/set_led_colour_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/settings_title_hour"
|
||||
style="?attr/shapeBorder"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
style="?attr/shapeBorder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/set_led_colour"/>
|
||||
<Spinner
|
||||
android:id="@+id/led_colour_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:text="@string/settings_time_from"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:focusableInTouchMode="false"
|
||||
android:id="@+id/settings_time_from"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/settings_time_to"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:focusableInTouchMode="false"
|
||||
android:id="@+id/settings_time_to"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<!-- MORE OPTIONS SETTINGS -->
|
||||
<TextView
|
||||
android:text="@string/settings_title_more_options"
|
||||
style="?attr/shapeBorder"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/led_colours"/>
|
||||
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/set_wifi_only"/>
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/set_wifi_only"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
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/set_notif_silent"/>
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/set_silence"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/set_led_colour_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/set_led_colour"/>
|
||||
<Spinner
|
||||
android:id="@+id/led_colour_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/led_colours"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_view_reply"
|
||||
android:title="@string/microphone"
|
||||
android:icon="@drawable/ic_action_eye_open"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/action_microphone"
|
||||
android:title="@string/microphone"
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_favorite"
|
||||
android:checkable="true"
|
||||
android:title="@string/favourite"
|
||||
app:actionViewClass="android.widget.CheckBox"
|
||||
app:showAsAction="always"
|
||||
tools:ignore="AlwaysShowAction" />
|
||||
<item
|
||||
android:id="@+id/action_follow"
|
||||
android:checkable="true"
|
||||
android:title="@string/follow"
|
||||
app:actionViewClass="android.widget.CheckBox"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/action_mention"
|
||||
android:checkable="true"
|
||||
android:title="@string/mention"
|
||||
app:actionViewClass="android.widget.CheckBox"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/action_boost"
|
||||
android:checkable="true"
|
||||
android:title="@string/reblog"
|
||||
app:actionViewClass="android.widget.CheckBox"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
|
@ -59,6 +59,10 @@
|
|||
<string name="username">Benutzername</string>
|
||||
<string name="drafts">Entwürfe</string>
|
||||
<string name="new_data">Neue Beiträge sind verfügbar! Anzeigen?</string>
|
||||
<string name="favourite">Favorisierungen</string>
|
||||
<string name="follow">Neue Folgende</string>
|
||||
<string name="mention">Erwähnungen</string>
|
||||
<string name="reblog">Geteilte Beiträge</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Home</string>
|
||||
<string name="local_menu">Lokale Zeitleiste</string>
|
||||
|
@ -303,6 +307,7 @@
|
|||
<string name="set_share_validation_fav">Bestätigungsdialog vor dem favorisieren</string>
|
||||
<string name="settings_title_more_options">Erweiterte Einstellungen</string>
|
||||
<string name="set_wifi_only">Nur bei WLAN benachrichtigen</string>
|
||||
<string name="set_notify">Benachrichtigen?</string>
|
||||
<string name="set_notif_silent">Leise Benachrichtigungen</string>
|
||||
<string name="set_night_mode">Nachtmodus</string>
|
||||
<string name="set_nsfw_timeout">NSFW Anzeige Dauer (Sekunden, 0 bedeutet aus)</string>
|
||||
|
|
|
@ -60,6 +60,11 @@
|
|||
<string name="username">Nom d\'utilisateur</string>
|
||||
<string name="drafts">Brouillons</string>
|
||||
<string name="new_data">De nouvelles données sont disponibles ! Souhaitez-vous les afficher ?</string>
|
||||
<string name="favourite">Favoris</string>
|
||||
<string name="follow">Nouveaux⋅elles abonn⋅é⋅s</string>
|
||||
<string name="mention">Mentions</string>
|
||||
<string name="reblog">Partages</string>
|
||||
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Accueil</string>
|
||||
<string name="local_menu">Fil public local</string>
|
||||
|
@ -291,6 +296,7 @@
|
|||
<string name="set_share_validation_fav">Confirmer avant d\'ajouter aux favoris</string>
|
||||
<string name="settings_title_more_options">Options avancées</string>
|
||||
<string name="set_wifi_only">Notifier en WIFI seulement</string>
|
||||
<string name="set_notify">Notifier ?</string>
|
||||
<string name="set_notif_silent">Utiliser le vibreur</string>
|
||||
<string name="set_night_mode">Mode nuit</string>
|
||||
<string name="set_nsfw_timeout">Délai d\'affichage NSFW (en secondes, 0 signifie aucun délai)</string>
|
||||
|
|
|
@ -60,6 +60,11 @@
|
|||
<string name="username">User name</string>
|
||||
<string name="drafts">Drafts</string>
|
||||
<string name="new_data">New data are available! Do you want to display them?</string>
|
||||
<string name="favourite">Favourites</string>
|
||||
<string name="follow">New followers</string>
|
||||
<string name="mention">Mentions</string>
|
||||
<string name="reblog">Boosts</string>
|
||||
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Home</string>
|
||||
<string name="local_menu">Local timeline</string>
|
||||
|
@ -297,6 +302,7 @@
|
|||
<string name="set_share_validation_fav">Show confirmation dialog before adding to favourites</string>
|
||||
<string name="settings_title_more_options">Advanced settings</string>
|
||||
<string name="set_wifi_only">Notify in WIFI only</string>
|
||||
<string name="set_notify">Notify?</string>
|
||||
<string name="set_notif_silent">Silent Notifications</string>
|
||||
<string name="set_night_mode">Night mode</string>
|
||||
<string name="set_nsfw_timeout">NSFW view timeout (seconds, 0 means off)</string>
|
||||
|
|
|
@ -42,6 +42,7 @@ import android.support.v7.widget.SwitchCompat;
|
|||
import android.util.Patterns;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
|
@ -142,6 +143,7 @@ public class MainActivity extends AppCompatActivity
|
|||
private String userIdService;
|
||||
private Intent streamingIntent;
|
||||
public static String lastHomeId = null, lastNotificationId = null;
|
||||
boolean notif_follow, notif_add, notif_mention, notif_share;
|
||||
|
||||
public MainActivity() {
|
||||
}
|
||||
|
@ -227,6 +229,89 @@ public class MainActivity extends AppCompatActivity
|
|||
tabLayout.addTab(tabLocal);
|
||||
if( display_global)
|
||||
tabLayout.addTab(tabPublic);
|
||||
//Display filter for notification when long pressing the tab
|
||||
final LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0);
|
||||
tabStrip.getChildAt(1).setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
//Only shown if the tab has focus
|
||||
if( notificationsFragment != null && notificationsFragment.getUserVisibleHint()){
|
||||
PopupMenu popup = new PopupMenu(MainActivity.this, tabStrip.getChildAt(1));
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.option_filter_notifications, popup.getMenu());
|
||||
Menu menu = popup.getMenu();
|
||||
final MenuItem itemFavourite = menu.findItem(R.id.action_favorite);
|
||||
final MenuItem itemFollow = menu.findItem(R.id.action_follow);
|
||||
final MenuItem itemMention = menu.findItem(R.id.action_mention);
|
||||
final MenuItem itemBoost = menu.findItem(R.id.action_boost);
|
||||
notif_follow = sharedpreferences.getBoolean(Helper.SET_NOTIF_FOLLOW, true);
|
||||
notif_add = sharedpreferences.getBoolean(Helper.SET_NOTIF_ADD, true);
|
||||
notif_mention = sharedpreferences.getBoolean(Helper.SET_NOTIF_MENTION, true);
|
||||
notif_share = sharedpreferences.getBoolean(Helper.SET_NOTIF_SHARE, true);
|
||||
itemFavourite.setChecked(notif_add);
|
||||
itemFollow.setChecked(notif_follow);
|
||||
itemMention.setChecked(notif_mention);
|
||||
itemBoost.setChecked(notif_share);
|
||||
popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(PopupMenu menu) {
|
||||
if( notificationsFragment != null)
|
||||
notificationsFragment.refreshAll();
|
||||
}
|
||||
});
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
item.setActionView(new View(getApplicationContext()));
|
||||
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
||||
@Override
|
||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemActionCollapse(MenuItem item) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_favorite:
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
notif_add = !notif_add;
|
||||
editor.putBoolean(Helper.SET_NOTIF_ADD, notif_add);
|
||||
itemFavourite.setChecked(notif_add);
|
||||
editor.apply();
|
||||
break;
|
||||
case R.id.action_follow:
|
||||
editor = sharedpreferences.edit();
|
||||
notif_follow = !notif_follow;
|
||||
editor.putBoolean(Helper.SET_NOTIF_FOLLOW, notif_follow);
|
||||
itemFollow.setChecked(notif_follow);
|
||||
editor.apply();
|
||||
break;
|
||||
case R.id.action_mention:
|
||||
editor = sharedpreferences.edit();
|
||||
notif_mention = !notif_mention;
|
||||
editor.putBoolean(Helper.SET_NOTIF_MENTION, notif_mention);
|
||||
itemMention.setChecked(notif_mention);
|
||||
editor.apply();
|
||||
break;
|
||||
case R.id.action_boost:
|
||||
editor = sharedpreferences.edit();
|
||||
notif_share = !notif_share;
|
||||
editor.putBoolean(Helper.SET_NOTIF_SHARE, notif_share);
|
||||
itemBoost.setChecked(notif_share);
|
||||
editor.apply();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
viewPager = (ViewPager) findViewById(R.id.viewpager);
|
||||
int countPage = 2;
|
||||
|
@ -622,6 +707,17 @@ public class MainActivity extends AppCompatActivity
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
menuAccounts(MainActivity.this);
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue