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>
</option>
</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" />
</component>
<component name="ProjectType">

View File

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

View File

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

View File

@ -4,7 +4,10 @@ import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
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.MenuItem;
import android.view.View;
import android.widget.Button;
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.TrendsAdapter;
public class MainActivity extends Activity
public class MainActivity extends AppCompatActivity
{
private Button linkButton, verifierButton, loginButton;
private EditText pin;
@ -54,7 +57,25 @@ public class MainActivity extends Activity
}
@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
@ -86,6 +107,9 @@ public class MainActivity extends Activity
list = (ListView) findViewById(R.id.list);
setRefreshListener();
setTabListener();
Toolbar tool = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(tool);
getSupportActionBar().setDisplayShowTitleEnabled(false);
}
/**
@ -114,7 +138,6 @@ public class MainActivity extends Activity
setTabContent();
}
/**
* Set DB Content
* separate THREAD
@ -123,17 +146,16 @@ public class MainActivity extends Activity
Thread thread = new Thread(){
@Override
public void run(){
Context c = getApplicationContext();
switch(currentTab){
case "timeline":
TweetDatabase tweetDeck = new TweetDatabase(c);
TimelineAdapter tlAdapt = new TimelineAdapter (c,R.layout.tweet,tweetDeck);
TweetDatabase tweetDeck = new TweetDatabase(con);
TimelineAdapter tlAdapt = new TimelineAdapter (con,R.layout.tweet,tweetDeck);
list.setAdapter(tlAdapt);
tlAdapt.notifyDataSetChanged();
break;
case "trends":
TrendDatabase trendDeck = new TrendDatabase(c);
TrendsAdapter trendAdp = new TrendsAdapter(c,R.layout.tweet,trendDeck);
TrendDatabase trendDeck = new TrendDatabase(con);
TrendsAdapter trendAdp = new TrendsAdapter(con,R.layout.tweet,trendDeck);
list.setAdapter(trendAdp);
trendAdp.notifyDataSetChanged();
break;

View File

@ -39,10 +39,6 @@ public class RegisterAccount extends AsyncTask<String, Void, Boolean> {
@Override
protected Boolean doInBackground( String... twitterPin ) {
// DEBUG
if(android.os.Debug.isDebuggerConnected())
android.os.Debug.waitForDebugger();
if ( twitter == null ) {
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setDebugEnabled(true);
@ -67,7 +63,6 @@ public class RegisterAccount extends AsyncTask<String, Void, Boolean> {
e.putString("accesstoken", accessToken.getToken());
e.putString("accesstokensecret", accessToken.getTokenSecret());
e.apply();
return true;
}
} catch ( TwitterException e ) {
@ -77,8 +72,6 @@ public class RegisterAccount extends AsyncTask<String, Void, Boolean> {
}
@Override
protected void onPostExecute(Boolean result) {
if(android.os.Debug.isDebuggerConnected())
android.os.Debug.waitForDebugger();
if( result ) {
loginButton.setVisibility(Button.VISIBLE);
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,45 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<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_height="match_parent"
android:background="@color/twitterBlau" android:orientation="vertical">
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
<TabHost
android:id="@+id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="?attr/actionBarSize">
<LinearLayout
</android.support.v7.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/twitterBlau"
android:orientation="vertical">
<TabHost
android:id="@+id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<TabWidget
android:id="@android:id/tabs"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/refresh"
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content" />
<ListView
android:id="@+id/list"
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="wrap_content">
</android.support.v4.widget.SwipeRefreshLayout>
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
</FrameLayout>
</TabHost>
</LinearLayout>
</TabHost>
</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="verifierbutton">Verifizieren</string>
<string name="register_link">Link zur Anmeldung</string>
<string name="profile">Profil</string>
<string name="tweet">Tweet</string>
<!--Datenbank Konstanten -->
<string name="user_table">

View File

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