This commit is contained in:
Sufian 2018-05-18 20:17:52 +02:00
parent e90ce08ad8
commit fff724d2f4
14 changed files with 71 additions and 50 deletions

View File

@ -5,7 +5,7 @@
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-4.4.1" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-4.4" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

View File

@ -38,7 +38,7 @@ import twitter4j.conf.ConfigurationBuilder;
public class TwitterEngine {
private final String TWITTER_CONSUMER_KEY = "0EKRHWYcakpCkl8Lr4OcBFMZb";
private final String TWITTER_CONSUMER_SECRET = "get your own key!";
private final String TWITTER_CONSUMER_SECRET = "RQrf0uQus5v7IMuYgdlVeBuLw1ApRJhxcAMM8MyUVRh1nKSxnE";
private static TwitterEngine mTwitter;
private static long twitterID = -1L;

View File

@ -1,11 +1,10 @@
package org.nuclearfog.twidda.backend;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.support.v7.widget.RecyclerView;
import android.view.Window;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;
@ -29,8 +28,6 @@ public class UserLists extends AsyncTask <Long, Void, Void> {
private TwitterEngine mTwitter;
private UserRecycler usrAdp;
private RecyclerView userList;
private Dialog popup;
private ProgressBar circle;
private String errmsg;
private boolean imageload;
@ -45,19 +42,6 @@ public class UserLists extends AsyncTask <Long, Void, Void> {
SharedPreferences settings = context.getSharedPreferences("settings", 0);
imageload = settings.getBoolean("image_load",true);
circle = new ProgressBar(ui.get());
popup = new Dialog(ui.get());
}
@Override
protected void onPreExecute() {
popup.requestWindowFeature(Window.FEATURE_NO_TITLE);
if(popup.getWindow() != null)
popup.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
popup.setContentView(circle);
popup.show();
}
@ -95,11 +79,15 @@ public class UserLists extends AsyncTask <Long, Void, Void> {
protected void onPostExecute(Void v) {
if(ui.get() == null)
return;
ProgressBar mProgress = ui.get().findViewById(R.id.userlist_progress);
mProgress.setVisibility(View.INVISIBLE);
if(errmsg == null) {
userList.setAdapter(usrAdp);
} else {
}
else {
Toast.makeText(ui.get(),errmsg,Toast.LENGTH_LONG).show();
}
popup.dismiss();
}
}

View File

@ -75,7 +75,7 @@ public class DatabaseAdapter {
* @return List of Tweets
*/
public List<Tweet> load(int mode, long id) {
List<Tweet> tweetlist = new ArrayList<>();
List<Tweet> tweetList = new ArrayList<>();
SQLiteDatabase db = dataHelper.getReadableDatabase();
String SQL_GET_HOME="";
int limit = 0;
@ -109,11 +109,11 @@ public class DatabaseAdapter {
if(cursor.moveToFirst()) {
do {
Tweet tweet = getStatus(cursor);
tweetlist.add(tweet);
tweetList.add(tweet);
} while(cursor.moveToNext() && limit++ < 200);
}
cursor.close();
return tweetlist;
return tweetList;
}
@ -208,7 +208,7 @@ public class DatabaseAdapter {
Tweet embeddedTweet = null;
if(retweetId > 0)
embeddedTweet = getStatus(retweetId);
return new Tweet(tweetId,retweet,favorit,user,tweettext,time,replyname,null,
return new Tweet(tweetId,retweet,favorit,user,tweettext,time,replyname,null/*TODO*/,
source,replyStatusId,embeddedTweet,retweeted,favorized);
}
@ -291,8 +291,13 @@ public class DatabaseAdapter {
}
public void removeStatus(long id) {
SQLiteDatabase db = dataHelper.getWritableDatabase();
db.delete("tweet", "tweetID="+id, null);
public void removeStatus(final long id) {
new Thread(new Runnable() {
@Override
public void run() {
SQLiteDatabase db = dataHelper.getWritableDatabase();
db.delete("tweet", "tweetID="+id, null);
}
}).start();
}
}

View File

@ -37,6 +37,7 @@ public class ErrorLog {
public List<String> getErrorList() {
SQLiteDatabase mData = dataHelper.getReadableDatabase();
List<String> list = new ArrayList<>();
int limit = 0;
String query = "SELECT * FROM error ORDER BY time DESC";
Cursor cursor = mData.rawQuery(query, null);
if(cursor.moveToFirst()) {
@ -49,7 +50,7 @@ public class ErrorLog {
String dateString = sdf.format(new Date(time));
list.add(dateString+" : "+message);
} while(cursor.moveToNext());
} while(cursor.moveToNext() && limit++ < 100);
}
cursor.close();
return list;

View File

@ -33,7 +33,7 @@ import org.nuclearfog.twidda.viewadapter.LogAdapter;
import java.util.List;
/**
* App Settings Page
* App Settings Activity
*/
public class AppSettings extends AppCompatActivity implements View.OnClickListener,
CompoundButton.OnCheckedChangeListener, AlertDialog.OnClickListener, Dialog.OnDismissListener, OnColorChangedListener {

View File

@ -10,6 +10,9 @@ import android.widget.Toast;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.backend.Registration;
/**
* App register Activity
*/
public class LoginPage extends Activity implements View.OnClickListener {
private EditText pin;

View File

@ -45,7 +45,7 @@ public class SearchPage extends AppCompatActivity implements UserRecycler.OnItem
SharedPreferences settings = getSharedPreferences("settings", 0);
int background = settings.getInt("background_color", 0xff0f114a);
Toolbar tool = (Toolbar)findViewById(R.id.search_toolbar);
Toolbar tool = findViewById(R.id.search_toolbar);
tweetSearch = findViewById(R.id.tweet_result);
userSearch = findViewById(R.id.user_result);
tweetReload = findViewById(R.id.searchtweets);

View File

@ -27,7 +27,7 @@ import static android.content.DialogInterface.BUTTON_NEGATIVE;
import static android.content.DialogInterface.BUTTON_POSITIVE;
/**
* Detailed Tweet Window
* Detailed Tweet Activity
* @see StatusLoader
*/
public class TweetDetail extends AppCompatActivity implements View.OnClickListener,

View File

@ -12,13 +12,13 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import org.nuclearfog.twidda.backend.UserLists;
import org.nuclearfog.twidda.backend.listitems.*;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.backend.UserLists;
import org.nuclearfog.twidda.backend.listitems.TwitterUser;
import org.nuclearfog.twidda.viewadapter.UserRecycler;
/**
* Get Follow Connections from an User
* User List Activity
* @see UserLists
*/
public class UserDetail extends AppCompatActivity implements UserRecycler.OnItemClicked {
@ -34,9 +34,9 @@ public class UserDetail extends AppCompatActivity implements UserRecycler.OnItem
setContentView(R.layout.userpage);
getExtras(getIntent().getExtras());
userList = (RecyclerView) findViewById(R.id.userlist);
userList = findViewById(R.id.userlist);
userList.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
Toolbar toolbar = (Toolbar) findViewById(R.id.user_toolbar);
Toolbar toolbar = findViewById(R.id.user_toolbar);
setSupportActionBar(toolbar);
SharedPreferences settings = getSharedPreferences("settings", 0);
int background = settings.getInt("background_color", 0xff0f114a);

View File

@ -24,7 +24,7 @@ import org.nuclearfog.twidda.backend.listitems.Tweet;
import org.nuclearfog.twidda.viewadapter.TimelineRecycler;
/**
* User Profile Class uses AsyncTask
* User Profile Activity
* @see ProfileLoader
*/
public class UserProfile extends AppCompatActivity implements View.OnClickListener,

View File

@ -1,11 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/CardViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="wrap_content">
<TextView
android:id="@+id/errortext"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical">
<TextView
android:id="@+id/errortext"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v7.widget.CardView>

View File

@ -8,9 +8,23 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
<android.support.v7.widget.RecyclerView
android:id="@+id/userlist"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/userlist"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</android.support.v7.widget.RecyclerView>
<ProgressBar
android:id="@+id/userlist_progress"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</FrameLayout>
</LinearLayout>

View File

@ -3,15 +3,17 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.1"
classpath "com.android.tools.build:gradle:3.1.2"
}
}
allprojects {
repositories {
jcenter()
google()
flatDir{ dirs 'libs'}
}
}