initial commit

This commit is contained in:
NudeDude 2017-12-16 17:06:22 +01:00
parent 4cbfb288d2
commit 6f82d95d6c
11 changed files with 125 additions and 49 deletions

2
.idea/misc.xml generated
View File

@ -24,7 +24,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -12,16 +12,20 @@ android {
} }
buildTypes { buildTypes {
release { release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
buildToolsVersion '27.0.0'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
} }
dependencies { dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs') compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.+' compile 'com.android.support:appcompat-v7:24+'
compile 'com.android.support:design:24.+' compile 'com.android.support:design:24+'
compile files('libs/twitter4j-core-4.0.4.jar') compile files('libs/twitter4j-core-4.0.4.jar')
} }

View File

@ -10,10 +10,10 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name">
android:theme="@style/AppTheme">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:theme="@style/AppTheme"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@ -4,7 +4,10 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
@ -20,7 +23,7 @@ import org.nuclearfog.twidda.engine.TwitterEngine;
import org.nuclearfog.twidda.engine.ViewAdapter.TimelineAdapter; import org.nuclearfog.twidda.engine.ViewAdapter.TimelineAdapter;
import org.nuclearfog.twidda.engine.ViewAdapter.TrendsAdapter; import org.nuclearfog.twidda.engine.ViewAdapter.TrendsAdapter;
public class MainActivity extends Activity public class MainActivity extends AppCompatActivity
{ {
private Button linkButton, verifierButton, loginButton; private Button linkButton, verifierButton, loginButton;
private EditText pin; private EditText pin;
@ -54,7 +57,25 @@ public class MainActivity extends Activity
} }
@Override @Override
public boolean onCreateOptionsMenu(Menu m){return false;} public boolean onCreateOptionsMenu(Menu m) {
getMenuInflater().inflate(R.menu.buttons, m);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch(item.getItemId())
{
case R.id.action_profile:
break;
case R.id.action_tweet:
break;
}
return true;
}
/** /**
* Load Preferences * Load Preferences
@ -86,6 +107,9 @@ public class MainActivity extends Activity
list = (ListView) findViewById(R.id.list); list = (ListView) findViewById(R.id.list);
setRefreshListener(); setRefreshListener();
setTabListener(); setTabListener();
Toolbar tool = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(tool);
getSupportActionBar().setDisplayShowTitleEnabled(false);
} }
/** /**
@ -114,7 +138,6 @@ public class MainActivity extends Activity
setTabContent(); setTabContent();
} }
/** /**
* Set DB Content * Set DB Content
* separate THREAD * separate THREAD
@ -123,17 +146,16 @@ public class MainActivity extends Activity
Thread thread = new Thread(){ Thread thread = new Thread(){
@Override @Override
public void run(){ public void run(){
Context c = getApplicationContext();
switch(currentTab){ switch(currentTab){
case "timeline": case "timeline":
TweetDatabase tweetDeck = new TweetDatabase(c); TweetDatabase tweetDeck = new TweetDatabase(con);
TimelineAdapter tlAdapt = new TimelineAdapter (c,R.layout.tweet,tweetDeck); TimelineAdapter tlAdapt = new TimelineAdapter (con,R.layout.tweet,tweetDeck);
list.setAdapter(tlAdapt); list.setAdapter(tlAdapt);
tlAdapt.notifyDataSetChanged(); tlAdapt.notifyDataSetChanged();
break; break;
case "trends": case "trends":
TrendDatabase trendDeck = new TrendDatabase(c); TrendDatabase trendDeck = new TrendDatabase(con);
TrendsAdapter trendAdp = new TrendsAdapter(c,R.layout.tweet,trendDeck); TrendsAdapter trendAdp = new TrendsAdapter(con,R.layout.tweet,trendDeck);
list.setAdapter(trendAdp); list.setAdapter(trendAdp);
trendAdp.notifyDataSetChanged(); trendAdp.notifyDataSetChanged();
break; break;

View File

@ -39,10 +39,6 @@ public class RegisterAccount extends AsyncTask<String, Void, Boolean> {
@Override @Override
protected Boolean doInBackground( String... twitterPin ) { protected Boolean doInBackground( String... twitterPin ) {
// DEBUG
if(android.os.Debug.isDebuggerConnected())
android.os.Debug.waitForDebugger();
if ( twitter == null ) { if ( twitter == null ) {
ConfigurationBuilder builder = new ConfigurationBuilder(); ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setDebugEnabled(true); builder.setDebugEnabled(true);
@ -67,7 +63,6 @@ public class RegisterAccount extends AsyncTask<String, Void, Boolean> {
e.putString("accesstoken", accessToken.getToken()); e.putString("accesstoken", accessToken.getToken());
e.putString("accesstokensecret", accessToken.getTokenSecret()); e.putString("accesstokensecret", accessToken.getTokenSecret());
e.apply(); e.apply();
return true; return true;
} }
} catch ( TwitterException e ) { } catch ( TwitterException e ) {
@ -77,8 +72,6 @@ public class RegisterAccount extends AsyncTask<String, Void, Boolean> {
} }
@Override @Override
protected void onPostExecute(Boolean result) { protected void onPostExecute(Boolean result) {
if(android.os.Debug.isDebuggerConnected())
android.os.Debug.waitForDebugger();
if( result ) { if( result ) {
loginButton.setVisibility(Button.VISIBLE); loginButton.setVisibility(Button.VISIBLE);
verifierButton.setVisibility(Button.INVISIBLE); verifierButton.setVisibility(Button.INVISIBLE);

View File

@ -0,0 +1,21 @@
package org.nuclearfog.twidda.newwindow;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import org.nuclearfog.twidda.R;
public class Profile extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstance){
super.onCreate(savedInstance);
setContentView(R.layout.profile);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1,8 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/test"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/twitterBlau" android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
</android.support.v7.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/twitterBlau"
android:orientation="vertical">
<TabHost <TabHost
android:id="@+id/tabhost" android:id="@+id/tabhost"
@ -43,3 +60,5 @@
</TabHost> </TabHost>
</LinearLayout> </LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Profil -->
<item
android:id="@+id/action_profile"
android:icon="@drawable/profile_icon"
android:title="@string/profile"
app:showAsAction="ifRoom" />
<!-- Tweet -->
<item
android:id="@+id/action_tweet"
android:title="@string/tweet"
app:showAsAction="ifRoom" />
</menu>

View File

@ -10,6 +10,8 @@
<string name="pin">PIN</string> <string name="pin">PIN</string>
<string name="verifierbutton">Verifizieren</string> <string name="verifierbutton">Verifizieren</string>
<string name="register_link">Link zur Anmeldung</string> <string name="register_link">Link zur Anmeldung</string>
<string name="profile">Profil</string>
<string name="tweet">Tweet</string>
<!--Datenbank Konstanten --> <!--Datenbank Konstanten -->
<string name="user_table"> <string name="user_table">

View File

@ -1,7 +1,5 @@
<resources> <resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar"> <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>