mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-02-06 22:13:21 +01:00
code cleanup
This commit is contained in:
parent
f5f214448c
commit
d8d08593d8
@ -50,8 +50,8 @@ public class MessagePopup extends AppCompatActivity implements OnClickListener,
|
||||
private MessageUploader messageAsync;
|
||||
private EditText receiver, message;
|
||||
private Dialog loadingCircle;
|
||||
private @Nullable
|
||||
String mediaPath;
|
||||
@Nullable
|
||||
private String mediaPath;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -86,7 +86,7 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener,
|
||||
private long tweetID;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle b) {
|
||||
protected void onCreate(@Nullable Bundle b) {
|
||||
super.onCreate(b);
|
||||
setContentView(R.layout.page_tweet);
|
||||
ViewPager pager = findViewById(R.id.tweet_pager);
|
||||
|
@ -19,14 +19,12 @@ public class UserDetail extends AppCompatActivity {
|
||||
public static final String KEY_USERDETAIL_MODE = "userlist_mode";
|
||||
public static final String KEY_USERDETAIL_ID = "userlist_owner_id";
|
||||
|
||||
public static final int USERLIST_FRIENDS = 0;
|
||||
public static final int USERLIST_FOLLOWER = 1;
|
||||
public static final int USERLIST_RETWEETS = 2;
|
||||
public static final int USERLSIT_FAVORITS = 3;
|
||||
public static final int USERLIST_SUBSCRIBER = 4;
|
||||
|
||||
private long id;
|
||||
private int mode;
|
||||
public static final int NONE = 0;
|
||||
public static final int USERLIST_FRIENDS = 1;
|
||||
public static final int USERLIST_FOLLOWER = 2;
|
||||
public static final int USERLIST_RETWEETS = 3;
|
||||
public static final int USERLIST_FAVORITS = 4;
|
||||
public static final int USERLIST_SUBSCRBR = 5;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle b) {
|
||||
@ -35,17 +33,16 @@ public class UserDetail extends AppCompatActivity {
|
||||
View root = findViewById(R.id.user_view);
|
||||
ViewPager pager = findViewById(R.id.user_pager);
|
||||
Toolbar toolbar = findViewById(R.id.user_toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
long id = 0;
|
||||
int mode = NONE;
|
||||
Bundle param = getIntent().getExtras();
|
||||
if (param != null && param.containsKey(KEY_USERDETAIL_MODE) && param.containsKey(KEY_USERDETAIL_ID)) {
|
||||
if (param != null) {
|
||||
mode = param.getInt(KEY_USERDETAIL_MODE);
|
||||
id = param.getLong(KEY_USERDETAIL_ID);
|
||||
}
|
||||
|
||||
GlobalSettings settings = GlobalSettings.getInstance(this);
|
||||
root.setBackgroundColor(settings.getBackgroundColor());
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
switch (mode) {
|
||||
case USERLIST_FRIENDS:
|
||||
FragmentAdapter adapter;
|
||||
@ -54,30 +51,37 @@ public class UserDetail extends AppCompatActivity {
|
||||
adapter = new FragmentAdapter(getSupportFragmentManager(), AdapterType.FRIENDS_PAGE, id, "");
|
||||
pager.setAdapter(adapter);
|
||||
break;
|
||||
|
||||
case USERLIST_FOLLOWER:
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setTitle(R.string.userlist_follower);
|
||||
adapter = new FragmentAdapter(getSupportFragmentManager(), AdapterType.FOLLOWER_PAGE, id, "");
|
||||
pager.setAdapter(adapter);
|
||||
break;
|
||||
|
||||
case USERLIST_RETWEETS:
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setTitle(R.string.userlist_retweet);
|
||||
adapter = new FragmentAdapter(getSupportFragmentManager(), AdapterType.RETWEETER_PAGE, id, "");
|
||||
pager.setAdapter(adapter);
|
||||
break;
|
||||
case USERLSIT_FAVORITS:
|
||||
|
||||
case USERLIST_FAVORITS:
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setTitle(R.string.userlist_favorite);
|
||||
adapter = new FragmentAdapter(getSupportFragmentManager(), AdapterType.FAVOR_PAGE, id, "");
|
||||
pager.setAdapter(adapter);
|
||||
break;
|
||||
case USERLIST_SUBSCRIBER:
|
||||
|
||||
case USERLIST_SUBSCRBR:
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setTitle(R.string.user_list_subscr);
|
||||
adapter = new FragmentAdapter(getSupportFragmentManager(), AdapterType.SUBSCRIBER_PAGE, id, "");
|
||||
pager.setAdapter(adapter);
|
||||
}
|
||||
|
||||
GlobalSettings settings = GlobalSettings.getInstance(this);
|
||||
root.setBackgroundColor(settings.getBackgroundColor());
|
||||
FontTool.setViewFontAndColor(settings, root);
|
||||
}
|
||||
}
|
@ -89,7 +89,6 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
@Nullable
|
||||
private TwitterUser user;
|
||||
private long userId;
|
||||
private boolean isHome;
|
||||
|
||||
private int tabIndex = 0;
|
||||
|
||||
@ -119,9 +118,8 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
|
||||
settings = GlobalSettings.getInstance(this);
|
||||
Bundle param = getIntent().getExtras();
|
||||
if (param != null && param.containsKey(KEY_PROFILE_ID)) {
|
||||
if (param != null) {
|
||||
userId = param.getLong(KEY_PROFILE_ID);
|
||||
isHome = userId == settings.getUserId();
|
||||
}
|
||||
|
||||
setSupportActionBar(tool);
|
||||
@ -200,7 +198,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu m) {
|
||||
getMenuInflater().inflate(R.menu.profile, m);
|
||||
if (isHome) {
|
||||
if (userId == settings.getUserId()) {
|
||||
MenuItem dmIcon = m.findItem(R.id.profile_message);
|
||||
MenuItem setting = m.findItem(R.id.profile_settings);
|
||||
dmIcon.setVisible(true);
|
||||
@ -225,7 +223,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
followIcon.setIcon(R.drawable.follow_requested);
|
||||
followIcon.setTitle(R.string.follow_requested);
|
||||
}
|
||||
if (user.isLocked() && !isHome) {
|
||||
if (user.isLocked() && userId != settings.getUserId()) {
|
||||
MenuItem listItem = m.findItem(R.id.profile_lists);
|
||||
listItem.setVisible(false);
|
||||
}
|
||||
@ -266,7 +264,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
case R.id.profile_tweet:
|
||||
if (user != null) {
|
||||
Intent tweet = new Intent(this, TweetPopup.class);
|
||||
if (!isHome)
|
||||
if (userId != settings.getUserId())
|
||||
tweet.putExtra(KEY_TWEETPOPUP_PREFIX, user.getScreenname());
|
||||
startActivity(tweet);
|
||||
}
|
||||
@ -394,7 +392,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
switch (v.getId()) {
|
||||
case R.id.following:
|
||||
if (user != null && properties != null) {
|
||||
if (!user.isLocked() || properties.isFriend() || isHome) {
|
||||
if (!user.isLocked() || properties.isFriend() || userId == settings.getUserId()) {
|
||||
Intent following = new Intent(this, UserDetail.class);
|
||||
following.putExtra(KEY_USERDETAIL_ID, userId);
|
||||
following.putExtra(KEY_USERDETAIL_MODE, USERLIST_FRIENDS);
|
||||
@ -405,7 +403,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
|
||||
case R.id.follower:
|
||||
if (user != null && properties != null) {
|
||||
if (!user.isLocked() || properties.isFriend() || isHome) {
|
||||
if (!user.isLocked() || properties.isFriend() || userId == settings.getUserId()) {
|
||||
Intent follower = new Intent(this, UserDetail.class);
|
||||
follower.putExtra(KEY_USERDETAIL_ID, userId);
|
||||
follower.putExtra(KEY_USERDETAIL_MODE, USERLIST_FOLLOWER);
|
||||
|
@ -37,7 +37,7 @@ import static org.nuclearfog.twidda.activity.ListDetail.KEY_LISTDETAIL_ID;
|
||||
import static org.nuclearfog.twidda.activity.ListDetail.KEY_LISTDETAIL_NAME;
|
||||
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_SUBSCRIBER;
|
||||
import static org.nuclearfog.twidda.activity.UserDetail.USERLIST_SUBSCRBR;
|
||||
import static org.nuclearfog.twidda.activity.UserProfile.KEY_PROFILE_ID;
|
||||
import static org.nuclearfog.twidda.backend.TwitterListLoader.Action.DELETE;
|
||||
import static org.nuclearfog.twidda.backend.TwitterListLoader.Action.FOLLOW;
|
||||
@ -134,7 +134,7 @@ public class ListFragment extends Fragment implements OnRefreshListener, ListCli
|
||||
case SUBSCRIBER:
|
||||
Intent following = new Intent(getContext(), UserDetail.class);
|
||||
following.putExtra(KEY_USERDETAIL_ID, listItem.getId());
|
||||
following.putExtra(KEY_USERDETAIL_MODE, USERLIST_SUBSCRIBER);
|
||||
following.putExtra(KEY_USERDETAIL_MODE, USERLIST_SUBSCRBR);
|
||||
startActivity(following);
|
||||
break;
|
||||
|
||||
|
@ -234,7 +234,7 @@
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/button"
|
||||
android:singleLine="true"
|
||||
android:text="@string/delete_database" />
|
||||
android:text="@string/settings_clear_data" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/logout"
|
||||
|
@ -13,7 +13,7 @@
|
||||
<string name="profile_image">Profilbild</string>
|
||||
<string name="settings">Einstellungen</string>
|
||||
<string name="settings_image">Bilder laden</string>
|
||||
<string name="delete_database">Datenbank Löschen</string>
|
||||
<string name="settings_clear_data">App Daten löschen</string>
|
||||
<string name="twitter_search">Suche</string>
|
||||
<string name="userlist_retweet">Tweet retweetet von</string>
|
||||
<string name="userlist_favorite">Tweet favorisiert von</string>
|
||||
@ -48,7 +48,7 @@
|
||||
<string name="error_dm">Nutzername oder Nachricht eingeben!</string>
|
||||
<string name="confirm_cancel_message">Nachricht verwerfen?</string>
|
||||
<string name="error_empty_tweet">Tweet leer!</string>
|
||||
<string name="settings_logout">ausloggen</string>
|
||||
<string name="settings_logout">Ausloggen</string>
|
||||
<string name="dm_answer">Antworten</string>
|
||||
<string name="delete_dm">löschen</string>
|
||||
<string name="confirm_yes">Ja</string>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<string name="profile">profile</string>
|
||||
<string name="register_link">get PIN</string>
|
||||
<string name="settings_image">load images</string>
|
||||
<string name="delete_database">delete database</string>
|
||||
<string name="settings_clear_data">Clear app data</string>
|
||||
<string name="twitter_search">search</string>
|
||||
<string name="confirm_delete_tweet">delete tweet?</string>
|
||||
<string name="error_enter_pin">Enter PIN!</string>
|
||||
@ -55,7 +55,7 @@
|
||||
<string name="error_dm">enter username or message!</string>
|
||||
<string name="confirm_cancel_message">cancel message?</string>
|
||||
<string name="error_empty_tweet">empty tweet!</string>
|
||||
<string name="settings_logout">log out!</string>
|
||||
<string name="settings_logout">log out</string>
|
||||
<string name="dm_answer">answer</string>
|
||||
<string name="delete_dm">delete</string>
|
||||
<string name="confirm_yes">Yes</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user