mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-26 02:42:16 -05:00
Handle irc:// uris
This commit is contained in:
parent
d5d294a5aa
commit
be2584f5fe
@ -34,6 +34,12 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
<activity
|
||||
android:name=".view.AddServerActivity"
|
||||
android:label="@string/add_server_label">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="irc"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".view.ConversationActivity"
|
||||
@ -53,6 +59,11 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:label="@string/join_label"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".view.ImportActivity"
|
||||
android:theme="@android:style/Theme.Dialog"
|
||||
android:label="@string/import_label">
|
||||
</activity>
|
||||
<service android:name=".irc.IRCService"></service>
|
||||
</application>
|
||||
|
||||
|
@ -23,6 +23,7 @@ package org.yaaic.view;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@ -63,7 +64,7 @@ public class AddServerActivity extends Activity implements OnClickListener
|
||||
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
||||
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if (extras.containsKey(Broadcast.EXTRA_SERVER)) {
|
||||
if (extras != null && extras.containsKey(Broadcast.EXTRA_SERVER)) {
|
||||
// Request to edit an existing server
|
||||
Database db = new Database(this);
|
||||
this.server = db.getServerById(extras.getInt(Broadcast.EXTRA_SERVER));
|
||||
@ -81,6 +82,16 @@ public class AddServerActivity extends Activity implements OnClickListener
|
||||
|
||||
((Button) findViewById(R.id.add)).setText("Save");
|
||||
}
|
||||
|
||||
Uri uri = getIntent().getData();
|
||||
if (uri != null && uri.getScheme().equals("irc")) {
|
||||
// handling an irc:// uri
|
||||
|
||||
((EditText) findViewById(R.id.host)).setText(uri.getHost());
|
||||
if (uri.getPort() != -1) {
|
||||
((EditText) findViewById(R.id.port)).setText(String.valueOf(uri.getPort()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -223,7 +234,6 @@ public class AddServerActivity extends Activity implements OnClickListener
|
||||
identity.setNickname(nickname);
|
||||
identity.setIdent(ident);
|
||||
identity.setRealName(realname);
|
||||
server.setIdentity(identity);
|
||||
|
||||
return identity;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user