version upgrade to 1.10, added block mute list

Signed-off-by: nuclearfog <hatespirit666@gmail.com>
This commit is contained in:
nuclearfog 2021-08-28 16:01:31 +02:00
parent 51b255e364
commit 90bfa02f74
No known key found for this signature in database
GPG Key ID: AA0271FBE406DB98
13 changed files with 247 additions and 52 deletions

View File

@ -10,8 +10,8 @@ android {
applicationId 'org.nuclearfog.twidda'
minSdkVersion 16
targetSdkVersion 30
versionCode 44
versionName '1.9.2'
versionCode 45
versionName '1.10'
// limiting language support for smaller APK size
resConfigs 'en', 'de-rDE', 'zh-rCN'
vectorDrawables.useSupportLibrary true

View File

@ -126,6 +126,11 @@
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
<activity
android:name=".activity.UserExclude"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
</application>
</manifest>

View File

@ -0,0 +1,69 @@
package org.nuclearfog.twidda.activity;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayout.OnTabSelectedListener;
import com.google.android.material.tabs.TabLayout.Tab;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.adapter.FragmentAdapter;
import org.nuclearfog.twidda.backend.utils.AppStyles;
import org.nuclearfog.twidda.database.GlobalSettings;
/**
*
*/
public class UserExclude extends AppCompatActivity implements OnTabSelectedListener {
@Override
protected void onCreate(Bundle savedInst) {
super.onCreate(savedInst);
setContentView(R.layout.page_user_exclude);
View root = findViewById(R.id.userexclude_root);
Toolbar toolbar = findViewById(R.id.userexclude_toolbar);
TabLayout tablayout = findViewById(R.id.userexclude_tab);
ViewPager pager = findViewById(R.id.userexclude_pager);
GlobalSettings settings = GlobalSettings.getInstance(this);
FragmentAdapter adapter = new FragmentAdapter(getSupportFragmentManager());
pager.setAdapter(adapter);
pager.setOffscreenPageLimit(2);
adapter.setupMuteBlockPage();
tablayout.setupWithViewPager(pager);
tablayout.addOnTabSelectedListener(this);
setSupportActionBar(toolbar);
AppStyles.setTheme(settings, root);
AppStyles.setTabIcons(tablayout, settings, R.array.user_exclude_icons);
}
@Override
protected void onStart() {
super.onStart();
}
@Override
public void onTabSelected(Tab tab) {
}
@Override
public void onTabUnselected(Tab tab) {
}
@Override
public void onTabReselected(Tab tab) {
}
}

View File

@ -1,5 +1,37 @@
package org.nuclearfog.twidda.activity;
import static android.content.Intent.ACTION_VIEW;
import static android.os.AsyncTask.Status.RUNNING;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static android.widget.Toast.LENGTH_SHORT;
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_LINK;
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_TYPE;
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_IMAGE;
import static org.nuclearfog.twidda.activity.MessageEditor.KEY_DM_PREFIX;
import static org.nuclearfog.twidda.activity.ProfileEditor.KEY_USER_DATA;
import static org.nuclearfog.twidda.activity.SearchPage.KEY_SEARCH_QUERY;
import static org.nuclearfog.twidda.activity.TweetActivity.KEY_TWEET_ID;
import static org.nuclearfog.twidda.activity.TweetActivity.KEY_TWEET_NAME;
import static org.nuclearfog.twidda.activity.TweetActivity.LINK_PATTERN;
import static org.nuclearfog.twidda.activity.TweetEditor.KEY_TWEETPOPUP_TEXT;
import static org.nuclearfog.twidda.activity.UserDetail.KEY_USERDETAIL_ID;
import static org.nuclearfog.twidda.activity.UserDetail.KEY_USERDETAIL_MODE;
import static org.nuclearfog.twidda.activity.UserDetail.USERLIST_FOLLOWER;
import static org.nuclearfog.twidda.activity.UserDetail.USERLIST_FRIENDS;
import static org.nuclearfog.twidda.activity.UserLists.KEY_USERLIST_OWNER_ID;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_BLOCK;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_FOLLOW;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_MUTE;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_UNBLOCK;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_UNFOLLOW;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_UNMUTE;
import static org.nuclearfog.twidda.backend.UserAction.Action.PROFILE_DB;
import static org.nuclearfog.twidda.backend.UserAction.Action.PROFILE_lOAD;
import static org.nuclearfog.twidda.database.GlobalSettings.PROFILE_IMG_HIGH_RES;
import static org.nuclearfog.twidda.fragment.UserFragment.KEY_USER_UPDATE;
import static org.nuclearfog.twidda.fragment.UserFragment.RETURN_USER_UPDATED;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Intent;
@ -51,38 +83,6 @@ import java.text.SimpleDateFormat;
import jp.wasabeef.picasso.transformations.RoundedCornersTransformation;
import static android.content.Intent.ACTION_VIEW;
import static android.os.AsyncTask.Status.RUNNING;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static android.widget.Toast.LENGTH_SHORT;
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_LINK;
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_TYPE;
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_IMAGE;
import static org.nuclearfog.twidda.activity.MessageEditor.KEY_DM_PREFIX;
import static org.nuclearfog.twidda.activity.ProfileEditor.KEY_USER_DATA;
import static org.nuclearfog.twidda.activity.SearchPage.KEY_SEARCH_QUERY;
import static org.nuclearfog.twidda.activity.TweetActivity.KEY_TWEET_ID;
import static org.nuclearfog.twidda.activity.TweetActivity.KEY_TWEET_NAME;
import static org.nuclearfog.twidda.activity.TweetActivity.LINK_PATTERN;
import static org.nuclearfog.twidda.activity.TweetEditor.KEY_TWEETPOPUP_TEXT;
import static org.nuclearfog.twidda.activity.UserDetail.KEY_USERDETAIL_ID;
import static org.nuclearfog.twidda.activity.UserDetail.KEY_USERDETAIL_MODE;
import static org.nuclearfog.twidda.activity.UserDetail.USERLIST_FOLLOWER;
import static org.nuclearfog.twidda.activity.UserDetail.USERLIST_FRIENDS;
import static org.nuclearfog.twidda.activity.UserLists.KEY_USERLIST_OWNER_ID;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_BLOCK;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_FOLLOW;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_MUTE;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_UNBLOCK;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_UNFOLLOW;
import static org.nuclearfog.twidda.backend.UserAction.Action.ACTION_UNMUTE;
import static org.nuclearfog.twidda.backend.UserAction.Action.PROFILE_DB;
import static org.nuclearfog.twidda.backend.UserAction.Action.PROFILE_lOAD;
import static org.nuclearfog.twidda.database.GlobalSettings.PROFILE_IMG_HIGH_RES;
import static org.nuclearfog.twidda.fragment.UserFragment.KEY_USER_UPDATE;
import static org.nuclearfog.twidda.fragment.UserFragment.RETURN_USER_UPDATED;
/**
* Activity class for user profile page
*
@ -294,8 +294,10 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
if (user.isCurrentUser()) {
MenuItem dmIcon = m.findItem(R.id.profile_message);
MenuItem setting = m.findItem(R.id.profile_settings);
MenuItem userExcl = m.findItem(R.id.profile_block_mute);
dmIcon.setVisible(true);
setting.setVisible(true);
userExcl.setVisible(true);
} else {
MenuItem followIcon = m.findItem(R.id.profile_follow);
MenuItem blockIcon = m.findItem(R.id.profile_block);
@ -402,6 +404,11 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
listPage.putExtra(KEY_USERLIST_OWNER_ID, user.getId());
startActivity(listPage);
}
// open mute/block list
else if (item.getItemId() == R.id.profile_block_mute) {
Intent userExclude = new Intent(this, UserExclude.class);
startActivity(userExclude);
}
}
return super.onOptionsItemSelected(item);
}

View File

@ -1,18 +1,5 @@
package org.nuclearfog.twidda.adapter;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import org.nuclearfog.twidda.fragment.ListFragment;
import org.nuclearfog.twidda.fragment.TrendFragment;
import org.nuclearfog.twidda.fragment.TweetFragment;
import org.nuclearfog.twidda.fragment.UserFragment;
import org.nuclearfog.twidda.fragment.UserListFragment;
import static org.nuclearfog.twidda.fragment.TweetFragment.KEY_FRAG_TWEET_ID;
import static org.nuclearfog.twidda.fragment.TweetFragment.KEY_FRAG_TWEET_MODE;
import static org.nuclearfog.twidda.fragment.TweetFragment.KEY_FRAG_TWEET_SEARCH;
@ -26,7 +13,9 @@ import static org.nuclearfog.twidda.fragment.UserFragment.KEY_FRAG_DEL_USER;
import static org.nuclearfog.twidda.fragment.UserFragment.KEY_FRAG_USER_ID;
import static org.nuclearfog.twidda.fragment.UserFragment.KEY_FRAG_USER_MODE;
import static org.nuclearfog.twidda.fragment.UserFragment.KEY_FRAG_USER_SEARCH;
import static org.nuclearfog.twidda.fragment.UserFragment.USER_FRAG_BLOCKS;
import static org.nuclearfog.twidda.fragment.UserFragment.USER_FRAG_LISTS;
import static org.nuclearfog.twidda.fragment.UserFragment.USER_FRAG_MUTES;
import static org.nuclearfog.twidda.fragment.UserFragment.USER_FRAG_SEARCH;
import static org.nuclearfog.twidda.fragment.UserFragment.USER_FRAG_SUBSCR;
import static org.nuclearfog.twidda.fragment.UserListFragment.KEY_FRAG_LIST_LIST_TYPE;
@ -35,6 +24,19 @@ import static org.nuclearfog.twidda.fragment.UserListFragment.KEY_FRAG_LIST_OWNE
import static org.nuclearfog.twidda.fragment.UserListFragment.LIST_USER_OWNS;
import static org.nuclearfog.twidda.fragment.UserListFragment.LIST_USER_SUBSCR_TO;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import org.nuclearfog.twidda.fragment.ListFragment;
import org.nuclearfog.twidda.fragment.TrendFragment;
import org.nuclearfog.twidda.fragment.TweetFragment;
import org.nuclearfog.twidda.fragment.UserFragment;
import org.nuclearfog.twidda.fragment.UserListFragment;
/**
* Fragment adapter for ViewPager
*
@ -197,6 +199,23 @@ public class FragmentAdapter extends FragmentStatePagerAdapter {
notifyDataSetChanged();
}
/**
* setup adapter for a page of muted / blocked users
*/
public void setupMuteBlockPage() {
Bundle paramMute = new Bundle();
Bundle paramBlock = new Bundle();
paramMute.putInt(KEY_FRAG_USER_MODE, USER_FRAG_MUTES);
paramBlock.putInt(KEY_FRAG_USER_MODE, USER_FRAG_BLOCKS);
fragments = new ListFragment[2];
fragments[0] = new UserFragment();
fragments[1] = new UserFragment();
fragments[0].setArguments(paramMute);
fragments[1].setArguments(paramBlock);
notifyDataSetChanged();
}
/**
* called when app settings change
*/

View File

@ -53,6 +53,14 @@ public class UserLoader extends AsyncTask<Long, Void, UserList> {
* load members of an userlist
*/
LISTMEMBER,
/**
*
*/
BLOCK,
/**
*
*/
MUTE,
NONE
}
@ -103,6 +111,12 @@ public class UserLoader extends AsyncTask<Long, Void, UserList> {
case LISTMEMBER:
return mTwitter.getListMember(id, cursor);
case BLOCK:
return mTwitter.getBlockedUsers(cursor);
case MUTE:
return mTwitter.getMutedUsers(cursor);
}
} catch (EngineException twException) {
this.twException = twException;

View File

@ -1,5 +1,10 @@
package org.nuclearfog.twidda.fragment;
import static android.os.AsyncTask.Status.RUNNING;
import static org.nuclearfog.twidda.activity.UserProfile.KEY_PROFILE_DATA;
import static org.nuclearfog.twidda.backend.ListManager.Action.DEL_USER;
import static org.nuclearfog.twidda.backend.UserLoader.NO_CURSOR;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
@ -23,11 +28,6 @@ import org.nuclearfog.twidda.dialog.ConfirmDialog;
import org.nuclearfog.twidda.dialog.ConfirmDialog.DialogType;
import org.nuclearfog.twidda.dialog.ConfirmDialog.OnConfirmListener;
import static android.os.AsyncTask.Status.RUNNING;
import static org.nuclearfog.twidda.activity.UserProfile.KEY_PROFILE_DATA;
import static org.nuclearfog.twidda.backend.ListManager.Action.DEL_USER;
import static org.nuclearfog.twidda.backend.UserLoader.NO_CURSOR;
/**
* Fragment class for lists a list of users
*
@ -97,6 +97,16 @@ public class UserFragment extends ListFragment implements UserClickListener,
*/
public static final int USER_FRAG_LISTS = 0x9A00B3A5;
/**
* configuration for block list
*/
public static final int USER_FRAG_BLOCKS = 0x83D186AD;
/**
* configuration for mute list
*/
public static final int USER_FRAG_MUTES = 0x5246DC35;
/**
* Request code to update user information
*/
@ -295,6 +305,14 @@ public class UserFragment extends ListFragment implements UserClickListener,
case USER_FRAG_LISTS:
listType = Type.LISTMEMBER;
break;
case USER_FRAG_BLOCKS:
listType = Type.BLOCK;
break;
case USER_FRAG_MUTES:
listType = Type.MUTE;
break;
}
userTask = new UserLoader(this, listType, id, search);
userTask.execute(cursor);

View File

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="21"
android:viewportHeight="21">
<path
android:pathData="M8.4646,14.1213C8.074,14.5118 8.074,15.145 8.4646,15.5355C8.8551,15.926 9.4882,15.926 9.8788,15.5355L15.5356,9.8786C15.9262,9.4881 15.9262,8.8549 15.5356,8.4644C15.1451,8.0739 14.5119,8.0739 14.1214,8.4644L8.4646,14.1213Z"
android:fillColor="#ffffff" />
<path
android:pathData="M6.3432,17.6569C9.4673,20.781 14.5327,20.781 17.6569,17.6569C20.781,14.5327 20.781,9.4673 17.6569,6.3432C14.5327,3.219 9.4673,3.219 6.3432,6.3432C3.219,9.4673 3.219,14.5327 6.3432,17.6569ZM16.2426,16.2426C13.8995,18.5858 10.1005,18.5858 7.7574,16.2426C5.4142,13.8995 5.4142,10.1005 7.7574,7.7574C10.1005,5.4142 13.8995,5.4142 16.2426,7.7574C18.5858,10.1005 18.5858,13.8995 16.2426,16.2426Z"
android:fillColor="#ffffff"
android:fillType="evenOdd" />
</vector>

View File

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="320"
android:viewportHeight="320">
<path
android:fillColor="#FFFFFF"
android:pathData="M19.747,121.968v70.068c0,21.499 17.43,38.924 38.924,38.924h40.703l112.088,73.612c11.351,6.271 26.808,-5.883 34.372,-21.256L47.261,84.75C31.333,89.628 19.747,104.438 19.747,121.968z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M250.386,41.816c0,-21.5 -19.464,-51.253 -38.924,-38.924L108.71,76.499l141.676,141.677V41.816z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M55.463,83.202l193.146,193.145l18.88,18.874c3.459,3.469 8.005,5.204 12.547,5.204c4.541,0 9.087,-1.735 12.552,-5.204c6.934,-6.929 6.934,-18.17 0,-25.104l-42.197,-42.197L103.037,80.566L38.771,16.314c-3.461,-3.469 -8.005,-5.204 -12.549,-5.204c-4.544,0 -9.085,1.735 -12.552,5.204c-6.937,6.928 -6.937,18.17 0,25.101L55.463,83.202z" />
</vector>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/userexclude_root"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<androidx.appcompat.widget.Toolbar
android:id="@+id/userexclude_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/userexclude_tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/userexclude_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@ -31,6 +31,10 @@
android:id="@+id/profile_lists"
android:visible="false"
android:title="@string/menu_goto_lists" />
<item
android:id="@+id/profile_block_mute"
android:visible="false"
android:title="@string/menu_excluded_users" />
<item
android:id="@+id/profile_settings"
android:visible="false"

View File

@ -18,6 +18,11 @@
<item>@drawable/subscriber</item>
</integer-array>
<integer-array name="user_exclude_icons">
<item>@drawable/mute</item>
<item>@drawable/block</item>
</integer-array>
<integer-array name="profile_tab_icons">
<item>@drawable/home</item>
<item>@drawable/favorite</item>

View File

@ -218,6 +218,7 @@
<string name="menu_unfollow_list">unfollow list</string>
<string name="menu_user_unfollow">unfollow</string>
<string name="menu_user_unblock">unblock</string>
<string name="menu_excluded_users">Block/Mute list</string>
<!--dialog strings-->
<string name="dialog_button_yes">Yes</string>