adding fragment classes

This commit is contained in:
NudeDude 2019-04-29 15:59:25 +02:00
parent fe188a4a55
commit 1e0accc412
11 changed files with 352 additions and 7 deletions

View File

@ -5,7 +5,7 @@
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -59,7 +59,7 @@ public class TwitterEngine {
twitter = factory.getInstance();
if (settings.getLogin()) {
String keys[] = settings.getKeys();
String[] keys = settings.getKeys();
initKeys(keys[0], keys[1]);
twitterID = settings.getUserId();
}
@ -200,7 +200,7 @@ public class TwitterEngine {
*/
public List<Trend> getTrends(int woeId) throws TwitterException {
List<Trend> result = new ArrayList<>();
twitter4j.Trend trends[] = twitter.getPlaceTrends(woeId).getTrends();
twitter4j.Trend[] trends = twitter.getPlaceTrends(woeId).getTrends();
for (int i = 0; i < trends.length; i++) {
Trend item = new Trend(i + 1, trends[i].getName());
@ -284,7 +284,7 @@ public class TwitterEngine {
*/
public boolean[] getConnection(long userId) throws TwitterException {
Relationship connect = twitter.showFriendship(twitterID, userId);
boolean connection[] = new boolean[5];
boolean[] connection = new boolean[5];
connection[0] = connect.isSourceFollowingTarget();
connection[1] = connect.isTargetFollowingSource();
connection[2] = connect.isSourceBlockingTarget();
@ -375,7 +375,7 @@ public class TwitterEngine {
*/
public List<TwitterUser> getFollowing(long userId, long cursor) throws TwitterException {
IDs userIDs = twitter.getFriendsIDs(userId, cursor, load);
long ids[] = userIDs.getIDs();
long[] ids = userIDs.getIDs();
if (ids.length == 0)
return new ArrayList<>();
return convertUserList(twitter.lookupUsers(ids));
@ -391,7 +391,7 @@ public class TwitterEngine {
*/
public List<TwitterUser> getFollower(long userId, long cursor) throws TwitterException {
IDs userIDs = twitter.getFollowersIDs(userId, cursor, load);
long ids[] = userIDs.getIDs();
long[] ids = userIDs.getIDs();
if (ids.length == 0)
return new ArrayList<>();
return convertUserList(twitter.lookupUsers(userIDs.getIDs()));

View File

@ -0,0 +1,50 @@
package org.nuclearfog.twidda.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.nuclearfog.twidda.adapter.OnItemClickListener;
public class MessageListFragment extends Fragment implements OnRefreshListener, OnItemClickListener {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle param) {
SwipeRefreshLayout reload = new SwipeRefreshLayout(inflater.getContext());
RecyclerView list = new RecyclerView(inflater.getContext());
reload.setOnRefreshListener(this);
reload.addView(list);
return reload;
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onRefresh() {
}
@Override
public void onItemClick(RecyclerView rv, int pos) {
}
}

View File

@ -0,0 +1,50 @@
package org.nuclearfog.twidda.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.nuclearfog.twidda.adapter.OnItemClickListener;
public class TrendListFragment extends Fragment implements OnRefreshListener, OnItemClickListener {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle param) {
SwipeRefreshLayout reload = new SwipeRefreshLayout(inflater.getContext());
RecyclerView list = new RecyclerView(inflater.getContext());
reload.setOnRefreshListener(this);
reload.addView(list);
return reload;
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onRefresh() {
}
@Override
public void onItemClick(RecyclerView rv, int pos) {
}
}

View File

@ -0,0 +1,50 @@
package org.nuclearfog.twidda.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.nuclearfog.twidda.adapter.OnItemClickListener;
public class TweetListFragment extends Fragment implements OnRefreshListener, OnItemClickListener {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle param) {
SwipeRefreshLayout reload = new SwipeRefreshLayout(inflater.getContext());
RecyclerView list = new RecyclerView(inflater.getContext());
reload.setOnRefreshListener(this);
reload.addView(list);
return reload;
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onRefresh() {
}
@Override
public void onItemClick(RecyclerView rv, int pos) {
}
}

View File

@ -0,0 +1,50 @@
package org.nuclearfog.twidda.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.nuclearfog.twidda.adapter.OnItemClickListener;
public class UserListFragment extends Fragment implements OnRefreshListener, OnItemClickListener {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle param) {
SwipeRefreshLayout reload = new SwipeRefreshLayout(inflater.getContext());
RecyclerView list = new RecyclerView(inflater.getContext());
reload.setOnRefreshListener(this);
reload.addView(list);
return reload;
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onRefresh() {
}
@Override
public void onItemClick(RecyclerView rv, int pos) {
}
}

View File

@ -0,0 +1,37 @@
package org.nuclearfog.twidda.fragment.backend;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import org.nuclearfog.twidda.fragment.MessageListFragment;
import java.lang.ref.WeakReference;
public class MessageLoader extends AsyncTask<Long, Void, Boolean> {
private WeakReference<MessageListFragment> ui;
public MessageLoader(@NonNull MessageListFragment frag) {
ui = new WeakReference<>(frag);
}
@Override
protected java.lang.Boolean doInBackground(java.lang.Long[] objects) {
return true;
}
@Override
protected void onProgressUpdate(java.lang.Void[] v) {
}
@Override
protected void onPostExecute(java.lang.Boolean success) {
}
}

View File

@ -0,0 +1,36 @@
package org.nuclearfog.twidda.fragment.backend;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import org.nuclearfog.twidda.fragment.TrendListFragment;
import java.lang.ref.WeakReference;
public class TrendLoader extends AsyncTask<Long, Void, Boolean> {
private WeakReference<TrendListFragment> ui;
public TrendLoader(@NonNull TrendListFragment frag) {
ui = new WeakReference<>(frag);
}
@Override
protected java.lang.Boolean doInBackground(java.lang.Long[] objects) {
return true;
}
@Override
protected void onProgressUpdate(java.lang.Void[] v) {
}
@Override
protected void onPostExecute(java.lang.Boolean success) {
}
}

View File

@ -0,0 +1,36 @@
package org.nuclearfog.twidda.fragment.backend;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import org.nuclearfog.twidda.fragment.TweetListFragment;
import java.lang.ref.WeakReference;
public class TweetLoader extends AsyncTask<Long, Void, Boolean> {
private WeakReference<TweetListFragment> ui;
public TweetLoader(@NonNull TweetListFragment frag) {
ui = new WeakReference<>(frag);
}
@Override
protected Boolean doInBackground(Long[] objects) {
return true;
}
@Override
protected void onProgressUpdate(Void[] v) {
}
@Override
protected void onPostExecute(Boolean success) {
}
}

View File

@ -0,0 +1,36 @@
package org.nuclearfog.twidda.fragment.backend;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import org.nuclearfog.twidda.fragment.UserListFragment;
import java.lang.ref.WeakReference;
public class UserLoader extends AsyncTask<Long, Void, Boolean> {
private WeakReference<UserListFragment> ui;
public UserLoader(@NonNull UserListFragment frag) {
ui = new WeakReference<>(frag);
}
@Override
protected java.lang.Boolean doInBackground(java.lang.Long[] objects) {
return true;
}
@Override
protected void onProgressUpdate(java.lang.Void[] v) {
}
@Override
protected void onPostExecute(java.lang.Boolean success) {
}
}

View File

@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.4.0'
}
}