mirror of
https://github.com/moparisthebest/Yaaic
synced 2025-02-27 17:01:47 -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
|
<activity
|
||||||
android:name=".view.AddServerActivity"
|
android:name=".view.AddServerActivity"
|
||||||
android:label="@string/add_server_label">
|
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>
|
||||||
<activity
|
<activity
|
||||||
android:name=".view.ConversationActivity"
|
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:label="@string/join_label"
|
||||||
android:theme="@android:style/Theme.Dialog">
|
android:theme="@android:style/Theme.Dialog">
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".view.ImportActivity"
|
||||||
|
android:theme="@android:style/Theme.Dialog"
|
||||||
|
android:label="@string/import_label">
|
||||||
|
</activity>
|
||||||
<service android:name=".irc.IRCService"></service>
|
<service android:name=".irc.IRCService"></service>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ package org.yaaic.view;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
@ -63,7 +64,7 @@ public class AddServerActivity extends Activity implements OnClickListener
|
|||||||
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
||||||
|
|
||||||
Bundle extras = getIntent().getExtras();
|
Bundle extras = getIntent().getExtras();
|
||||||
if (extras.containsKey(Broadcast.EXTRA_SERVER)) {
|
if (extras != null && extras.containsKey(Broadcast.EXTRA_SERVER)) {
|
||||||
// Request to edit an existing server
|
// Request to edit an existing server
|
||||||
Database db = new Database(this);
|
Database db = new Database(this);
|
||||||
this.server = db.getServerById(extras.getInt(Broadcast.EXTRA_SERVER));
|
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");
|
((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.setNickname(nickname);
|
||||||
identity.setIdent(ident);
|
identity.setIdent(ident);
|
||||||
identity.setRealName(realname);
|
identity.setRealName(realname);
|
||||||
server.setIdentity(identity);
|
|
||||||
|
|
||||||
return identity;
|
return identity;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user