Skip to content

Commit

Permalink
Merge pull request #11 from Blacky-Toggle/master
Browse files Browse the repository at this point in the history
Add SetProfile Activity for external use
  • Loading branch information
saiho committed Aug 3, 2022
2 parents 57c8cb3 + 9f2136d commit 7aceb3d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
</intent-filter>
</activity>

<activity
android:name=".api.SetProfile"
android:autoRemoveFromRecents="true"
android:excludeFromRecents="true"
android:exported="true"
android:taskAffinity=".api.SetProfile">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>

<receiver
android:name=".widget.ProfileWidget"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.saiho.togglelineageprofiles.api;

import android.app.Activity;
import android.os.RemoteException;

import static com.saiho.togglelineageprofiles.Common.setCurrentProfile;

public class SetProfile extends Activity {

public static final String PROFILE_NAME = "com.saiho.togglelineageprofiles.api.profileName";

protected void onStart() {
super.onStart();
try {
performTask();
} catch (RemoteException e) {
e.printStackTrace();
}
}

private void performTask() throws RemoteException {
String profileName = getIntent().getStringExtra( PROFILE_NAME );
setCurrentProfile( getApplicationContext(), profileName );
finish();
}
}

0 comments on commit 7aceb3d

Please sign in to comment.